shithub: moonfish

Download patch

ref: 7dfd3ade4698e0290379bb22064becab8428365d
parent: 3d405b7e12f564289fbdb3e4d1da170b7a436b1e
author: zamfofex <zamfofex@twdb.moe>
date: Thu Oct 12 16:11:23 EDT 2023

apply style changes

--- a/chess.c
+++ b/chess.c
@@ -224,8 +224,7 @@
 	moonfish_flip_horizontally(ctx);
 	moonfish_flip_vertically(ctx);
 	
-	if (ctx->white) ctx->white = 0;
-	else ctx->white = 1;
+	ctx->white ^= 1;
 	
 	for (y = 0 ; y < 8 ; y++)
 	for (x = 0 ; x < 8 ; x++)
@@ -518,5 +517,5 @@
 	
 	ctx->castle = castle;
 	
-	return valid ? 0 : 1;
+	return valid ^ 1;
 }
--- a/search.c
+++ b/search.c
@@ -61,7 +61,7 @@
 		if (depth <= -3) return score;
 		
 		if (score >= beta) return beta;
-		if (alpha < score) alpha = score;
+		if (score > alpha) alpha = score;
 	}
 	
 	for (y = 0 ; y < 8 ; y++)
@@ -89,7 +89,7 @@
 int moonfish_best_move(struct moonfish *ctx, struct moonfish_move *best_move)
 {
 	int x, y;
-	struct moonfish_move moves[512];
+	struct moonfish_move moves[32];
 	struct moonfish_move *move;
 	int score, best_score;
 	
--