Skip to content

Commit

Permalink
Fix an overflow in SEE
Browse files Browse the repository at this point in the history
If the stage is King and incremented by one, the stage would overflow leading to reading from bitboards that, in this context, are nonsensical

Passed Non-Regr:
Elo   | 29.49 +- 12.84 (95%)
SPRT  | 8.0+0.08s Threads=1 Hash=8MB
LLR   | 2.91 (-2.25, 2.89) [-5.00, 0.00]
Games | N: 1358 W: 384 L: 269 D: 705
Penta | [8, 136, 293, 217, 25]
https://aytchell.eu.pythonanywhere.com/test/710/

bench 7874387
  • Loading branch information
rn5f107s2 committed Sep 18, 2024
1 parent b50f5d9 commit c33ab96
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/searchUtil.h
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ inline bool see(Position &pos, int threshold, Move move) {
continue;
}

while (!attackers[stm] && stages[stm] < KING + 1) {
while (!attackers[stm] && stages[stm] < KING) {
stage = PieceType(++stages[stm]);
attackers[stm] |= getAttacks(stages[stm], to, blockers, !stm) & pos.getPieces(stm, stage) & blockers;
}
Expand Down

0 comments on commit c33ab96

Please sign in to comment.