add pos_copy(); pos->king[] set at higher level

This commit is contained in:
2024-05-16 07:16:17 +02:00
parent 5db45a760a
commit 2069d6073d
7 changed files with 91 additions and 20 deletions

View File

@@ -62,6 +62,21 @@ pos_t *pos_dup(const pos_t *pos)
return newpos;
}
/**
* pos_copy() - copy a position into another one.
* @from: &position to duplicate.
* @to: &destination position.
*
* Return a copy of @from into @to.
*
* @Return: @to.
*/
pos_t *pos_copy(const pos_t *from, pos_t *to)
{
*to = *from;
return to;
}
/**
* pos_del() - delete a position.
* @pos: &position.
@@ -87,6 +102,7 @@ pos_t *pos_clear(pos_t *pos)
pos->turn = WHITE;
/* move_do/undo position state */
pos->key = 0;
pos->en_passant = SQUARE_NONE;
pos->castle = 0;
pos->clock_50 = 0;
@@ -336,9 +352,9 @@ bool pos_ok(const pos_t *pos, const bool strict)
/* force BUG_ON and WARN_ON */
# pragma push_macro("BUG_ON")
# pragma push_macro("WARN_ON")
# undef BUG_ON
# define BUG_ON
# pragma push_macro("WARN_ON")
# undef WARN_ON
# define WARN_ON