ref: 3ace5c346f0dcd2cef2b762b0d020fe4b85edc10
parent: d8c5da39867c766419fda1f40b5b0a94e09242d5
author: zamfofex <zamfofex@twdb.moe>
date: Tue Mar 11 18:31:18 EDT 2025
make small changes
--- a/main.c
+++ b/main.c
@@ -6,7 +6,6 @@
#include <string.h>
#include <stdio.h>
#include <strings.h>
-#include <unistd.h>
#include "moonfish.h"
#include "threads.h"
@@ -309,7 +308,7 @@
static struct moonfish_info info;
static struct moonfish_option options[] = {#ifndef moonfish_no_threads
- {"Threads", "spin", 0, 1, 256},+ {"Threads", "spin", 0, 1, 0xFFFF},#endif
{"MultiPV", "spin", 0, 0, 256}, {NULL},--- a/mini.c
+++ b/mini.c
@@ -4,6 +4,7 @@
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
+#include <unistd.h>
#include "moonfish.h"
@@ -22,7 +23,8 @@
root = moonfish_new();
moonfish_root(root, &chess);
- options.thread_count = 1;
+ options.thread_count = sysconf(_SC_NPROCESSORS_ONLN);
+ if (options.thread_count < 1) options.thread_count = 1;
for (;;) {@@ -70,8 +72,7 @@
if (!moonfish_equal(&chess0, &chess)) moonfish_reroot(root, &chess);
}
- if (!strncmp(line, "setoption ", 10)) sscanf(line, "setoption name Threads value %d", &options.thread_count);
- if (!strcmp(line, "uci")) printf("option name Threads type spin default 1 min 1 max 256\nuciok\n");+ if (!strcmp(line, "uci")) printf("uciok\n"); if (!strcmp(line, "isready")) printf("readyok\n");if (!strcmp(line, "quit")) return 0;
}
--- a/scripts/rename.sh
+++ b/scripts/rename.sh
@@ -9,7 +9,7 @@
alphabet2=("${alphabet[@]}")declare -A names
-functions="main fopen fread printf fprintf sscanf fgets fflush stdin stdout stderr strcmp strncmp strcpy strtok strstr strchr malloc realloc free exit errno clock_gettime timespec tv_sec tv_nsec typedef memmove fabs sqrt log pow qsort thrd_t atomic_compare_exchange_strong atomic_fetch_add thrd_create thrd_success thrd_join"
+functions="main fopen fread printf fprintf sscanf fgets fflush stdin stdout stderr strcmp strncmp strcpy strtok strstr strchr malloc realloc free exit errno clock_gettime timespec tv_sec tv_nsec typedef memmove fabs sqrt log pow qsort thrd_t atomic_compare_exchange_strong atomic_fetch_add thrd_create thrd_success thrd_join sysconf"
keywords="do while for if else switch case break continue return extern static struct enum unsigned signed long short int char double float void const sizeof $functions"
while read -r name
--- a/search.c
+++ b/search.c
@@ -79,11 +79,10 @@
unsigned char clean;
};
-static short int moonfish_values0[] = {0, 0, 0, 0, 56, 96, 84, 65, 61, 92, 74, 79, 58, 88, 83, 95, 69, 102, 96, 115, 82, 132, 156, 159, 258, 226, 262, 274, 0, 0, 0, 0, 262, 317, 317, 310, 323, 314, 337, 344, 321, 350, 356, 367, 341, 370, 371, 371, 366, 368, 406, 398, 361, 399, 433, 442, 338, 329, 420, 402, 194, 295, 237, 363, 356, 375, 360, 346, 382, 394, 396, 378, 386, 393, 387, 395, 382, 390, 392, 414, 380, 397, 421, 430, 406, 429, 426, 440, 374, 391, 413, 395, 343, 339, 291, 298, 456, 467, 469, 477, 427, 460, 462, 465, 440, 462, 447, 458, 447, 457, 454, 469, 474, 484, 496, 513, 491, 529, 533, 548, 523, 521, 552, 552, 564, 550, 535, 552, 1046, 1032, 1038, 1058, 1046, 1062, 1070, 1058, 1049, 1063, 1056, 1052, 1047, 1056, 1051, 1046, 1073, 1053, 1058, 1057, 1078, 1083, 1077, 1071, 1049, 1001, 1063, 1041, 1057, 1071, 1089, 1107, 20, 37, -21, -15, 18, 4, -61, -82, -63, -50, -84, -97, -93, -68, -82, -97, -77, -40, -24, -40, -31, 28, 52, 36, 44, 13, 53, 63, 163, 141, 61, 70};-static short int moonfish_values1[] = {0, 0, 0, 0, 137, 142, 141, 145, 132, 137, 127, 134, 139, 138, 123, 119, 156, 152, 134, 125, 223, 214, 184, 178, 255, 269, 236, 215, 0, 0, 0, 0, 320, 318, 360, 369, 345, 378, 378, 387, 360, 388, 396, 416, 384, 403, 428, 436, 388, 413, 430, 439, 376, 396, 414, 416, 362, 399, 385, 408, 317, 372, 415, 387, 389, 391, 391, 410, 393, 402, 404, 420, 402, 416, 431, 431, 410, 429, 436, 437, 420, 437, 431, 440, 412, 421, 431, 425, 399, 420, 418, 423, 409, 418, 423, 430, 699, 708, 715, 717, 706, 704, 709, 708, 705, 712, 718, 716, 724, 732, 737, 734, 737, 740, 743, 738, 744, 738, 742, 734, 742, 749, 743, 746, 727, 736, 744, 738, 1255, 1256, 1247, 1234, 1248, 1249, 1246, 1271, 1276, 1274, 1307, 1305, 1308, 1332, 1342, 1359, 1309, 1358, 1374, 1384, 1318, 1333, 1375, 1386, 1327, 1388, 1381, 1410, 1338, 1346, 1357, 1352, -71, -42, -29, -42, -27, -11, 12, 17, -3, 12, 30, 39, 8, 30, 45, 55, 21, 48, 49, 52, 29, 49, 42, 30, -7, 42, 27, 10, -95, -30, -17, -26};-
static short int moonfish_score(struct moonfish_chess *chess)
{+ static short int values0[] = {0, 0, 0, 0, 56, 96, 84, 65, 61, 92, 74, 79, 58, 88, 83, 95, 69, 102, 96, 115, 82, 132, 156, 159, 258, 226, 262, 274, 0, 0, 0, 0, 262, 317, 317, 310, 323, 314, 337, 344, 321, 350, 356, 367, 341, 370, 371, 371, 366, 368, 406, 398, 361, 399, 433, 442, 338, 329, 420, 402, 194, 295, 237, 363, 356, 375, 360, 346, 382, 394, 396, 378, 386, 393, 387, 395, 382, 390, 392, 414, 380, 397, 421, 430, 406, 429, 426, 440, 374, 391, 413, 395, 343, 339, 291, 298, 456, 467, 469, 477, 427, 460, 462, 465, 440, 462, 447, 458, 447, 457, 454, 469, 474, 484, 496, 513, 491, 529, 533, 548, 523, 521, 552, 552, 564, 550, 535, 552, 1046, 1032, 1038, 1058, 1046, 1062, 1070, 1058, 1049, 1063, 1056, 1052, 1047, 1056, 1051, 1046, 1073, 1053, 1058, 1057, 1078, 1083, 1077, 1071, 1049, 1001, 1063, 1041, 1057, 1071, 1089, 1107, 20, 37, -21, -15, 18, 4, -61, -82, -63, -50, -84, -97, -93, -68, -82, -97, -77, -40, -24, -40, -31, 28, 52, 36, 44, 13, 53, 63, 163, 141, 61, 70};+ static short int values1[] = {0, 0, 0, 0, 137, 142, 141, 145, 132, 137, 127, 134, 139, 138, 123, 119, 156, 152, 134, 125, 223, 214, 184, 178, 255, 269, 236, 215, 0, 0, 0, 0, 320, 318, 360, 369, 345, 378, 378, 387, 360, 388, 396, 416, 384, 403, 428, 436, 388, 413, 430, 439, 376, 396, 414, 416, 362, 399, 385, 408, 317, 372, 415, 387, 389, 391, 391, 410, 393, 402, 404, 420, 402, 416, 431, 431, 410, 429, 436, 437, 420, 437, 431, 440, 412, 421, 431, 425, 399, 420, 418, 423, 409, 418, 423, 430, 699, 708, 715, 717, 706, 704, 709, 708, 705, 712, 718, 716, 724, 732, 737, 734, 737, 740, 743, 738, 744, 738, 742, 734, 742, 749, 743, 746, 727, 736, 744, 738, 1255, 1256, 1247, 1234, 1248, 1249, 1246, 1271, 1276, 1274, 1307, 1305, 1308, 1332, 1342, 1359, 1309, 1358, 1374, 1384, 1318, 1333, 1375, 1386, 1327, 1388, 1381, 1410, 1338, 1346, 1357, 1352, -71, -42, -29, -42, -27, -11, 12, 17, -3, 12, 30, 39, 8, 30, 45, 55, 21, 48, 49, 52, 29, 49, 42, 30, -7, 42, 27, 10, -95, -30, -17, -26}; static int values[] = {0, 1, 1, 2, 4, 0};int x, y;
@@ -114,8 +113,8 @@
i = x1 + y1 * 4 + type * 32;
- score0 -= moonfish_values0[i] * (color * 2 - 1);
- score1 -= moonfish_values1[i] * (color * 2 - 1);
+ score0 -= values0[i] * (color * 2 - 1);
+ score1 -= values1[i] * (color * 2 - 1);
phase += values[type];
}
--
⑨