summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--tit4tat.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/tit4tat.c b/tit4tat.c
index fa3fe50..3546987 100644
--- a/tit4tat.c
+++ b/tit4tat.c
@@ -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 */