8 #include <boost/program_options.hpp>
9 #include <boost/foreach.hpp>
12 namespace po = boost::program_options;
15 void run(
const NumEffectState& initial,
const vector<Move>&
moves)
18 for (
size_t i=0; i<moves.size(); ++i){
19 MoveVector normal, loss;
21 bool show = ! loss.empty() || ! normal.isMember(moves[i]);
23 std::cerr << state.
state();
24 std::cerr <<
"history ";
25 for (
size_t j=0; j<=i; ++j)
30 std::cerr <<
"losing moves ";
31 BOOST_FOREACH(
Move m, loss) {
36 if (! normal.isMember(moves[i]))
37 std::cerr <<
"error? " << moves[i] <<
"\n";
44 int main(
int argc,
char **argv) {
46 po::options_description options(
"Options");
51 (
"csa-file", po::value<std::vector<std::string> >())
52 (
"help",
"produce help message")
54 po::positional_options_description p;
55 p.add(
"csa-file", -1);
58 std::vector<std::string> filenames;
60 po::store(po::command_line_parser(argc, argv).
61 options(options).positional(p).
run(), vm);
63 if (vm.count(
"help")) {
64 std::cout << options << std::endl;
67 if (vm.count(
"csa-file"))
68 filenames = vm[
"csa-file"].as<std::vector<std::string> >();
70 catch (std::exception& e) {
71 std::cerr <<
"error in parsing options" << std::endl
72 << e.what() << std::endl;
73 std::cerr << options << std::endl;
77 if (kisen_filename !=
"") {
78 KisenFile kisen(kisen_filename);
79 for (
size_t i=0; i<kisen.size(); ++i) {
81 NumEffectState state(kisen.getInitialState());
82 vector<Move>
moves = kisen.getMoves(i);
86 for (
size_t i=0; i<filenames.size(); ++i) {
88 CsaFile file(filenames[i].c_str());
89 NumEffectState state(file.getInitialState());
90 vector<Move>
moves = file.getRecord().getMoves();