shithub: moonfish

Download patch

ref: 41e9faca71d687dedc6c37892b4a7035bdb89139
parent: 3ace5c346f0dcd2cef2b762b0d020fe4b85edc10
author: zamfofex <zamfofex@twdb.moe>
date: Sat Mar 15 06:58:26 EDT 2025

make small fixes

--- a/main.c
+++ b/main.c
@@ -45,7 +45,7 @@
 	static struct moonfish_chess chess;
 	
 	struct moonfish_info *info;
-	int i, j, count;
+	int i, j, count, count0;
 	char name[6];
 	
 	info = data;
@@ -52,8 +52,8 @@
 	
 	moonfish_best_move(info->root, &info->result, &info->search_options);
 	
-	count = moonfish_getoption(info->options, "MultiPV");
-	for (i = 0 ; i < count ; i++) {
+	count0 = moonfish_getoption(info->options, "MultiPV");
+	for (i = 0 ; i < count0 ; i++) {
 		count = sizeof pv / sizeof *pv;
 		moonfish_pv(info->root, pv, &result, i, &count);
 		if (count == 0) continue;
--- a/scripts/check.txt
+++ b/scripts/check.txt
@@ -1,6 +1,6 @@
 perft 0: 1
 info depth 1 score cp 23 nodes 2048
-bestmove d2d4
+bestmove e2e4
 perft 0: 1
 info depth 1 score cp 213 nodes 2048
 bestmove e2a6
--- a/search.c
+++ b/search.c
@@ -159,12 +159,15 @@
 static int moonfish_compare(const void *ax, const void *bx)
 {
 	const struct moonfish_node *a, *b;
+	
 	a = ax;
 	b = bx;
 	if (!a->ignored && b->ignored) return -1;
 	if (a->ignored && !b->ignored) return 1;
-	if (a->score == b->score) return a->index - b->index;
-	return a->score - b->score;
+	if (a->score != b->score) return a->score - b->score;
+	if (a->from != b->from) return a->from - b->from;
+	if (a->index != b->index) return a->index - b->index;
+	return 0;
 }
 
 static void moonfish_expand(struct moonfish_node *node, struct moonfish_chess *chess)
--