add uci pst option (not handled)

This commit is contained in:
2024-07-25 09:56:27 +02:00
parent 4733a1d65f
commit d5920886a3
4 changed files with 30 additions and 16 deletions

View File

@@ -80,16 +80,6 @@ void param_set(int num, eval_t val)
* A1 .... H1 * A1 .... H1
* } * }
*/ */
/**
* pst_defs - pre-defined piece-square tables.
*/
enum {
PST_ROFCHADE,
PST_CPW,
PST_SJENG,
PST_NB
};
static const struct pst { static const struct pst {
char *name; /* one word only, no spaces */ char *name; /* one word only, no spaces */
int val[PIECE_TYPE_NB][PHASE_NB][SQUARE_NB]; /* MG then EG */ int val[PIECE_TYPE_NB][PHASE_NB][SQUARE_NB]; /* MG then EG */
@@ -536,7 +526,7 @@ static const struct pst {
}, /* sjeng end */ }, /* sjeng end */
}; };
int pst_current = 0; int pst_current = PST_DEFAULT;
eval_t pst_mg[COLOR_NB][PT_NB][SQUARE_NB]; eval_t pst_mg[COLOR_NB][PT_NB][SQUARE_NB];
eval_t pst_eg[COLOR_NB][PT_NB][SQUARE_NB]; eval_t pst_eg[COLOR_NB][PT_NB][SQUARE_NB];
@@ -578,3 +568,10 @@ void pst_init(int set)
} }
} }
} }
char *pst_name(int i)
{
if (i >= 0 && i < PST_NB)
return pst_defs[i].name;
return "undef";
}

View File

@@ -83,7 +83,17 @@ extern eval_t parameters[EV_PARAMS_NB];
void param_set (int num, eval_t val); void param_set (int num, eval_t val);
/* PST data */ /* PST data */
#define PST_DEFAULT "cpw" /**
* pst_defs - pre-defined piece-square tables.
*/
enum {
PST_ROFCHADE,
PST_CPW,
PST_SJENG,
PST_NB
};
#define PST_DEFAULT PST_CPW
extern int pst_current; extern int pst_current;
extern eval_t pst_mg[COLOR_NB][PT_NB][SQUARE_NB]; extern eval_t pst_mg[COLOR_NB][PT_NB][SQUARE_NB];
extern eval_t pst_eg[COLOR_NB][PT_NB][SQUARE_NB]; extern eval_t pst_eg[COLOR_NB][PT_NB][SQUARE_NB];

View File

@@ -68,9 +68,7 @@ void init_all(void)
/* eval tables */ /* eval tables */
printf("pst tables... "); printf("pst tables... ");
int pst; pst_init(PST_DEFAULT);
bug_on_always((pst = pst_find(PST_DEFAULT)) < 0);
pst_init(pst);
printf("done.\n"); printf("done.\n");
} }

View File

@@ -27,6 +27,7 @@
#include "move-gen.h" #include "move-gen.h"
#include "move-do.h" #include "move-do.h"
#include "search.h" #include "search.h"
#include "eval-defs.h"
struct command { struct command {
char *name; /* command name */ char *name; /* command name */
@@ -224,8 +225,16 @@ int do_uci(__unused pos_t *pos, __unused char *arg)
{ {
printf("id name brchess " VERSION "\n"); printf("id name brchess " VERSION "\n");
printf("id author Bruno Raoult\n"); printf("id author Bruno Raoult\n");
printf("option option name Hash type spin default %d min %d max %d\n", printf("option name Hash type spin default %d min %d max %d\n",
hash_tt.mb, HASH_SIZE_MIN, HASH_SIZE_MAX); hash_tt.mb, HASH_SIZE_MIN, HASH_SIZE_MAX);
if (PST_NB > 1) {
printf("option name pst type combo default %s",
pst_name(pst_current));
for (int i = 0; i < PST_NB; ++i)
printf(" var %s", pst_name(i));
}
printf("\n");
printf("uciok\n"); printf("uciok\n");
return 1; return 1;
} }