From 74577e92c9bdeb427f186299b3f92be9088bc20a Mon Sep 17 00:00:00 2001 From: Fabian Fichter Date: Wed, 31 Oct 2018 13:55:12 +0100 Subject: [PATCH] Always evaluate space for drop games 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 | 9 +++++---- src/pawns.cpp | 12 ++++++++++++ 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/src/evaluate.cpp b/src/evaluate.cpp index 0235745..13d508a 100644 --- a/src/evaluate.cpp +++ b/src/evaluate.cpp @@ -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(Us) - 2 * pe->open_files(); diff --git a/src/pawns.cpp b/src/pawns.cpp index 924e9c6..6976f4c 100644 --- a/src/pawns.cpp +++ b/src/pawns.cpp @@ -146,6 +146,18 @@ namespace { score -= Doubled; } + const Square* pl_shogi = pos.squares(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; } -- 1.7.0.4