1
0
Fork 0
mirror of https://github.com/sockspls/badfish synced 2025-05-02 09:39:36 +00:00

Bonus for restricting opponent's piece moves

STC:
LLR: 2.96 (-2.94,2.94) [0.00,5.00]
Total: 51883 W: 11297 L: 10915 D: 29671
http://tests.stockfishchess.org/tests/view/5bf1e2ee0ebc595e0ae3cacd

LTC:
LLR: 2.96 (-2.94,2.94) [0.00,5.00]
Total: 15859 W: 2752 L: 2565 D: 10542
http://tests.stockfishchess.org/tests/view/5bf337980ebc5902bcecbf62

Notes:

(1) The bonus value has not been carefully tested, so it may be possible
to find slightly better values.

(2) Plan is to now try adding similar restriction for pawns. I wanted to
include that as part of this pull request, but I was advised to do it as
two separate pull requests. STC is currently running here, but may not add
enough value to pass green.

Bench: 3679086
This commit is contained in:
xoto10 2018-11-20 07:45:00 +01:00 committed by Stéphane Nicolet
parent cf5d683408
commit 3925750945
3 changed files with 13 additions and 5 deletions

View file

@ -162,6 +162,7 @@ namespace {
constexpr Score MinorBehindPawn = S( 16, 0);
constexpr Score Overload = S( 12, 6);
constexpr Score PawnlessFlank = S( 18, 94);
constexpr Score RestrictedPiece = S( 7, 6);
constexpr Score RookOnPawn = S( 10, 28);
constexpr Score SliderOnQueen = S( 49, 21);
constexpr Score ThreatByKing = S( 21, 84);
@ -508,7 +509,7 @@ namespace {
constexpr Direction Up = (Us == WHITE ? NORTH : SOUTH);
constexpr Bitboard TRank3BB = (Us == WHITE ? Rank3BB : Rank6BB);
Bitboard b, weak, defended, nonPawnEnemies, stronglyProtected, safe;
Bitboard b, weak, defended, nonPawnEnemies, stronglyProtected, safe, restricted;
Score score = SCORE_ZERO;
// Non-pawn enemies
@ -558,6 +559,13 @@ namespace {
score += Overload * popcount(b);
}
// Bonus for restricting their piece moves
restricted = attackedBy[Them][ALL_PIECES]
& ~attackedBy[Them][PAWN]
& ~attackedBy2[Them]
& attackedBy[Us][ALL_PIECES];
score += RestrictedPiece * popcount(restricted);
// Bonus for enemy unopposed weak pawns
if (pos.pieces(Us, ROOK, QUEEN))
score += WeakUnopposedPawn * pe->weak_unopposed(Them);