]> git.sesse.net Git - stockfish/commitdiff
Retire 'finished' from MovePicker
authorMarco Costalba <mcostalba@gmail.com>
Sun, 3 Jan 2010 12:27:31 +0000 (13:27 +0100)
committerMarco Costalba <mcostalba@gmail.com>
Sun, 3 Jan 2010 14:37:17 +0000 (15:37 +0100)
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 <mcostalba@gmail.com>
src/movepick.cpp
src/movepick.h

index ea332b7be37b4ae4b73be30ea8fa9277d5660ff2..f4f475fb18baa75d7cdb4535723d455daf14be4f 100644 (file)
@@ -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;
index 09ad1c39bfe995ae791e3c1af58ad6b45e17b848..b42f839bc8bc571fcf3dc4a3e544b6dad4400076 100644 (file)
@@ -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;