Remove duplicated Position object in UCIEngine

Also fixes searchmoves.

Drop the need of a Position object in uci.cpp.

A side note, it is still required for the static functions,
but these should be moved to a different namespace/class
later on, since sf kinda relies on them.

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

No functional change
This commit is contained in:
Disservin
2024-04-12 19:11:10 +02:00
committed by Joost VandeVondele
parent 14f6eab07d
commit 4912f5b0b5
8 changed files with 67 additions and 46 deletions

View File

@@ -24,6 +24,8 @@
#include <string_view>
#include <utility>
#include <vector>
#include <sstream>
#include <iosfwd>
#include "evaluate.h"
#include "misc.h"
@@ -146,8 +148,6 @@ void Engine::save_network(const std::pair<std::optional<std::string>, std::strin
// utility functions
OptionsMap& Engine::get_options() { return options; }
void Engine::trace_eval() const {
StateListPtr trace_states(new std::deque<StateInfo>(1));
Position p;
@@ -158,4 +158,16 @@ void Engine::trace_eval() const {
sync_cout << "\n" << Eval::trace(p, networks) << sync_endl;
}
OptionsMap& Engine::get_options() { return options; }
std::string Engine::fen() const { return pos.fen(); }
void Engine::flip() { pos.flip(); }
std::string Engine::visualize() const {
std::stringstream ss;
ss << pos;
return ss.str();
}
}