From: Marco Costalba Date: Sun, 1 Dec 2013 09:25:10 +0000 (+0100) Subject: Rename CASTLE to CASTLING X-Git-Url: https://git.sesse.net/?p=stockfish;a=commitdiff_plain;h=f99cb3dc27719021e126690b7fd5aa5f43663ed8;hp=dd4e5db2be2eb5631d739af634cb33bea2f3fddd Rename CASTLE to CASTLING It is call 'castling move', not 'castle move' Noticed while reading DiscoCheck sources. No functional change. --- diff --git a/src/book.cpp b/src/book.cpp index 8d021ab2..da45b324 100644 --- a/src/book.cpp +++ b/src/book.cpp @@ -49,7 +49,7 @@ namespace { Key PolyGlotRandoms[781]; struct { Key psq[12][64]; // [piece][square] - Key castle[4]; // [castle right] + Key castling[4]; // [castling flag] Key enpassant[8]; // [file] Key turn; } Zobrist; @@ -332,10 +332,10 @@ namespace { key ^= PG.Zobrist.psq[2 * (type_of(p) - 1) + (color_of(p) == WHITE)][s]; } - b = pos.can_castle(ALL_CASTLES); + b = pos.can_castle(ANY_CASTLING); while (b) - key ^= PG.Zobrist.castle[pop_lsb(&b)]; + key ^= PG.Zobrist.castling[pop_lsb(&b)]; if (pos.ep_square() != SQ_NONE) key ^= PG.Zobrist.enpassant[file_of(pos.ep_square())]; diff --git a/src/evaluate.cpp b/src/evaluate.cpp index dd719554..a9c4c4e7 100644 --- a/src/evaluate.cpp +++ b/src/evaluate.cpp @@ -569,7 +569,7 @@ Value do_evaluate(const Position& pos) { Square ksq = pos.king_square(Us); // Penalize rooks which are trapped inside a king. Penalize more if - // king has lost right to castle. + // king has lost castling availability. if ( ((file_of(ksq) < FILE_E) == (file_of(s) < file_of(ksq))) && (rank_of(ksq) == rank_of(s) || relative_rank(Us, ksq) == RANK_1) && !ei.pi->semiopen_on_side(Us, file_of(ksq), file_of(ksq) < FILE_E)) diff --git a/src/movegen.cpp b/src/movegen.cpp index a3623a69..ee138b91 100644 --- a/src/movegen.cpp +++ b/src/movegen.cpp @@ -32,15 +32,15 @@ namespace { template - ExtMove* generate_castle(const Position& pos, ExtMove* mlist, Color us) { + ExtMove* generate_castling(const Position& pos, ExtMove* mlist, Color us) { - if (pos.castle_impeded(us, Side) || !pos.can_castle(make_castle_right(us, Side))) + if (pos.castling_impeded(us, Side) || !pos.can_castle(make_castling_flag(us, Side))) return mlist; // After castling, the rook and king final positions are the same in Chess960 // as they would be in standard chess. Square kfrom = pos.king_square(us); - Square rfrom = pos.castle_rook_square(us, Side); + Square rfrom = pos.castling_rook_square(us, Side); Square kto = relative_square(us, Side == KING_SIDE ? SQ_G1 : SQ_C1); Bitboard enemies = pos.pieces(~us); @@ -59,7 +59,7 @@ namespace { if (Chess960 && (attacks_bb(kto, pos.pieces() ^ rfrom) & pos.pieces(~us, ROOK, QUEEN))) return mlist; - (mlist++)->move = make(kfrom, rfrom); + (mlist++)->move = make(kfrom, rfrom); if (Checks && !pos.gives_check((mlist - 1)->move, CheckInfo(pos))) --mlist; @@ -260,13 +260,13 @@ namespace { { if (pos.is_chess960()) { - mlist = generate_castle< KING_SIDE, Checks, true>(pos, mlist, Us); - mlist = generate_castle(pos, mlist, Us); + mlist = generate_castling< KING_SIDE, Checks, true>(pos, mlist, Us); + mlist = generate_castling(pos, mlist, Us); } else { - mlist = generate_castle< KING_SIDE, Checks, false>(pos, mlist, Us); - mlist = generate_castle(pos, mlist, Us); + mlist = generate_castling< KING_SIDE, Checks, false>(pos, mlist, Us); + mlist = generate_castling(pos, mlist, Us); } } diff --git a/src/notation.cpp b/src/notation.cpp index d017c079..a1b95bc0 100644 --- a/src/notation.cpp +++ b/src/notation.cpp @@ -56,7 +56,7 @@ string score_to_uci(Value v, Value alpha, Value beta) { /// move_to_uci() converts a move to a string in coordinate notation /// (g1f3, a7a8q, etc.). The only special case is castling moves, where we print /// in the e1g1 notation in normal chess mode, and in e1h1 notation in chess960 -/// mode. Internally castle moves are always coded as "king captures rook". +/// mode. Internally castling moves are always encoded as "king captures rook". const string move_to_uci(Move m, bool chess960) { @@ -69,7 +69,7 @@ const string move_to_uci(Move m, bool chess960) { if (m == MOVE_NULL) return "0000"; - if (type_of(m) == CASTLE && !chess960) + if (type_of(m) == CASTLING && !chess960) to = (to > from ? FILE_G : FILE_C) | rank_of(from); string move = square_to_string(from) + square_to_string(to); @@ -118,7 +118,7 @@ const string move_to_san(Position& pos, Move m) { Piece pc = pos.piece_on(from); PieceType pt = type_of(pc); - if (type_of(m) == CASTLE) + if (type_of(m) == CASTLING) san = to > from ? "O-O" : "O-O-O"; else { diff --git a/src/pawns.cpp b/src/pawns.cpp index d2a53ef9..0bd99f9b 100644 --- a/src/pawns.cpp +++ b/src/pawns.cpp @@ -259,7 +259,7 @@ template Score Entry::update_safety(const Position& pos, Square ksq) { kingSquares[Us] = ksq; - castleRights[Us] = pos.can_castle(Us); + castlingFlags[Us] = pos.can_castle(Us); minKPdistance[Us] = 0; Bitboard pawns = pos.pieces(Us, PAWN); @@ -271,11 +271,11 @@ Score Entry::update_safety(const Position& pos, Square ksq) { Value bonus = shelter_storm(pos, ksq); - // If we can castle use the bonus after the castle if it is bigger - if (pos.can_castle(make_castle_right(Us, KING_SIDE))) + // If we can castle use the bonus after the castling if it is bigger + if (pos.can_castle(make_castling_flag(Us, KING_SIDE))) bonus = std::max(bonus, shelter_storm(pos, relative_square(Us, SQ_G1))); - if (pos.can_castle(make_castle_right(Us, QUEEN_SIDE))) + if (pos.can_castle(make_castling_flag(Us, QUEEN_SIDE))) bonus = std::max(bonus, shelter_storm(pos, relative_square(Us, SQ_C1))); return kingSafety[Us] = make_score(bonus, -16 * minKPdistance[Us]); diff --git a/src/pawns.h b/src/pawns.h index f6be84e7..0099ec20 100644 --- a/src/pawns.h +++ b/src/pawns.h @@ -48,7 +48,7 @@ struct Entry { template Score king_safety(const Position& pos, Square ksq) { - return kingSquares[Us] == ksq && castleRights[Us] == pos.can_castle(Us) + return kingSquares[Us] == ksq && castlingFlags[Us] == pos.can_castle(Us) ? kingSafety[Us] : update_safety(pos, ksq); } @@ -64,7 +64,7 @@ struct Entry { Bitboard pawnAttacks[COLOR_NB]; Square kingSquares[COLOR_NB]; int minKPdistance[COLOR_NB]; - int castleRights[COLOR_NB]; + int castlingFlags[COLOR_NB]; Score value; int semiopenFiles[COLOR_NB]; Score kingSafety[COLOR_NB]; diff --git a/src/position.cpp b/src/position.cpp index 2f3c62f5..f6b8d0ce 100644 --- a/src/position.cpp +++ b/src/position.cpp @@ -47,7 +47,7 @@ namespace Zobrist { Key psq[COLOR_NB][PIECE_TYPE_NB][SQUARE_NB]; Key enpassant[FILE_NB]; - Key castle[CASTLE_RIGHT_NB]; + Key castling[CASTLING_FLAG_NB]; Key side; Key exclusion; } @@ -125,13 +125,13 @@ void Position::init() { for (File f = FILE_A; f <= FILE_H; ++f) Zobrist::enpassant[f] = rk.rand(); - for (int cr = CASTLES_NONE; cr <= ALL_CASTLES; ++cr) + for (int cf = NO_CASTLING; cf <= ANY_CASTLING; ++cf) { - Bitboard b = cr; + Bitboard b = cf; while (b) { - Key k = Zobrist::castle[1ULL << pop_lsb(&b)]; - Zobrist::castle[cr] ^= k ? k : rk.rand(); + Key k = Zobrist::castling[1ULL << pop_lsb(&b)]; + Zobrist::castling[cf] ^= k ? k : rk.rand(); } } @@ -263,7 +263,7 @@ void Position::set(const string& fenStr, bool isChess960, Thread* th) { else continue; - set_castle_right(c, rsq); + set_castling_flag(c, rsq); } // 4. En passant square. Ignore if no pawn capture is possible @@ -297,30 +297,30 @@ void Position::set(const string& fenStr, bool isChess960, Thread* th) { } -/// Position::set_castle_right() is an helper function used to set castling -/// rights given the corresponding color and the rook starting square. +/// Position::set_castling_flag() is an helper function used to set castling +/// flags given the corresponding color and the rook starting square. -void Position::set_castle_right(Color c, Square rfrom) { +void Position::set_castling_flag(Color c, Square rfrom) { Square kfrom = king_square(c); CastlingSide cs = kfrom < rfrom ? KING_SIDE : QUEEN_SIDE; - CastleRight cr = make_castle_right(c, cs); + CastlingFlag cf = make_castling_flag(c, cs); - st->castleRights |= cr; - castleRightsMask[kfrom] |= cr; - castleRightsMask[rfrom] |= cr; - castleRookSquare[c][cs] = rfrom; + st->castlingFlags |= cf; + castlingFlagsMask[kfrom] |= cf; + castlingFlagsMask[rfrom] |= cf; + castlingRookSquare[c][cs] = rfrom; Square kto = relative_square(c, cs == KING_SIDE ? SQ_G1 : SQ_C1); Square rto = relative_square(c, cs == KING_SIDE ? SQ_F1 : SQ_D1); for (Square s = std::min(rfrom, rto); s <= std::max(rfrom, rto); ++s) if (s != kfrom && s != rfrom) - castlePath[c][cs] |= s; + castlingPath[c][cs] |= s; for (Square s = std::min(kfrom, kto); s <= std::max(kfrom, kto); ++s) if (s != kfrom && s != rfrom) - castlePath[c][cs] |= s; + castlingPath[c][cs] |= s; } @@ -357,18 +357,18 @@ const string Position::fen() const { ss << (sideToMove == WHITE ? " w " : " b "); if (can_castle(WHITE_OO)) - ss << (chess960 ? file_to_char(file_of(castle_rook_square(WHITE, KING_SIDE)), false) : 'K'); + ss << (chess960 ? file_to_char(file_of(castling_rook_square(WHITE, KING_SIDE)), false) : 'K'); if (can_castle(WHITE_OOO)) - ss << (chess960 ? file_to_char(file_of(castle_rook_square(WHITE, QUEEN_SIDE)), false) : 'Q'); + ss << (chess960 ? file_to_char(file_of(castling_rook_square(WHITE, QUEEN_SIDE)), false) : 'Q'); if (can_castle(BLACK_OO)) - ss << (chess960 ? file_to_char(file_of(castle_rook_square(BLACK, KING_SIDE)), true) : 'k'); + ss << (chess960 ? file_to_char(file_of(castling_rook_square(BLACK, KING_SIDE)), true) : 'k'); if (can_castle(BLACK_OOO)) - ss << (chess960 ? file_to_char(file_of(castle_rook_square(BLACK, QUEEN_SIDE)), true) : 'q'); + ss << (chess960 ? file_to_char(file_of(castling_rook_square(BLACK, QUEEN_SIDE)), true) : 'q'); - if (st->castleRights == CASTLES_NONE) + if (st->castlingFlags == NO_CASTLING) ss << '-'; ss << (ep_square() == SQ_NONE ? " - " : " " + square_to_string(ep_square()) + " ") @@ -489,7 +489,7 @@ bool Position::legal(Move m, Bitboard pinned) const { // square is attacked by the opponent. Castling moves are checked // for legality during move generation. if (type_of(piece_on(from)) == KING) - return type_of(m) == CASTLE || !(attackers_to(to_sq(m)) & pieces(~us)); + return type_of(m) == CASTLING || !(attackers_to(to_sq(m)) & pieces(~us)); // A non-king move is legal if and only if it is not pinned or it // is moving along the ray towards or away from the king. @@ -663,10 +663,10 @@ bool Position::gives_check(Move m, const CheckInfo& ci) const { return (attacks_bb< ROOK>(ksq, b) & pieces(us, QUEEN, ROOK)) | (attacks_bb(ksq, b) & pieces(us, QUEEN, BISHOP)); } - case CASTLE: + case CASTLING: { Square kfrom = from; - Square rfrom = to; // 'King captures the rook' notation + Square rfrom = to; // Castling is encoded as 'King captures the rook' Square kto = relative_square(us, rfrom > kfrom ? SQ_G1 : SQ_C1); Square rto = relative_square(us, rfrom > kfrom ? SQ_F1 : SQ_D1); @@ -724,20 +724,20 @@ void Position::do_move(Move m, StateInfo& newSt, const CheckInfo& ci, bool moveI PieceType captured = type_of(m) == ENPASSANT ? PAWN : type_of(piece_on(to)); assert(color_of(pc) == us); - assert(piece_on(to) == NO_PIECE || color_of(piece_on(to)) == them || type_of(m) == CASTLE); + assert(piece_on(to) == NO_PIECE || color_of(piece_on(to)) == them || type_of(m) == CASTLING); assert(captured != KING); - if (type_of(m) == CASTLE) + if (type_of(m) == CASTLING) { assert(pc == make_piece(us, KING)); bool kingSide = to > from; - Square rfrom = to; // Castle is encoded as "king captures friendly rook" + Square rfrom = to; // Castling is encoded as "king captures friendly rook" Square rto = relative_square(us, kingSide ? SQ_F1 : SQ_D1); to = relative_square(us, kingSide ? SQ_G1 : SQ_C1); captured = NO_PIECE_TYPE; - do_castle(from, to, rfrom, rto); + do_castling(from, to, rfrom, rto); st->psq += psq[us][ROOK][rto] - psq[us][ROOK][rfrom]; k ^= Zobrist::psq[us][ROOK][rfrom] ^ Zobrist::psq[us][ROOK][rto]; @@ -794,19 +794,19 @@ void Position::do_move(Move m, StateInfo& newSt, const CheckInfo& ci, bool moveI st->epSquare = SQ_NONE; } - // Update castle rights if needed - if (st->castleRights && (castleRightsMask[from] | castleRightsMask[to])) + // Update castling flags if needed + if (st->castlingFlags && (castlingFlagsMask[from] | castlingFlagsMask[to])) { - int cr = castleRightsMask[from] | castleRightsMask[to]; - k ^= Zobrist::castle[st->castleRights & cr]; - st->castleRights &= ~cr; + int cf = castlingFlagsMask[from] | castlingFlagsMask[to]; + k ^= Zobrist::castling[st->castlingFlags & cf]; + st->castlingFlags &= ~cf; } // Prefetch TT access as soon as we know the new hash key prefetch((char*)TT.first_entry(k)); - // Move the piece. The tricky Chess960 castle is handled earlier - if (type_of(m) != CASTLE) + // Move the piece. The tricky Chess960 castling is handled earlier + if (type_of(m) != CASTLING) move_piece(from, to, us, pt); // If the moving piece is a pawn do some special extra work @@ -907,7 +907,7 @@ void Position::undo_move(Move m) { PieceType pt = type_of(piece_on(to)); PieceType captured = st->capturedType; - assert(empty(from) || type_of(m) == CASTLE); + assert(empty(from) || type_of(m) == CASTLING); assert(captured != KING); if (type_of(m) == PROMOTION) @@ -923,15 +923,15 @@ void Position::undo_move(Move m) { pt = PAWN; } - if (type_of(m) == CASTLE) + if (type_of(m) == CASTLING) { bool kingSide = to > from; - Square rfrom = to; // Castle is encoded as "king captures friendly rook" + Square rfrom = to; // Castling is encoded as "king captures friendly rook" Square rto = relative_square(us, kingSide ? SQ_F1 : SQ_D1); to = relative_square(us, kingSide ? SQ_G1 : SQ_C1); captured = NO_PIECE_TYPE; pt = KING; - do_castle(to, from, rto, rfrom); + do_castling(to, from, rto, rfrom); } else move_piece(to, from, us, pt); // Put the piece back at the source square @@ -961,10 +961,10 @@ void Position::undo_move(Move m) { } -/// Position::do_castle() is a helper used to do/undo a castling move. This +/// Position::do_castling() is a helper used to do/undo a castling move. This /// is a bit tricky, especially in Chess960. -void Position::do_castle(Square kfrom, Square kto, Square rfrom, Square rto) { +void Position::do_castling(Square kfrom, Square kto, Square rfrom, Square rto) { // Remove both pieces first since squares could overlap in Chess960 remove_piece(kfrom, sideToMove, KING); @@ -1048,10 +1048,10 @@ int Position::see(Move m, int asymmThreshold) const { stm = color_of(piece_on(from)); occupied = pieces() ^ from; - // Castle moves are implemented as king capturing the rook so cannot be + // Castling moves are implemented as king capturing the rook so cannot be // handled correctly. Simply return 0 that is always the correct value // unless in the rare case the rook ends up under attack. - if (type_of(m) == CASTLE) + if (type_of(m) == CASTLING) return 0; if (type_of(m) == ENPASSANT) @@ -1139,7 +1139,7 @@ void Position::clear() { Key Position::compute_key() const { - Key k = Zobrist::castle[st->castleRights]; + Key k = Zobrist::castling[st->castlingFlags]; for (Bitboard b = pieces(); b; ) { @@ -1326,7 +1326,7 @@ bool Position::pos_is_ok(int* failedStep) const { const bool debugNonPawnMaterial = all || false; const bool debugPieceCounts = all || false; const bool debugPieceList = all || false; - const bool debugCastleSquares = all || false; + const bool debugCastlingSquares = all || false; *step = 1; @@ -1410,18 +1410,18 @@ bool Position::pos_is_ok(int* failedStep) const { || index[pieceList[c][pt][i]] != i) return false; - if ((*step)++, debugCastleSquares) + if ((*step)++, debugCastlingSquares) for (Color c = WHITE; c <= BLACK; ++c) for (CastlingSide s = KING_SIDE; s <= QUEEN_SIDE; s = CastlingSide(s + 1)) { - CastleRight cr = make_castle_right(c, s); + CastlingFlag cf = make_castling_flag(c, s); - if (!can_castle(cr)) + if (!can_castle(cf)) continue; - if ( (castleRightsMask[king_square(c)] & cr) != cr - || piece_on(castleRookSquare[c][s]) != make_piece(c, ROOK) - || castleRightsMask[castleRookSquare[c][s]] != cr) + if ( (castlingFlagsMask[king_square(c)] & cf) != cf + || piece_on(castlingRookSquare[c][s]) != make_piece(c, ROOK) + || castlingFlagsMask[castlingRookSquare[c][s]] != cf) return false; } diff --git a/src/position.h b/src/position.h index cd297df7..903b1b64 100644 --- a/src/position.h +++ b/src/position.h @@ -51,7 +51,7 @@ struct CheckInfo { struct StateInfo { Key pawnKey, materialKey; Value npMaterial[COLOR_NB]; - int castleRights, rule50, pliesFromNull; + int castlingFlags, rule50, pliesFromNull; Score psq; Square epSquare; @@ -100,10 +100,10 @@ public: template const Square* list(Color c) const; // Castling - int can_castle(CastleRight f) const; + int can_castle(CastlingFlag f) const; int can_castle(Color c) const; - bool castle_impeded(Color c, CastlingSide s) const; - Square castle_rook_square(Color c, CastlingSide s) const; + bool castling_impeded(Color c, CastlingSide s) const; + Square castling_rook_square(Color c, CastlingSide s) const; // Checking Bitboard checkers() const; @@ -170,10 +170,10 @@ public: private: // Initialization helpers (used while setting up a position) void clear(); - void set_castle_right(Color c, Square rfrom); + void set_castling_flag(Color c, Square rfrom); // Helper functions - void do_castle(Square kfrom, Square kto, Square rfrom, Square rto); + void do_castling(Square kfrom, Square kto, Square rfrom, Square rto); Bitboard hidden_checkers(Square ksq, Color c, Color toMove) const; void put_piece(Square s, Color c, PieceType pt); void remove_piece(Square s, Color c, PieceType pt); @@ -197,9 +197,9 @@ private: int index[SQUARE_NB]; // Other info - int castleRightsMask[SQUARE_NB]; - Square castleRookSquare[COLOR_NB][CASTLING_SIDE_NB]; - Bitboard castlePath[COLOR_NB][CASTLING_SIDE_NB]; + int castlingFlagsMask[SQUARE_NB]; + Square castlingRookSquare[COLOR_NB][CASTLING_SIDE_NB]; + Bitboard castlingPath[COLOR_NB][CASTLING_SIDE_NB]; StateInfo startState; int64_t nodes; int gamePly; @@ -273,20 +273,20 @@ inline Square Position::king_square(Color c) const { return pieceList[c][KING][0]; } -inline int Position::can_castle(CastleRight f) const { - return st->castleRights & f; +inline int Position::can_castle(CastlingFlag f) const { + return st->castlingFlags & f; } inline int Position::can_castle(Color c) const { - return st->castleRights & ((WHITE_OO | WHITE_OOO) << (2 * c)); + return st->castlingFlags & ((WHITE_OO | WHITE_OOO) << (2 * c)); } -inline bool Position::castle_impeded(Color c, CastlingSide s) const { - return byTypeBB[ALL_PIECES] & castlePath[c][s]; +inline bool Position::castling_impeded(Color c, CastlingSide s) const { + return byTypeBB[ALL_PIECES] & castlingPath[c][s]; } -inline Square Position::castle_rook_square(Color c, CastlingSide s) const { - return castleRookSquare[c][s]; +inline Square Position::castling_rook_square(Color c, CastlingSide s) const { + return castlingRookSquare[c][s]; } template @@ -380,14 +380,14 @@ inline bool Position::is_chess960() const { inline bool Position::capture_or_promotion(Move m) const { assert(is_ok(m)); - return type_of(m) ? type_of(m) != CASTLE : !empty(to_sq(m)); + return type_of(m) ? type_of(m) != CASTLING : !empty(to_sq(m)); } inline bool Position::capture(Move m) const { - // Note that castle is coded as "king captures the rook" + // Note that castling is encoded as "king captures the rook" assert(is_ok(m)); - return (!empty(to_sq(m)) && type_of(m) != CASTLE) || type_of(m) == ENPASSANT; + return (!empty(to_sq(m)) && type_of(m) != CASTLING) || type_of(m) == ENPASSANT; } inline PieceType Position::captured_piece_type() const { diff --git a/src/search.cpp b/src/search.cpp index e235c3fc..a4e2309e 100644 --- a/src/search.cpp +++ b/src/search.cpp @@ -807,7 +807,7 @@ moves_loop: // When in check and at SpNode search starts from here givesCheck = pos.gives_check(move, ci); dangerous = givesCheck || pos.passed_pawn_push(move) - || type_of(move) == CASTLE; + || type_of(move) == CASTLING; // Step 12. Extend checks if (givesCheck && pos.see_sign(move) >= 0) @@ -1332,7 +1332,7 @@ moves_loop: // When in check and at SpNode search starts from here assert(is_ok(first)); assert(is_ok(second)); assert(color_of(pos.piece_on(from_sq(second))) == ~pos.side_to_move()); - assert(type_of(first) == CASTLE || color_of(pos.piece_on(to_sq(first))) == ~pos.side_to_move()); + assert(type_of(first) == CASTLING || color_of(pos.piece_on(to_sq(first))) == ~pos.side_to_move()); Square m1from = from_sq(first); Square m2from = from_sq(second); diff --git a/src/types.h b/src/types.h index ff376386..cf067779 100644 --- a/src/types.h +++ b/src/types.h @@ -97,7 +97,7 @@ const int MAX_PLY_PLUS_6 = MAX_PLY + 6; /// bit 0- 5: destination square (from 0 to 63) /// bit 6-11: origin square (from 0 to 63) /// bit 12-13: promotion piece type - 2 (from KNIGHT-2 to QUEEN-2) -/// bit 14-15: special move flag: promotion (1), en passant (2), castle (3) +/// bit 14-15: special move flag: promotion (1), en passant (2), castling (3) /// /// Special cases are MOVE_NONE and MOVE_NULL. We can sneak these in because in /// any normal move destination square is always different from origin square @@ -112,17 +112,17 @@ enum MoveType { NORMAL, PROMOTION = 1 << 14, ENPASSANT = 2 << 14, - CASTLE = 3 << 14 + CASTLING = 3 << 14 }; -enum CastleRight { // Defined as in PolyGlot book hash key - CASTLES_NONE, +enum CastlingFlag { // Defined as in PolyGlot book hash key + NO_CASTLING, WHITE_OO, WHITE_OOO = WHITE_OO << 1, BLACK_OO = WHITE_OO << 2, BLACK_OOO = WHITE_OO << 3, - ALL_CASTLES = WHITE_OO | WHITE_OOO | BLACK_OO | BLACK_OOO, - CASTLE_RIGHT_NB = 16 + ANY_CASTLING = WHITE_OO | WHITE_OOO | BLACK_OO | BLACK_OOO, + CASTLING_FLAG_NB = 16 }; enum CastlingSide { @@ -346,8 +346,8 @@ inline Piece make_piece(Color c, PieceType pt) { return Piece((c << 3) | pt); } -inline CastleRight make_castle_right(Color c, CastlingSide s) { - return CastleRight(WHITE_OO << ((s == QUEEN_SIDE) + 2 * c)); +inline CastlingFlag make_castling_flag(Color c, CastlingSide s) { + return CastlingFlag(WHITE_OO << ((s == QUEEN_SIDE) + 2 * c)); } inline PieceType type_of(Piece p) {