]> git.sesse.net Git - stockfish/commit
Fix wrong condition in PawnEntry::king_safety()
authorMarco Costalba <mcostalba@gmail.com>
Fri, 27 Apr 2012 09:30:35 +0000 (10:30 +0100)
committerMarco Costalba <mcostalba@gmail.com>
Fri, 27 Apr 2012 09:59:18 +0000 (10:59 +0100)
commit2aac860db3d04881103a3b0d09e864ac77b80697
tree270b12430e675122b31a344242afb22c2774c06b
parent8b00e50cb74392c24938c0019ac528a9feabd614
Fix wrong condition in PawnEntry::king_safety()

Since revision 374c9e6b63d0e233371
we use also castling information to calculate king safety.
So before to reuse the cached king safety score we have to
veify not only king position, but also castling rights are
the same of the pre-calculated ones.

This is a very subtle bug, found only becuase even after
previous patch, consecutives runs of 'bench' _still_ showed
different numbers. Pawn tables are not cleared between 'bench'
runs and in the second run a king safety score, previously
evaluated under some castling rights, was reused by another
position with different castling rights instead of being
recalculated from scratch.

Bug spotted and tracked down by Balint Pfliegel

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
src/pawns.cpp
src/pawns.h
src/position.h