{ -1, 1, 15, 17 }, // euroshogi knight
{ -8, -1, 1, 7, 8, 9 }, // gold
{ -8, -1, 1, 8 }, // horse
+ { -8, -1, 1, 8 }, // clobber
{ -9, -8, -7, -1, 1, 7, 8, 9 }, // commoner
{ -9, -8, -7, -1, 1, 7, 8, 9 } // king
};
{ -1, 1, 15, 17 }, // euroshogi knight
{ -8, -1, 1, 7, 8, 9 }, // gold
{ -8, -1, 1, 8 }, // horse
+ {}, // clobber
{ -9, -8, -7, -1, 1, 7, 8, 9 }, // commoner
{ -9, -8, -7, -1, 1, 7, 8, 9 } // king
};
{}, // euroshogi knight
{}, // gold
{ NORTH_EAST, SOUTH_EAST, SOUTH_WEST, NORTH_WEST }, // horse
+ {}, // clobber
{}, // commoner
{} // king
};
{}, // euroshogi knight
{}, // gold
{ NORTH_EAST, SOUTH_EAST, SOUTH_WEST, NORTH_WEST }, // horse
+ {}, // clobber
{}, // commoner
{} // king
};
0, // euroshogi knight
0, // gold
7, // horse
+ 0, // clobber
0, // commoner
0 // king
};
0, // euroshogi knight
0, // gold
7, // horse
+ 0, // clobber
0, // commoner
0 // king
};
}
// no legal moves from target square
- if ((type_of(m) == DROP || type_of(m) == NORMAL) && !(moves_bb(us, type_of(moved_piece(m)), to, 0) & board_bb()))
+ if (immobility_illegal() && (type_of(m) == DROP || type_of(m) == NORMAL) && !(moves_bb(us, type_of(moved_piece(m)), to, 0) & board_bb()))
return false;
// illegal drops
bool drop_loop() const;
bool captures_to_hand() const;
bool first_rank_drops() const;
+ bool immobility_illegal() const;
// winning conditions
Value stalemate_value(int ply = 0) const;
Value checkmate_value(int ply = 0) const;
return var->firstRankDrops;
}
+inline bool Position::immobility_illegal() const {
+ assert(var != nullptr);
+ return var->immobilityIllegal;
+}
+
inline Value Position::stalemate_value(int ply) const {
assert(var != nullptr);
Value v = var->stalemateValue;
EuroShogiKnightValueMg = 400, EuroShogiKnightValueEg = 400,
GoldValueMg = 600, GoldValueEg = 600,
HorseValueMg = 1500, HorseValueEg = 1500,
+ ClobberPieceValueMg = 300, ClobberPieceValueEg = 300,
CommonerValueMg = 600, CommonerValueEg = 600,
MidgameLimit = 15258, EndgameLimit = 3915
enum PieceType {
NO_PIECE_TYPE, PAWN, KNIGHT, BISHOP, ROOK,
QUEEN, FERS, MET = FERS, ALFIL, SILVER, KHON = SILVER, AIWOK, BERS, DRAGON = BERS, CHANCELLOR,
- AMAZON, KNIBIS, BISKNI, SHOGI_PAWN, LANCE, SHOGI_KNIGHT, EUROSHOGI_KNIGHT, GOLD, HORSE, COMMONER, KING,
+ AMAZON, KNIBIS, BISKNI, SHOGI_PAWN, LANCE, SHOGI_KNIGHT, EUROSHOGI_KNIGHT, GOLD, HORSE, CLOBBER_PIECE, COMMONER, KING,
ALL_PIECES = 0,
PIECE_TYPE_NB = 1 << PIECE_TYPE_BITS
v->promotedPieceType[BISHOP] = HORSE;
v->promotedPieceType[ROOK] = DRAGON;
v->mandatoryPiecePromotion = true;
+ v->immobilityIllegal = true;
return v;
} ();
const Variant* judkinsshogi = [&]{
v->promotedPieceType[SILVER] = GOLD;
v->promotedPieceType[BISHOP] = HORSE;
v->promotedPieceType[ROOK] = DRAGON;
+ v->immobilityIllegal = true;
return v;
} ();
const Variant* minishogi = [&]{
v->promotedPieceType[SILVER] = GOLD;
v->promotedPieceType[BISHOP] = HORSE;
v->promotedPieceType[ROOK] = DRAGON;
+ v->immobilityIllegal = true;
return v;
} ();
const Variant* losalamos = [&]{
// TODO: illegal checkmates
return v;
} ();
+ const Variant* clobber = [&]{
+ Variant* v = new Variant();
+ v->maxRank = RANK_6;
+ v->maxFile = FILE_E;
+ v->reset_pieces();
+ v->add_piece(CLOBBER_PIECE, 'p');
+ v->startFen = "PpPpP/pPpPp/PpPpP/pPpPp/PpPpP/pPpPp w 0 1";
+ v->promotionPieceTypes = {};
+ v->doubleStep = false;
+ v->castling = false;
+ v->stalemateValue = -VALUE_MATE;
+ v->immobilityIllegal = false;
+ return v;
+ } ();
// Add to UCI_Variant option
add("chess", chess);
add("almost", almost);
add("chigorin", chigorin);
add("shatar", shatar);
+ add("clobber", clobber);
}
void VariantMap::add(std::string s, const Variant* v) {
bool dropLoop = false;
bool capturesToHand = false;
bool firstRankDrops = false;
+ bool immobilityIllegal = false;
// game end
Value stalemateValue = VALUE_DRAW;
Value checkmateValue = -VALUE_MATE;