tictactoe

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

start counting `player_t` enumeration from `1`

Diffstat:
Mtictactoe.cpp | 6++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/tictactoe.cpp b/tictactoe.cpp
@@ -8,7 +8,7 @@
 #define  TUI_TOTAL_HEIGHT  7
 
 typedef enum {
-    PLAYER_1,
+    PLAYER_1 = 1,
     PLAYER_2
 } player_t;
 
@@ -62,15 +62,13 @@ void game_clear_board(void) {
 }
 
 void game_player_status_msg(void) {
-    std::ostringstream current_player_string;
     unsigned int player_won;
     key_string.assign("\033[0J");
 
     switch(game_status) {
     case PLAYING:
         player_status = std::string("Player ");
-        current_player_string << current_player+1;
-        player_status += current_player_string.str();
+        player_status += (std::ostringstream() << current_player).str();
         player_status += "\033[0J";
         break;
     case WIN: