It is a more conventional naming and is nicer.
No functional change.
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
if (Type == MV_CAPTURE || Type == MV_EVASION || Type == MV_NON_EVASION)
(*mlist++).move = make_promotion(to - Delta, to, QUEEN);
if (Type == MV_CAPTURE || Type == MV_EVASION || Type == MV_NON_EVASION)
(*mlist++).move = make_promotion(to - Delta, to, QUEEN);
- if (Type == MV_NON_CAPTURE || Type == MV_EVASION || Type == MV_NON_EVASION)
+ if (Type == MV_QUIET || Type == MV_EVASION || Type == MV_NON_EVASION)
{
(*mlist++).move = make_promotion(to - Delta, to, ROOK);
(*mlist++).move = make_promotion(to - Delta, to, BISHOP);
{
(*mlist++).move = make_promotion(to - Delta, to, ROOK);
(*mlist++).move = make_promotion(to - Delta, to, BISHOP);
// Knight-promotion is the only one that can give a direct check not
// already included in the queen-promotion.
// Knight-promotion is the only one that can give a direct check not
// already included in the queen-promotion.
- if (Type == MV_NON_CAPTURE_CHECK && bit_is_set(StepAttacksBB[W_KNIGHT][to], ksq))
+ if (Type == MV_QUIET_CHECK && bit_is_set(StepAttacksBB[W_KNIGHT][to], ksq))
(*mlist++).move = make_promotion(to - Delta, to, KNIGHT);
else
(void)ksq; // Silence a warning under MSVC
(*mlist++).move = make_promotion(to - Delta, to, KNIGHT);
else
(void)ksq; // Silence a warning under MSVC
// Single and double pawn pushes, no promotions
if (Type != MV_CAPTURE)
{
// Single and double pawn pushes, no promotions
if (Type != MV_CAPTURE)
{
- emptySquares = (Type == MV_NON_CAPTURE ? target : pos.empty_squares());
+ emptySquares = (Type == MV_QUIET ? target : pos.empty_squares());
b1 = move_pawns<UP>(pawnsNotOn7) & emptySquares;
b2 = move_pawns<UP>(b1 & TRank3BB) & emptySquares;
b1 = move_pawns<UP>(pawnsNotOn7) & emptySquares;
b2 = move_pawns<UP>(b1 & TRank3BB) & emptySquares;
- if (Type == MV_NON_CAPTURE_CHECK)
+ if (Type == MV_QUIET_CHECK)
{
b1 &= pos.attacks_from<PAWN>(ksq, Them);
b2 &= pos.attacks_from<PAWN>(ksq, Them);
{
b1 &= pos.attacks_from<PAWN>(ksq, Them);
b2 &= pos.attacks_from<PAWN>(ksq, Them);
/// generate<MV_CAPTURE> generates all pseudo-legal captures and queen
/// promotions. Returns a pointer to the end of the move list.
///
/// generate<MV_CAPTURE> generates all pseudo-legal captures and queen
/// promotions. Returns a pointer to the end of the move list.
///
-/// generate<MV_NON_CAPTURE> generates all pseudo-legal non-captures and
+/// generate<MV_QUIET> generates all pseudo-legal non-captures and
/// underpromotions. Returns a pointer to the end of the move list.
///
/// generate<MV_NON_EVASION> generates all pseudo-legal captures and
/// underpromotions. Returns a pointer to the end of the move list.
///
/// generate<MV_NON_EVASION> generates all pseudo-legal captures and
template<MoveType Type>
MoveStack* generate(const Position& pos, MoveStack* mlist) {
template<MoveType Type>
MoveStack* generate(const Position& pos, MoveStack* mlist) {
- assert(Type == MV_CAPTURE || Type == MV_NON_CAPTURE || Type == MV_NON_EVASION);
+ assert(Type == MV_CAPTURE || Type == MV_QUIET || Type == MV_NON_EVASION);
assert(!pos.in_check());
Color us = pos.side_to_move();
assert(!pos.in_check());
Color us = pos.side_to_move();
if (Type == MV_CAPTURE)
target = pos.pieces(~us);
if (Type == MV_CAPTURE)
target = pos.pieces(~us);
- else if (Type == MV_NON_CAPTURE)
+ else if (Type == MV_QUIET)
target = pos.empty_squares();
else if (Type == MV_NON_EVASION)
target = pos.empty_squares();
else if (Type == MV_NON_EVASION)
// Explicit template instantiations
template MoveStack* generate<MV_CAPTURE>(const Position& pos, MoveStack* mlist);
// Explicit template instantiations
template MoveStack* generate<MV_CAPTURE>(const Position& pos, MoveStack* mlist);
-template MoveStack* generate<MV_NON_CAPTURE>(const Position& pos, MoveStack* mlist);
+template MoveStack* generate<MV_QUIET>(const Position& pos, MoveStack* mlist);
template MoveStack* generate<MV_NON_EVASION>(const Position& pos, MoveStack* mlist);
template MoveStack* generate<MV_NON_EVASION>(const Position& pos, MoveStack* mlist);
-/// generate<MV_NON_CAPTURE_CHECK> generates all pseudo-legal non-captures and knight
+/// generate<MV_QUIET_CHECK> generates all pseudo-legal non-captures and knight
/// underpromotions that give check. Returns a pointer to the end of the move list.
template<>
/// underpromotions that give check. Returns a pointer to the end of the move list.
template<>
-MoveStack* generate<MV_NON_CAPTURE_CHECK>(const Position& pos, MoveStack* mlist) {
+MoveStack* generate<MV_QUIET_CHECK>(const Position& pos, MoveStack* mlist) {
- mlist = (us == WHITE ? generate_pawn_moves<WHITE, MV_NON_CAPTURE_CHECK>(pos, mlist, ci.dcCandidates, ci.ksq)
- : generate_pawn_moves<BLACK, MV_NON_CAPTURE_CHECK>(pos, mlist, ci.dcCandidates, ci.ksq));
+ mlist = (us == WHITE ? generate_pawn_moves<WHITE, MV_QUIET_CHECK>(pos, mlist, ci.dcCandidates, ci.ksq)
+ : generate_pawn_moves<BLACK, MV_QUIET_CHECK>(pos, mlist, ci.dcCandidates, ci.ksq));
mlist = generate_direct_checks<KNIGHT>(pos, mlist, us, ci);
mlist = generate_direct_checks<BISHOP>(pos, mlist, us, ci);
mlist = generate_direct_checks<KNIGHT>(pos, mlist, us, ci);
mlist = generate_direct_checks<BISHOP>(pos, mlist, us, ci);
enum MoveType {
MV_CAPTURE,
enum MoveType {
MV_CAPTURE,
- MV_NON_CAPTURE,
- MV_NON_CAPTURE_CHECK,
+ MV_QUIET,
+ MV_QUIET_CHECK,
MV_EVASION,
MV_NON_EVASION,
MV_LEGAL
MV_EVASION,
MV_NON_EVASION,
MV_LEGAL
namespace {
enum Sequencer {
namespace {
enum Sequencer {
- MAIN_SEARCH, TT_MOVE_S1, GOOD_CAPTURES_S1, KILLERS_S1, NONCAPTURES_1_S1,
- NONCAPTURES_2_S1, BAD_CAPTURES_S1, STOP_S1,
+ MAIN_SEARCH, TT_MOVE_S1, CAPTURES_S1, KILLERS_S1, QUIETS_1_S1,
+ QUIETS_2_S1, BAD_CAPTURES_S1, STOP_S1,
EVASIONS, TT_MOVE_S2, EVASIONS_S2, STOP_S2,
EVASIONS, TT_MOVE_S2, EVASIONS_S2, STOP_S2,
- CAPTURES_AND_CHECKS, TT_MOVE_S3, CAPTURES_S3, CHECKS_S3, STOP_S3,
+ CAPTURES_AND_CHECKS, TT_MOVE_S3, CAPTURES_S3, QUIET_CHECKS_S3, STOP_S3,
CAPTURES, TT_MOVE_S4, CAPTURES_S4, STOP_S4,
PROBCUT, TT_MOVE_S5, CAPTURES_S5, STOP_S5,
CAPTURES, TT_MOVE_S4, CAPTURES_S4, STOP_S4,
PROBCUT, TT_MOVE_S5, CAPTURES_S5, STOP_S5,
- RECAPTURES, RECAPTURES_S6, STOP_S6
+ RECAPTURES, CAPTURES_S6, STOP_S6
};
// Unary predicate used by std::partition to split positive scores from remaining
};
// Unary predicate used by std::partition to split positive scores from remaining
phase += (ttMove == MOVE_NONE);
}
phase += (ttMove == MOVE_NONE);
}
-MovePicker::MovePicker(const Position& p, Move ttm, const History& h, PieceType parentCapture)
- : pos(p), H(h), curMove(0), lastMove(0) {
+MovePicker::MovePicker(const Position& p, Move ttm, const History& h,
+ PieceType parentCapture) : pos(p), H(h) {
assert (!pos.in_check());
// In ProbCut we consider only captures better than parent's move
captureThreshold = PieceValueMidgame[Piece(parentCapture)];
assert (!pos.in_check());
// In ProbCut we consider only captures better than parent's move
captureThreshold = PieceValueMidgame[Piece(parentCapture)];
+ curMove = lastMove = 0;
phase = PROBCUT;
if ( ttm != MOVE_NONE
phase = PROBCUT;
if ( ttm != MOVE_NONE
lastMove = curMove + 1;
return;
lastMove = curMove + 1;
return;
- case GOOD_CAPTURES_S1:
- case CAPTURES_S3: case CAPTURES_S4: case CAPTURES_S5:
- case RECAPTURES_S6:
+ case CAPTURES_S1: case CAPTURES_S3: case CAPTURES_S4:
+ case CAPTURES_S5: case CAPTURES_S6:
lastMove = generate<MV_CAPTURE>(pos, moves);
score_captures();
return;
lastMove = generate<MV_CAPTURE>(pos, moves);
score_captures();
return;
lastMove = curMove + 2;
return;
lastMove = curMove + 2;
return;
- case NONCAPTURES_1_S1:
- lastNonCapture = lastMove = generate<MV_NON_CAPTURE>(pos, moves);
+ case QUIETS_1_S1:
+ lastQuiet = lastMove = generate<MV_QUIET>(pos, moves);
score_noncaptures();
lastMove = std::partition(curMove, lastMove, has_positive_score);
sort<MoveStack>(curMove, lastMove);
return;
score_noncaptures();
lastMove = std::partition(curMove, lastMove, has_positive_score);
sort<MoveStack>(curMove, lastMove);
return;
- lastMove = lastNonCapture;
if (depth >= 3 * ONE_PLY)
sort<MoveStack>(curMove, lastMove);
return;
if (depth >= 3 * ONE_PLY)
sort<MoveStack>(curMove, lastMove);
return;
score_evasions();
return;
score_evasions();
return;
- case CHECKS_S3:
- lastMove = generate<MV_NON_CAPTURE_CHECK>(pos, moves);
+ case QUIET_CHECKS_S3:
+ lastMove = generate<MV_QUIET_CHECK>(pos, moves);
return;
case STOP_S1: case STOP_S2: case STOP_S3: case STOP_S4: case STOP_S5: case STOP_S6:
return;
case STOP_S1: case STOP_S2: case STOP_S3: case STOP_S4: case STOP_S5: case STOP_S6:
move = pick_best(curMove++, lastMove)->move;
if (move != ttMove)
{
move = pick_best(curMove++, lastMove)->move;
if (move != ttMove)
{
- case NONCAPTURES_1_S1:
- case NONCAPTURES_2_S1:
+ case QUIETS_1_S1:
+ case QUIETS_2_S1:
move = (curMove++)->move;
if ( move != ttMove
&& move != killers[0].move
move = (curMove++)->move;
if ( move != ttMove
&& move != killers[0].move
return move;
case EVASIONS_S2:
return move;
case EVASIONS_S2:
- case CAPTURES_S3:
- case CAPTURES_S4:
+ case CAPTURES_S3: case CAPTURES_S4:
move = pick_best(curMove++, lastMove)->move;
if (move != ttMove)
return move;
move = pick_best(curMove++, lastMove)->move;
if (move != ttMove)
return move;
move = (curMove++)->move;
if (to_sq(move) == recaptureSquare)
return move;
break;
move = (curMove++)->move;
if (to_sq(move) == recaptureSquare)
return move;
break;
move = (curMove++)->move;
if (move != ttMove)
return move;
move = (curMove++)->move;
if (move != ttMove)
return move;
MoveStack killers[2];
Square recaptureSquare;
int captureThreshold, phase;
MoveStack killers[2];
Square recaptureSquare;
int captureThreshold, phase;
- MoveStack *curMove, *lastMove, *lastNonCapture, *badCaptures;
+ MoveStack *curMove, *lastMove, *lastQuiet, *badCaptures;
MoveStack moves[MAX_MOVES];
};
MoveStack moves[MAX_MOVES];
};