From bf01bd07551dd4e2d68d82b305cc5d89a4c23bb0 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Ste=CC=81phane=20Nicolet?= Date: Sun, 13 May 2018 07:20:39 +0200 Subject: [PATCH] Tweak kingAttackersCount and KingAttackWeights Use the whole kingRing for pawn attackers instead of only the squares directly around the king. This tends to give quite a lot more kingAttackersCount, so to compensate and to avoid raising the king danger too fast we lower the values in the KingAttackWeights array a little bit. STC: LLR: 2.95 (-2.94,2.94) [0.00,4.00] Total: 51892 W: 10723 L: 10369 D: 30800 http://tests.stockfishchess.org/tests/view/5af6d4dd0ebc5968e652428e LTC: LLR: 2.96 (-2.94,2.94) [0.00,4.00] Total: 24536 W: 3737 L: 3515 D: 17284 http://tests.stockfishchess.org/tests/view/5af709890ebc5968e65242ac Credits to user @xoroshiro for the idea of using the kingRing for pawn attackers. How to continue? It seems that the KingAttackWeights[] array stores values which are quite Elo-sensitive, yet they have not been tuned with SPSA recently. There might be easy Elo points to get there. Closes https://github.com/official-stockfish/Stockfish/pull/1597 Bench: 5282815 --- AUTHORS | 1 + src/evaluate.cpp | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/AUTHORS b/AUTHORS index 305d8b31..b396db81 100644 --- a/AUTHORS +++ b/AUTHORS @@ -118,3 +118,4 @@ Tom Vijlbrief (tomtor) Torsten Franz (torfranz) Uri Blass (uriblass) Vince Negri +xoroshiro diff --git a/src/evaluate.cpp b/src/evaluate.cpp index 1d2c5f8e..01b5aa5b 100644 --- a/src/evaluate.cpp +++ b/src/evaluate.cpp @@ -89,7 +89,7 @@ namespace { constexpr Value SpaceThreshold = Value(12222); // KingAttackWeights[PieceType] contains king attack weights by piece type - constexpr int KingAttackWeights[PIECE_TYPE_NB] = { 0, 0, 78, 56, 45, 11 }; + constexpr int KingAttackWeights[PIECE_TYPE_NB] = { 0, 0, 77, 55, 44, 10 }; // Penalties for enemy's safe checks constexpr int QueenSafeCheck = 780; @@ -281,7 +281,7 @@ namespace { else if (file_of(pos.square(Us)) == FILE_A) kingRing[Us] |= shift(kingRing[Us]); - kingAttackersCount[Them] = popcount(attackedBy[Us][KING] & pe->pawn_attacks(Them)); + kingAttackersCount[Them] = popcount(kingRing[Us] & pe->pawn_attacks(Them)); kingAttacksCount[Them] = kingAttackersWeight[Them] = 0; } else -- 2.39.2