From 120a45920697f3ec151b40e39751e8a30be58e96 Mon Sep 17 00:00:00 2001 From: Bruno Raoult Date: Fri, 7 Jul 2023 15:53:57 +0200 Subject: [PATCH] add pos_del function --- src/position.c | 12 ++++++++++++ src/position.h | 1 + 2 files changed, 13 insertions(+) diff --git a/src/position.c b/src/position.c index 8446408..169a86f 100644 --- a/src/position.c +++ b/src/position.c @@ -163,6 +163,18 @@ pos_t *pos_clear(pos_t *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) { static char *startfen="rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1"; diff --git a/src/position.h b/src/position.h index 5e66fcd..3219b62 100644 --- a/src/position.h +++ b/src/position.h @@ -45,6 +45,7 @@ void bitboard_print2(bitboard_t bb1, bitboard_t bb2); void pos_pieces_print(pos_t *pos); void pos_print(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_create(); pool_t *pos_pool_init();