if (pos.seirawan_gating() && !pos.piece_drops() && pos.count_in_hand(Us, ALL_PIECES) > popcount(pos.gates(Us)))
score -= make_score(200, 900) / pos.count_in_hand(Us, ALL_PIECES) * (pos.count_in_hand(Us, ALL_PIECES) - popcount(pos.gates(Us)));
- if (pt == SHOGI_PAWN && !pos.shogi_doubled_pawn())
- score -= make_score(50, 20) * std::max(pos.count_with_hand(Us, SHOGI_PAWN) - pos.max_file() - 1, 0);
+ // Redundant pieces that can not be doubled per file (e.g., shogi pawns)
+ if (pt == pos.drop_no_doubled())
+ score -= make_score(50, 20) * std::max(pos.count_with_hand(Us, pt) - pos.max_file() - 1, 0);
}
return score;
char token;
size_t idx;
std::stringstream ss(it->second);
- if (ss >> token && (idx = pieceToChar.find(toupper(token))) != std::string::npos)
+ if (ss >> token && (idx = token == '-' ? 0 : pieceToChar.find(toupper(token))) != std::string::npos)
target = PieceType(idx);
else if (DoCheck)
std::cerr << key << " - Invalid piece type: " << token << std::endl;
parse_attribute("sittuyinRookDrop", v->sittuyinRookDrop);
parse_attribute("dropOppositeColoredBishop", v->dropOppositeColoredBishop);
parse_attribute("dropPromoted", v->dropPromoted);
- parse_attribute("shogiDoubledPawn", v->shogiDoubledPawn);
+ parse_attribute("dropNoDoubled", v->dropNoDoubled, v->pieceToChar);
parse_attribute("immobilityIllegal", v->immobilityIllegal);
parse_attribute("gating", v->gating);
parse_attribute("arrowGating", v->arrowGating);
bool sittuyin_rook_drop() const;
bool drop_opposite_colored_bishop() const;
bool drop_promoted() const;
- bool shogi_doubled_pawn() const;
+ PieceType drop_no_doubled() const;
bool immobility_illegal() const;
bool gating() const;
bool arrow_gating() const;
b &= ~rank_bb(relative_rank(c, RANK_1, max_rank()));
}
// Doubled shogi pawns
- if (pt == SHOGI_PAWN && !shogi_doubled_pawn())
+ if (pt == drop_no_doubled())
for (File f = FILE_A; f <= max_file(); ++f)
if (file_bb(f) & pieces(c, pt))
b &= ~file_bb(f);
return var->dropPromoted;
}
-inline bool Position::shogi_doubled_pawn() const {
+inline PieceType Position::drop_no_doubled() const {
assert(var != nullptr);
- return var->shogiDoubledPawn;
+ return var->dropNoDoubled;
}
inline bool Position::immobility_illegal() const {
{
if (pt == PAWN && !v->firstRankPawnDrops)
suffix += "j";
- else if (pt == SHOGI_PAWN && !v->shogiDoubledPawn)
+ else if (pt == v->dropNoDoubled)
suffix += "f";
else if (pt == BISHOP && v->dropOppositeColoredBishop)
suffix += "s";
v->promotedPieceType[SILVER] = GOLD;
v->promotedPieceType[BISHOP] = DRAGON_HORSE;
v->promotedPieceType[ROOK] = DRAGON;
- v->shogiDoubledPawn = false;
+ v->dropNoDoubled = SHOGI_PAWN;
v->immobilityIllegal = true;
v->shogiPawnDropMateIllegal = true;
v->stalemateValue = -VALUE_MATE;
v->promotedPieceType[ROOK] = NO_PIECE_TYPE;
v->immobilityIllegal = false;
v->shogiPawnDropMateIllegal = false;
- v->shogiDoubledPawn = true;
+ v->dropNoDoubled = NO_PIECE_TYPE;
return v;
}
Variant* microshogi_variant() {
v->flagPiece = KING;
v->whiteFlag = Rank4BB;
v->blackFlag = Rank1BB;
- v->shogiDoubledPawn = true;
+ v->dropNoDoubled = NO_PIECE_TYPE;
return v;
}
Variant* gorogoroshogi_variant() {
bool sittuyinRookDrop = false;
bool dropOppositeColoredBishop = false;
bool dropPromoted = false;
- bool shogiDoubledPawn = true;
+ PieceType dropNoDoubled = NO_PIECE_TYPE;
bool immobilityIllegal = false;
bool gating = false;
bool arrowGating = false;
# sittuyinRookDrop: restrict region of rook drops to first rank [bool] (default: false)
# dropOppositeColoredBishop: dropped bishops have to be on opposite-colored squares [bool] (default: false)
# dropPromoted: pieces may be dropped in promoted state [bool] (default: false)
-# shogiDoubledPawn: allow shogi pawns to be doubled [bool] (default: true)
+# dropNoDoubled: specified piece type can not be dropped to the same file (e.g. shogi pawn) [PieceType] (default: -)
# immobilityIllegal: pieces may not move to squares where they can never move from [bool] (default: false)
# gating: maintain squares on backrank with extra rights in castling field of FEN [bool] (default: false)
# arrowGating: allow gating in Game of the Amazons style [bool] (default: false)
# doubleStep = false
# castling = false
# promotedPieceType = p:g s:g b:h r:d
-# shogiDoubledPawn = false
+# dropNoDoubled = p
# immobilityIllegal = true
# shogiPawnDropMateIllegal = true
# stalemateValue = loss