mirror of
https://github.com/sockspls/badfish
synced 2025-05-02 01:29:36 +00:00
Fix repetition detection bug
Bug spotted by Jouni Uski and fix suggested by Pablo Vazquez Also add note that we are not always handling fifty move rule correctly Signed-off-by: Marco Costalba <mcostalba@gmail.com>
This commit is contained in:
parent
1a03f0b0d3
commit
e6f2d43b8a
1 changed files with 2 additions and 1 deletions
|
@ -1678,6 +1678,7 @@ Value Position::compute_non_pawn_material(Color c) const {
|
||||||
/// Position::is_draw() tests whether the position is drawn by material,
|
/// Position::is_draw() tests whether the position is drawn by material,
|
||||||
/// repetition, or the 50 moves rule. It does not detect stalemates, this
|
/// repetition, or the 50 moves rule. It does not detect stalemates, this
|
||||||
/// must be done by the search.
|
/// must be done by the search.
|
||||||
|
// FIXME: Currently we are not handling 50 move rule correctly when in check
|
||||||
|
|
||||||
bool Position::is_draw() const {
|
bool Position::is_draw() const {
|
||||||
|
|
||||||
|
@ -1691,7 +1692,7 @@ bool Position::is_draw() const {
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
// Draw by repetition?
|
// Draw by repetition?
|
||||||
for (int i = 2; i < Min(Min(gamePly, st->rule50), st->pliesFromNull); i += 2)
|
for (int i = 4; i <= Min(Min(gamePly, st->rule50), st->pliesFromNull); i += 2)
|
||||||
if (history[gamePly - i] == st->key)
|
if (history[gamePly - i] == st->key)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue