diff options
-rw-r--r-- | tit4tat.c | 5 |
1 files changed, 2 insertions, 3 deletions
@@ -16,7 +16,6 @@ */ #include <stdio.h> -#include <unistd.h> #include <stdlib.h> enum {COORPERATION, DEFECTION}; @@ -38,8 +37,8 @@ int main(int argc, char **argv) for (;;) { /* human input */ - a = getc(stdin); - fpurge(stdin); + a = getc(stdin); + while (getc(stdin) != '\n'); a = (a == 'c') ? COORPERATION : DEFECTION; /* computer rules */ |