aboutsummaryrefslogtreecommitdiff
path: root/morpion_rec/NiAh
diff options
context:
space:
mode:
authorAlex AUVOLAT <alex.auvolat@ens.fr>2014-11-10 10:46:37 +0100
committerAlex AUVOLAT <alex.auvolat@ens.fr>2014-11-10 10:46:37 +0100
commit80e625a9c8d33c71fe69a375c211868fcc1938a5 (patch)
treef516d701cc8cb50e9a1d003afe6e7d1f05b457ca /morpion_rec/NiAh
parentd343fcb803e955504b0d6b5c9c852620886c2994 (diff)
downloadCompetIA-80e625a9c8d33c71fe69a375c211868fcc1938a5.tar.gz
CompetIA-80e625a9c8d33c71fe69a375c211868fcc1938a5.zip
Start work on players!
Diffstat (limited to 'morpion_rec/NiAh')
-rw-r--r--morpion_rec/NiAh/main.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/morpion_rec/NiAh/main.c b/morpion_rec/NiAh/main.c
index 1cee771..7447085 100644
--- a/morpion_rec/NiAh/main.c
+++ b/morpion_rec/NiAh/main.c
@@ -46,10 +46,12 @@ int main()
if(strcmp(input, "Hello morpion_rec") == 0)
{
printf("Hello morpion_rec\n");
+ fflush(stdout);
}
else
{
printf("Who are you, crazy bastard?\n");
+ fflush(stdout);
return EXIT_FAILURE;
}
@@ -95,6 +97,7 @@ int main()
if(strstr(input,"You win")==input || strstr(input,"You lose")==input || strstr(input,"Tie")==input || strstr(input,"Cheater")==input)
{
printf("Fair enough\n");
+ fflush(stdout);
return EXIT_SUCCESS;
}
}
@@ -115,11 +118,13 @@ int main()
play(grid, subgrid, move, CROSS);
updateWon(grid, &won, swon, subgrid, move);
printf("Play %d %d %d %d\n", subgrid%3+1, subgrid/3+1, move%3+1, move/3+1);
+ fflush(stdout);
subgrid=move;
printGrid(grid, swon);
if(won==CROSS)
fprintf(stderr, "I won !!");
+ fflush(stdout);
}
return EXIT_SUCCESS;