From: Fabian Fichter Date: Sun, 19 Apr 2020 06:55:38 +0000 (+0200) Subject: Consider double blocked squares in CTF evaluation X-Git-Url: http://winboard.nl/cgi-bin?a=commitdiff_plain;h=225e2d91459b2308c14ecb278f4272c4ce8ea8a6;p=fairystockfish.git Consider double blocked squares in CTF evaluation racingkings STC LLR: 2.97 (-2.94,2.94) [0.00,10.00] Total: 1004 W: 387 L: 296 D: 321 http://www.variantfishtest.org:6543/tests/view/5e9b4ecf6e23db36d55f29cc racingkings LTC LLR: 2.95 (-2.94,2.94) [0.00,10.00] Total: 1647 W: 504 L: 414 D: 729 http://www.variantfishtest.org:6543/tests/view/5e9b572b6e23db36d55f29d2 kingofthehill STC LLR: 2.96 (-2.94,2.94) [0.00,10.00] Total: 1849 W: 884 L: 765 D: 200 http://www.variantfishtest.org:6543/tests/view/5e9b4eb86e23db36d55f29c9 kingofthehill LTC LLR: 2.96 (-2.94,2.94) [0.00,10.00] Total: 1252 W: 602 L: 493 D: 157 http://www.variantfishtest.org:6543/tests/view/5e9b57236e23db36d55f29d0 --- diff --git a/src/evaluate.cpp b/src/evaluate.cpp index 5f9bfce..11870c5 100644 --- a/src/evaluate.cpp +++ b/src/evaluate.cpp @@ -906,26 +906,31 @@ namespace { if (pos.capture_the_flag(Us)) { PieceType ptCtf = pos.capture_the_flag_piece(); - Bitboard ctfPieces = pos.pieces(Us, pos.capture_the_flag_piece()); + Bitboard ctfPieces = pos.pieces(Us, ptCtf); Bitboard ctfTargets = pos.capture_the_flag(Us) & pos.board_bb(); Bitboard onHold = 0; + Bitboard onHold2 = 0; Bitboard processed = 0; // Traverse all paths of the CTF pieces to the CTF targets. // Put squares that are attacked or occupied on hold for one iteration. - for (int dist = 0; (ctfPieces || onHold) && (ctfTargets & ~processed); dist++) + for (int dist = 0; (ctfPieces || onHold || onHold2) && (ctfTargets & ~processed); dist++) { - score += make_score(2500, 2500) * popcount(ctfTargets & ctfPieces) / (1 + dist * dist); + int wins = popcount(ctfTargets & ctfPieces); + if (wins) + score += make_score(4000, 4000) * wins / (wins + dist * dist); Bitboard current = ctfPieces; processed |= ctfPieces; ctfPieces = onHold & ~processed; - onHold = 0; + onHold = onHold2 & ~processed; + onHold2 = 0; while (current) { Square s = pop_lsb(¤t); Bitboard attacks = ( (PseudoAttacks[Us][ptCtf][s] & pos.pieces()) | (PseudoMoves[Us][ptCtf][s] & ~pos.pieces())) & ~processed & pos.board_bb(); ctfPieces |= attacks & ~pos.pieces(Us) & ~attackedBy[Them][ALL_PIECES]; - onHold |= attacks; + onHold |= attacks & ~((pos.pieces(Us) & attackedBy[Them][ALL_PIECES]) | attackedBy2[Them]); + onHold2 |= attacks; } } }