Move perft out of search

This splits the logic of search and perft. Before, threads were started,
which then constructed a search object, which then started perft and
returned immediately. All of this is unnecessary, instead uci should
start perft right away.

closes https://github.com/official-stockfish/Stockfish/pull/5008

No functional change
This commit is contained in:
Disservin
2024-01-14 00:21:46 +01:00
parent 3d49a99aaf
commit 1dfbde2d10
4 changed files with 77 additions and 38 deletions

View File

@@ -39,6 +39,7 @@
#include "syzygy/tbprobe.h"
#include "types.h"
#include "ucioption.h"
#include "perft.h"
namespace Stockfish {
@@ -172,7 +173,6 @@ void UCI::loop() {
void UCI::go(Position& pos, std::istringstream& is, StateListPtr& states) {
Search::LimitsType limits;
std::string token;
bool ponderMode = false;
@@ -211,6 +211,12 @@ void UCI::go(Position& pos, std::istringstream& is, StateListPtr& states) {
Eval::NNUE::verify(options, evalFiles);
if (limits.perft)
{
perft(pos.fen(), limits.perft, options["UCI_Chess960"]);
return;
}
threads.start_thinking(options, pos, states, limits, ponderMode);
}