shithub: moonfish

Download patch

ref: c17ff753bda7016025a9ac2b69fc890989c18e1b
parent: 244df7208fe05b842fae60edd4ac0d6724331485
author: zamfofex <zamfofex@twdb.moe>
date: Fri Oct 27 22:57:51 EDT 2023

simplify time management

--- a/search.c
+++ b/search.c
@@ -181,25 +181,17 @@
 	time_t t, d;
 	int i;
 	int score;
-	int base;
 	
 	d = our_time - their_time;
 	if (d < 0) d = 0;
 	d += our_time / 8;
 	
-	t = 0;
-	base = 2;
+	i = 3;
 	
-	while (t < 4)
-	{
-		base++;
-		t = time(NULL);
-		score = moonfish_best_move_depth(ctx, best_move, base);
-		t = time(NULL) - t + 2;
-	}
+	t = time(NULL);
+	score = moonfish_best_move_depth(ctx, best_move, i);
+	t = time(NULL) - t + 4;
 	
-	i = base;
-	
 	for (;;)
 	{
 		t *= 32;
@@ -208,6 +200,6 @@
 		if (i >= 8) break;
 	}
 	
-	if (i == base) return score;
+	if (i == 3) return score;
 	return moonfish_best_move_depth(ctx, best_move, i);
 }
--