00001 #include "osl/game_playing/gameState.h"
00002 #include "osl/game_playing/mtdfPlayer.h"
00003 #include "osl/game_playing/searchPlayer.tcc"
00004 #include "osl/record/csaString.h"
00005 #include "osl/misc/perfmon.h"
00006 #include "osl/misc/random.h"
00007 #include "osl/eval/progressEval.h"
00008 #include "osl/search/parallelSearch.h"
00009 #include <iostream>
00010
00011 using namespace osl;
00012 using namespace osl::game_playing;
00013
00014 int main()
00015 {
00016 #ifdef OSL_SMP
00017 int search_limit=1200;
00018 int table_size=5000000;
00019 int check_table_size=5000000;
00020 int logMargin=0;
00021 #if 0
00022 int record_limit=-5;
00023 #else
00024 int record_limit=-16;
00025 #endif
00026 int initial_limit = 400, deepening_step=200;
00027 int node_limit = 1600000;
00028 int seconds = 120;
00029 int nproc=4;
00030 osl::search::parallelSearch.setNumCPUs(nproc);
00031 GameState state(CsaString(
00032 #if 0
00033 "P1-KY-KE * -OU * +KA * * -KY\n"
00034 "P2 * -GI-KI * * -GI-KI * * \n"
00035 "P3-FU * * -FU-FU-FU-KE * -FU\n"
00036 "P4 * * -FU * * * * -RY-KA\n"
00037 "P5 * * * +GI * * +FU * * \n"
00038 "P6 * +RY * * * * * * * \n"
00039 "P7+FU * +KE+FU+FU+FU+KE * +FU\n"
00040 "P8 * * +KI * +OU+GI+KI+FU * \n"
00041 "P9+KY * * * * * * * +KY\n"
00042 "P+00FU00FU\n"
00043 "P-00FU00FU00FU\n"
00044 "+\n"
00045 #else
00046 "P1-KY-KE-GI-KI * -KI * -KE-KY\n"
00047 "P2 * * -OU * * * -GI * * \n"
00048 "P3-FU-FU-FU-FU-FU * -KA-FU-FU\n"
00049 "P4 * * * * * -HI-FU * * \n"
00050 "P5 * * * * * * * * * \n"
00051 "P6 * * +FU * * * +FU * * \n"
00052 "P7+FU+FU * +FU+FU * * * +FU\n"
00053 "P8 * +KA+OU * +KI+GI * +HI * \n"
00054 "P9+KY+KE+GI+KI * * * +KE+KY\n"
00055 "P+00FU00FU\n"
00056 "P-00FU\n"
00057 "+\n"
00058 #endif
00059 ).getInitialState());
00060 ProgressMtdfPlayer player;
00061 const char *pair_table_filename="../data/sibling-attack.pair";
00062 int load_success = eval::ProgressEval::setUp(pair_table_filename);
00063 if (! load_success)
00064 {
00065 std::cerr << pair_table_filename << " read error\n";
00066 return 1;
00067 }
00068 player.setVerbose();
00069 player.setDepthLimit(search_limit, initial_limit, deepening_step);
00070 player.setNodeLimit(node_limit);
00071 player.setTotalCheckmateLimit(check_table_size);
00072 player.setTableLimit(table_size, record_limit);
00073 {
00074 misc::PerfMon clock;
00075 const Move best_move = player.searchWithSecondsForThisMove(state, seconds).move;
00076 const unsigned long long cycles = clock.stop();
00077 std::cerr << cycles << std::endl;
00078 int depth = 0;
00079
00080 #if 0
00081 const unsigned int nodes
00082 = recorder.nodeCount() + recorder.quiescenceCount();
00083 misc::PerfMon::message(cycles, "search ", nodes);
00084 misc::PerfMon::message(cycles, "search+checkmate ",
00085 nodes + recorder.checkmateCount());
00086 #endif
00087 }
00088 #endif
00089 }