From: Alain SAVARD Date: Thu, 26 Sep 2019 03:23:07 +0000 (-0400) Subject: Simplify RookOnPawn X-Git-Url: https://git.sesse.net/?p=stockfish;a=commitdiff_plain;h=28dcd700a9dd3c776b66b2032cf0cf6df88b671d Simplify RookOnPawn Remove the RookOnPawn logic (for rook on rank 5 and above aligning with pawns on same row or file) which was overlapping with a few other parameters. Inspired by @31m059 interesting result hinting that a direct attack on pawns instead of PseudoAttacks might work. http://tests.stockfishchess.org/tests/view/5d89a7c70ebc595091801b8d After a few attempts by me and @31m059, and some long STC greens but red LTC, as a proof of concept I first tried a local SPSA at VSTC trying to tune related rook psqt rows, and mainly some rook related stuff in evaluate.cpp. Result was STC green, but still red LTC, Finally a 100M fishtest SPSA at LTC proved successful both at STC and LTC. All this was possible with the awesome fishtest contributors. At some point, I had 850 workers on the last test ! Run as a simplification STC http://tests.stockfishchess.org/tests/view/5d8d68f40ebc590f3beaf171 LLR: 2.96 (-2.94,2.94) [-3.00,1.00] Total: 7399 W: 1693 L: 1543 D: 4163 LTC http://tests.stockfishchess.org/tests/view/5d8d70270ebc590f3beaf63c LLR: 2.95 (-2.94,2.94) [-3.00,1.00] Total: 41617 W: 6981 L: 6894 D: 27742 Closes https://github.com/official-stockfish/Stockfish/pull/2329 bench: 4037914 --- diff --git a/src/evaluate.cpp b/src/evaluate.cpp index f37820af..880aa137 100644 --- a/src/evaluate.cpp +++ b/src/evaluate.cpp @@ -78,7 +78,7 @@ namespace { constexpr Value SpaceThreshold = Value(12222); // KingAttackWeights[PieceType] contains king attack weights by piece type - constexpr int KingAttackWeights[PIECE_TYPE_NB] = { 0, 0, 77, 55, 44, 10 }; + constexpr int KingAttackWeights[PIECE_TYPE_NB] = { 0, 0, 81, 52, 44, 10 }; // Penalties for enemy's safe checks constexpr int QueenSafeCheck = 780; @@ -108,17 +108,17 @@ namespace { // RookOnFile[semiopen/open] contains bonuses for each rook when there is // no (friendly) pawn on the rook file. - constexpr Score RookOnFile[] = { S(18, 7), S(44, 20) }; + constexpr Score RookOnFile[] = { S(21, 4), S(47, 25) }; // ThreatByMinor/ByRook[attacked PieceType] contains bonuses according to // which piece type attacks which one. Attacks on lesser pieces which are // pawn-defended are not considered. constexpr Score ThreatByMinor[PIECE_TYPE_NB] = { - S(0, 0), S(0, 31), S(39, 42), S(57, 44), S(68, 112), S(62, 120) + S(0, 0), S(6, 28), S(39, 42), S(57, 44), S(68, 112), S(62, 120) }; constexpr Score ThreatByRook[PIECE_TYPE_NB] = { - S(0, 0), S(0, 24), S(38, 71), S(38, 61), S(0, 38), S(51, 38) + S(0, 0), S(3, 44), S(38, 71), S(38, 61), S(0, 38), S(51, 38) }; // PassedRank[Rank] contains a bonus according to the rank of a passed pawn @@ -139,8 +139,7 @@ namespace { constexpr Score PassedFile = S( 11, 8); constexpr Score PawnlessFlank = S( 17, 95); constexpr Score RestrictedPiece = S( 7, 7); - constexpr Score RookOnPawn = S( 10, 32); - constexpr Score RookOnQueenFile = S( 11, 4); + constexpr Score RookOnQueenFile = S( 7, 6); constexpr Score SliderOnQueen = S( 59, 18); constexpr Score ThreatByKing = S( 24, 89); constexpr Score ThreatByPawnPush = S( 48, 39); @@ -343,10 +342,6 @@ namespace { if (Pt == ROOK) { - // Bonus for aligning rook with enemy pawns on the same rank/file - if (relative_rank(Us, s) >= RANK_5) - score += RookOnPawn * popcount(pos.pieces(Them, PAWN) & PseudoAttacks[ROOK][s]); - // Bonus for rook on the same file as a queen if (file_bb(s) & pos.pieces(QUEEN)) score += RookOnQueenFile; diff --git a/src/psqt.cpp b/src/psqt.cpp index 83d11cf1..655eb993 100644 --- a/src/psqt.cpp +++ b/src/psqt.cpp @@ -59,14 +59,14 @@ constexpr Score Bonus[][RANK_NB][int(FILE_NB) / 2] = { { S(-48,-51), S( -3,-40), S(-12,-39), S(-25,-20) } }, { // Rook - { S(-24, -2), S(-13,-6), S(-7, -3), S( 2,-2) }, - { S(-18,-10), S(-10,-7), S(-5, 1), S( 9, 0) }, - { S(-21, 10), S( -7,-4), S( 3, 2), S( 7,-2) }, - { S(-13, -5), S( -5, 2), S(-4, -8), S(-6, 8) }, - { S(-24, -8), S(-12, 5), S(-1, 4), S( 6,-9) }, - { S(-24, 3), S( -4,-2), S( 4,-10), S(10, 7) }, - { S( -8, 1), S( 6, 2), S(10, 17), S(12,-8) }, - { S(-22, 12), S(-24,-6), S(-6, 13), S( 4, 7) } + { S(-31, -9), S(-20,-13), S(-14,-10), S(-5, -9) }, + { S(-21,-12), S(-13, -9), S( -8, -1), S( 6, -2) }, + { S(-25, 6), S(-11, -8), S( -1, -2), S( 3, -6) }, + { S(-13, -6), S( -5, 1), S( -4, -9), S(-6, 7) }, + { S(-27, -5), S(-15, 8), S( -4, 7), S( 3, -6) }, + { S(-22, 6), S( -2, 1), S( 6, -7), S(12, 10) }, + { S( -2, 4), S( 12, 5), S( 16, 20), S(18, -5) }, + { S(-17, 18), S(-19, 0), S( -1, 19), S( 9, 13) } }, { // Queen { S( 3,-69), S(-5,-57), S(-5,-47), S( 4,-26) },