From 4a6d59c6c7caa8a9055197280ea7bdcd072feeaa Mon Sep 17 00:00:00 2001 From: Alain SAVARD Date: Thu, 30 Jul 2015 00:47:51 +0800 Subject: [PATCH] MobilityArea (simplified) 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 | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/evaluate.cpp b/src/evaluate.cpp index 5c1f7496..37cdce99 100644 --- a/src/evaluate.cpp +++ b/src/evaluate.cpp @@ -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(pos.pieces()) | Rank2BB | Rank3BB), + pos.pieces(BLACK, PAWN) & (shift_bb(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(pos, ei, mobility, mobilityArea); -- 2.39.2