use eval_simple() as base for eval()
This commit is contained in:
13
src/eval.c
13
src/eval.c
@@ -18,6 +18,7 @@
|
|||||||
|
|
||||||
#include "position.h"
|
#include "position.h"
|
||||||
#include "eval.h"
|
#include "eval.h"
|
||||||
|
#include "eval-simple.h"
|
||||||
|
|
||||||
inline eval_t eval_material(pos_t *pos, bool color)
|
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 eval(pos_t *pos)
|
||||||
{
|
{
|
||||||
eval_t material[2] = {0}, control[2] = {0};
|
eval_t simple = 0, control[2] = {0};
|
||||||
|
|
||||||
if (pos->eval != EVAL_INVALID)
|
if (pos->eval != EVAL_INVALID)
|
||||||
return pos->eval;
|
return pos->eval;
|
||||||
|
|
||||||
/* 1) pieces value */
|
/* 1) pieces value */
|
||||||
material[WHITE] = eval_material(pos, WHITE);
|
//material[WHITE] = eval_material(pos, WHITE);
|
||||||
material[BLACK] = eval_material(pos, BLACK);
|
//material[BLACK] = eval_material(pos, BLACK);
|
||||||
|
simple = eval_simple(pos);
|
||||||
|
|
||||||
# ifdef DEBUG_EVAL
|
# ifdef DEBUG_EVAL
|
||||||
log_f(2, "material: W:%d B:%d diff=%d\n",
|
log_f(2, "eval_simple=%d\n", simple);
|
||||||
material[WHITE], material[BLACK], material[WHITE] - material[BLACK]);
|
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
/* 2) square control: 10 square controls diff = 1 pawn */
|
/* 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);
|
(pos->mobility[WHITE] - pos->mobility[BLACK]) * 10);
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
eval_t res = material[WHITE] - material[BLACK] +
|
eval_t res = simple +
|
||||||
(control[WHITE] - control[BLACK]) * 10 +
|
(control[WHITE] - control[BLACK]) * 10 +
|
||||||
(pos->mobility[WHITE] - pos->mobility[BLACK]) * 10;
|
(pos->mobility[WHITE] - pos->mobility[BLACK]) * 10;
|
||||||
# ifdef DEBUG_EVAL
|
# ifdef DEBUG_EVAL
|
||||||
|
11
src/eval.h
11
src/eval.h
@@ -19,13 +19,12 @@
|
|||||||
#include "chessdefs.h"
|
#include "chessdefs.h"
|
||||||
#include "piece.h"
|
#include "piece.h"
|
||||||
|
|
||||||
#define EVAL_MAX \
|
/* max pieces eval is KING_VALUE + 9*QUEEN_VALUE + 2*ROOK_VALUE + 2*BISHOP_VALUE
|
||||||
KING_VALUE + \
|
* + 2*KNIGHT_VALUE which around 30000.
|
||||||
QUEEN_VALUE * 9 + \
|
* We are on secure sire with -50000/+50000
|
||||||
ROOK_VALUE * 2 + \
|
*/
|
||||||
BISHOP_VALUE * 2 + \
|
|
||||||
KNIGHT_VALUE * 2
|
|
||||||
|
|
||||||
|
#define EVAL_MAX (50000)
|
||||||
#define EVAL_MIN (-EVAL_MAX)
|
#define EVAL_MIN (-EVAL_MAX)
|
||||||
#define EVAL_INVALID INT_MIN
|
#define EVAL_INVALID INT_MIN
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user