minimum uci parceing
This commit is contained in:
parent
276539181c
commit
c2d539e6a9
36
main.c
Normal file
36
main.c
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
#include <stdio.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
#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++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user