MoHexMain.cpp
Go to the documentation of this file.00001
00002
00003
00004
00005
00006 #include "SgSystem.h"
00007
00008 #include "config.h"
00009 #include "HexProgram.hpp"
00010 #include "MoHexEngine.hpp"
00011 #include "MoHexPlayer.hpp"
00012
00013 using namespace benzene;
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043 namespace {
00044
00045 const char* build_date = __DATE__;
00046
00047 }
00048
00049
00050
00051 int main(int argc, char** argv)
00052 {
00053 HexProgram& program = HexProgram::Get();
00054 program.SetInfo("Mohex", VERSION, build_date);
00055 program.PrintStartupMessage();
00056 program.Initialize(argc, argv);
00057 MoHexPlayer player;
00058 try
00059 {
00060 MoHexEngine gh(program.BoardSize(), player);
00061 std::string config = program.ConfigFileToExecute();
00062 if (config != "")
00063 gh.ExecuteFile(config);
00064 GtpInputStream gin(std::cin);
00065 GtpOutputStream gout(std::cout);
00066 gh.MainLoop(gin, gout);
00067 program.Shutdown();
00068 }
00069 catch (const GtpFailure& f)
00070 {
00071 std::cerr << f.Response() << std::endl;
00072 return 1;
00073 }
00074 return 0;
00075 }
00076
00077