From c8af7a867e91e833f76b564f6f430c96829760bc Mon Sep 17 00:00:00 2001 From: Marco Costalba Date: Sun, 3 Jan 2010 13:27:31 +0100 Subject: [PATCH] Retire 'finished' from MovePicker It is not useful becasue it is safe to call get_next_move() multiple times when phase == PH_STOP No functional change. Signed-off-by: Marco Costalba --- src/movepick.cpp | 13 ++++--------- src/movepick.h | 1 - 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/src/movepick.cpp b/src/movepick.cpp index ea332b7b..f4f475fb 100644 --- a/src/movepick.cpp +++ b/src/movepick.cpp @@ -74,7 +74,6 @@ MovePicker::MovePicker(const Position& p, Move ttm, Depth d, const History& h, SearchStack* ss) : pos(p), H(h) { int searchTT = ttm; ttMoves[0].move = ttm; - finished = false; lastBadCapture = badCaptures; pinned = p.pinned_pieces(pos.side_to_move()); @@ -156,7 +155,7 @@ void MovePicker::go_next_phase() { return; case PH_STOP: - lastMove = curMove + 1; // hack to be friendly for get_next_move() + lastMove = curMove + 1; // Avoids another go_next_phase() call return; default: @@ -346,14 +345,10 @@ Move MovePicker::get_next_move() { Move MovePicker::get_next_move(Lock &lock) { lock_grab(&lock); - if (finished) - { - lock_release(&lock); - return MOVE_NONE; - } + + // Note that it is safe to call many times + // get_next_move() when phase == PH_STOP Move m = get_next_move(); - if (m == MOVE_NONE) - finished = true; lock_release(&lock); return m; diff --git a/src/movepick.h b/src/movepick.h index 09ad1c39..b42f839b 100644 --- a/src/movepick.h +++ b/src/movepick.h @@ -64,7 +64,6 @@ private: const Position& pos; const History& H; MoveStack ttMoves[2], killers[2]; - bool finished; int phase; const uint8_t* phasePtr; MoveStack *curMove, *lastMove, *lastBadCapture; -- 2.39.2