David Zar
Daylen Yang (daylen)
Deshawn Mohan-Smith (GoldenRare)
+Dieter Dobbelaere (ddobbelaere)
DiscanX
Dominik Schlösser (domschl)
double-beep
// Add pawn pushes which give discovered check. This is possible only
// if the pawn is not on the same file as the enemy king, because we
- // don't generate captures. Note that a possible discovery check
+ // don't generate captures. Note that a possible discovered check
// promotion has been already generated amongst the captures.
Bitboard dcCandidateQuiets = pos.blockers_for_king(Them) & pawnsNotOn7;
if (dcCandidateQuiets)
moveList = make_promotions<Type, Up >(moveList, pop_lsb(&b3), ksq);
}
- // Standard and en-passant captures
+ // Standard and en passant captures
if (Type == CAPTURES || Type == EVASIONS || Type == NON_EVASIONS)
{
Bitboard b1 = shift<UpRight>(pawnsNotOn7) & enemies;
assert(b1);
while (b1)
- *moveList++ = make<ENPASSANT>(pop_lsb(&b1), pos.ep_square());
+ *moveList++ = make<EN_PASSANT>(pop_lsb(&b1), pos.ep_square());
}
}
moveList = pos.checkers() ? generate<EVASIONS >(pos, moveList)
: generate<NON_EVASIONS>(pos, moveList);
while (cur != moveList)
- if ( (pinned || from_sq(*cur) == ksq || type_of(*cur) == ENPASSANT)
+ if ( (pinned || from_sq(*cur) == ksq || type_of(*cur) == EN_PASSANT)
&& !pos.legal(*cur))
*cur = (--moveList)->move;
else
}
/// MovePicker::next_move() is the most important method of the MovePicker class. It
-/// returns a new pseudo legal move every time it is called until there are no more
+/// returns a new pseudo-legal move every time it is called until there are no more
/// moves left, picking the move with the highest score from a list of generated moves.
Move MovePicker::next_move(bool skipQuiets) {
typedef Stats<PieceToHistory, NOT_USED, PIECE_NB, SQUARE_NB> ContinuationHistory;
-/// MovePicker class is used to pick one pseudo legal move at a time from the
+/// MovePicker class is used to pick one pseudo-legal move at a time from the
/// current position. The most important method is next_move(), which returns a
-/// new pseudo legal move each time it is called, until there are no moves left,
+/// new pseudo-legal move each time it is called, until there are no moves left,
/// when MOVE_NONE is returned. In order to improve the efficiency of the alpha
/// beta algorithm, MovePicker attempts to return the moves which are most likely
/// to get a cut-off first.
// En passant captures are a tricky special case. Because they are rather
// uncommon, we do it simply by testing whether the king is attacked after
// the move is made.
- if (type_of(m) == ENPASSANT)
+ if (type_of(m) == EN_PASSANT)
{
Square ksq = square<KING>(us);
Square capsq = to - pawn_push(us);
// of direct checks and ordinary discovered check, so the only case we
// need to handle is the unusual case of a discovered check through
// the captured pawn.
- case ENPASSANT:
+ case EN_PASSANT:
{
Square capsq = make_square(file_of(to), rank_of(from));
Bitboard b = (pieces() ^ from ^ capsq) | to;
Square from = from_sq(m);
Square to = to_sq(m);
Piece pc = piece_on(from);
- Piece captured = type_of(m) == ENPASSANT ? make_piece(them, PAWN) : piece_on(to);
+ Piece captured = type_of(m) == EN_PASSANT ? make_piece(them, PAWN) : piece_on(to);
assert(color_of(pc) == us);
assert(captured == NO_PIECE || color_of(captured) == (type_of(m) != CASTLING ? them : us));
// update non-pawn material.
if (type_of(captured) == PAWN)
{
- if (type_of(m) == ENPASSANT)
+ if (type_of(m) == EN_PASSANT)
{
capsq -= pawn_push(us);
// Update board and piece lists
remove_piece(capsq);
- if (type_of(m) == ENPASSANT)
+ if (type_of(m) == EN_PASSANT)
board[capsq] = NO_PIECE;
// Update material hash key and prefetch access to materialTable
// If the moving piece is a pawn do some special extra work
if (type_of(pc) == PAWN)
{
- // Set en-passant square if the moved pawn can be captured
+ // Set en passant square if the moved pawn can be captured
if ( (int(to) ^ int(from)) == 16
&& (pawn_attacks_bb(us, to - pawn_push(us)) & pieces(them, PAWN)))
{
{
Square capsq = to;
- if (type_of(m) == ENPASSANT)
+ if (type_of(m) == EN_PASSANT)
{
capsq -= pawn_push(us);
/// Position::key_after() computes the new hash key after the given move. Needed
/// for speculative prefetch. It doesn't recognize special moves like castling,
-/// en-passant and promotions.
+/// en passant and promotions.
Key Position::key_after(Move m) const {
Bitboard blockers_for_king(Color c) const;
Bitboard check_squares(PieceType pt) const;
Bitboard pinners(Color c) const;
- bool is_discovery_check_on_king(Color c, Move m) const;
+ bool is_discovered_check_on_king(Color c, Move m) const;
// Attacks to/from a given square
Bitboard attackers_to(Square s) const;
return st->checkSquares[pt];
}
-inline bool Position::is_discovery_check_on_king(Color c, Move m) const {
+inline bool Position::is_discovered_check_on_king(Color c, Move m) const {
return st->blockersForKing[c] & from_sq(m);
}
inline bool Position::capture(Move m) const {
assert(is_ok(m));
// Castling is encoded as "king captures rook"
- return (!empty(to_sq(m)) && type_of(m) != CASTLING) || type_of(m) == ENPASSANT;
+ return (!empty(to_sq(m)) && type_of(m) != CASTLING) || type_of(m) == EN_PASSANT;
}
inline Piece Position::captured_piece() const {
return d > 14 ? 29 : 8 * d * d + 224 * d - 215;
}
- // Add a small random component to draw evaluations to avoid 3fold-blindness
+ // Add a small random component to draw evaluations to avoid 3-fold blindness
Value value_draw(Thread* thisThread) {
return VALUE_DRAW + Value(2 * (thisThread->nodes & 1) - 1);
}
// Check extension (~2 Elo)
else if ( givesCheck
- && (pos.is_discovery_check_on_king(~us, move) || pos.see_ge(move)))
+ && (pos.is_discovered_check_on_king(~us, move) || pos.see_ge(move)))
extension = 1;
// Last captures extension
&& futilityBase > -VALUE_KNOWN_WIN
&& !pos.advanced_pawn_push(move))
{
- assert(type_of(move) != ENPASSANT); // Due to !pos.advanced_pawn_push
+ assert(type_of(move) != EN_PASSANT); // Due to !pos.advanced_pawn_push
// moveCount pruning
if (moveCount > 2)
/// 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), castling (3)
-/// NOTE: EN-PASSANT bit is set only when a pawn can be captured
+/// NOTE: en passant bit is set only when a pawn can be captured
///
/// 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
enum MoveType {
NORMAL,
PROMOTION = 1 << 14,
- ENPASSANT = 2 << 14,
+ EN_PASSANT = 2 << 14,
CASTLING = 3 << 14
};