From 4554760b07ba4c58a320205be08d31f6abe6a608 Mon Sep 17 00:00:00 2001 From: Fabian Fichter Date: Sat, 3 Nov 2018 14:11:03 +0100 Subject: [PATCH] Add connected bonus for shogi pawns shogi ELO: 26.11 +-33.2 (95%) LOS: 93.9% Total: 400 W: 204 L: 174 D: 22 euroshogi ELO: 15.65 +-33.7 (95%) LOS: 81.9% Total: 400 W: 204 L: 186 D: 10 minishogi ELO: 0.87 +-32.8 (95%) LOS: 52.1% Total: 400 W: 185 L: 184 D: 31 --- src/pawns.cpp | 12 +++++++++++- 1 files changed, 11 insertions(+), 1 deletions(-) diff --git a/src/pawns.cpp b/src/pawns.cpp index 6976f4c..805c816 100644 --- a/src/pawns.cpp +++ b/src/pawns.cpp @@ -146,7 +146,10 @@ namespace { score -= Doubled; } - const Square* pl_shogi = pos.squares(Us); + const Square* pl_shogi = pos.squares(Us); + + ourPawns = pos.pieces(Us, SHOGI_PAWN); + theirPawns = pos.pieces(Them, SHOGI_PAWN); // Loop through all shogi pawns of the current color and score each one while ((s = *pl_shogi++) != SQ_NONE) @@ -156,6 +159,13 @@ namespace { File f = file_of(s); e->semiopenFiles[Us] &= ~(1 << f); + + opposed = theirPawns & forward_file_bb(Us, s); + neighbours = ourPawns & adjacent_files_bb(f); + phalanx = neighbours & rank_bb(s); + + if (phalanx) + score += Connected[opposed][bool(phalanx)][0][relative_rank(Us, s, pos.max_rank())] / 2; } return score; -- 1.7.0.4