From 84408e5cd68a9323292ddababec4d1183abeef2e Mon Sep 17 00:00:00 2001 From: Marco Costalba Date: Thu, 20 Nov 2014 12:13:00 +0100 Subject: [PATCH] Fix doubled pawns asymmetry When evaluating double pawns we use always lsb() to extract the frontmost square. This breaks evaluation color symmetry as is possible to verify with an instrumented evaluate() Value evaluate(const Position& pos) { Value v = do_evaluate(pos); Position p = pos; p.flip(); assert(v == do_evaluate(p)); return v; } Passed no regression test: STC LLR: 2.96 (-2.94,2.94) [-3.00,1.00] Total: 21035 W: 4244 L: 4122 D: 12669 LTC LLR: 2.95 (-2.94,2.94) [-3.00,1.00] Total: 39839 W: 6662 L: 6572 D: 26605 bench: 8255966 --- src/pawns.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pawns.cpp b/src/pawns.cpp index 1099c5a4..fe989e9b 100644 --- a/src/pawns.cpp +++ b/src/pawns.cpp @@ -165,7 +165,7 @@ namespace { value -= UnsupportedPawnPenalty; if (doubled) - value -= Doubled[f] / distance(s, Square(lsb(doubled))); + value -= Doubled[f] / distance(s, frontmost_sq(Us, doubled)); if (backward) value -= Backward[opposed][f]; -- 2.39.2