add pos_del function

This commit is contained in:
2023-07-07 15:53:57 +02:00
parent 7952a34c88
commit 120a459206
2 changed files with 13 additions and 0 deletions

View File

@@ -163,6 +163,18 @@ pos_t *pos_clear(pos_t *pos)
return pos; return pos;
} }
/**
* pos_del() - delete a position.
* @pos: &position.
*/
void pos_del(pos_t *pos)
{
pieces_del(pos, WHITE);
pieces_del(pos, BLACK);
moves_del(pos);
pool_add(pos_pool, pos);
}
pos_t *pos_startpos(pos_t *pos) pos_t *pos_startpos(pos_t *pos)
{ {
static char *startfen="rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1"; static char *startfen="rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1";

View File

@@ -45,6 +45,7 @@ void bitboard_print2(bitboard_t bb1, bitboard_t bb2);
void pos_pieces_print(pos_t *pos); void pos_pieces_print(pos_t *pos);
void pos_print(pos_t *pos); void pos_print(pos_t *pos);
pos_t *pos_clear(pos_t *pos); pos_t *pos_clear(pos_t *pos);
void pos_del(pos_t *pos);
pos_t *pos_startpos(pos_t *pos); pos_t *pos_startpos(pos_t *pos);
pos_t *pos_create(); pos_t *pos_create();
pool_t *pos_pool_init(); pool_t *pos_pool_init();