tictactoe

Tic Tac Toe on the terminal using ANSI Escape Codes
Index Commits Files Refs README LICENSE
commit ebc5259d87e306e666a666b67bfb94418451c6aa
parent f5146a6d7b18bfbadb586bb05ab652ac8d4b18a7
Author: Martin Kloeckner <mjkloeckner@gmail.com>
Date:   Mon,  1 Apr 2024 17:03:38 -0300

Delete `goto` statement

Diffstat:
Mtictactoe.cpp | 10+++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/tictactoe.cpp b/tictactoe.cpp
@@ -248,12 +248,12 @@ void game_check_status() {
         game_status = WIN;
     }
 
-    for(i = 0; i < 3; ++i)
-        for(j = 0; j < 3; ++j)
-            if(game_board[i][j] == ' ')
-                goto end;;
+    if(game_status != WIN)
+        for(i = 0; i < 3; ++i)
+            for(j = 0; j < 3; ++j)
+                if(game_board[i][j] == ' ')
+                    return;
 
-end:
     if((i == j) && (i == 3))
         game_status = DRAFT;
 }