diff options
| author | tslil clingman <tslil@posteo.de> | 2021-01-19 00:41:07 -0500 |
|---|---|---|
| committer | tslil <tslil@posteo.de> | 2026-08-28 19:37:41 +0100 |
| commit | 21cc48d2d5ce1a1bb3e8219c6d4cd4d321b978af (patch) | |
| tree | 566ddf2ffb95e53af8288c00028649f843740f09 | |
| parent | 29cebd42bf2f748c23018cc64a102ca3e589526c (diff) | |
Slight bug
| -rw-r--r-- | Makefile | 22 | ||||
| -rw-r--r-- | src/ctaklm.c | 14 |
2 files changed, 20 insertions, 16 deletions
@@ -21,17 +21,6 @@ endif %.o: %.c $(CC) -c $< -o $@ $(CFLAGS) -all: ctaklm ct1986 -ifneq ($(PLATFORM), native) - $(info Building the pi image) - ./do_buildroot.sh $(BUILDROOT_DIR) -endif - -ct1986: src/ct1986.o $(OBJS) - $(CC) $(CFLAGS) src/ct1986.o $(OBJS) -o ct1986 - $(STRIP) ct1986 - $(SIZE) ct1986 - ctaklm: src/ctaklm.o $(OBJS) $(CC) $(CFLAGS) src/ctaklm.o $(OBJS) -o ctaklm $(STRIP) ctaklm @@ -40,6 +29,17 @@ ctaklm: src/ctaklm.o $(OBJS) pptdb: src/pptdb.o $(OBJS) $(CC) $(CFLAGS) src/pptdb.o $(OBJS) -o pptdb +ct1986: src/ct1986.o $(OBJS) + $(CC) $(CFLAGS) src/ct1986.o $(OBJS) -o ct1986 + $(STRIP) ct1986 + $(SIZE) ct1986 + +all: ctaklm ct1986 +ifneq ($(PLATFORM), native) + $(info Building the pi image) + ./do_buildroot.sh $(BUILDROOT_DIR) +endif + clean: rm -f $(PROG) rm -f $(STAT) 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); |
