9 #include <boost/program_options.hpp> 
   10 #include <boost/foreach.hpp> 
   13 namespace po = boost::program_options;
 
   17 bool run(
const NumEffectState& initial, 
const vector<Move>& 
moves) 
 
   19   NumEffectState state(initial);
 
   20   for (
size_t i=0; i<moves.size(); ++i){
 
   21     state.makeMove(moves[i]);
 
   23     if (EnterKing::canDeclareWin(state, drops)) 
 
   27       std::cout << state << moves[i] << 
"\n";
 
   34 int main(
int argc, 
char **argv) {
 
   36   po::options_description options(
"Options");
 
   41     (
"csa-file", po::value<std::vector<std::string> >())
 
   42     (
"help", 
"produce help message")
 
   44   po::positional_options_description p;
 
   45   p.add(
"csa-file", -1);
 
   48   std::vector<std::string> filenames;
 
   50     po::store(po::command_line_parser(argc, argv).
 
   51               options(options).positional(p).
run(), vm);
 
   53     if (vm.count(
"help")) {
 
   54       std::cout << options << std::endl;
 
   57     if (vm.count(
"csa-file"))
 
   58       filenames = vm[
"csa-file"].as<std::vector<std::string> >();
 
   60   catch (std::exception& e) {
 
   61     std::cerr << 
"error in parsing options" << std::endl
 
   62               << e.what() << std::endl;
 
   63     std::cerr << options << std::endl;
 
   67   if (kisen_filename != 
"") {
 
   68     KisenFile kisen(kisen_filename);
 
   69     for (
size_t i=0; i<kisen.size(); ++i) {
 
   71       NumEffectState state(kisen.getInitialState());
 
   72       vector<Move> 
moves = kisen.getMoves(i);
 
   73       if (
run(state, moves))
 
   74         std::cout << i << 
"\n";
 
   77   for (
size_t i=0; i<filenames.size(); ++i) {
 
   79     CsaFile file(filenames[i].c_str());
 
   80     NumEffectState state(file.getInitialState());
 
   81     vector<Move> 
moves = file.getRecord().getMoves();
 
   82     if (
run(state, moves))
 
   83       std::cout << filenames[i] << 
"\n";
 
   85   std::cerr << 
"count = " << 
count << 
"\n";