tictactoe

Tic Tac Toe on the terminal using ANSI Escape Codes
Index Commits Files Refs README LICENSE
commit b578096355a4231fc973aff6ee0d17f870841bd5
parent 77c7c30cf95c38f360abba313b0fc50a1332e989
Author: mjkloeckner <martin.cachari@gmail.com>
Date:   Sat, 27 Apr 2024 21:43:26 -0300

remove `break` on `switch` case

also changed `if` case with the ternary operator in one assignment

Diffstat:
Mtictactoe.cpp | 5+----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/tictactoe.cpp b/tictactoe.cpp
@@ -79,9 +79,7 @@ void game_player_status_msg(void) {
         break;
     case DRAFT:
         player_status.assign("Draft\033[0J");
-        key_string.assign("Press `r` to restart\033[0J");
         game_status = HALT;
-        break;
     case HALT:
         key_string.assign("Press `r` to restart\033[0J");
         break;
@@ -138,8 +136,7 @@ void game_move_cursor_down(void) {
 
 void game_set_at_cursor_pos(void) {
     if(game_board[cursor_row][cursor_col] == ' ') {
-        char aux = ((current_player == PLAYER_1) ? 'X' : 'O');
-        game_board[cursor_row][cursor_col] = aux;
+        game_board[cursor_row][cursor_col] = ((current_player == PLAYER_1) ? 'X' : 'O');
         current_player = ((current_player == PLAYER_1) ? PLAYER_2 : PLAYER_1);
     }
 }