- Add horde chess.
- Increase piece list size.
- Add configuration option for pawn double steps from first rank.
No functional change for existing variants.
// Compute our parametrized parameters at compile time, named according to
// the point of view of white side.
constexpr Color Them = (Us == WHITE ? BLACK : WHITE);
- constexpr Bitboard TRank3BB = (Us == WHITE ? Rank3BB : Rank6BB);
constexpr Direction Up = (Us == WHITE ? NORTH : SOUTH);
constexpr Direction Down = (Us == WHITE ? SOUTH : NORTH);
constexpr Direction UpRight = (Us == WHITE ? NORTH_EAST : SOUTH_WEST);
constexpr Direction UpLeft = (Us == WHITE ? NORTH_WEST : SOUTH_EAST);
+ // Define squares a pawn can pass during a double step
+ Bitboard TRank3BB = rank_bb(relative_rank(Us, RANK_3, pos.max_rank()));
+ if (pos.first_rank_double_steps())
+ TRank3BB |= rank_bb(relative_rank(Us, RANK_2, pos.max_rank()));
+
Bitboard emptySquares;
Bitboard TRank8BB = rank_bb(Us == WHITE ? pos.promotion_rank() : Rank(pos.max_rank() - pos.promotion_rank()));
{
// Set en-passant square if the moved pawn can be captured
if ( (int(to) ^ int(from)) == 16
+ && relative_rank(us, rank_of(from), max_rank()) == RANK_2
&& (attacks_from<PAWN>(us, to - pawn_push(us)) & pieces(them, PAWN)))
{
st->epSquare = to - pawn_push(us);
bool mandatory_piece_promotion() const;
bool endgame_eval() const;
bool double_step_enabled() const;
+ bool first_rank_double_steps() const;
bool castling_enabled() const;
bool checking_permitted() const;
bool must_capture() const;
Bitboard byTypeBB[PIECE_TYPE_NB];
Bitboard byColorBB[COLOR_NB];
int pieceCount[PIECE_NB];
- Square pieceList[PIECE_NB][16];
+ Square pieceList[PIECE_NB][64];
int index[SQUARE_NB];
int castlingRightsMask[SQUARE_NB];
Square castlingRookSquare[CASTLING_RIGHT_NB];
return var->doubleStep;
}
+inline bool Position::first_rank_double_steps() const {
+ assert(var != nullptr);
+ return var->firstRankDoubleSteps;
+}
+
inline bool Position::castling_enabled() const {
assert(var != nullptr);
return var->castling;
v->extinctionPieceTypes = {PAWN};
return v;
} ();
+ const Variant* horde = [&]{
+ Variant* v = new Variant();
+ v->startFen = "rnbqkbnr/pppppppp/8/1PP2PP1/PPPPPPPP/PPPPPPPP/PPPPPPPP/PPPPPPPP w kq - 0 1";
+ v->firstRankDoubleSteps = true;
+ v->extinctionValue = -VALUE_MATE;
+ v->extinctionPieceTypes = {ALL_PIECES};
+ return v;
+ } ();
const Variant* threecheck = [&]{
Variant* v = new Variant();
v->startFen = "rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 3+3 0 1";
add("antichess", antichess);
add("extinction", extinction);
add("kinglet", kinglet);
+ add("horde", horde);
add("3check", threecheck);
add("5check", fivecheck);
add("crazyhouse", crazyhouse);
bool mandatoryPiecePromotion = false;
bool endgameEval = false;
bool doubleStep = true;
+ bool firstRankDoubleSteps = false;
bool castling = true;
bool checking = true;
bool mustCapture = false;
expect perft.exp ai-wok startpos 5 13275068 > /dev/null
expect perft.exp euroshogi startpos 5 9451149 > /dev/null
expect perft.exp minishogi startpos 5 533203 > /dev/null
+expect perft.exp horde startpos 6 5396554 > /dev/null
rm perft.exp