1
0
Fork 0
mirror of https://github.com/sockspls/badfish synced 2025-04-29 16:23:09 +00:00

Fix critical SEE bug (take 2)

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 Retire seeValues[] and move PieceValue[] out of Position of 26/6/2011 (!)
    although for some reason didn't show immediately, indeed the
    bougous patch was a "No functional change" (!!)

    bench: 4699504
This commit is contained in:
Marco Costalba 2013-07-20 14:24:23 +02:00
parent 2ed56f4d5f
commit 3e95800814

View file

@ -1195,6 +1195,12 @@ int Position::see(Move m, int asymmThreshold) const {
do {
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
swapList[slIndex] = -swapList[slIndex - 1] + PieceValue[MG][captured];
slIndex++;
@ -1205,15 +1211,6 @@ int Position::see(Move m, int asymmThreshold) const {
stm = ~stm;
stmAttackers = attackers & pieces(stm);
if (captured == KING)
{
// Stop before processing a king capture
if (stmAttackers)
swapList[slIndex++] = QueenValueMg * 16;
break;
}
} while (stmAttackers);
// If we are doing asymmetric SEE evaluation and the same side does the first