From 251d37c4895f29f504c52f05f28be2e9e5b04801 Mon Sep 17 00:00:00 2001 From: Fabian Fichter Date: Tue, 6 Aug 2019 23:10:40 +0200 Subject: [PATCH] Consider all major pieces in king safety seirawan STC LLR: 2.97 (-2.94,2.94) [0.00,10.00] Total: 574 W: 247 L: 160 D: 167 http://35.161.250.236:6543/tests/view/5d49ed306e23db34f4206d5b seirawan LTC LLR: 2.95 (-2.94,2.94) [0.00,10.00] Total: 992 W: 396 L: 304 D: 292 http://35.161.250.236:6543/tests/view/5d4a6ace6e23db34f4206d5e capablanca STC LLR: 2.96 (-2.94,2.94) [0.00,10.00] Total: 458 W: 220 L: 131 D: 107 http://35.161.250.236:6543/tests/view/5d4d4a8c6e23db34f4206d62 capablanca LTC LLR: 2.95 (-2.94,2.94) [0.00,10.00] Total: 362 W: 191 L: 101 D: 70 http://35.161.250.236:6543/tests/view/5d4d6faf6e23db34f4206d67 --- src/evaluate.cpp | 2 +- src/position.h | 5 +++++ 2 files changed, 6 insertions(+), 1 deletions(-) diff --git a/src/evaluate.cpp b/src/evaluate.cpp index c6827b1..573b7f9 100644 --- a/src/evaluate.cpp +++ b/src/evaluate.cpp @@ -549,7 +549,7 @@ namespace { - 35 * bool(attackedBy[Us][BISHOP] & attackedBy[Us][KING]) - 10 * bool(attackedBy2[Us] & attackedBy[Us][KING]) * pos.captures_to_hand() + 150 * popcount(pos.blockers_for_king(Us) | unsafeChecks) - - 873 * !(pos.count(Them) || pos.captures_to_hand()) / (1 + !!pos.max_check_count()) + - 873 * !(pos.major_pieces(Them) || pos.captures_to_hand()) / (1 + !!pos.max_check_count()) - 6 * mg_value(score) / 8 + mg_value(mobility[Them] - mobility[Us]) + 5 * kingFlankAttacks * kingFlankAttacks / 16 diff --git a/src/position.h b/src/position.h index fb396ca..cef06f7 100644 --- a/src/position.h +++ b/src/position.h @@ -157,6 +157,7 @@ public: Bitboard pieces(Color c) const; Bitboard pieces(Color c, PieceType pt) const; Bitboard pieces(Color c, PieceType pt1, PieceType pt2) const; + Bitboard major_pieces(Color c) const; Piece piece_on(Square s) const; Piece unpromoted_piece_on(Square s) const; Square ep_square() const; @@ -663,6 +664,10 @@ inline Bitboard Position::pieces(Color c, PieceType pt1, PieceType pt2) const { return byColorBB[c] & (byTypeBB[pt1] | byTypeBB[pt2]); } +inline Bitboard Position::major_pieces(Color c) const { + return byColorBB[c] & (byTypeBB[QUEEN] | byTypeBB[AIWOK] | byTypeBB[ARCHBISHOP] | byTypeBB[CHANCELLOR] | byTypeBB[AMAZON]); +} + inline int Position::count(Color c, PieceType pt) const { return pieceCount[make_piece(c, pt)]; } -- 1.7.0.4