From e2a3563fce0c9bd3701b3738c086e468c4cefe8b Mon Sep 17 00:00:00 2001 From: Bruno Raoult Date: Wed, 12 Jul 2023 21:32:26 +0200 Subject: [PATCH] use eval_simple() as base for eval() --- src/eval.c | 13 +++++++------ src/eval.h | 11 +++++------ 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/eval.c b/src/eval.c index 8ff333e..ad1f625 100644 --- a/src/eval.c +++ b/src/eval.c @@ -18,6 +18,7 @@ #include "position.h" #include "eval.h" +#include "eval-simple.h" inline eval_t eval_material(pos_t *pos, bool color) { @@ -51,18 +52,18 @@ inline eval_t eval_square_control(pos_t *pos, bool color) eval_t eval(pos_t *pos) { - eval_t material[2] = {0}, control[2] = {0}; + eval_t simple = 0, control[2] = {0}; if (pos->eval != EVAL_INVALID) return pos->eval; /* 1) pieces value */ - material[WHITE] = eval_material(pos, WHITE); - material[BLACK] = eval_material(pos, BLACK); + //material[WHITE] = eval_material(pos, WHITE); + //material[BLACK] = eval_material(pos, BLACK); + simple = eval_simple(pos); # ifdef DEBUG_EVAL - log_f(2, "material: W:%d B:%d diff=%d\n", - material[WHITE], material[BLACK], material[WHITE] - material[BLACK]); + log_f(2, "eval_simple=%d\n", simple); # endif /* 2) square control: 10 square controls diff = 1 pawn */ @@ -83,7 +84,7 @@ eval_t eval(pos_t *pos) (pos->mobility[WHITE] - pos->mobility[BLACK]) * 10); # endif - eval_t res = material[WHITE] - material[BLACK] + + eval_t res = simple + (control[WHITE] - control[BLACK]) * 10 + (pos->mobility[WHITE] - pos->mobility[BLACK]) * 10; # ifdef DEBUG_EVAL diff --git a/src/eval.h b/src/eval.h index 9b16edf..39dd577 100644 --- a/src/eval.h +++ b/src/eval.h @@ -19,13 +19,12 @@ #include "chessdefs.h" #include "piece.h" -#define EVAL_MAX \ - KING_VALUE + \ - QUEEN_VALUE * 9 + \ - ROOK_VALUE * 2 + \ - BISHOP_VALUE * 2 + \ - KNIGHT_VALUE * 2 +/* max pieces eval is KING_VALUE + 9*QUEEN_VALUE + 2*ROOK_VALUE + 2*BISHOP_VALUE + * + 2*KNIGHT_VALUE which around 30000. + * We are on secure sire with -50000/+50000 + */ +#define EVAL_MAX (50000) #define EVAL_MIN (-EVAL_MAX) #define EVAL_INVALID INT_MIN