1
0
Fork 0
mirror of https://github.com/sockspls/badfish synced 2025-04-29 16:23:09 +00:00

Shrink names of move helpers

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
This commit is contained in:
Marco Costalba 2011-10-03 09:56:49 +01:00
parent 1a8e3f0b2e
commit 3141490374
7 changed files with 90 additions and 89 deletions

View file

@ -44,10 +44,10 @@ const string move_to_uci(Move m, bool chess960) {
if (m == MOVE_NULL) if (m == MOVE_NULL)
return "0000"; return "0000";
if (move_is_castle(m) && !chess960) if (is_castle(m) && !chess960)
to = from + (file_of(to) == FILE_H ? Square(2) : -Square(2)); to = from + (file_of(to) == FILE_H ? Square(2) : -Square(2));
if (move_is_promotion(m)) if (is_promotion(m))
promotion = char(tolower(piece_type_to_char(promotion_piece_type(m)))); promotion = char(tolower(piece_type_to_char(promotion_piece_type(m))));
return square_to_string(from) + square_to_string(to) + promotion; return square_to_string(from) + square_to_string(to) + promotion;
@ -80,7 +80,7 @@ const string move_to_san(Position& pos, Move m) {
if (m == MOVE_NULL) if (m == MOVE_NULL)
return "(null)"; return "(null)";
assert(move_is_ok(m)); assert(is_ok(m));
Bitboard attackers; Bitboard attackers;
bool ambiguousMove, ambiguousFile, ambiguousRank; bool ambiguousMove, ambiguousFile, ambiguousRank;
@ -89,7 +89,7 @@ const string move_to_san(Position& pos, Move m) {
PieceType pt = type_of(pos.piece_on(from)); PieceType pt = type_of(pos.piece_on(from));
string san; string san;
if (move_is_castle(m)) if (is_castle(m))
san = (move_to(m) < move_from(m) ? "O-O-O" : "O-O"); san = (move_to(m) < move_from(m) ? "O-O-O" : "O-O");
else else
{ {
@ -127,7 +127,7 @@ const string move_to_san(Position& pos, Move m) {
} }
} }
if (pos.move_is_capture(m)) if (pos.is_capture(m))
{ {
if (pt == PAWN) if (pt == PAWN)
san += file_to_char(file_of(from)); san += file_to_char(file_of(from));
@ -137,7 +137,7 @@ const string move_to_san(Position& pos, Move m) {
san += square_to_string(to); san += square_to_string(to);
if (move_is_promotion(m)) if (is_promotion(m))
{ {
san += '='; san += '=';
san += piece_type_to_char(promotion_piece_type(m)); san += piece_type_to_char(promotion_piece_type(m));

View file

@ -82,19 +82,19 @@ inline Square move_to(Move m) {
return Square(m & 0x3F); return Square(m & 0x3F);
} }
inline bool move_is_special(Move m) { inline bool is_special(Move m) {
return m & (3 << 14); return m & (3 << 14);
} }
inline bool move_is_promotion(Move m) { inline bool is_promotion(Move m) {
return (m & (3 << 14)) == (1 << 14); return (m & (3 << 14)) == (1 << 14);
} }
inline int move_is_ep(Move m) { inline int is_enpassant(Move m) {
return (m & (3 << 14)) == (2 << 14); return (m & (3 << 14)) == (2 << 14);
} }
inline int move_is_castle(Move m) { inline int is_castle(Move m) {
return (m & (3 << 14)) == (3 << 14); return (m & (3 << 14)) == (3 << 14);
} }
@ -110,7 +110,7 @@ inline Move make_promotion_move(Square from, Square to, PieceType promotion) {
return Move(to | (from << 6) | (1 << 14) | ((promotion - 2) << 12)) ; return Move(to | (from << 6) | (1 << 14) | ((promotion - 2) << 12)) ;
} }
inline Move make_ep_move(Square from, Square to) { inline Move make_enpassant_move(Square from, Square to) {
return Move(to | (from << 6) | (2 << 14)); return Move(to | (from << 6) | (2 << 14));
} }
@ -118,7 +118,7 @@ inline Move make_castle_move(Square from, Square to) {
return Move(to | (from << 6) | (3 << 14)); return Move(to | (from << 6) | (3 << 14));
} }
inline bool move_is_ok(Move m) { inline bool is_ok(Move m) {
return move_from(m) != move_to(m); // Catches also MOVE_NONE return move_from(m) != move_to(m); // Catches also MOVE_NONE
} }

View file

@ -489,7 +489,7 @@ namespace {
while (b1) while (b1)
{ {
to = pop_1st_bit(&b1); to = pop_1st_bit(&b1);
(*mlist++).move = make_ep_move(to, pos.ep_square()); (*mlist++).move = make_enpassant_move(to, pos.ep_square());
} }
} }
return mlist; return mlist;

View file

@ -96,7 +96,7 @@ MovePicker::MovePicker(const Position& p, Move ttm, Depth d, const History& h,
phasePtr = MainSearchTable; phasePtr = MainSearchTable;
} }
ttMove = (ttm && pos.move_is_pl(ttm) ? ttm : MOVE_NONE); ttMove = (ttm && pos.is_pseudo_legal(ttm) ? ttm : MOVE_NONE);
phasePtr += int(ttMove == MOVE_NONE) - 1; phasePtr += int(ttMove == MOVE_NONE) - 1;
go_next_phase(); go_next_phase();
} }
@ -117,7 +117,7 @@ MovePicker::MovePicker(const Position& p, Move ttm, Depth d, const History& h, S
// Skip TT move if is not a capture or a promotion, this avoids // Skip TT move if is not a capture or a promotion, this avoids
// qsearch tree explosion due to a possible perpetual check or // qsearch tree explosion due to a possible perpetual check or
// similar rare cases when TT table is full. // similar rare cases when TT table is full.
if (ttm != MOVE_NONE && !pos.move_is_capture_or_promotion(ttm)) if (ttm != MOVE_NONE && !pos.is_capture_or_promotion(ttm))
ttm = MOVE_NONE; ttm = MOVE_NONE;
} }
else else
@ -127,7 +127,7 @@ MovePicker::MovePicker(const Position& p, Move ttm, Depth d, const History& h, S
ttm = MOVE_NONE; ttm = MOVE_NONE;
} }
ttMove = (ttm && pos.move_is_pl(ttm) ? ttm : MOVE_NONE); ttMove = (ttm && pos.is_pseudo_legal(ttm) ? ttm : MOVE_NONE);
phasePtr += int(ttMove == MOVE_NONE) - 1; phasePtr += int(ttMove == MOVE_NONE) - 1;
go_next_phase(); go_next_phase();
} }
@ -142,10 +142,10 @@ MovePicker::MovePicker(const Position& p, Move ttm, const History& h, PieceType
phasePtr = ProbCutTable; phasePtr = ProbCutTable;
if ( ttm != MOVE_NONE if ( ttm != MOVE_NONE
&& (!pos.move_is_capture(ttm) || pos.see(ttm) <= captureThreshold)) && (!pos.is_capture(ttm) || pos.see(ttm) <= captureThreshold))
ttm = MOVE_NONE; ttm = MOVE_NONE;
ttMove = (ttm && pos.move_is_pl(ttm) ? ttm : MOVE_NONE); ttMove = (ttm && pos.is_pseudo_legal(ttm) ? ttm : MOVE_NONE);
phasePtr += int(ttMove == MOVE_NONE) - 1; phasePtr += int(ttMove == MOVE_NONE) - 1;
go_next_phase(); go_next_phase();
} }
@ -254,7 +254,7 @@ void MovePicker::score_captures() {
cur->score = piece_value_midgame(pos.piece_on(move_to(m))) cur->score = piece_value_midgame(pos.piece_on(move_to(m)))
- type_of(pos.piece_on(move_from(m))); - type_of(pos.piece_on(move_from(m)));
if (move_is_promotion(m)) if (is_promotion(m))
cur->score += piece_value_midgame(Piece(promotion_piece_type(m))); cur->score += piece_value_midgame(Piece(promotion_piece_type(m)));
} }
} }
@ -289,7 +289,7 @@ void MovePicker::score_evasions() {
m = cur->move; m = cur->move;
if ((seeScore = pos.see_sign(m)) < 0) if ((seeScore = pos.see_sign(m)) < 0)
cur->score = seeScore - History::MaxValue; // Be sure we are at the bottom cur->score = seeScore - History::MaxValue; // Be sure we are at the bottom
else if (pos.move_is_capture(m)) else if (pos.is_capture(m))
cur->score = piece_value_midgame(pos.piece_on(move_to(m))) cur->score = piece_value_midgame(pos.piece_on(move_to(m)))
- type_of(pos.piece_on(move_from(m))) + History::MaxValue; - type_of(pos.piece_on(move_from(m))) + History::MaxValue;
else else
@ -347,9 +347,9 @@ Move MovePicker::get_next_move() {
case PH_KILLERS: case PH_KILLERS:
move = (curMove++)->move; move = (curMove++)->move;
if ( move != MOVE_NONE if ( move != MOVE_NONE
&& pos.move_is_pl(move) && pos.is_pseudo_legal(move)
&& move != ttMove && move != ttMove
&& !pos.move_is_capture(move)) && !pos.is_capture(move))
return move; return move;
break; break;

View file

@ -458,7 +458,7 @@ Bitboard Position::attacks_from(Piece p, Square s, Bitboard occ) {
bool Position::move_attacks_square(Move m, Square s) const { bool Position::move_attacks_square(Move m, Square s) const {
assert(move_is_ok(m)); assert(is_ok(m));
assert(square_is_ok(s)); assert(square_is_ok(s));
Bitboard occ, xray; Bitboard occ, xray;
@ -486,7 +486,7 @@ bool Position::move_attacks_square(Move m, Square s) const {
bool Position::pl_move_is_legal(Move m, Bitboard pinned) const { bool Position::pl_move_is_legal(Move m, Bitboard pinned) const {
assert(move_is_ok(m)); assert(is_ok(m));
assert(pinned == pinned_pieces()); assert(pinned == pinned_pieces());
Color us = side_to_move(); Color us = side_to_move();
@ -498,7 +498,7 @@ bool Position::pl_move_is_legal(Move m, Bitboard pinned) const {
// En passant captures are a tricky special case. Because they are rather // 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 // uncommon, we do it simply by testing whether the king is attacked after
// the move is made. // the move is made.
if (move_is_ep(m)) if (is_enpassant(m))
{ {
Color them = flip(us); Color them = flip(us);
Square to = move_to(m); Square to = move_to(m);
@ -523,7 +523,7 @@ bool Position::pl_move_is_legal(Move m, Bitboard pinned) const {
// square is attacked by the opponent. Castling moves are checked // square is attacked by the opponent. Castling moves are checked
// for legality during move generation. // for legality during move generation.
if (type_of(piece_on(from)) == KING) if (type_of(piece_on(from)) == KING)
return move_is_castle(m) || !(attackers_to(move_to(m)) & pieces(flip(us))); return is_castle(m) || !(attackers_to(move_to(m)) & pieces(flip(us)));
// A non-king move is legal if and only if it is not pinned or it // 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. // is moving along the ray towards or away from the king.
@ -533,7 +533,7 @@ bool Position::pl_move_is_legal(Move m, Bitboard pinned) const {
} }
/// Position::move_is_legal() takes a move and tests whether the move /// Position::move_is_legal() takes a random move and tests whether the move
/// is legal. This version is not very fast and should be used only /// is legal. This version is not very fast and should be used only
/// in non time-critical paths. /// in non time-critical paths.
@ -547,10 +547,11 @@ bool Position::move_is_legal(const Move m) const {
} }
/// Fast version of Position::move_is_pl() that takes a move and a bitboard /// Position::is_pseudo_legal() takes a random move and tests whether the move
/// of pinned pieces as input, and tests whether the move is pseudo legal. /// is pseudo legal. It is used to validate moves from TT that can be corrupted
/// due to SMP concurrent access or hash position key aliasing.
bool Position::move_is_pl(const Move m) const { bool Position::is_pseudo_legal(const Move m) const {
Color us = sideToMove; Color us = sideToMove;
Color them = flip(sideToMove); Color them = flip(sideToMove);
@ -559,7 +560,7 @@ bool Position::move_is_pl(const Move m) const {
Piece pc = piece_on(from); Piece pc = piece_on(from);
// Use a slower but simpler function for uncommon cases // Use a slower but simpler function for uncommon cases
if (move_is_special(m)) if (is_special(m))
return move_is_legal(m); return move_is_legal(m);
// Is not a promotion, so promotion piece must be empty // Is not a promotion, so promotion piece must be empty
@ -670,11 +671,11 @@ bool Position::move_is_pl(const Move m) const {
} }
/// Position::move_gives_check() tests whether a pseudo-legal move is a check /// Position::move_gives_check() tests whether a pseudo-legal move gives a check
bool Position::move_gives_check(Move m, const CheckInfo& ci) const { bool Position::move_gives_check(Move m, const CheckInfo& ci) const {
assert(move_is_ok(m)); assert(is_ok(m));
assert(ci.dcCandidates == discovered_check_candidates()); assert(ci.dcCandidates == discovered_check_candidates());
assert(color_of(piece_on(move_from(m))) == side_to_move()); assert(color_of(piece_on(move_from(m))) == side_to_move());
@ -696,7 +697,7 @@ bool Position::move_gives_check(Move m, const CheckInfo& ci) const {
} }
// Can we skip the ugly special cases ? // Can we skip the ugly special cases ?
if (!move_is_special(m)) if (!is_special(m))
return false; return false;
Color us = side_to_move(); Color us = side_to_move();
@ -704,7 +705,7 @@ bool Position::move_gives_check(Move m, const CheckInfo& ci) const {
Square ksq = king_square(flip(us)); Square ksq = king_square(flip(us));
// Promotion with check ? // Promotion with check ?
if (move_is_promotion(m)) if (is_promotion(m))
{ {
clear_bit(&b, from); clear_bit(&b, from);
@ -727,7 +728,7 @@ bool Position::move_gives_check(Move m, const CheckInfo& ci) const {
// of direct checks and ordinary discovered check, the only case we // of direct checks and ordinary discovered check, the only case we
// need to handle is the unusual case of a discovered check through // need to handle is the unusual case of a discovered check through
// the captured pawn. // the captured pawn.
if (move_is_ep(m)) if (is_enpassant(m))
{ {
Square capsq = make_square(file_of(to), rank_of(from)); Square capsq = make_square(file_of(to), rank_of(from));
clear_bit(&b, from); clear_bit(&b, from);
@ -738,7 +739,7 @@ bool Position::move_gives_check(Move m, const CheckInfo& ci) const {
} }
// Castling with check ? // Castling with check ?
if (move_is_castle(m)) if (is_castle(m))
{ {
Square kfrom, kto, rfrom, rto; Square kfrom, kto, rfrom, rto;
kfrom = from; kfrom = from;
@ -775,7 +776,7 @@ void Position::do_move(Move m, StateInfo& newSt) {
void Position::do_move(Move m, StateInfo& newSt, const CheckInfo& ci, bool moveIsCheck) { void Position::do_move(Move m, StateInfo& newSt, const CheckInfo& ci, bool moveIsCheck) {
assert(move_is_ok(m)); assert(is_ok(m));
assert(&newSt != st); assert(&newSt != st);
nodes++; nodes++;
@ -805,7 +806,7 @@ void Position::do_move(Move m, StateInfo& newSt, const CheckInfo& ci, bool moveI
st->rule50++; st->rule50++;
st->pliesFromNull++; st->pliesFromNull++;
if (move_is_castle(m)) if (is_castle(m))
{ {
st->key = key; st->key = key;
do_castle_move(m); do_castle_move(m);
@ -816,8 +817,8 @@ void Position::do_move(Move m, StateInfo& newSt, const CheckInfo& ci, bool moveI
Color them = flip(us); Color them = flip(us);
Square from = move_from(m); Square from = move_from(m);
Square to = move_to(m); Square to = move_to(m);
bool ep = move_is_ep(m); bool ep = is_enpassant(m);
bool pm = move_is_promotion(m); bool pm = is_promotion(m);
Piece piece = piece_on(from); Piece piece = piece_on(from);
PieceType pt = type_of(piece); PieceType pt = type_of(piece);
@ -1044,8 +1045,8 @@ void Position::do_capture_move(Key& key, PieceType capture, Color them, Square t
void Position::do_castle_move(Move m) { void Position::do_castle_move(Move m) {
assert(move_is_ok(m)); assert(is_ok(m));
assert(move_is_castle(m)); assert(is_castle(m));
Color us = side_to_move(); Color us = side_to_move();
Color them = flip(us); Color them = flip(us);
@ -1142,11 +1143,11 @@ void Position::do_castle_move(Move m) {
void Position::undo_move(Move m) { void Position::undo_move(Move m) {
assert(move_is_ok(m)); assert(is_ok(m));
sideToMove = flip(sideToMove); sideToMove = flip(sideToMove);
if (move_is_castle(m)) if (is_castle(m))
{ {
undo_castle_move(m); undo_castle_move(m);
return; return;
@ -1156,8 +1157,8 @@ void Position::undo_move(Move m) {
Color them = flip(us); Color them = flip(us);
Square from = move_from(m); Square from = move_from(m);
Square to = move_to(m); Square to = move_to(m);
bool ep = move_is_ep(m); bool ep = is_enpassant(m);
bool pm = move_is_promotion(m); bool pm = is_promotion(m);
PieceType pt = type_of(piece_on(to)); PieceType pt = type_of(piece_on(to));
@ -1245,8 +1246,8 @@ void Position::undo_move(Move m) {
void Position::undo_castle_move(Move m) { void Position::undo_castle_move(Move m) {
assert(move_is_ok(m)); assert(is_ok(m));
assert(move_is_castle(m)); assert(is_castle(m));
// When we have arrived here, some work has already been done by // When we have arrived here, some work has already been done by
// Position::undo_move. In particular, the side to move has been switched, // Position::undo_move. In particular, the side to move has been switched,
@ -1375,7 +1376,7 @@ void Position::undo_null_move() {
int Position::see_sign(Move m) const { int Position::see_sign(Move m) const {
assert(move_is_ok(m)); assert(is_ok(m));
Square from = move_from(m); Square from = move_from(m);
Square to = move_to(m); Square to = move_to(m);
@ -1397,12 +1398,12 @@ int Position::see(Move m) const {
PieceType capturedType, pt; PieceType capturedType, pt;
Color stm; Color stm;
assert(move_is_ok(m)); assert(is_ok(m));
// As castle moves are implemented as capturing the rook, they have // As castle moves are implemented as capturing the rook, they have
// SEE == RookValueMidgame most of the times (unless the rook is under // SEE == RookValueMidgame most of the times (unless the rook is under
// attack). // attack).
if (move_is_castle(m)) if (is_castle(m))
return 0; return 0;
from = move_from(m); from = move_from(m);

View file

@ -148,13 +148,13 @@ public:
template<PieceType> Bitboard attacks_from(Square s, Color c) const; template<PieceType> Bitboard attacks_from(Square s, Color c) const;
// Properties of moves // Properties of moves
bool pl_move_is_legal(Move m, Bitboard pinned) const;
bool move_is_pl(const Move m) const;
bool move_gives_check(Move m, const CheckInfo& ci) const; bool move_gives_check(Move m, const CheckInfo& ci) const;
bool move_is_capture(Move m) const;
bool move_is_capture_or_promotion(Move m) const;
bool move_is_passed_pawn_push(Move m) const;
bool move_attacks_square(Move m, Square s) const; bool move_attacks_square(Move m, Square s) const;
bool pl_move_is_legal(Move m, Bitboard pinned) const;
bool is_pseudo_legal(const Move m) const;
bool is_capture(Move m) const;
bool is_capture_or_promotion(Move m) const;
bool is_passed_pawn_push(Move m) const;
// Piece captured with previous moves // Piece captured with previous moves
PieceType captured_piece_type() const; PieceType captured_piece_type() const;
@ -415,7 +415,7 @@ inline Value Position::non_pawn_material(Color c) const {
return st->npMaterial[c]; return st->npMaterial[c];
} }
inline bool Position::move_is_passed_pawn_push(Move m) const { inline bool Position::is_passed_pawn_push(Move m) const {
return board[move_from(m)] == make_piece(sideToMove, PAWN) return board[move_from(m)] == make_piece(sideToMove, PAWN)
&& pawn_is_passed(sideToMove, move_to(m)); && pawn_is_passed(sideToMove, move_to(m));
@ -440,17 +440,17 @@ inline bool Position::is_chess960() const {
return chess960; return chess960;
} }
inline bool Position::move_is_capture_or_promotion(Move m) const { inline bool Position::is_capture_or_promotion(Move m) const {
assert(move_is_ok(m)); assert(is_ok(m));
return move_is_special(m) ? !move_is_castle(m) : !square_is_empty(move_to(m)); return is_special(m) ? !is_castle(m) : !square_is_empty(move_to(m));
} }
inline bool Position::move_is_capture(Move m) const { inline bool Position::is_capture(Move m) const {
// Note that castle is coded as "king captures the rook" // Note that castle is coded as "king captures the rook"
assert(move_is_ok(m)); assert(is_ok(m));
return (!square_is_empty(move_to(m)) && !move_is_castle(m)) || move_is_ep(m); return (!square_is_empty(move_to(m)) && !is_castle(m)) || is_enpassant(m);
} }
inline PieceType Position::captured_piece_type() const { inline PieceType Position::captured_piece_type() const {

View file

@ -289,7 +289,7 @@ namespace {
&& type_of(pos.piece_on(move_to(m))) != PAWN && type_of(pos.piece_on(move_to(m))) != PAWN
&& ( pos.non_pawn_material(WHITE) + pos.non_pawn_material(BLACK) && ( pos.non_pawn_material(WHITE) + pos.non_pawn_material(BLACK)
- piece_value_midgame(pos.piece_on(move_to(m))) == VALUE_ZERO) - piece_value_midgame(pos.piece_on(move_to(m))) == VALUE_ZERO)
&& !move_is_special(m)) && !is_special(m))
{ {
result += PawnEndgameExtension[PvNode]; result += PawnEndgameExtension[PvNode];
*dangerous = true; *dangerous = true;
@ -783,7 +783,7 @@ namespace {
if ( value >= beta if ( value >= beta
&& move && move
&& !pos.move_is_capture_or_promotion(move) && !pos.is_capture_or_promotion(move)
&& move != ss->killers[0]) && move != ss->killers[0])
{ {
ss->killers[1] = ss->killers[0]; ss->killers[1] = ss->killers[0];
@ -972,7 +972,7 @@ split_point_start: // At split points actual search starts from here
&& (move = mp.get_next_move()) != MOVE_NONE && (move = mp.get_next_move()) != MOVE_NONE
&& !thread.cutoff_occurred()) && !thread.cutoff_occurred())
{ {
assert(move_is_ok(move)); assert(is_ok(move));
if (move == excludedMove) if (move == excludedMove)
continue; continue;
@ -1013,7 +1013,7 @@ split_point_start: // At split points actual search starts from here
// At Root and at first iteration do a PV search on all the moves to score root moves // At Root and at first iteration do a PV search on all the moves to score root moves
isPvMove = (PvNode && moveCount <= (RootNode && depth <= ONE_PLY ? MAX_MOVES : 1)); isPvMove = (PvNode && moveCount <= (RootNode && depth <= ONE_PLY ? MAX_MOVES : 1));
givesCheck = pos.move_gives_check(move, ci); givesCheck = pos.move_gives_check(move, ci);
captureOrPromotion = pos.move_is_capture_or_promotion(move); captureOrPromotion = pos.is_capture_or_promotion(move);
// Step 12. Decide the new search depth // Step 12. Decide the new search depth
ext = extension<PvNode>(pos, move, captureOrPromotion, givesCheck, &dangerous); ext = extension<PvNode>(pos, move, captureOrPromotion, givesCheck, &dangerous);
@ -1053,7 +1053,7 @@ split_point_start: // At split points actual search starts from here
&& !inCheck && !inCheck
&& !dangerous && !dangerous
&& move != ttMove && move != ttMove
&& !move_is_castle(move)) && !is_castle(move))
{ {
// Move count based pruning // Move count based pruning
if ( moveCount >= futility_move_count(depth) if ( moveCount >= futility_move_count(depth)
@ -1127,7 +1127,7 @@ split_point_start: // At split points actual search starts from here
if ( depth > 3 * ONE_PLY if ( depth > 3 * ONE_PLY
&& !captureOrPromotion && !captureOrPromotion
&& !dangerous && !dangerous
&& !move_is_castle(move) && !is_castle(move)
&& ss->killers[0] != move && ss->killers[0] != move
&& ss->killers[1] != move && ss->killers[1] != move
&& (ss->reduction = reduction<PvNode>(depth, moveCount)) != DEPTH_ZERO) && (ss->reduction = reduction<PvNode>(depth, moveCount)) != DEPTH_ZERO)
@ -1252,7 +1252,7 @@ split_point_start: // At split points actual search starts from here
// Update killers and history only for non capture moves that fails high // Update killers and history only for non capture moves that fails high
if ( bestValue >= beta if ( bestValue >= beta
&& !pos.move_is_capture_or_promotion(move)) && !pos.is_capture_or_promotion(move))
{ {
if (move != ss->killers[0]) if (move != ss->killers[0])
{ {
@ -1372,7 +1372,7 @@ split_point_start: // At split points actual search starts from here
while ( bestValue < beta while ( bestValue < beta
&& (move = mp.get_next_move()) != MOVE_NONE) && (move = mp.get_next_move()) != MOVE_NONE)
{ {
assert(move_is_ok(move)); assert(is_ok(move));
givesCheck = pos.move_gives_check(move, ci); givesCheck = pos.move_gives_check(move, ci);
@ -1382,12 +1382,12 @@ split_point_start: // At split points actual search starts from here
&& !givesCheck && !givesCheck
&& move != ttMove && move != ttMove
&& enoughMaterial && enoughMaterial
&& !move_is_promotion(move) && !is_promotion(move)
&& !pos.move_is_passed_pawn_push(move)) && !pos.is_passed_pawn_push(move))
{ {
futilityValue = futilityBase futilityValue = futilityBase
+ piece_value_endgame(pos.piece_on(move_to(move))) + piece_value_endgame(pos.piece_on(move_to(move)))
+ (move_is_ep(move) ? PawnValueEndgame : VALUE_ZERO); + (is_enpassant(move) ? PawnValueEndgame : VALUE_ZERO);
if (futilityValue < beta) if (futilityValue < beta)
{ {
@ -1408,14 +1408,14 @@ split_point_start: // At split points actual search starts from here
evasionPrunable = !PvNode evasionPrunable = !PvNode
&& inCheck && inCheck
&& bestValue > VALUE_MATED_IN_PLY_MAX && bestValue > VALUE_MATED_IN_PLY_MAX
&& !pos.move_is_capture(move) && !pos.is_capture(move)
&& !pos.can_castle(pos.side_to_move()); && !pos.can_castle(pos.side_to_move());
// Don't search moves with negative SEE values // Don't search moves with negative SEE values
if ( !PvNode if ( !PvNode
&& (!inCheck || evasionPrunable) && (!inCheck || evasionPrunable)
&& move != ttMove && move != ttMove
&& !move_is_promotion(move) && !is_promotion(move)
&& pos.see_sign(move) < 0) && pos.see_sign(move) < 0)
continue; continue;
@ -1424,7 +1424,7 @@ split_point_start: // At split points actual search starts from here
&& !inCheck && !inCheck
&& givesCheck && givesCheck
&& move != ttMove && move != ttMove
&& !pos.move_is_capture_or_promotion(move) && !pos.is_capture_or_promotion(move)
&& ss->eval + PawnValueMidgame / 4 < beta && ss->eval + PawnValueMidgame / 4 < beta
&& !check_is_dangerous(pos, move, futilityBase, beta, &bestValue)) && !check_is_dangerous(pos, move, futilityBase, beta, &bestValue))
{ {
@ -1548,8 +1548,8 @@ split_point_start: // At split points actual search starts from here
Piece p1, p2; Piece p1, p2;
Square ksq; Square ksq;
assert(move_is_ok(m1)); assert(is_ok(m1));
assert(move_is_ok(m2)); assert(is_ok(m2));
// Case 1: The moving piece is the same in both moves // Case 1: The moving piece is the same in both moves
f2 = move_from(m2); f2 = move_from(m2);
@ -1624,10 +1624,10 @@ split_point_start: // At split points actual search starts from here
bool connected_threat(const Position& pos, Move m, Move threat) { bool connected_threat(const Position& pos, Move m, Move threat) {
assert(move_is_ok(m)); assert(is_ok(m));
assert(move_is_ok(threat)); assert(is_ok(threat));
assert(!pos.move_is_capture_or_promotion(m)); assert(!pos.is_capture_or_promotion(m));
assert(!pos.move_is_passed_pawn_push(m)); assert(!pos.is_passed_pawn_push(m));
Square mfrom, mto, tfrom, tto; Square mfrom, mto, tfrom, tto;
@ -1642,7 +1642,7 @@ split_point_start: // At split points actual search starts from here
// Case 2: If the threatened piece has value less than or equal to the // Case 2: If the threatened piece has value less than or equal to the
// value of the threatening piece, don't prune moves which defend it. // value of the threatening piece, don't prune moves which defend it.
if ( pos.move_is_capture(threat) if ( pos.is_capture(threat)
&& ( piece_value_midgame(pos.piece_on(tfrom)) >= piece_value_midgame(pos.piece_on(tto)) && ( piece_value_midgame(pos.piece_on(tfrom)) >= piece_value_midgame(pos.piece_on(tto))
|| type_of(pos.piece_on(tfrom)) == KING) || type_of(pos.piece_on(tfrom)) == KING)
&& pos.move_attacks_square(m, tto)) && pos.move_attacks_square(m, tto))
@ -1722,7 +1722,7 @@ split_point_start: // At split points actual search starts from here
&& before != VALUE_NONE && before != VALUE_NONE
&& after != VALUE_NONE && after != VALUE_NONE
&& pos.captured_piece_type() == PIECE_TYPE_NONE && pos.captured_piece_type() == PIECE_TYPE_NONE
&& !move_is_special(m)) && !is_special(m))
H.update_gain(pos.piece_on(move_to(m)), move_to(m), -(before + after)); H.update_gain(pos.piece_on(move_to(m)), move_to(m), -(before + after));
} }
@ -2083,7 +2083,7 @@ split_point_start: // At split points actual search starts from here
int ply = 1; int ply = 1;
Move m = pv[0]; Move m = pv[0];
assert(m != MOVE_NONE && pos.move_is_pl(m)); assert(m != MOVE_NONE && pos.is_pseudo_legal(m));
pv.clear(); pv.clear();
pv.push_back(m); pv.push_back(m);
@ -2091,7 +2091,7 @@ split_point_start: // At split points actual search starts from here
while ( (tte = TT.probe(pos.get_key())) != NULL while ( (tte = TT.probe(pos.get_key())) != NULL
&& tte->move() != MOVE_NONE && tte->move() != MOVE_NONE
&& pos.move_is_pl(tte->move()) && pos.is_pseudo_legal(tte->move())
&& pos.pl_move_is_legal(tte->move(), pos.pinned_pieces()) && pos.pl_move_is_legal(tte->move(), pos.pinned_pieces())
&& ply < PLY_MAX && ply < PLY_MAX
&& (!pos.is_draw<false>() || ply < 2)) && (!pos.is_draw<false>() || ply < 2))
@ -2117,7 +2117,7 @@ split_point_start: // At split points actual search starts from here
Value v, m = VALUE_NONE; Value v, m = VALUE_NONE;
int ply = 0; int ply = 0;
assert(pv[0] != MOVE_NONE && pos.move_is_pl(pv[0])); assert(pv[0] != MOVE_NONE && pos.is_pseudo_legal(pv[0]));
do { do {
k = pos.get_key(); k = pos.get_key();