shithub: moonfish

Download patch

ref: f546f1faf0587a86092cb36b119de0aa13590b64
parent: 496d788f8c4929807ee9ede7999cf142d2d1575c
author: zamfofex <zamfofex@twdb.moe>
date: Fri Dec 15 04:40:46 EST 2023

consider promotions in quiescence search

--- a/search.c
+++ b/search.c
@@ -39,8 +39,13 @@
 		
 		for (move = moves ; move->piece != moonfish_outside ; move++)
 		{
-			if (depth <= 0 && move->captured == moonfish_empty) continue;
-			if (move->captured % 16 == moonfish_king) return moonfish_omega * (depth + 10);
+			if (depth <= 0)
+			if (move->captured == moonfish_empty)
+			if (move->promotion == move->piece)
+				continue;
+			
+			if (move->captured % 16 == moonfish_king)
+				return moonfish_omega * (depth + 10);
 			
 			moonfish_play(chess, move);
 			score = -moonfish_search(chess, -beta, -alpha, depth - 1);
--