]> git.sesse.net Git - stockfish/commitdiff
Use std::vector<Move> to store UCI search moves
authorMarco Costalba <mcostalba@gmail.com>
Wed, 20 Jul 2011 08:21:41 +0000 (10:21 +0200)
committerMarco Costalba <mcostalba@gmail.com>
Sun, 24 Jul 2011 05:15:38 +0000 (06:15 +0100)
Avoid the ugly and anyhow incorrect hard limit on the
maximum number of moves and allow to handle an arbitrary
number of moves to search.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
src/uci.cpp

index b17cf08920c0a10eddf5c1d1b5d1818c2bb34861..64489f79593095130fe3421bc2bb719523dcd389 100644 (file)
@@ -189,7 +189,7 @@ namespace {
 
     string token;
     SearchLimits limits;
 
     string token;
     SearchLimits limits;
-    Move searchMoves[MAX_MOVES], *cur = searchMoves;
+    std::vector<Move> searchMoves;
     int time[] = { 0, 0 }, inc[] = { 0, 0 };
 
     while (up >> token)
     int time[] = { 0, 0 }, inc[] = { 0, 0 };
 
     while (up >> token)
@@ -216,14 +216,14 @@ namespace {
             up >> limits.maxTime;
         else if (token == "searchmoves")
             while (up >> token)
             up >> limits.maxTime;
         else if (token == "searchmoves")
             while (up >> token)
-                *cur++ = move_from_uci(pos, token);
+                searchMoves.push_back(move_from_uci(pos, token));
     }
 
     }
 
-    *cur = MOVE_NONE;
+    searchMoves.push_back(MOVE_NONE);
     limits.time = time[pos.side_to_move()];
     limits.increment = inc[pos.side_to_move()];
 
     limits.time = time[pos.side_to_move()];
     limits.increment = inc[pos.side_to_move()];
 
-    return think(pos, limits, searchMoves);
+    return think(pos, limits, &searchMoves[0]);
   }
 
 
   }