From b9746ce4075405d39a54bf1c6ebafd4d673d4533 Mon Sep 17 00:00:00 2001 From: ianfab Date: Thu, 9 Aug 2018 22:14:38 +0200 Subject: [PATCH] Threat evaluation for variants with mandatory captures giveaway STC LLR: 2.96 (-2.94,2.94) [0.00,10.00] Total: 704 W: 401 L: 290 D: 13 http://35.161.250.236:6543/tests/view/5b6ca2256e23db0fbab0dc69 losers STC LLR: 2.95 (-2.94,2.94) [0.00,10.00] Total: 288 W: 187 L: 86 D: 15 http://35.161.250.236:6543/tests/view/5b6ca24c6e23db0fbab0dc6c --- src/evaluate.cpp | 17 +++++++++++++++++ 1 files changed, 17 insertions(+), 0 deletions(-) diff --git a/src/evaluate.cpp b/src/evaluate.cpp index 9ce95de..a9c8269 100644 --- a/src/evaluate.cpp +++ b/src/evaluate.cpp @@ -535,6 +535,23 @@ namespace { Bitboard b, weak, defended, nonPawnEnemies, stronglyProtected, safeThreats; Score score = SCORE_ZERO; + // Bonuses for variants with mandatory captures + if (pos.must_capture()) + { + // Penalties for possible captures + score -= make_score(100, 100) * popcount(attackedBy[Us][ALL_PIECES] & pos.pieces(Them)); + + // Bonus if we threaten to force captures + Bitboard moves = 0, piecebb = pos.pieces(Us); + while (piecebb) + { + Square s = pop_lsb(&piecebb); + if (type_of(pos.piece_on(s)) != KING) + moves |= pos.moves_from(Us, type_of(pos.piece_on(s)), s); + } + score += make_score(200, 200) * popcount(attackedBy[Them][ALL_PIECES] & moves & ~pos.pieces()); + } + // Non-pawn enemies nonPawnEnemies = pos.pieces(Them) ^ pos.pieces(Them, PAWN); -- 1.7.0.4