Code: Select all
if (WhiteCastle(ply) <= 0) {
if (File(WhiteKingSQ) >= FILEE) {
if (File(WhiteKingSQ) > FILEE)
tree->w_safety += tree->pawn_score.white_defects_k;
else
tree->w_safety += tree->pawn_score.white_defects_e;
} else if (File(WhiteKingSQ) <= FILED) {
if (File(WhiteKingSQ) < FILED)
tree->w_safety += tree->pawn_score.white_defects_q;
else
tree->w_safety += tree->pawn_score.white_defects_d;
}
}
Example: Castle early in the search, some extension triggering is reached, the King goes from (in 8x8 chess) g1 to f2 to e2 to d1 due to being checked, and the "if" statement fails despite castling having occured.
Now in a vast majority of the cases you castle kingside and your File(king) will be greater than FILEE. But, the faster computers become, and the deeper you search, the more often this will fail (in terms of nodes misevaluated, not in terms of percentage of occurances.)
I have toyed with adding some "WhiteDefinitelyCastledKingside(ply)" structure, but setting and resetting this during Move/Unmove, yet having it "inherit" the data where applicable seems to be a bit of trouble.
Any comments?