Consider all major pieces in king safety
authorFabian Fichter <ianfab@users.noreply.github.com>
Tue, 6 Aug 2019 21:10:40 +0000 (23:10 +0200)
committerFabian Fichter <ianfab@users.noreply.github.com>
Fri, 9 Aug 2019 16:20:53 +0000 (18:20 +0200)
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
src/position.h

index c6827b1..573b7f9 100644 (file)
@@ -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<QUEEN>(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
index fb396ca..cef06f7 100644 (file)
@@ -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)];
 }