Systems-programming-labs/Week 6-workshop/goodchessmove.c
2021-09-04 22:08:32 +08:00

24 lines
510 B
C

#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
int main(int argc, char const *argv[])
{
if (argc != 3)
{
printf("Usage: goodchessmove [GAMESTATE] [OUTPUT]\n");
exit(EXIT_FAILURE);
}
// placeholder for a real chess program
printf("Executing chess move. GAMESTATE: %s, OUTPUT: %s\n",
argv[1], argv[2]);
// do chess
sleep(5);
fflush(stdout);
printf("Finished executing chess move. Wrote %s\n", argv[2]);
exit(EXIT_SUCCESS);
}