tictactoe

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

change `player_status` string assign style

Diffstat:
Mtictactoe.cpp | 4++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/tictactoe.cpp b/tictactoe.cpp
@@ -67,15 +67,15 @@ void game_player_status_msg(void) {
 
     switch(game_status) {
     case PLAYING:
-        player_status = std::string("Player ");
+        player_status.assign("Player ");
         player_status += (std::ostringstream() << current_player).str();
         player_status += "\033[0J";
         break;
     case WIN:
         player_won = ((current_player == PLAYER_1) ? PLAYER_2 : PLAYER_1);
-        player_status = std::string("Player ");
         current_player_string << player_won+1;
         player_status += current_player_string.str();
+        player_status.assign("Player ");
         player_status += " Wins";
         key_string.assign("Press `r` to restart\033[0J");
         game_status = HALT;