00001 #include "osl/apply_move/applyMove.h" 00002 #include "osl/state/numEffectState.h" 00003 #include "osl/record/kisen.h" 00004 00005 #include <iostream> 00006 00007 void usage (const char *program_name) 00008 { 00009 std::cerr << "Usage: " << program_name << " KISEN-FILE" 00010 << std::endl; 00011 exit(1); 00012 } 00013 00014 void check_all(const char*filename) 00015 { 00016 osl::record::KisenFile kisen(filename); 00017 00018 for (size_t i = 0; i < kisen.size(); i++) 00019 { 00020 std::cout << i << std::endl; 00021 const osl::vector<osl::Move> moves = kisen.getMoves(i); 00022 osl::state::NumEffectState state(kisen.getInitialState()); 00023 00024 for (size_t j = 0; j < moves.size(); j++) 00025 { 00026 const osl::Position opKingPosition 00027 = state.getKingPosition(alt(state.getTurn())); 00028 if (state.hasEffectBy(state.getTurn(), opKingPosition)) 00029 { 00030 break; 00031 } 00032 osl::apply_move::ApplyMoveOfTurn::doMove(state, moves[j]); 00033 } 00034 } 00035 } 00036 00037 int main(int argc, char **argv) 00038 { 00039 if (argc != 2) 00040 usage(argv[0]); 00041 00042 check_all(argv[1]); 00043 00044 return 0; 00045 }