mirror of
https://github.com/HChaZZY/Stockfish.git
synced 2025-12-20 00:56:39 +08:00
Use bench to implement UI 'perft' command
Now that we can call bench on current position we can directly use it to perform our perft. No functional change. Signed-off-by: Marco Costalba <mcostalba@gmail.com>
This commit is contained in:
@@ -19,7 +19,7 @@
|
||||
|
||||
#include <fstream>
|
||||
#include <iostream>
|
||||
#include <sstream>
|
||||
#include <istream>
|
||||
#include <vector>
|
||||
|
||||
#include "misc.h"
|
||||
@@ -58,11 +58,11 @@ static const char* Defaults[] = {
|
||||
/// format (defaults are the positions defined above) and the type of the
|
||||
/// limit value: depth (default), time in secs or number of nodes.
|
||||
|
||||
void benchmark(istringstream& is) {
|
||||
void benchmark(const Position& current, istream& is) {
|
||||
|
||||
string token;
|
||||
Search::LimitsType limits;
|
||||
vector<string> fens(Defaults, Defaults + 16);
|
||||
vector<string> fens;
|
||||
|
||||
// Assign default values to missing arguments
|
||||
string ttSize = (is >> token) ? token : "128";
|
||||
@@ -83,14 +83,14 @@ void benchmark(istringstream& is) {
|
||||
else
|
||||
limits.depth = atoi(limit.c_str());
|
||||
|
||||
if (fenFile == "current")
|
||||
if (fenFile == "default")
|
||||
fens.assign(Defaults, Defaults + 16);
|
||||
|
||||
else if (fenFile == "current")
|
||||
fens.push_back(current.to_fen());
|
||||
|
||||
else
|
||||
{
|
||||
fens.clear();
|
||||
fens.push_back(Search::RootPosition.to_fen());
|
||||
}
|
||||
else if (fenFile != "default")
|
||||
{
|
||||
fens.clear();
|
||||
string fen;
|
||||
ifstream file(fenFile.c_str());
|
||||
|
||||
|
||||
Reference in New Issue
Block a user