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:
Marco Costalba
2012-04-07 13:23:43 +01:00
parent cc04a745e2
commit 9546b79e20
2 changed files with 23 additions and 42 deletions

View File

@@ -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());