Add check array in position structure

This commit is contained in:
2023-07-25 06:54:33 +02:00
parent f27b649503
commit 48b5420830
4 changed files with 10 additions and 2 deletions

View File

@@ -21,12 +21,12 @@
/* 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
* We are on secure side with -50000/+50000
*/
#define EVAL_MAX (50000)
#define EVAL_MIN (-EVAL_MAX)
#define EVAL_INVALID INT_MIN
#define EVAL_MATE EVAL_MAX
eval_t eval_material(pos_t *pos, bool color);
eval_t eval_mobility(pos_t *pos, bool color);

View File

@@ -198,6 +198,9 @@ static move_t *move_add(pos_t *pos, piece_t piece, square_t from,
move->from = from;
move->to = to;
move->capture = board[to].piece;
if (PIECE(move->capture) == KING)
pos->check[color]++;
move->flags = M_NORMAL;
if (move->capture)
move->flags |= M_CAPTURE;
@@ -386,6 +389,8 @@ int pseudo_moves_pawn(pos_t *pos, piece_list_t *ppiece, bool doit)
continue;
pos->controlled[color] |= SQ88_2_BB(new);
if (board[new].piece && COLOR(board[new].piece) != color) {
if (PIECE(board[new].piece) == KING)
pos->check[color]++;
//log_f(2, "pawn capture mobility\n");
pos->mobility[color]++;
count++;

View File

@@ -271,6 +271,7 @@ pos_t *pos_get()
* - nodecount is set to zero
* - eval is set to EVAL_INVALID
* - moves_generated ans moves_counted are unset
* - check is set to zero
*
* @return: The new position.
*
@@ -303,6 +304,7 @@ pos_t *pos_dup(pos_t *pos)
new->eval = EVAL_INVALID;
new->moves_generated = false;
new->moves_counted = false;
new->check[WHITE] = new->check[BLACK] = 0;
}
return new;
}

View File

@@ -29,6 +29,7 @@ typedef struct pos_s {
u16 clock_50;
u16 curmove;
eval_t eval;
int check[2];
int eval_simple_phase;
eval_t eval_simple;
move_t *bestmove;