From d887d6289c9ec3236081d628d6bffcdf6a7c26d5 Mon Sep 17 00:00:00 2001 From: Fabian Fichter Date: Sat, 3 Nov 2018 19:35:20 +0100 Subject: [PATCH] Consider shogi pawns in threat evaluation shogi ELO: 50.74 +-34.0 (95%) LOS: 99.9% Total: 400 W: 224 L: 166 D: 10 euroshogi ELO: 14.77 +-33.7 (95%) LOS: 80.6% Total: 400 W: 203 L: 186 D: 11 minishogi ELO: -2.61 +-33.1 (95%) LOS: 43.9% Total: 400 W: 187 L: 190 D: 23 --- src/evaluate.cpp | 13 +++++++------ 1 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/evaluate.cpp b/src/evaluate.cpp index 8ef9136..2a598b6 100644 --- a/src/evaluate.cpp +++ b/src/evaluate.cpp @@ -264,7 +264,7 @@ namespace { // Squares occupied by those pawns, by our king or queen, or controlled by enemy pawns // are excluded from the mobility area. - mobilityArea[Us] = ~(b | pos.pieces(Us, KING, QUEEN) | pe->pawn_attacks(Them)); + mobilityArea[Us] = ~(b | pos.pieces(Us, KING, QUEEN) | pe->pawn_attacks(Them) | shift(pos.pieces(Them, SHOGI_PAWN))); // Initialise attackedBy bitboards for kings and pawns attackedBy[Us][KING] = pos.count(Us) ? pos.attacks_from(Us, pos.square(Us)) : 0; @@ -565,7 +565,7 @@ namespace { } // Non-pawn enemies - nonPawnEnemies = pos.pieces(Them) ^ pos.pieces(Them, PAWN); + nonPawnEnemies = pos.pieces(Them) ^ pos.pieces(Them, PAWN, SHOGI_PAWN); // Squares strongly protected by the enemy, either because they defend the // square with a pawn, or because they defend the square twice and we don't. @@ -586,7 +586,7 @@ namespace { { Square s = pop_lsb(&b); score += ThreatByMinor[type_of(pos.piece_on(s))]; - if (type_of(pos.piece_on(s)) != PAWN) + if (type_of(pos.piece_on(s)) != PAWN && type_of(pos.piece_on(s)) != SHOGI_PAWN) score += ThreatByRank * (int)relative_rank(Them, s, pos.max_rank()); } @@ -595,7 +595,7 @@ namespace { { Square s = pop_lsb(&b); score += ThreatByRook[type_of(pos.piece_on(s))]; - if (type_of(pos.piece_on(s)) != PAWN) + if (type_of(pos.piece_on(s)) != PAWN && type_of(pos.piece_on(s)) != SHOGI_PAWN) score += ThreatByRank * (int)relative_rank(Them, s, pos.max_rank()); } @@ -788,8 +788,9 @@ namespace { // Find the available squares for our pieces inside the area defined by SpaceMask Bitboard safe = SpaceMask - & ~pos.pieces(Us, PAWN) - & ~attackedBy[Them][PAWN]; + & ~pos.pieces(Us, PAWN, SHOGI_PAWN) + & ~attackedBy[Them][PAWN] + & ~attackedBy[Them][SHOGI_PAWN]; // Find all squares which are at most three squares behind some friendly pawn Bitboard behind = pos.pieces(Us, PAWN, SHOGI_PAWN); -- 1.7.0.4