shithub: moonfish

Download patch

ref: a9265a19e194363c2b2d5e9171828765c763639a
parent: 2d4418c24ad95172831580fe71bb00259eb716d0
author: zamfofex <zamfofex@twdb.moe>
date: Thu Nov 21 03:20:45 EST 2024

make small style changes

--- a/search.c
+++ b/search.c
@@ -54,8 +54,7 @@
 {
 	int x, y;
 	int x1, y1;
-	int from;
-	unsigned char type, color;
+	unsigned char type, color, piece;
 	double score;
 	
 	score = 0;
@@ -62,15 +61,15 @@
 	
 	for (y = 0 ; y < 8 ; y++) {
 		for (x = 0 ; x < 8 ; x++) {
-			from = (x + 1) + (y + 2) * 10;
-			type = chess->board[from] % 16;
-			color = chess->board[from] / 16 - 1;
-			if (chess->board[from] == moonfish_empty) continue;
+			piece = chess->board[(x + 1) + (y + 2) * 10];
+			if (piece == moonfish_empty) continue;
+			type = piece % 16 - 1;
+			color = piece / 16 - 1;
 			x1 = x;
 			y1 = y;
 			if (x1 > 3) x1 = 7 - x1;
 			if (color == 1) y1 = 7 - y1;
-			score -= moonfish_values[x1 + y1 * 4 + (type - 1) * 32] * (color * 2 - 1);
+			score -= moonfish_values[x1 + y1 * 4 + type * 32] * (color * 2 - 1);
 		}
 	}
 	
--- a/tools/lichess.c
+++ b/tools/lichess.c
@@ -467,8 +467,7 @@
 int main(int argc, char **argv)
 {
 	static char *format = "<cmd> <args>...";
-	static struct moonfish_arg args[] =
-	{
+	static struct moonfish_arg args[] = {
 		{"N", "host", "<name>", "lichess.org", "Lichess' host name (default: 'lichess.org')"},
 		{"P", "port", "<port>", "443", "Lichess' port (default: '443')"},
 		{NULL, NULL, NULL, NULL, NULL},
--