diff options
| author | tslil clingman <tslil@posteo.de> | 2021-01-21 01:37:07 -0500 |
|---|---|---|
| committer | tslil <tslil@posteo.de> | 2021-01-21 01:37:07 -0500 |
| commit | 69a5f93c3c41cc3ba01159f7a4e724575cd8f005 (patch) | |
| tree | d867ef7848f0eb00d86c3956522633eea6b394f7 /src/ct1986.c | |
| parent | 053faca26c86d6d052f8cd1f5fed7a588a121545 (diff) | |
Slight fix to game loop
Diffstat (limited to 'src/ct1986.c')
| -rw-r--r-- | src/ct1986.c | 13 |
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); |
