From: Carl Worth Date: Tue, 13 Dec 2005 20:26:34 +0000 (+0000) Subject: 2005-12-13 Carl Worth X-Git-Url: https://git.cworth.org/git?p=ttt;a=commitdiff_plain;h=9a3347e8aa9db1618fc0df92103e84d34413ba11 2005-12-13 Carl Worth * 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. --- diff --git a/ChangeLog b/ChangeLog index edb3e3b..3865c81 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2005-12-13 Carl Worth + + * 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 * TODO: check off INVITE, RETRACT, DECLINE, Game Invitation diff --git a/TODO b/TODO index f54ef62..f9cc226 100644 --- 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. + diff --git a/src/test-board.c b/src/test-board.c index 1f5c93a..13f6f6c 100644 --- a/src/test-board.c +++ b/src/test-board.c @@ -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); } diff --git a/src/ttt-board.c b/src/ttt-board.c index 6444315..92391eb 100644 --- a/src/ttt-board.c +++ b/src/ttt-board.c @@ -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; }