From: Ralph Stößer Date: Sat, 11 Jan 2014 02:00:17 +0000 (+0100) Subject: Ad-hoc shelter rule X-Git-Url: https://git.sesse.net/?p=stockfish;a=commitdiff_plain;h=402a7ae151cfc6090c8f6682763b0fb3729bf8ca Ad-hoc shelter rule This hacky rule allows to get an about right eval out of this position: r2qk2r/ppp2p2/2npbn2/2b1p3/2P1P1P1/2NB1PPp/PPNP3K/R1BQ1R2 b kq - 0 13 And, more importantly, passed both short TC: LLR: 2.95 (-2.94,2.94) [-1.50,4.50] Total: 6239 W: 1249 L: 1127 D: 3863 And long TC: LLR: 2.96 (-2.94,2.94) [0.00,6.00] Total: 38371 W: 6165 L: 5888 D: 26318 bench: 8183238 --- diff --git a/src/pawns.cpp b/src/pawns.cpp index 1e88652e..f767f6db 100644 --- a/src/pawns.cpp +++ b/src/pawns.cpp @@ -240,6 +240,7 @@ template Value Entry::shelter_storm(const Position& pos, Square ksq) { const Color Them = (Us == WHITE ? BLACK : WHITE); + static const Bitboard MiddleEdges = (FileABB | FileHBB) & (Rank2BB | Rank3BB); Value safety = MaxSafetyBonus; Bitboard b = pos.pieces(PAWN) & (in_front_bb(Us, rank_of(ksq)) | rank_bb(ksq)); @@ -252,11 +253,17 @@ Value Entry::shelter_storm(const Position& pos, Square ksq) { { b = ourPawns & file_bb(f); rkUs = b ? relative_rank(Us, backmost_sq(Us, b)) : RANK_1; - safety -= ShelterWeakness[rkUs]; b = theirPawns & file_bb(f); rkThem = b ? relative_rank(Us, frontmost_sq(Them, b)) : RANK_1; - safety -= StormDanger[rkUs == RANK_1 ? 0 : rkThem == rkUs + 1 ? 2 : 1][rkThem]; + + if ( (MiddleEdges & (f | rkThem)) + && file_of(ksq) == f + && relative_rank(Us, ksq) == rkThem - 1) + safety += Value(200); + else + safety -= ShelterWeakness[rkUs] + + StormDanger[rkUs == RANK_1 ? 0 : rkThem == rkUs + 1 ? 2 : 1][rkThem]; } return safety;