32int main(
int argc,
char *argv[])
44 std::srand(
static_cast<unsigned int> (std::time(
nullptr)));
48#if defined(BELOFTE_UCIMODE)
66 for (
int i = 1; i < argc; ++i) {
67 std::string arg = argv[i];
68 if (arg ==
"--help") {
72 }
else if (arg ==
"--version") {
76 }
else if (arg ==
"-xboard") {
79 }
else if ((arg ==
"bench") || (arg ==
"--bench")) {
82 }
else if (arg.substr(0, 1) ==
"@") {
83 if (arg.length() > 1) {
88 App().
bout <<
"Use filename with @" << std::endl;
94 }
else if (arg.substr(0, 2) ==
"--") {
100 }
catch (
const std::logic_error& e) {
101 std::cout <<
"Logic Error: " << e.what() << std::endl;
103 std::cout <<
"Error: Unmatched exception" << std::endl;
113 if (!
App().m_reader.isFileAttached()) {
121 }
catch (
const std::logic_error& e) {
122 std::cout <<
"Logic Error: " << e.what() << std::endl;
124 std::cout <<
"Error: Unmatched exception" << std::endl;
149 , m_stringsettings{{}}
150 , m_engineInterfaces{{}}
154 m_engineInterfaces[
"xboard"] =
new XboardMode();
155 m_engineInterfaces[
"uci"] =
new UCIMode();
162 engineInterfaces_t::iterator itr = m_engineInterfaces.begin();
163 while (itr != m_engineInterfaces.end()) {
165 itr = m_engineInterfaces.erase(itr);
167 m_engineInterfaces.clear();
172 std::string sOldName = m_interfaceName;
173 m_interfaceName = iName;
174 m_ui = m_engineInterfaces[m_interfaceName];
185 if (m_settings.find(s) != m_settings.end())
return m_settings[s];
191 m_stringsettings[s] = v;
196 if (m_stringsettings.find(s) != m_stringsettings.end())
return m_stringsettings[s];
206 std::string sExename;
208 std::string sFile(sName);
209 sExename = sFile.substr(sFile.find_last_of(
"/\\") + 1);
212 if (sExename.find(
".exe") != std::string::npos)
213 sExename.erase(sExename.find(
".exe"));
245#if defined(BELOFTE_NOSIGNALS)
247 signal(SIGTERM, SIG_IGN);
248 signal(SIGINT, SIG_IGN);
int main(int argc, char *argv[])
Main entry point.
static void platform_ctor()
The main program.
static void platform_dtor()
engineInterface * AppEI()
This is the main include file, needs to be included before any other include.
implementation of specific implementation
Singleton implementation of application.
outputWriter sout
normal output
void setName(char *sName)
set name of executable based on argv[0] Remove leading / and \ characters Remove trailing ....
bel_debug m_debuginterface
bel_hash m_hashEngine
read input
void setConfig(std::string const &s, int64_t v)
int64_t getConfig(std::string const &s, int64_t v)
std::string getName() const
std::string const setMode(std::string const &iName)
commandReader m_reader
searching output
game representation, singleton
void setDepthCommand(depth_t const d)
implementation of user interface
void execute(std::string const &command, std::string const ¶ms)
constexpr depth_t DEFAULT_DEPTH