]> git.sesse.net Git - stockfish/commitdiff
Retire KingExposed[] array
authorArjun Temurnikar <arjuntemurnikano@gmail.com>
Mon, 30 Dec 2013 07:13:39 +0000 (23:13 -0800)
committerMarco Costalba <mcostalba@gmail.com>
Tue, 31 Dec 2013 11:05:22 +0000 (12:05 +0100)
And merge its values into KPSQT table.

Passed blazingly fast both short TC:
LLR: 2.95 (-2.94,2.94) [-1.50,4.50]
Total: 5348 W: 1091 L: 971 D: 3286

And long TC:
LLR: 2.96 (-2.94,2.94) [0.00,6.00]
Total: 3029 W: 530 L: 415 D: 2084

bench: 8702197

src/evaluate.cpp
src/psqtab.h

index d3190bfcbe91a3b3a2185ea58e1cc70dac58dda3..6acaaad0e0eaf1cc30e2222032772f4ecf553e36 100644 (file)
@@ -207,19 +207,6 @@ namespace {
   const int BishopCheck       = 2;
   const int KnightCheck       = 3;
 
-  // KingExposed[Square] contains penalties based on the position of the
-  // defending king, indexed by king's square (from white's point of view).
-  const int KingExposed[] = {
-     2,  0,  2,  5,  5,  2,  0,  2,
-     2,  2,  4,  8,  8,  4,  2,  2,
-     7, 10, 12, 12, 12, 12, 10,  7,
-    15, 15, 15, 15, 15, 15, 15, 15,
-    15, 15, 15, 15, 15, 15, 15, 15,
-    15, 15, 15, 15, 15, 15, 15, 15,
-    15, 15, 15, 15, 15, 15, 15, 15,
-    15, 15, 15, 15, 15, 15, 15, 15
-  };
-
   // KingDanger[Color][attackUnits] contains the actual king danger weighted
   // scores, indexed by color and by a calculated integer number.
   Score KingDanger[COLOR_NB][128];
@@ -653,11 +640,10 @@ Value do_evaluate(const Position& pos) {
         // Initialize the 'attackUnits' variable, which is used later on as an
         // index to the KingDanger[] array. The initial value is based on the
         // number and types of the enemy's attacking pieces, the number of
-        // attacked and undefended squares around our king, the square of the
-        // king, and the quality of the pawn shelter.
+        // attacked and undefended squares around our king and the quality of
+        // the pawn shelter (current 'score' value).
         attackUnits =  std::min(20, (ei.kingAttackersCount[Them] * ei.kingAttackersWeight[Them]) / 2)
                      + 3 * (ei.kingAdjacentZoneAttacksCount[Them] + popcount<Max15>(undefended))
-                     + KingExposed[relative_square(Us, ksq)]
                      - mg_value(score) / 32;
 
         // Analyse the enemy's safe queen contact checks. Firstly, find the
index 1859428074a86d4d3a63954e38c48a16ae833ed9..42bd9c9bff6e98a3e2992a32b51c48be78461709 100644 (file)
@@ -82,14 +82,14 @@ static const Score PSQT[][SQUARE_NB] = {
    S(8,-80), S(8,-54), S(8,-42), S(8,-30), S(8,-30), S(8,-42), S(8,-54), S(8,-80)
   },
   { // King
-   S(287, 18), S(311, 77), S(262,105), S(214,135), S(214,135), S(262,105), S(311, 77), S(287, 18),
-   S(262, 77), S(287,135), S(238,165), S(190,193), S(190,193), S(238,165), S(287,135), S(262, 77),
-   S(214,105), S(238,165), S(190,193), S(142,222), S(142,222), S(190,193), S(238,165), S(214,105),
-   S(190,135), S(214,193), S(167,222), S(119,251), S(119,251), S(167,222), S(214,193), S(190,135),
-   S(167,135), S(190,193), S(142,222), S( 94,251), S( 94,251), S(142,222), S(190,193), S(167,135),
-   S(142,105), S(167,165), S(119,193), S( 69,222), S( 69,222), S(119,193), S(167,165), S(142,105),
-   S(119, 77), S(142,135), S( 94,165), S( 46,193), S( 46,193), S( 94,165), S(142,135), S(119, 77),
-   S(94,  18), S(119, 77), S( 69,105), S( 21,135), S( 21,135), S( 69,105), S(119, 77), S( 94, 18)
+   S(302, 18), S(326, 77), S(277,105), S(229,135), S(229,135), S(277,105), S(326, 77), S(302, 18),
+   S(277, 77), S(302,135), S(253,165), S(205,193), S(205,193), S(253,165), S(302,135), S(277, 77),
+   S(229,105), S(253,165), S(205,193), S(157,222), S(157,222), S(205,193), S(253,165), S(229,105),
+   S(205,135), S(229,193), S(182,222), S(134,251), S(134,251), S(182,222), S(229,193), S(205,135),
+   S(182,135), S(205,193), S(157,222), S(109,251), S(109,251), S(157,222), S(205,193), S(182,135),
+   S(149,105), S(177,165), S(131,193), S( 81,222), S( 81,222), S(131,193), S(177,165), S(149,105),
+   S(121, 77), S(144,135), S( 98,165), S( 54,193), S( 54,193), S( 98,165), S(144,135), S(121, 77),
+   S(96,  18), S(119, 77), S( 71,105), S( 26,135), S( 26,135), S( 71,105), S(119, 77), S( 96, 18)
   }
 };