ref: 42d9d57f673987ca1fcc0de3361308cea0bf7258
parent: 017078aad3a63ef7b696f7736410a50ceac77408
author: zamfofex <zamfofex@twdb.moe>
date: Mon Oct 16 08:24:26 EDT 2023
small changes
--- a/tools/play.c
+++ b/tools/play.c
@@ -1,5 +1,4 @@
#include <unistd.h>
-#include <stdio.h>
#include <string.h>
#include <errno.h>
#include <stdlib.h>
@@ -77,7 +76,7 @@
}
}
-static void moonfish_time(int time, char *name)
+static void moonfish_clock(int time, char *name)
{ printf(" \x1B[48;5;248m\x1B[38;5;235m ");@@ -132,7 +131,7 @@
their_time = 0;
}
- moonfish_time(their_time, fancy->their_name);
+ moonfish_clock(their_time, fancy->their_name);
for (y = 0 ; y < 8 ; y++)
{@@ -142,7 +141,7 @@
printf("\x1B[0m\n");}
- moonfish_time(our_time, fancy->our_name);
+ moonfish_clock(our_time, fancy->our_name);
if (done) exit(0);
}
@@ -183,7 +182,7 @@
exit(1);
}
-static int moonfish_play_from(struct moonfish_chess *chess, struct moonfish_move *found, int x0, int y0, int x1, int y1)
+static int moonfish_move_from(struct moonfish_chess *chess, struct moonfish_move *found, int x0, int y0, int x1, int y1)
{struct moonfish_move moves[32];
struct moonfish_move *move;
@@ -468,7 +467,7 @@
for (;;)
{ch = getchar();
- if (ch == EOF) return 0;
+ if (ch == EOF) return 1;
if (ch == 0x1B) break;
}
@@ -552,7 +551,7 @@
if (x1 == 0) continue;
if (y1 == 0) continue;
- if (moonfish_play_from(&fancy->chess, &move, fancy->x, fancy->y, x1, y1) == 0)
+ if (moonfish_move_from(&fancy->chess, &move, fancy->x, fancy->y, x1, y1) == 0)
{*name++ = ' ';
moonfish_to_uci(name, &move, fancy->chess.white);
@@ -562,8 +561,8 @@
moonfish_play(&fancy->chess, &move);
moonfish_reset_time(fancy);
- fancy->x = 0;
moonfish_fancy(fancy);
+ fancy->x = 0;
pthread_mutex_unlock(fancy->mutex);
@@ -574,6 +573,7 @@
moonfish_go(fancy, names + 1, name, in, out);
name += strlen(name);
moonfish_reset_time(fancy);
+ moonfish_fancy(fancy);
pthread_mutex_unlock(fancy->mutex);
printf("\x1B[?1000h");--- a/tools/utils.c
+++ b/tools/utils.c
@@ -43,12 +43,9 @@
{static char line[2048];
- for (;;)
- {- if (fgets(line, sizeof line, file) == NULL)
- return NULL;
- return line;
- }
+ if (fgets(line, sizeof line, file) == NULL)
+ return NULL;
+ return line;
}
char *moonfish_wait(FILE *file, char *name)
--
⑨