]> git.cworth.org Git - ttt/blobdiff - src/test-board.c
General Maintenance
[ttt] / src / test-board.c
index 13f6f6c2af3017b757a649ad2db659ca7b1cd793..463e1b9eec267a35ef6cf17b8614477d5b5e5a59 100644 (file)
@@ -12,20 +12,28 @@ main (void)
     
     for (i = 0; i <= 8; i++)
     {
-       printf ("This is the board \"");
        ttt_board_write (&board, stdout);
-       printf ("\"\n");    
+       printf ("\n");    
 
-       printf ("Make a move \n");
-       m = getchar() - '0';
+       printf ("Make a move ");
+       m = getchar();
        newline = getchar();
+       m = m - '0';
        ttt_board_make_move (&board, m);
+       ttt_board_is_won (&board);
+       if (ttt_board_is_won (&board) == TTT_CELL_X)
+       {
+           printf ("X's Win! ");
+           break;
+       }
+       else if (ttt_board_is_won (&board) == TTT_CELL_O)
+       {
+           printf ("O's Win! ");
+           break;
+       }
     }
 
-    printf ("This is the board \"");
     ttt_board_write (&board, stdout);
-    printf ("\"\n");    
-
-
+    printf ("\n");    
     return 0;
 }