From 3e0753bef36e5efeed700d7277187f6fbd7275f5 Mon Sep 17 00:00:00 2001 From: Marco Costalba Date: Thu, 11 Jun 2009 11:04:05 +0200 Subject: [PATCH] MovePicker doesn't need to know if called from a pv node This was needed by an old optimization in sorting of non-captures that is now obsoleted by new std::sort() approach. Remove also the unused depth member data. Interestingly this has always been unused since the Glaurung days. No functional change. Signed-off-by: Marco Costalba --- src/movepick.cpp | 15 +++++---------- src/movepick.h | 4 +--- src/san.cpp | 4 ++-- src/search.cpp | 6 +++--- 4 files changed, 11 insertions(+), 18 deletions(-) diff --git a/src/movepick.cpp b/src/movepick.cpp index 7906eb75..4b08e1b4 100644 --- a/src/movepick.cpp +++ b/src/movepick.cpp @@ -63,10 +63,8 @@ namespace { /// search captures, promotions and some checks) and about how important good /// move ordering is at the current node. -MovePicker::MovePicker(const Position& p, bool pv, Move ttm, Depth d, +MovePicker::MovePicker(const Position& p, Move ttm, Depth d, const History& h, SearchStack* ss) : pos(p), H(h) { - - pvNode = pv; ttMove = ttm; if (ss) { @@ -76,17 +74,14 @@ MovePicker::MovePicker(const Position& p, bool pv, Move ttm, Depth d, } else mateKiller = killer1 = killer2 = MOVE_NONE; - depth = d; - movesPicked = 0; - numOfMoves = 0; - numOfBadCaptures = 0; - checkKillers = checkLegal = false; + movesPicked = numOfMoves = numOfBadCaptures = 0; + checkKillers = checkLegal = finished = false; if (p.is_check()) phaseIndex = EvasionsPhaseIndex; - else if (depth > Depth(0)) + else if (d > Depth(0)) phaseIndex = MainSearchPhaseIndex; - else if (depth == Depth(0)) + else if (d == Depth(0)) phaseIndex = QsearchWithChecksPhaseIndex; else phaseIndex = QsearchWithoutChecksPhaseIndex; diff --git a/src/movepick.h b/src/movepick.h index 94a0e5f9..bcd5eb14 100644 --- a/src/movepick.h +++ b/src/movepick.h @@ -65,7 +65,7 @@ public: PH_STOP }; - MovePicker(const Position& p, bool pvnode, Move ttm, Depth d, const History& h, SearchStack* ss = NULL); + MovePicker(const Position& p, Move ttm, Depth d, const History& h, SearchStack* ss = NULL); Move get_next_move(); Move get_next_move(Lock& lock); int number_of_moves() const; @@ -85,8 +85,6 @@ private: Move ttMove, mateKiller, killer1, killer2; Bitboard pinned, dc; MoveStack moves[256], badCaptures[64]; - bool pvNode; - Depth depth; int phaseIndex; int numOfMoves, numOfBadCaptures; int movesPicked; diff --git a/src/san.cpp b/src/san.cpp index fad47f95..b53b2013 100644 --- a/src/san.cpp +++ b/src/san.cpp @@ -141,7 +141,7 @@ Move move_from_san(const Position& pos, const string& movestr) { assert(pos.is_ok()); - MovePicker mp = MovePicker(pos, false, MOVE_NONE, OnePly, H); + MovePicker mp = MovePicker(pos, MOVE_NONE, OnePly, H); // Castling moves if (movestr == "O-O-O" || movestr == "O-O-O+") @@ -365,7 +365,7 @@ namespace { if (type_of_piece(pc) == KING) return AMBIGUITY_NONE; - MovePicker mp = MovePicker(pos, false, MOVE_NONE, OnePly, H); + MovePicker mp = MovePicker(pos, MOVE_NONE, OnePly, H); Move mv, moveList[8]; int n = 0; diff --git a/src/search.cpp b/src/search.cpp index a6e2c341..8021f0f5 100644 --- a/src/search.cpp +++ b/src/search.cpp @@ -1054,7 +1054,7 @@ namespace { // Initialize a MovePicker object for the current position, and prepare // to search all moves - MovePicker mp = MovePicker(pos, true, ttMove, depth, Threads[threadID].H, &ss[ply]); + MovePicker mp = MovePicker(pos, ttMove, depth, Threads[threadID].H, &ss[ply]); Move move, movesSearched[256]; int moveCount = 0; @@ -1315,7 +1315,7 @@ namespace { // Initialize a MovePicker object for the current position, and prepare // to search all moves: - MovePicker mp = MovePicker(pos, false, ttMove, depth, Threads[threadID].H, &ss[ply]); + MovePicker mp = MovePicker(pos, ttMove, depth, Threads[threadID].H, &ss[ply]); Move move, movesSearched[256]; int moveCount = 0; @@ -1535,7 +1535,7 @@ namespace { // Initialize a MovePicker object for the current position, and prepare // to search the moves. Because the depth is <= 0 here, only captures, // queen promotions and checks (only if depth == 0) will be generated. - MovePicker mp = MovePicker(pos, pvNode, ttMove, depth, Threads[threadID].H); + MovePicker mp = MovePicker(pos, ttMove, depth, Threads[threadID].H); Move move; int moveCount = 0; Bitboard dcCandidates = mp.discovered_check_candidates(); -- 2.39.2