added the 50-move draw rule
This commit is contained in:
parent
6e567f2f11
commit
d6aa977a15
@ -267,6 +267,12 @@ Board Board::make_move(Move move) const {
|
||||
}
|
||||
}
|
||||
|
||||
ret.n_half_moves = n_half_moves + 1;
|
||||
if (is_capturing || piece_at(move.source_square) == Piece::Pawn)
|
||||
ret.n_half_moves = 0;
|
||||
if (!white_to_play)
|
||||
ret.n_full_moves = n_full_moves + 1;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -43,7 +43,7 @@ struct Board {
|
||||
}
|
||||
|
||||
bool is_terminal() const {
|
||||
return insufficient_material() || white_to_play
|
||||
return n_half_moves == 100 || insufficient_material() || white_to_play
|
||||
? is_checkmate_for(White) || is_stalemate_for(White)
|
||||
: is_checkmate_for(Black) || is_stalemate_for(Black);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user