]> git.sesse.net Git - stockfish/commitdiff
Introduce attacks on space area
authorVizvezdenec <Vizvezdenec@gmail.com>
Thu, 27 Jun 2019 07:21:50 +0000 (09:21 +0200)
committerStéphane Nicolet <cassio@free.fr>
Thu, 27 Jun 2019 07:26:08 +0000 (09:26 +0200)
This patch introduces a small malus for every square in our space mask
that is attacked by enemy. The value of the malus is completely arbitrary
and is something we can tweak, also maybe we can gain some elo with tweaking
space threshold after this addition.

Passed STC
http://tests.stockfishchess.org/tests/view/5d10ce590ebc5925cf0af30b
LLR: 2.96 (-2.94,2.94) [0.50,4.50]
Total: 7082 W: 1648 L: 1449 D: 3985

Passed LTC
http://tests.stockfishchess.org/tests/view/5d10d2d80ebc5925cf0af3fd
LLR: 2.96 (-2.94,2.94) [0.00,3.50]
Total: 79494 W: 13727 L: 13324 D: 52443

Closes https://github.com/official-stockfish/Stockfish/pull/2207

bench 3516460

src/evaluate.cpp

index da76de100f00fcd8fb6326506f95356cb204cf86..f2e822d0b6b9f1dd65e70ff911880516bf05753c 100644 (file)
@@ -133,6 +133,7 @@ namespace {
   };
 
   // Assorted bonuses and penalties
   };
 
   // Assorted bonuses and penalties
+  constexpr Score AttacksOnSpaceArea = S(  4,  0);
   constexpr Score BishopPawns        = S(  3,  7);
   constexpr Score CorneredBishop     = S( 50, 50);
   constexpr Score FlankAttacks       = S(  8,  0);
   constexpr Score BishopPawns        = S(  3,  7);
   constexpr Score CorneredBishop     = S( 50, 50);
   constexpr Score FlankAttacks       = S(  8,  0);
@@ -711,6 +712,8 @@ namespace {
     int weight = pos.count<ALL_PIECES>(Us) - 1;
     Score score = make_score(bonus * weight * weight / 16, 0);
 
     int weight = pos.count<ALL_PIECES>(Us) - 1;
     Score score = make_score(bonus * weight * weight / 16, 0);
 
+    score -= AttacksOnSpaceArea * popcount(attackedBy[Them][ALL_PIECES] & behind & safe);
+
     if (T)
         Trace::add(SPACE, Us, score);
 
     if (T)
         Trace::add(SPACE, Us, score);