simplify pos_clear
This commit is contained in:
@@ -100,31 +100,14 @@ pos_t *pos_clear(pos_t *pos)
|
|||||||
# ifdef DEBUG_POS
|
# ifdef DEBUG_POS
|
||||||
printf("size(pos_board=%lu elt=%lu\n", sizeof(pos->board), sizeof(int));
|
printf("size(pos_board=%lu elt=%lu\n", sizeof(pos->board), sizeof(int));
|
||||||
# endif
|
# endif
|
||||||
pos->node_count = 0;
|
memset(pos, 0, sizeof (pos_t));
|
||||||
pos->turn = WHITE;
|
|
||||||
|
|
||||||
/* move_do/undo position state */
|
/* non-zero values */
|
||||||
pos->key = 0;
|
|
||||||
pos->en_passant = SQUARE_NONE;
|
pos->en_passant = SQUARE_NONE;
|
||||||
pos->castle = 0;
|
|
||||||
pos->clock_50 = 0;
|
|
||||||
pos->plycount = 0;
|
|
||||||
pos->move = MOVE_NONE;
|
pos->move = MOVE_NONE;
|
||||||
pos->captured = NO_PIECE;
|
|
||||||
|
|
||||||
for (square_t sq = A1; sq <= H8; ++sq)
|
pos->king[WHITE] = SQUARE_NONE;
|
||||||
pos->board[sq] = EMPTY;
|
pos->king[BLACK] = SQUARE_NONE;
|
||||||
|
|
||||||
for (color_t color = WHITE; color <= BLACK; ++color) {
|
|
||||||
for (piece_type_t piece = 0; piece <= KING; ++piece)
|
|
||||||
pos->bb[color][piece] = 0;
|
|
||||||
//pos->controlled[color] = 0;
|
|
||||||
pos->king[color] = SQUARE_NONE;
|
|
||||||
}
|
|
||||||
|
|
||||||
pos->checkers = 0;
|
|
||||||
pos->pinners = 0;
|
|
||||||
pos->blockers = 0;
|
|
||||||
|
|
||||||
return pos;
|
return pos;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user