]> git.sesse.net Git - stockfish/blobdiff - src/benchmark.cpp
Retire States global variable
[stockfish] / src / benchmark.cpp
index 2978f3468ff55812c6c0551499638d8c7ebe67a4..f61b5da31bef9783f39a9830ce72f7612b1686c1 100644 (file)
@@ -2,7 +2,7 @@
   Stockfish, a UCI chess playing engine derived from Glaurung 2.1
   Copyright (C) 2004-2008 Tord Romstad (Glaurung author)
   Copyright (C) 2008-2015 Marco Costalba, Joona Kiiski, Tord Romstad
-  Copyright (C) 2015-2016 Marco Costalba, Joona Kiiski, Gary Linscott, Tord Romstad
+  Copyright (C) 2015-2017 Marco Costalba, Joona Kiiski, Gary Linscott, Tord Romstad
 
   Stockfish is free software: you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
@@ -76,7 +76,14 @@ const vector<string> Defaults = {
   "8/8/3P3k/8/1p6/8/1P6/1K3n2 b - - 0 1",  // Nd2 - draw
 
   // 7-man positions
-  "8/R7/2q5/8/6k1/8/1P5p/K6R w - - 0 124"  // Draw
+  "8/R7/2q5/8/6k1/8/1P5p/K6R w - - 0 124", // Draw
+
+  // Mate and stalemate positions
+  "8/8/8/8/8/6k1/6p1/6K1 w - -",
+  "5k2/5P2/5K2/8/8/8/8/8 b - -",
+  "8/8/8/8/8/4k3/4p3/4K3 w - -",
+  "8/8/8/8/8/5K2/8/3Q1k2 b - -",
+  "7k/7P/6K1/8/3B4/8/8/8 b - -"
 };
 
 } // namespace
@@ -102,15 +109,15 @@ void benchmark(const Position& current, istream& is) {
   string fenFile   = (is >> token) ? token : "default";
   string limitType = (is >> token) ? token : "depth";
 
-  Options["Hash"]    = ttSize;
+  Search::clear(); // Wait for search finished
   Options["Threads"] = threads;
-  Search::clear();
+  Options["Hash"]    = ttSize;
 
   if (limitType == "time")
       limits.movetime = stoi(limit); // movetime is in millisecs
 
   else if (limitType == "nodes")
-      limits.nodes = stoi(limit);
+      limits.nodes = stoll(limit);
 
   else if (limitType == "mate")
       limits.mate = stoi(limit);
@@ -148,7 +155,7 @@ void benchmark(const Position& current, istream& is) {
 
   for (size_t i = 0; i < fens.size(); ++i)
   {
-      StateListPtr states(new std::vector<StateInfo>(1));
+      StateListPtr states(new std::deque<StateInfo>(1));
       pos.set(fens[i], Options["UCI_Chess960"], &states->back(), Threads.main());
 
       cerr << "\nPosition: " << i + 1 << '/' << fens.size() << endl;