mirror of
https://github.com/sockspls/badfish
synced 2025-07-11 19:49:14 +00:00
Bugfix of Position::has_repeated()
The function Position::has_repeated() is used by Tablebases::root_probe()
to determine whether we can rank all winning moves with the same value, or
if we need to strictly rank by dtz in case the position has already been
repeated once, and we are risking to run into the 50-move rule and thus
losing the win (especially critical in some very complicated endgames).
To check whether the current position or one of the previous positions
after the last zeroing move has already been occured once, we start looking
for a repetition of the current position, and if that is not the case, we
step one position back and repeat the check for that position, and so on.
If you now look at how this was done before the new root ranking patch was
merged two months ago, it seems quite obvious that it is a simple oversight:
108f0da4d7
More specifically, after we stepped one position back with
```
stc = stc->previous;
```
we now have to start checking for a repetition with
```
StateInfo* stp = stc->previous->previous;
```
and not with
```
StateInfo* stp = st->previous->previous;
```
Closes https://github.com/official-stockfish/Stockfish/pull/1625
No functional change
This commit is contained in:
parent
8ef9bc5a95
commit
f7bae2de82
1 changed files with 1 additions and 1 deletions
|
@ -1153,7 +1153,7 @@ bool Position::has_repeated() const {
|
|||
if (end < i)
|
||||
return false;
|
||||
|
||||
StateInfo* stp = st->previous->previous;
|
||||
StateInfo* stp = stc->previous->previous;
|
||||
|
||||
do {
|
||||
stp = stp->previous->previous;
|
||||
|
|
Loading…
Add table
Reference in a new issue