#include #include #define BUFF_SIZE 4096 int main() { setbuf(stdin, NULL); setbuf(stdout, NULL); char line[BUFF_SIZE]; char *lineRest, *token; char ltz[] = "abcdefgh"; int cnt = 0; while (1) { (void)fgets(line, sizeof(line), stdin); size_t len = strlen(line); if (len - 1) line[len - 1] = '\0'; token = strtok_r(line, " ", &lineRest); if (!strcmp("uci", token)) { printf("id name RatChess 0.0\n"); printf("id author rat<3\n\n"); printf("uciok\n"); } else if (!strcmp("quit", token)) { return 0; } else if (!strcmp("setoption", token)) { } else if (!strcmp("position", token)) { } else if (!strcmp("ucinewgame", token)) { } else if (!strcmp("isready", token)) { printf("readyok\n"); } else if (!strcmp("go", token)) { printf("bestmove %c2%c4\n", ltz[cnt], ltz[cnt]); cnt++; } } }