mirror of
https://github.com/sockspls/badfish
synced 2025-04-30 08:43:09 +00:00
Position::move_is_capture() does not handle MOVE_NONE
Actually square 0 can be dirty, so that move_is_capture(0) can return any random values. Add an assert to be sure it is caught. Signed-off-by: Marco Costalba <mcostalba@gmail.com>
This commit is contained in:
parent
268c12bf31
commit
dc2302b701
1 changed files with 3 additions and 1 deletions
|
@ -675,10 +675,12 @@ bool Position::move_is_check(Move m, Bitboard dcCandidates) const {
|
||||||
|
|
||||||
|
|
||||||
/// Position::move_is_capture() tests whether a move from the current
|
/// Position::move_is_capture() tests whether a move from the current
|
||||||
/// position is a capture.
|
/// position is a capture. Move must not be MOVE_NONE.
|
||||||
|
|
||||||
bool Position::move_is_capture(Move m) const {
|
bool Position::move_is_capture(Move m) const {
|
||||||
|
|
||||||
|
assert(m != MOVE_NONE);
|
||||||
|
|
||||||
return ( !square_is_empty(move_to(m))
|
return ( !square_is_empty(move_to(m))
|
||||||
&& (color_of_piece_on(move_to(m)) == opposite_color(side_to_move()))
|
&& (color_of_piece_on(move_to(m)) == opposite_color(side_to_move()))
|
||||||
)
|
)
|
||||||
|
|
Loading…
Add table
Reference in a new issue