mirror of
https://github.com/sockspls/badfish
synced 2025-07-11 19:49:14 +00:00
Rename NON_CAPTURE to QUIET
It is a more conventional naming and is nicer. No functional change. Signed-off-by: Marco Costalba <mcostalba@gmail.com>
This commit is contained in:
parent
b96db269a8
commit
6f6be95bad
4 changed files with 36 additions and 37 deletions
|
@ -112,7 +112,7 @@ namespace {
|
||||||
if (Type == MV_CAPTURE || Type == MV_EVASION || Type == MV_NON_EVASION)
|
if (Type == MV_CAPTURE || Type == MV_EVASION || Type == MV_NON_EVASION)
|
||||||
(*mlist++).move = make_promotion(to - Delta, to, QUEEN);
|
(*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, ROOK);
|
||||||
(*mlist++).move = make_promotion(to - Delta, to, BISHOP);
|
(*mlist++).move = make_promotion(to - Delta, to, BISHOP);
|
||||||
|
@ -121,7 +121,7 @@ namespace {
|
||||||
|
|
||||||
// Knight-promotion is the only one that can give a direct check not
|
// Knight-promotion is the only one that can give a direct check not
|
||||||
// already included in the queen-promotion.
|
// 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);
|
(*mlist++).move = make_promotion(to - Delta, to, KNIGHT);
|
||||||
else
|
else
|
||||||
(void)ksq; // Silence a warning under MSVC
|
(void)ksq; // Silence a warning under MSVC
|
||||||
|
@ -155,7 +155,7 @@ namespace {
|
||||||
// Single and double pawn pushes, no promotions
|
// Single and double pawn pushes, no promotions
|
||||||
if (Type != MV_CAPTURE)
|
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;
|
b1 = move_pawns<UP>(pawnsNotOn7) & emptySquares;
|
||||||
b2 = move_pawns<UP>(b1 & TRank3BB) & emptySquares;
|
b2 = move_pawns<UP>(b1 & TRank3BB) & emptySquares;
|
||||||
|
@ -166,7 +166,7 @@ namespace {
|
||||||
b2 &= target;
|
b2 &= target;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Type == MV_NON_CAPTURE_CHECK)
|
if (Type == MV_QUIET_CHECK)
|
||||||
{
|
{
|
||||||
b1 &= pos.attacks_from<PAWN>(ksq, Them);
|
b1 &= pos.attacks_from<PAWN>(ksq, Them);
|
||||||
b2 &= pos.attacks_from<PAWN>(ksq, Them);
|
b2 &= pos.attacks_from<PAWN>(ksq, Them);
|
||||||
|
@ -302,7 +302,7 @@ namespace {
|
||||||
/// generate<MV_CAPTURE> generates all pseudo-legal captures and queen
|
/// generate<MV_CAPTURE> generates all pseudo-legal captures and queen
|
||||||
/// promotions. Returns a pointer to the end of the move list.
|
/// 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.
|
/// underpromotions. Returns a pointer to the end of the move list.
|
||||||
///
|
///
|
||||||
/// generate<MV_NON_EVASION> generates all pseudo-legal captures and
|
/// generate<MV_NON_EVASION> generates all pseudo-legal captures and
|
||||||
|
@ -311,7 +311,7 @@ namespace {
|
||||||
template<MoveType Type>
|
template<MoveType Type>
|
||||||
MoveStack* generate(const Position& pos, MoveStack* mlist) {
|
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());
|
assert(!pos.in_check());
|
||||||
|
|
||||||
Color us = pos.side_to_move();
|
Color us = pos.side_to_move();
|
||||||
|
@ -320,7 +320,7 @@ MoveStack* generate(const Position& pos, MoveStack* mlist) {
|
||||||
if (Type == MV_CAPTURE)
|
if (Type == MV_CAPTURE)
|
||||||
target = pos.pieces(~us);
|
target = pos.pieces(~us);
|
||||||
|
|
||||||
else if (Type == MV_NON_CAPTURE)
|
else if (Type == MV_QUIET)
|
||||||
target = pos.empty_squares();
|
target = pos.empty_squares();
|
||||||
|
|
||||||
else if (Type == MV_NON_EVASION)
|
else if (Type == MV_NON_EVASION)
|
||||||
|
@ -346,14 +346,14 @@ MoveStack* generate(const Position& pos, MoveStack* mlist) {
|
||||||
|
|
||||||
// Explicit template instantiations
|
// Explicit template instantiations
|
||||||
template MoveStack* generate<MV_CAPTURE>(const Position& pos, MoveStack* mlist);
|
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.
|
/// underpromotions that give check. Returns a pointer to the end of the move list.
|
||||||
template<>
|
template<>
|
||||||
MoveStack* generate<MV_NON_CAPTURE_CHECK>(const Position& pos, MoveStack* mlist) {
|
MoveStack* generate<MV_QUIET_CHECK>(const Position& pos, MoveStack* mlist) {
|
||||||
|
|
||||||
assert(!pos.in_check());
|
assert(!pos.in_check());
|
||||||
|
|
||||||
|
@ -377,8 +377,8 @@ MoveStack* generate<MV_NON_CAPTURE_CHECK>(const Position& pos, MoveStack* mlist)
|
||||||
SERIALIZE(b);
|
SERIALIZE(b);
|
||||||
}
|
}
|
||||||
|
|
||||||
mlist = (us == WHITE ? generate_pawn_moves<WHITE, 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_NON_CAPTURE_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<KNIGHT>(pos, mlist, us, ci);
|
||||||
mlist = generate_direct_checks<BISHOP>(pos, mlist, us, ci);
|
mlist = generate_direct_checks<BISHOP>(pos, mlist, us, ci);
|
||||||
|
|
|
@ -24,8 +24,8 @@
|
||||||
|
|
||||||
enum MoveType {
|
enum MoveType {
|
||||||
MV_CAPTURE,
|
MV_CAPTURE,
|
||||||
MV_NON_CAPTURE,
|
MV_QUIET,
|
||||||
MV_NON_CAPTURE_CHECK,
|
MV_QUIET_CHECK,
|
||||||
MV_EVASION,
|
MV_EVASION,
|
||||||
MV_NON_EVASION,
|
MV_NON_EVASION,
|
||||||
MV_LEGAL
|
MV_LEGAL
|
||||||
|
|
|
@ -27,13 +27,13 @@
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
enum Sequencer {
|
enum Sequencer {
|
||||||
MAIN_SEARCH, TT_MOVE_S1, GOOD_CAPTURES_S1, KILLERS_S1, NONCAPTURES_1_S1,
|
MAIN_SEARCH, TT_MOVE_S1, CAPTURES_S1, KILLERS_S1, QUIETS_1_S1,
|
||||||
NONCAPTURES_2_S1, BAD_CAPTURES_S1, STOP_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,
|
CAPTURES, TT_MOVE_S4, CAPTURES_S4, STOP_S4,
|
||||||
PROBCUT, TT_MOVE_S5, CAPTURES_S5, STOP_S5,
|
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
|
||||||
|
@ -121,13 +121,14 @@ MovePicker::MovePicker(const Position& p, Move ttm, Depth d, const History& h,
|
||||||
phase += (ttMove == MOVE_NONE);
|
phase += (ttMove == MOVE_NONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
MovePicker::MovePicker(const Position& p, Move ttm, const History& h, PieceType parentCapture)
|
MovePicker::MovePicker(const Position& p, Move ttm, const History& h,
|
||||||
: pos(p), H(h), curMove(0), lastMove(0) {
|
PieceType parentCapture) : pos(p), H(h) {
|
||||||
|
|
||||||
assert (!pos.in_check());
|
assert (!pos.in_check());
|
||||||
|
|
||||||
// In ProbCut we consider only captures better than parent's move
|
// In ProbCut we consider only captures better than parent's move
|
||||||
captureThreshold = PieceValueMidgame[Piece(parentCapture)];
|
captureThreshold = PieceValueMidgame[Piece(parentCapture)];
|
||||||
|
curMove = lastMove = 0;
|
||||||
phase = PROBCUT;
|
phase = PROBCUT;
|
||||||
|
|
||||||
if ( ttm != MOVE_NONE
|
if ( ttm != MOVE_NONE
|
||||||
|
@ -221,9 +222,8 @@ void MovePicker::next_phase() {
|
||||||
lastMove = curMove + 1;
|
lastMove = curMove + 1;
|
||||||
return;
|
return;
|
||||||
|
|
||||||
case GOOD_CAPTURES_S1:
|
case CAPTURES_S1: case CAPTURES_S3: case CAPTURES_S4:
|
||||||
case CAPTURES_S3: case CAPTURES_S4: case CAPTURES_S5:
|
case CAPTURES_S5: case CAPTURES_S6:
|
||||||
case RECAPTURES_S6:
|
|
||||||
lastMove = generate<MV_CAPTURE>(pos, moves);
|
lastMove = generate<MV_CAPTURE>(pos, moves);
|
||||||
score_captures();
|
score_captures();
|
||||||
return;
|
return;
|
||||||
|
@ -233,16 +233,16 @@ void MovePicker::next_phase() {
|
||||||
lastMove = curMove + 2;
|
lastMove = curMove + 2;
|
||||||
return;
|
return;
|
||||||
|
|
||||||
case NONCAPTURES_1_S1:
|
case QUIETS_1_S1:
|
||||||
lastNonCapture = lastMove = generate<MV_NON_CAPTURE>(pos, moves);
|
lastQuiet = lastMove = generate<MV_QUIET>(pos, moves);
|
||||||
score_noncaptures();
|
score_noncaptures();
|
||||||
lastMove = std::partition(curMove, lastMove, has_positive_score);
|
lastMove = std::partition(curMove, lastMove, has_positive_score);
|
||||||
sort<MoveStack>(curMove, lastMove);
|
sort<MoveStack>(curMove, lastMove);
|
||||||
return;
|
return;
|
||||||
|
|
||||||
case NONCAPTURES_2_S1:
|
case QUIETS_2_S1:
|
||||||
curMove = lastMove;
|
curMove = lastMove;
|
||||||
lastMove = lastNonCapture;
|
lastMove = lastQuiet;
|
||||||
if (depth >= 3 * ONE_PLY)
|
if (depth >= 3 * ONE_PLY)
|
||||||
sort<MoveStack>(curMove, lastMove);
|
sort<MoveStack>(curMove, lastMove);
|
||||||
return;
|
return;
|
||||||
|
@ -260,8 +260,8 @@ void MovePicker::next_phase() {
|
||||||
score_evasions();
|
score_evasions();
|
||||||
return;
|
return;
|
||||||
|
|
||||||
case CHECKS_S3:
|
case QUIET_CHECKS_S3:
|
||||||
lastMove = generate<MV_NON_CAPTURE_CHECK>(pos, moves);
|
lastMove = generate<MV_QUIET_CHECK>(pos, moves);
|
||||||
return;
|
return;
|
||||||
|
|
||||||
case STOP_S1: case STOP_S2: case STOP_S3: case STOP_S4: case STOP_S5: case STOP_S6:
|
case STOP_S1: case STOP_S2: case STOP_S3: case STOP_S4: case STOP_S5: case STOP_S6:
|
||||||
|
@ -297,7 +297,7 @@ Move MovePicker::next_move() {
|
||||||
return ttMove;
|
return ttMove;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case GOOD_CAPTURES_S1:
|
case CAPTURES_S1:
|
||||||
move = pick_best(curMove++, lastMove)->move;
|
move = pick_best(curMove++, lastMove)->move;
|
||||||
if (move != ttMove)
|
if (move != ttMove)
|
||||||
{
|
{
|
||||||
|
@ -322,8 +322,8 @@ Move MovePicker::next_move() {
|
||||||
return move;
|
return move;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case NONCAPTURES_1_S1:
|
case QUIETS_1_S1:
|
||||||
case NONCAPTURES_2_S1:
|
case QUIETS_2_S1:
|
||||||
move = (curMove++)->move;
|
move = (curMove++)->move;
|
||||||
if ( move != ttMove
|
if ( move != ttMove
|
||||||
&& move != killers[0].move
|
&& move != killers[0].move
|
||||||
|
@ -336,8 +336,7 @@ Move MovePicker::next_move() {
|
||||||
return move;
|
return move;
|
||||||
|
|
||||||
case EVASIONS_S2:
|
case EVASIONS_S2:
|
||||||
case CAPTURES_S3:
|
case CAPTURES_S3: case CAPTURES_S4:
|
||||||
case CAPTURES_S4:
|
|
||||||
move = pick_best(curMove++, lastMove)->move;
|
move = pick_best(curMove++, lastMove)->move;
|
||||||
if (move != ttMove)
|
if (move != ttMove)
|
||||||
return move;
|
return move;
|
||||||
|
@ -350,13 +349,13 @@ Move MovePicker::next_move() {
|
||||||
return move;
|
return move;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case RECAPTURES_S6:
|
case CAPTURES_S6:
|
||||||
move = (curMove++)->move;
|
move = (curMove++)->move;
|
||||||
if (to_sq(move) == recaptureSquare)
|
if (to_sq(move) == recaptureSquare)
|
||||||
return move;
|
return move;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CHECKS_S3:
|
case QUIET_CHECKS_S3:
|
||||||
move = (curMove++)->move;
|
move = (curMove++)->move;
|
||||||
if (move != ttMove)
|
if (move != ttMove)
|
||||||
return move;
|
return move;
|
||||||
|
|
|
@ -56,7 +56,7 @@ private:
|
||||||
MoveStack killers[2];
|
MoveStack killers[2];
|
||||||
Square recaptureSquare;
|
Square recaptureSquare;
|
||||||
int captureThreshold, phase;
|
int captureThreshold, phase;
|
||||||
MoveStack *curMove, *lastMove, *lastNonCapture, *badCaptures;
|
MoveStack *curMove, *lastMove, *lastQuiet, *badCaptures;
|
||||||
MoveStack moves[MAX_MOVES];
|
MoveStack moves[MAX_MOVES];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue