From 09ceca44e50f997afc852372808f842503f44566 Mon Sep 17 00:00:00 2001 From: Bruno Raoult Date: Sun, 25 Jun 2023 16:02:23 +0200 Subject: [PATCH] pos: keep possibility to have opponent moves (NULL move) --- src/position.c | 6 ++++-- src/position.h | 4 ++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/position.c b/src/position.c index 5ff4530..a40845c 100644 --- a/src/position.c +++ b/src/position.c @@ -176,7 +176,8 @@ pos_t *pos_get() INIT_LIST_HEAD(&pos->pieces[WHITE]); INIT_LIST_HEAD(&pos->pieces[BLACK]); - INIT_LIST_HEAD(&pos->moves); + INIT_LIST_HEAD(&pos->moves[WHITE]); + INIT_LIST_HEAD(&pos->moves[BLACK]); pos_clear(pos); } else { fprintf(stderr, "zobaaa\n"); @@ -197,7 +198,8 @@ pos_t *pos_dup(pos_t *pos) *new = *pos; INIT_LIST_HEAD(&new->pieces[WHITE]); INIT_LIST_HEAD(&new->pieces[BLACK]); - INIT_LIST_HEAD(&new->moves); + INIT_LIST_HEAD(&new->moves[WHITE]); + INIT_LIST_HEAD(&new->moves[BLACK]); /* duplicate piece list */ for (int color=0; color<2; ++color) { diff --git a/src/position.h b/src/position.h index 53757e6..7b5714b 100644 --- a/src/position.h +++ b/src/position.h @@ -27,7 +27,6 @@ typedef struct pos_s { castle_t castle; u16 clock_50; u16 curmove; - u16 mobility[2]; eval_t eval; board_t board[BOARDSIZE]; @@ -37,8 +36,9 @@ typedef struct pos_s { bitboard_t bb[2][BB_END]; /* use: pieces[BLACK][BB_PAWN] */ bitboard_t occupied[2]; /* OR of bb[COLOR][x] */ bitboard_t controlled[2]; + u16 mobility[2]; struct list_head pieces[2]; - struct list_head moves; + struct list_head moves[2]; } pos_t; void bitboard_print(bitboard_t bb);