summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/main.c21
1 files changed, 8 insertions, 13 deletions
diff --git a/src/main.c b/src/main.c
index 01a440d..9d02aa9 100644
--- a/src/main.c
+++ b/src/main.c
@@ -115,24 +115,19 @@ int main() {
BOARD board = {{EMPTY}, {EMPTY}, {EMPTY}};
cursor(1);
+ print_board(board);
- while (solution == MOVES_LEFT) {
- print_board(board);
+ do {
player_move(board);
-
- if ((solution = is_board_solved(board)) != MOVES_LEFT) {
- print_endgame(solution);
- return 0;
- }
-
print_board(board);
- opponent_move(board, EASY);
- if ((solution = is_board_solved(board)) != MOVES_LEFT) {
- print_endgame(solution);
- return 0;
+ if ((solution = is_board_solved(board)) == MOVES_LEFT) {
+ opponent_move(board, EASY);
+ print_board(board);
}
- }
+ } while (solution == MOVES_LEFT);
+
+ print_endgame(solution);
return 0;
}