Always evaluate space for drop games
authorFabian Fichter <ianfab@users.noreply.github.com>
Wed, 31 Oct 2018 12:55:12 +0000 (13:55 +0100)
committerFabian Fichter <ianfab@users.noreply.github.com>
Fri, 2 Nov 2018 16:29:07 +0000 (17:29 +0100)
Furthermore, consider shogi pawns in space evaluation
and fix a bug for the large board version.

crazyhouse STC (failed)
LLR: -2.97 (-2.94,2.94) [-10.00,5.00]
Total: 3008 W: 1430 L: 1519 D: 59
http://35.161.250.236:6543/tests/view/5bd9a7b96e23db7639060c3e

shogi
ELO: 36.62 +-33.5 (95%) LOS: 98.5%
Total: 400 W: 212 L: 170 D: 18

euroshogi
ELO: 34.86 +-33.4 (95%) LOS: 98.1%
Total: 400 W: 210 L: 170 D: 20

minishogi
ELO: 9.38 +-16.9 (95%) LOS: 86.2%
Total: 1000 W: 322 L: 295 D: 383

chess (large-board version)
ELO: 9.56 +-27.6 (95%) LOS: 75.1%
Total: 400 W: 137 L: 126 D: 137

src/evaluate.cpp
src/pawns.cpp

index 0235745..13d508a 100644 (file)
@@ -783,7 +783,7 @@ namespace {
       Us == WHITE ? CenterFiles & (Rank2BB | Rank3BB | Rank4BB)
                   : CenterFiles & (Rank7BB | Rank6BB | Rank5BB);
 
-    if (pos.non_pawn_material() < SpaceThreshold)
+    if (pos.non_pawn_material() < SpaceThreshold && !pos.captures_to_hand())
         return SCORE_ZERO;
 
     // Find the available squares for our pieces inside the area defined by SpaceMask
@@ -792,9 +792,10 @@ namespace {
                    & ~attackedBy[Them][PAWN];
 
     // Find all squares which are at most three squares behind some friendly pawn
-    Bitboard behind = pos.pieces(Us, PAWN);
-    behind |= (Us == WHITE ? behind >>  8 : behind <<  8);
-    behind |= (Us == WHITE ? behind >> 16 : behind << 16);
+    Bitboard behind = pos.pieces(Us, PAWN, SHOGI_PAWN);
+    behind |= (Us == WHITE ? behind >> NORTH : behind << NORTH);
+    behind |= (Us == WHITE ? behind >> (2 * NORTH) : behind << (2 * NORTH));
+
 
     int bonus = popcount(safe) + popcount(behind & safe);
     int weight = pos.count<ALL_PIECES>(Us) - 2 * pe->open_files();
index 924e9c6..6976f4c 100644 (file)
@@ -146,6 +146,18 @@ namespace {
             score -= Doubled;
     }
 
+    const Square* pl_shogi   = pos.squares<SHOGI_PAWN>(Us);
+
+    // Loop through all shogi pawns of the current color and score each one
+    while ((s = *pl_shogi++) != SQ_NONE)
+    {
+        assert(pos.piece_on(s) == make_piece(Us, SHOGI_PAWN));
+
+        File f = file_of(s);
+
+        e->semiopenFiles[Us] &= ~(1 << f);
+    }
+
     return score;
   }