From: Fabian Fichter Date: Sat, 3 Nov 2018 13:11:03 +0000 (+0100) Subject: Add connected bonus for shogi pawns X-Git-Url: http://winboard.nl/cgi-bin?a=commitdiff_plain;h=4554760b07ba4c58a320205be08d31f6abe6a608;p=fairystockfish.git 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 --- 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;