From: Marco Costalba Date: Sat, 21 Jan 2012 17:45:18 +0000 (+0100) Subject: Rename NON_CAPTURE to QUIET X-Git-Url: https://git.sesse.net/?p=stockfish;a=commitdiff_plain;h=6f6be95bad6f5371d9979de85f7f5892309b7aee;hp=b96db269a87549ceefaf8b812c050292f81b6c5c Rename NON_CAPTURE to QUIET It is a more conventional naming and is nicer. No functional change. Signed-off-by: Marco Costalba --- diff --git a/src/movegen.cpp b/src/movegen.cpp index cec98f00..bc5b9cde 100644 --- a/src/movegen.cpp +++ b/src/movegen.cpp @@ -112,7 +112,7 @@ namespace { 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); @@ -121,7 +121,7 @@ namespace { // 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 @@ -155,7 +155,7 @@ namespace { // 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(pawnsNotOn7) & emptySquares; b2 = move_pawns(b1 & TRank3BB) & emptySquares; @@ -166,7 +166,7 @@ namespace { b2 &= target; } - if (Type == MV_NON_CAPTURE_CHECK) + if (Type == MV_QUIET_CHECK) { b1 &= pos.attacks_from(ksq, Them); b2 &= pos.attacks_from(ksq, Them); @@ -302,7 +302,7 @@ namespace { /// generate generates all pseudo-legal captures and queen /// promotions. Returns a pointer to the end of the move list. /// -/// generate generates all pseudo-legal non-captures and +/// generate generates all pseudo-legal non-captures and /// underpromotions. Returns a pointer to the end of the move list. /// /// generate generates all pseudo-legal captures and @@ -311,7 +311,7 @@ namespace { template 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(); @@ -320,7 +320,7 @@ MoveStack* generate(const Position& pos, MoveStack* mlist) { 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) @@ -346,14 +346,14 @@ MoveStack* generate(const Position& pos, MoveStack* mlist) { // Explicit template instantiations template MoveStack* generate(const Position& pos, MoveStack* mlist); -template MoveStack* generate(const Position& pos, MoveStack* mlist); +template MoveStack* generate(const Position& pos, MoveStack* mlist); template MoveStack* generate(const Position& pos, MoveStack* mlist); -/// generate generates all pseudo-legal non-captures and knight +/// generate generates all pseudo-legal non-captures and knight /// underpromotions that give check. Returns a pointer to the end of the move list. template<> -MoveStack* generate(const Position& pos, MoveStack* mlist) { +MoveStack* generate(const Position& pos, MoveStack* mlist) { assert(!pos.in_check()); @@ -377,8 +377,8 @@ MoveStack* generate(const Position& pos, MoveStack* mlist) SERIALIZE(b); } - mlist = (us == WHITE ? generate_pawn_moves(pos, mlist, ci.dcCandidates, ci.ksq) - : generate_pawn_moves(pos, mlist, ci.dcCandidates, ci.ksq)); + mlist = (us == WHITE ? generate_pawn_moves(pos, mlist, ci.dcCandidates, ci.ksq) + : generate_pawn_moves(pos, mlist, ci.dcCandidates, ci.ksq)); mlist = generate_direct_checks(pos, mlist, us, ci); mlist = generate_direct_checks(pos, mlist, us, ci); diff --git a/src/movegen.h b/src/movegen.h index c5c6e3e2..68ae7059 100644 --- a/src/movegen.h +++ b/src/movegen.h @@ -24,8 +24,8 @@ enum MoveType { MV_CAPTURE, - MV_NON_CAPTURE, - MV_NON_CAPTURE_CHECK, + MV_QUIET, + MV_QUIET_CHECK, MV_EVASION, MV_NON_EVASION, MV_LEGAL diff --git a/src/movepick.cpp b/src/movepick.cpp index e5aef10d..a656cc2f 100644 --- a/src/movepick.cpp +++ b/src/movepick.cpp @@ -27,13 +27,13 @@ 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, - 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, - RECAPTURES, RECAPTURES_S6, STOP_S6 + RECAPTURES, CAPTURES_S6, STOP_S6 }; // 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); } -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)]; + curMove = lastMove = 0; phase = PROBCUT; if ( ttm != MOVE_NONE @@ -221,9 +222,8 @@ void MovePicker::next_phase() { 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(pos, moves); score_captures(); return; @@ -233,16 +233,16 @@ void MovePicker::next_phase() { lastMove = curMove + 2; return; - case NONCAPTURES_1_S1: - lastNonCapture = lastMove = generate(pos, moves); + case QUIETS_1_S1: + lastQuiet = lastMove = generate(pos, moves); score_noncaptures(); lastMove = std::partition(curMove, lastMove, has_positive_score); sort(curMove, lastMove); return; - case NONCAPTURES_2_S1: + case QUIETS_2_S1: curMove = lastMove; - lastMove = lastNonCapture; + lastMove = lastQuiet; if (depth >= 3 * ONE_PLY) sort(curMove, lastMove); return; @@ -260,8 +260,8 @@ void MovePicker::next_phase() { score_evasions(); return; - case CHECKS_S3: - lastMove = generate(pos, moves); + case QUIET_CHECKS_S3: + lastMove = generate(pos, moves); return; 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; break; - case GOOD_CAPTURES_S1: + case CAPTURES_S1: move = pick_best(curMove++, lastMove)->move; if (move != ttMove) { @@ -322,8 +322,8 @@ Move MovePicker::next_move() { return move; break; - 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 @@ -336,8 +336,7 @@ Move MovePicker::next_move() { 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; @@ -350,13 +349,13 @@ Move MovePicker::next_move() { return move; break; - case RECAPTURES_S6: + case CAPTURES_S6: move = (curMove++)->move; if (to_sq(move) == recaptureSquare) return move; break; - case CHECKS_S3: + case QUIET_CHECKS_S3: move = (curMove++)->move; if (move != ttMove) return move; diff --git a/src/movepick.h b/src/movepick.h index 317a0fc9..9aed12e1 100644 --- a/src/movepick.h +++ b/src/movepick.h @@ -56,7 +56,7 @@ private: MoveStack killers[2]; Square recaptureSquare; int captureThreshold, phase; - MoveStack *curMove, *lastMove, *lastNonCapture, *badCaptures; + MoveStack *curMove, *lastMove, *lastQuiet, *badCaptures; MoveStack moves[MAX_MOVES]; };