]> git.cworth.org Git - ttt/blobdiff - src/ttt-board.c
Fixed board_make_move to use TTT_CELL_EMPTY
[ttt] / src / ttt-board.c
index 64443155e5baa06aa5426d564970216f957ae3a6..8c34b3e0074165300f35958e73be7637bde7081f 100644 (file)
@@ -104,22 +104,17 @@ ttt_board_write (ttt_board_t *board, FILE *file)
  
 ttt_error_t ttt_board_make_move (ttt_board_t *board, int move)
 {  
-    if (board->cells[move] != '_')
-    {
-       return(TTT_ERROR_NOT_VALID_MOVE);
-    }
+    if (board->cells[move] != TTT_CELL_EMPTY)
+       return TTT_ERROR_NOT_VALID_MOVE;
+
+    board->cells[move] = board->current_player;
 
     if (board->current_player == TTT_CELL_X)
-    {       
-       board->cells[move] = 'X';
        board->current_player = TTT_CELL_O;     
-    }
     else
-    {
-       board->cells[move] = 'O';
        board->current_player = TTT_CELL_X;
-    }
-    return(TTT_ERROR_NONE);
+
+    return TTT_ERROR_NONE;
 }