diff options
| author | tslil clingman <tslil@posteo.de> | 2021-01-19 00:41:07 -0500 |
|---|---|---|
| committer | tslil <tslil@posteo.de> | 2021-01-19 00:41:07 -0500 |
| commit | 976c94a34881c30bdd236cddd845681d89484202 (patch) | |
| tree | 566ddf2ffb95e53af8288c00028649f843740f09 /src/ctaklm.c | |
| parent | 4b8a949687e069b3fe5afe5c5d248940d6165fee (diff) | |
Slight bug
Diffstat (limited to 'src/ctaklm.c')
| -rw-r--r-- | src/ctaklm.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/src/ctaklm.c b/src/ctaklm.c index 2696231..a198d2c 100644 --- a/src/ctaklm.c +++ b/src/ctaklm.c @@ -425,10 +425,11 @@ main(int argc, char **argv) { size_t alloc_size; for (int playing = 1; playing;) { - fputs("ctaklm> ", stdout); - fflush(stdout); - while ((human == 0) && (read = getline(&line, &alloc_size, stdin)) != -1) { - if (read) { + while (human == 0) { + fputs("ctaklm> ", stdout); + fflush(stdout); + read = getline(&line, &alloc_size, stdin); + if (read > 0) { line[read - 1] = 0; if (input_is_not_turn(line)) { int r = handle_turn(line); @@ -436,9 +437,12 @@ main(int argc, char **argv) { human = 1; } } + } else { + read = -1; + human = 1; } } - if ((human == 0) && (read == -1)) { + if (read == -1) { playing = 0; } else { ct1986_turn(search_depth); |
