Matthies / RubiChess

Another chess engine
GNU General Public License v3.0
150 stars 16 forks source link

index out of bounds #430

Closed HansLoehle closed 9 months ago

HansLoehle commented 9 months ago

https://github.com/Matthies/RubiChess/blob/654d1bd09678ad49179c2ec6ef7237700f4ef74e/src/tbprobe.cpp#L714

the initialisation of i should read i = PREROOTMOVES - 1 because in line 715 prerootmovestack[i].hash is accessed before i becomes decremented.

Matthies commented 9 months ago

I agree that this code is quite ugly but it works as expected because of https://github.com/Matthies/RubiChess/blob/654d1bd09678ad49179c2ec6ef7237700f4ef74e/src/RubiChess.h#L1734-L1735 So prerootmovestack[PREROOTMOVES].hash is movestack[0].hash, the hash of the actual root position which needs to be included in the repetition search.