All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
pass.cc
Go to the documentation of this file.
5 #include "osl/record/kisen.h"
7 #include "osl/sennichite.h"
8 
9 #include <boost/program_options.hpp>
10 #include <iostream>
11 
12 namespace po = boost::program_options;
13 
14 int main(int argc, char **argv)
15 {
16  std::string kisen_filename;
17  int kisen_index;
18  po::options_description options("Options");
19  options.add_options()
20  ("kisen,k",
21  po::value<std::string>(&kisen_filename),
22  "kisen filename")
23  ("index,i",
24  po::value<int>(&kisen_index)->default_value(0))
25  ("help", "produce help message")
26  ;
27  po::positional_options_description p;
28  po::variables_map vm;
29 
30  try
31  {
32  po::store(po::command_line_parser(argc, argv).
33  options(options).positional(p).run(), vm);
34  notify(vm);
35  if (vm.count("help"))
36  {
37  std::cout << options << std::endl;
38  return 0;
39  }
40  }
41  catch (std::exception& e)
42  {
43  std::cerr << "error in parsing options" << std::endl
44  << e.what() << std::endl;
45  std::cerr << options << std::endl;
46  return 1;
47  }
48 
49  osl::record::KisenFile kisen(kisen_filename);
51  osl::stl::vector<osl::Move> moves = kisen.getMoves(kisen_index);
52 
55 
56  osl::game_playing::GameState game_state(state);
58  player.setDepthLimit(600, 400, 200);
60  {
63  }
64 
65  for (size_t i = 0; i < moves.size() + 1; ++i)
66  {
67  if (!game_state.state().inCheck())
68  {
69  osl::search::MoveWithComment result = player.selectBestMove(game_state, 0, 0, 10);
70  osl::state::NumEffectState state2(game_state.state());
71  state2.changeTurn();
72  osl::game_playing::GameState game_state2(state2);
73  osl::search::MoveWithComment pass_result = player.selectBestMove(game_state2, 0, 0, 10);
74  int diff = result.value - pass_result.value;
75 
76  std::cout << i << " " << result.value << " " << pass_result.value << " "
77  << (i % 2 == 0 ? diff : -diff) << std::endl;
78  }
79  if (i < moves.size())
80  {
81  game_state.pushMove(moves[i]);
82  }
83  }
84 
85  return 0;
86 }