shithub: moonfish

Download patch

ref: 2777bd283d4e238761e594fcd038e20f5b9a1d7b
parent: b17005fc77447a0922c292913300c3acf5d421ce
author: zamfofex <zamfofex@twdb.moe>
date: Wed Nov 27 08:19:42 EST 2024

show centipawn score

--- a/README.md
+++ b/README.md
@@ -107,7 +107,7 @@
 
 After compiling and running it, you may use the mouse to click and move pieces around. (So, they require mouse support from your terminal.)
 
-To analyse a game with a UCI bot, use `./analyse` followed optionally by the UCI options you want to specify, and then the command of whichever bot you want to use for analysis. (Though note that moonfish currently does not have analysis capabilities.)
+To analyse a game with a UCI bot, use `./analyse` followed optionally by the UCI options you want to specify, and then the command of whichever bot you want to use for analysis. (Though note that moonfish has limited analysis capabilities.)
 
 ~~~
 # (analyse a game using Stockfish)
--- a/main.c
+++ b/main.c
@@ -82,7 +82,7 @@
 	moonfish_best_move(node, &result, &options);
 	moonfish_to_uci(&chess, &result.move, name);
 	
-	printf("info nodes %ld\n", result.node_count);
+	printf("info depth 1 score cp %d nodes %ld multipv 1 pv %s\n", result.score, result.node_count, name);
 	printf("bestmove %s\n", name);
 }
 
--- a/mini.c
+++ b/mini.c
@@ -33,14 +33,12 @@
 		if (arg) *arg = 0;
 		
 		if (!strncmp(line, "go ", 3)) {
-			
 			sscanf(line, "go wtime %d btime %d", &wtime, &btime);
-			
 			options.max_time = -1;
 			options.our_time = chess.white ? wtime : btime;
 			moonfish_best_move(node, &result, &options);
 			moonfish_to_uci(&chess, &result.move, name);
-			printf("bestmove %s\n", name);
+			printf("info depth 1 score cp %d nodes %ld\nbestmove %s\n", result.score, result.node_count, name);
 		}
 		
 		if (!strncmp(line, "position ", 9)) {
@@ -71,10 +69,7 @@
 			if (!moonfish_equal(&chess0, &chess)) moonfish_reroot(node, &chess);
 		}
 		
-		if (!strncmp(line, "setoption ", 10)) {
-			sscanf(line, "setoption name Threads value %d", &options.thread_count);
-		}
-		
+		if (!strncmp(line, "setoption ", 10)) sscanf(line, "setoption name Threads value %d", &options.thread_count);
 		if (!strcmp(line, "uci")) printf("option name Threads type spin default 1 min 1 max 256\nuciok\n");
 		if (!strcmp(line, "isready")) printf("readyok\n");
 		if (!strcmp(line, "quit")) return 0;
--- a/moonfish.h
+++ b/moonfish.h
@@ -104,6 +104,7 @@
 struct moonfish_result {
 	struct moonfish_move move;
 	long int node_count;
+	int score;
 };
 
 /* the PST */
--- a/search.c
+++ b/search.c
@@ -388,6 +388,7 @@
 	}
 	
 	result->move = best_node->move;
+	result->score = node->score;
 	result->node_count = node->visits;
 }
 
--