00001
00002
00003
00004
00005
00006
00007 #include "SgSystem.h"
00008 #include "FuegoMainEngine.h"
00009
00010 #include "FuegoMainUtil.h"
00011 #include "GoGtpCommandUtil.h"
00012 #include "GoUctPlayer.h"
00013
00014 using namespace std;
00015
00016
00017
00018 FuegoMainEngine::FuegoMainEngine(GtpInputStream& in, GtpOutputStream& out,
00019 int fixedBoardSize, const char* programPath,
00020 bool noHandicap)
00021 : GoGtpEngine(in, out, fixedBoardSize, programPath, false, noHandicap),
00022 m_uctCommands(Board(), m_player),
00023 m_autoBookCommands(Board(), m_player, m_autoBook),
00024 m_safetyCommands(Board())
00025 {
00026 m_uctCommands.Register(*this);
00027 m_safetyCommands.Register(*this);
00028 m_autoBookCommands.Register(*this);
00029 Register("fuego-license", &FuegoMainEngine::CmdLicense, this);
00030 SetPlayer(new PlayerType(Board()));
00031 }
00032
00033 FuegoMainEngine::~FuegoMainEngine()
00034 {
00035 }
00036
00037 void FuegoMainEngine::CmdAnalyzeCommands(GtpCommand& cmd)
00038 {
00039 GoGtpEngine::CmdAnalyzeCommands(cmd);
00040 m_uctCommands.AddGoGuiAnalyzeCommands(cmd);
00041 m_safetyCommands.AddGoGuiAnalyzeCommands(cmd);
00042 m_autoBookCommands.AddGoGuiAnalyzeCommands(cmd);
00043 cmd << "string/Fuego License/fuego-license\n";
00044 string response = cmd.Response();
00045 cmd.SetResponse(GoGtpCommandUtil::SortResponseAnalyzeCommands(response));
00046 }
00047
00048 void FuegoMainEngine::CmdLicense(GtpCommand& cmd)
00049 {
00050 cmd << "\n" <<
00051 "Fuego " << FuegoMainUtil::Version() << "\n" <<
00052 "Copyright (C) 2009 - 10 by the authors of the Fuego project.\n"
00053 "See http://fuego.sf.net for information about Fuego. Fuego comes\n"
00054 "with NO WARRANTY to the extent permitted by law. This program is\n"
00055 "free software; you can redistribute it and/or modify it under the\n"
00056 "terms of the GNU Lesser General Public License as published by the\n"
00057 "Free Software Foundation - version 3. For more information about\n"
00058 "these matters, see the files named COPYING and COPYING.LESSER\n";
00059 }
00060
00061 void FuegoMainEngine::CmdName(GtpCommand& cmd)
00062 {
00063 cmd << "Fuego";
00064 }
00065
00066
00067
00068
00069 void FuegoMainEngine::CmdVersion(GtpCommand& cmd)
00070 {
00071 cmd << FuegoMainUtil::Version();
00072 }
00073
00074