mirror of
https://github.com/sockspls/badfish
synced 2025-04-30 16:53:09 +00:00
Fix critical SEE bug
It is somewhat unbilievable but our SEE is broken !
If the first SEE move is a king capture and square is
defended then SEE continues instead of breaking.
The bug shows only on normal SEE, not see_sign() so
probing with a:
dbg_hit_on_c(slIndex==1, captured == KING);
reports just a tiny:
Total 3465656 Hits 6646 hit rate (%) 0
Bug was there since 351ef5c85b
of 26/6/2011 (!)
although for some reason didn't show immediately, indeed the
bougous patch was a "No functional change" (!!)
bench: 4793754
This commit is contained in:
parent
0504a6975d
commit
a6c5b4c6fb
1 changed files with 7 additions and 10 deletions
|
@ -1136,7 +1136,7 @@ int Position::see_sign(Move m) const {
|
||||||
// Early return if SEE cannot be negative because captured piece value
|
// Early return if SEE cannot be negative because captured piece value
|
||||||
// is not less then capturing one. Note that king moves always return
|
// is not less then capturing one. Note that king moves always return
|
||||||
// here because king midgame value is set to 0.
|
// here because king midgame value is set to 0.
|
||||||
if (PieceValue[MG][piece_on(to_sq(m))] >= PieceValue[MG][piece_moved(m)])
|
if (PieceValue[MG][piece_moved(m)] <= PieceValue[MG][piece_on(to_sq(m))])
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
return see(m);
|
return see(m);
|
||||||
|
@ -1197,6 +1197,12 @@ int Position::see(Move m, int asymmThreshold) const {
|
||||||
do {
|
do {
|
||||||
assert(slIndex < 32);
|
assert(slIndex < 32);
|
||||||
|
|
||||||
|
if (captured == KING) // Stop before processing a king capture
|
||||||
|
{
|
||||||
|
swapList[slIndex++] = QueenValueMg * 16;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
// Add the new entry to the swap list
|
// Add the new entry to the swap list
|
||||||
swapList[slIndex] = -swapList[slIndex - 1] + PieceValue[MG][captured];
|
swapList[slIndex] = -swapList[slIndex - 1] + PieceValue[MG][captured];
|
||||||
slIndex++;
|
slIndex++;
|
||||||
|
@ -1206,15 +1212,6 @@ int Position::see(Move m, int asymmThreshold) const {
|
||||||
stm = ~stm;
|
stm = ~stm;
|
||||||
stmAttackers = attackers & pieces(stm);
|
stmAttackers = attackers & pieces(stm);
|
||||||
|
|
||||||
if (captured == KING)
|
|
||||||
{
|
|
||||||
// Stop before processing a king capture
|
|
||||||
if (stmAttackers)
|
|
||||||
swapList[slIndex++] = QueenValueMg * 16;
|
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
} while (stmAttackers);
|
} while (stmAttackers);
|
||||||
|
|
||||||
// If we are doing asymmetric SEE evaluation and the same side does the first
|
// If we are doing asymmetric SEE evaluation and the same side does the first
|
||||||
|
|
Loading…
Add table
Reference in a new issue