]> git.sesse.net Git - stockfish/commitdiff
MobilityArea (simplified)
authorAlain SAVARD <support@multicim.com>
Wed, 29 Jul 2015 16:47:51 +0000 (00:47 +0800)
committerGary Linscott <glinscott@gmail.com>
Wed, 29 Jul 2015 16:47:51 +0000 (00:47 +0800)
Based off of Pull request #383:

Include squares occupied by some pawns in the MobilityArea
a) not blocked
b) on rank 4 and above
c) or captures

Passed STC
LLR: 2.95 (-2.94,2.94) [-1.50,4.50]
Total: 8157 W: 1644 L: 1516 D: 4997

And LTC
LLR: 2.97 (-2.94,2.94) [0.00,6.00]
Total: 26086 W: 4274 L: 4051 D: 17761

-----------

Then, a simplification test failed, trying to remove b and c)
LLR: -2.95 (-2.94,2.94) [-3.00,1.00]
Total: 6048 W: 1117 L: 1288 D: 3643

Another simplification test, was run to remove just (c)
Passed STC
LLR: 2.96 (-2.94,2.94) [-3.00,1.00]
Total: 28073 W: 5364 L: 5255 D: 17454

And LTC
LLR: 2.96 (-2.94,2.94) [-3.00,1.00]
Total: 34652 W: 5448 L: 5348 D: 23856

A parameter tweak test showed that changing b) for "on rank 3 and above"
does not work
LLR: -2.95 (-2.94,2.94) [0.00,4.00]
Total: 5233 W: 937 L: 1077 D: 3219

Finally, a small rewrite, and we have this version

Include squares occupied by some pawns in the MobilityArea which are
a) not blocked
b) on rank 4 and above

Bench: 8977899

Resolves #385

src/evaluate.cpp

index 5c1f7496d0b208da4984cb2302aaac9b0412ee48..37cdce997c8ec014484c5ab865d50c89751a4d62 100644 (file)
@@ -701,9 +701,18 @@ namespace {
     ei.attackedBy[WHITE][ALL_PIECES] |= ei.attackedBy[WHITE][KING];
     ei.attackedBy[BLACK][ALL_PIECES] |= ei.attackedBy[BLACK][KING];
 
-    // Do not include in mobility squares protected by enemy pawns or occupied by our pawns or king
-    Bitboard mobilityArea[] = { ~(ei.attackedBy[BLACK][PAWN] | pos.pieces(WHITE, PAWN, KING)),
-                                ~(ei.attackedBy[WHITE][PAWN] | pos.pieces(BLACK, PAWN, KING)) };
+    // Pawns blocked or on ranks 2 and 3. Will be excluded from the mobility area
+    Bitboard blockedPawns[] = {
+      pos.pieces(WHITE, PAWN) & (shift_bb<DELTA_S>(pos.pieces()) | Rank2BB | Rank3BB),
+      pos.pieces(BLACK, PAWN) & (shift_bb<DELTA_N>(pos.pieces()) | Rank7BB | Rank6BB)
+    };
+
+    // Do not include in mobility squares protected by enemy pawns, or occupied
+    // by our blocked pawns or king.
+    Bitboard mobilityArea[] = {
+      ~(ei.attackedBy[BLACK][PAWN] | blockedPawns[WHITE] | pos.king_square(WHITE)),
+      ~(ei.attackedBy[WHITE][PAWN] | blockedPawns[BLACK] | pos.king_square(BLACK))
+    };
 
     // Evaluate pieces and mobility
     score += evaluate_pieces<KNIGHT, WHITE, Trace>(pos, ei, mobility, mobilityArea);