31int main(
int argc,
char *argv[])
44 std::srand(
static_cast<unsigned int> (std::time(
nullptr)));
48#if defined(BELOFTE_UCIMODE)
50#elif defined(BELOFTE_XBOARDMODE)
68 for (
int i = 1; i < argc; ++i) {
69 std::string arg = argv[i];
70 if (arg ==
"--help") {
74 }
else if (arg ==
"--version") {
78#if !defined(BELOFTE_UCIMODE)
79 }
else if ((arg ==
"xboard") || (arg ==
"-xboard") || (arg ==
"--xboard")) {
83 }
else if ((arg ==
"bench") || (arg ==
"--bench")) {
86 }
else if (arg.substr(0, 1) ==
"@") {
87 if (arg.length() > 1) {
92 App().
bout <<
"Use filename with @";
99 }
else if (arg.substr(0, 2) ==
"--") {
105 }
catch (
const std::logic_error& e) {
106 std::cout <<
"Logic Error: " << e.what() << std::endl;
108 std::cout <<
"Error: Unmatched exception" << std::endl;
118 if (!
App().m_reader.isFileAttached()) {
126 }
catch (
const std::logic_error& e) {
127 std::cout <<
"Logic Error: " << e.what() << std::endl;
129 std::cout <<
"Error: Unmatched exception" << std::endl;
146#pragma GCC diagnostic push
147#pragma GCC diagnostic ignored "-Weffc++"
158#if defined(BELOFTE_XBOARDMODE)
159 m_engineInterfaces[
"xboard"] =
new XboardMode();
161#elif defined(BELOFTE_UCIMODE)
162 m_engineInterfaces[
"uci"] =
new UCIMode();
165 m_engineInterfaces[
"xboard"] =
new XboardMode();
166 m_engineInterfaces[
"uci"] =
new UCIMode();
173#pragma GCC diagnostic pop
178 engineInterfaces_t::iterator itr = m_engineInterfaces.begin();
179 while (itr != m_engineInterfaces.end()) {
181 itr = m_engineInterfaces.erase(itr);
183 m_engineInterfaces.clear();
188 std::string sOldName = m_interfaceName;
189 m_interfaceName = iName;
190 m_ui = m_engineInterfaces[m_interfaceName];
201 if (m_settings.find(s) != m_settings.end())
return m_settings[s];
207 m_stringsettings[s] = v;
212 if (m_stringsettings.find(s) != m_stringsettings.end())
return m_stringsettings[s];
223 std::string sExename;
225 std::string sFile(sName);
226 sExename = sFile.substr(sFile.find_last_of(
"/\\") + 1);
229 if (sExename.find(
".exe") != std::string::npos)
230 sExename.erase(sExename.find(
".exe"));
262#if defined(BELOFTE_NOSIGNALS)
264 signal(SIGTERM, SIG_IGN);
265 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
static void setName(char *sName)
set name of executable based on argv[0] Remove leading / and \ characters Remove trailing ....
bel_hash m_hashEngine
read input
static std::string getName()
void setConfig(std::string const &s, int64_t v)
int64_t getConfig(std::string const &s, int64_t v)
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