aboutsummaryrefslogtreecommitdiff
path: root/src/ct1986.c
diff options
context:
space:
mode:
authortslil clingman <tslil@posteo.de>2021-01-21 01:37:07 -0500
committertslil <tslil@posteo.de>2026-08-28 19:37:41 +0100
commitbb4d6da7d75de116c2fb6bd50ed96d5c478afd66 (patch)
treed867ef7848f0eb00d86c3956522633eea6b394f7 /src/ct1986.c
parente1c9a014420648b2799509016b4fc52dec19bc2d (diff)
Slight fix to game loop
Diffstat (limited to 'src/ct1986.c')
-rw-r--r--src/ct1986.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/ct1986.c b/src/ct1986.c
index 49a1075..f697877 100644
--- a/src/ct1986.c
+++ b/src/ct1986.c
@@ -159,11 +159,12 @@ main(int argc, char **argv) {
lcd = fopen("/dev/lcd", "w");
if (lcd == NULL) return EXIT_FAILURE;
+ fprintf(lcd, "%sB", esc);
+ fflush(lcd);
+
human = 0;
negamax_cnn1986_search_depth = 3;
new_game(5);
- fprintf(lcd, "%sB", esc);
- fflush(lcd);
char *line = NULL;
ssize_t read;
@@ -182,13 +183,15 @@ main(int argc, char **argv) {
human = 1;
}
}
- } else if (read == -1) {
+ } else {
playing = 0;
break;
}
}
- negamax_cnn1986_turn();
- human = 0;
+ if (playing) {
+ negamax_cnn1986_turn();
+ human = 0;
+ }
}
fclose(lcd);