]> git.cworth.org Git - ttt/commitdiff
2005-12-13 Carl Worth <cworth@cworth.org>
authorCarl Worth <carl@theworths.org>
Tue, 13 Dec 2005 20:26:34 +0000 (20:26 +0000)
committerCarl Worth <carl@theworths.org>
Tue, 13 Dec 2005 20:26:34 +0000 (20:26 +0000)
        * TODO: Note that ttt-server should retry a couple times if its
        port is not available.

        * src/test-board.c: (main): Remove debug print messages.

        * src/ttt-board.c: (ttt_board_make_move): Tighten up the code just
        a little bit more.

ChangeLog
TODO
src/test-board.c
src/ttt-board.c

index edb3e3b4eb19fe71e74cc77c4433037eb72ea119..3865c8113ca7e1345c95e68a6749fe4f0650093e 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2005-12-13  Carl Worth  <cworth@cworth.org>
+
+       * TODO: Note that ttt-server should retry a couple times if its
+       port is not available.
+       
+       * src/test-board.c: (main): Remove debug print messages.
+       
+       * src/ttt-board.c: (ttt_board_make_move): Tighten up the code just
+       a little bit more.
+
 2005-12-10  Richard D. Worth  <richard@theworths.org>
 
        * TODO: check off INVITE, RETRACT, DECLINE, Game Invitation
diff --git a/TODO b/TODO
index f54ef6225e00ac4a24f4a22cb7747489340c2b14..f9cc2260c2e0263d58ca761311a162437f00bf90 100644 (file)
--- a/TODO
+++ b/TODO
@@ -68,3 +68,7 @@ Other bits
 ----------
 Server log messages should include pid date and time. And server
 should log the fact when it gets terminated by a signal.
+
+Server should wait and retry a couple of times if its port is not
+available, rather than just giving up.
+
index 1f5c93a9dc4180302a6e5ffa36509b81763093ea..13f6f6c2af3017b757a649ad2db659ca7b1cd793 100644 (file)
@@ -17,10 +17,8 @@ main (void)
        printf ("\"\n");    
 
        printf ("Make a move \n");
-       m = getchar();
+       m = getchar() - '0';
        newline = getchar();
-       printf ("getchar returned a numeric value of %d which is character '%c'\n", m, m);
-       m = m - '0';
        ttt_board_make_move (&board, m);
     }
 
index 64443155e5baa06aa5426d564970216f957ae3a6..92391ebd2d7db4243ed14f76ff7253fa2c9a963f 100644 (file)
@@ -105,21 +105,16 @@ 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);
-    }
+       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;
 }