ref: ee96577c4f443d30e35e737ce9a456cb9dca2546
parent: 11fefd4c09d138a0910da4da522e8b63cd6e190f
author: zamfofex <zamfofex@twdb.moe>
date: Thu Jul 11 18:47:48 EDT 2024
fix checkmate handling
--- a/main.c
+++ b/main.c
@@ -145,13 +145,8 @@
else
score = moonfish_best_move_clock(&chess, &move, our_time, their_time);
- if (depth < 0) depth = 4;
- printf("info depth %d ", depth);-
- if (score >= moonfish_omega || score <= -moonfish_omega)
- printf("score mate %d\n", moonfish_countdown(score));- else
- printf("score cp %ld\n", score);+ if (depth < 0) depth = 1;
+ printf("info depth %d score cp %ld\n", depth, score / 100);moonfish_to_uci(&chess, &move, name);
printf("bestmove %s\n", name);--- a/moonfish.h
+++ b/moonfish.h
@@ -159,10 +159,6 @@
/* returns the depth-zero score for the given position */
moonfish_t moonfish_score(struct moonfish_chess *chess);
-/* if a score is too large (i.e. "score >= moonfish_omega"), it will instead represent a "checkmate in X" evaluation */
-/* this function will obtain such "X" from the given score in that case */
-int moonfish_countdown(int score);
-
/* creates a move from UCI notation */
/* the move is stored in "move" */
/* on success, the parser will return 0, on failure, it will return 1 (and the move is unusable) */
--- a/search.c
+++ b/search.c
@@ -123,7 +123,7 @@
for (i = 0 ; i < count ; i++)
if (chess->board[moves[i].to] % 16 == moonfish_king)
- return moonfish_omega * (moonfish_depth - depth);
+ return moonfish_omega * (moonfish_depth + depth);
for (i = 0 ; i < count ; i++)
{@@ -143,18 +143,6 @@
return alpha;
}
-
-#ifndef moonfish_mini
-
-int moonfish_countdown(int score)
-{- score /= moonfish_omega;
- if (score < 0) score -= moonfish_depth + 1;
- else score += moonfish_depth;
- return score / 2;
-}
-
-#endif
static moonfish_result_t moonfish_start_search(void *data)
{--
⑨