From 8f51f09de7813ebc0f5f3efb9d0c142b884faeb3 Mon Sep 17 00:00:00 2001 From: Marco Costalba Date: Sat, 28 May 2011 12:57:36 +0100 Subject: [PATCH] Unify MovePickerExt template parameters No functional change. Signed-off-by: Marco Costalba --- src/search.cpp | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/src/search.cpp b/src/search.cpp index cea95b47..ae62d312 100644 --- a/src/search.cpp +++ b/src/search.cpp @@ -96,7 +96,7 @@ namespace { // MovePickerExt template class extends MovePicker and allows to choose at compile // time the proper moves source according to the type of node. In the default case // we simply create and use a standard MovePicker object. - template struct MovePickerExt : public MovePicker { + template struct MovePickerExt : public MovePicker { MovePickerExt(const Position& p, Move ttm, Depth d, const History& h, SearchStack* ss, Value b) : MovePicker(p, ttm, d, h, ss, b) {} @@ -105,19 +105,23 @@ namespace { }; // In case of a SpNode we use split point's shared MovePicker object as moves source - template<> struct MovePickerExt : public MovePicker { + template<> struct MovePickerExt : public MovePickerExt { MovePickerExt(const Position& p, Move ttm, Depth d, const History& h, SearchStack* ss, Value b) - : MovePicker(p, ttm, d, h, ss, b), mp(ss->sp->mp) {} + : MovePickerExt(p, ttm, d, h, ss, b), mp(ss->sp->mp) {} Move get_next_move() { return mp->get_next_move(); } - - RootMoveList::iterator rm; // Dummy, needed to compile MovePicker* mp; }; + template<> struct MovePickerExt : public MovePickerExt { + + MovePickerExt(const Position& p, Move ttm, Depth d, const History& h, SearchStack* ss, Value b) + : MovePickerExt(p, ttm, d, h, ss, b) {} + }; + // In case of a Root node we use RootMoveList as moves source - template<> struct MovePickerExt : public MovePicker { + template<> struct MovePickerExt : public MovePicker { MovePickerExt(const Position&, Move, Depth, const History&, SearchStack*, Value); Move get_next_move(); @@ -876,7 +880,7 @@ namespace { split_point_start: // At split points actual search starts from here // Initialize a MovePicker object for the current position - MovePickerExt mp(pos, ttMove, depth, H, ss, (PvNode ? -VALUE_INFINITE : beta)); + MovePickerExt mp(pos, ttMove, depth, H, ss, PvNode ? -VALUE_INFINITE : beta); CheckInfo ci(pos); Bitboard pinned = pos.pinned_pieces(pos.side_to_move()); ss->bestMove = MOVE_NONE; @@ -895,7 +899,7 @@ split_point_start: // At split points actual search starts from here } // Step 10. Loop through moves - // Loop through all legal moves until no moves remain or a beta cutoff occurs + // Loop through all pseudo-legal moves until no moves remain or a beta cutoff occurs while ( bestValue < beta && (move = mp.get_next_move()) != MOVE_NONE && !Threads[threadID].cutoff_occurred()) @@ -2077,9 +2081,9 @@ split_point_start: // At split points actual search starts from here } // Specializations for MovePickerExt in case of Root node - MovePickerExt::MovePickerExt(const Position& p, Move ttm, Depth d, + MovePickerExt::MovePickerExt(const Position& p, Move ttm, Depth d, const History& h, SearchStack* ss, Value b) - : MovePicker(p, ttm, d, h, ss, b), firstCall(true) { + : MovePicker(p, ttm, d, h, ss, b), firstCall(true) { Move move; Value score = VALUE_ZERO; @@ -2099,7 +2103,7 @@ split_point_start: // At split points actual search starts from here rm = Rml.begin(); } - Move MovePickerExt::get_next_move() { + Move MovePickerExt::get_next_move() { if (!firstCall) ++rm; -- 2.39.2