isCheckPerf.cc
Go to the documentation of this file.
00001 
00004 #include "osl/state/numEffectState.h"
00005 #include "osl/move_generator/allMoves.h"
00006 #include "osl/move_action/store.h"
00007 #include "osl/move_classifier/check_.h"
00008 #include "osl/record/csaString.h"
00009 #include "osl/misc/perfmon.h"
00010 #include <iostream>
00011 #include <cstdio>
00012 using namespace osl;
00013 
00014 int main(int argc,char **argv)
00015 {
00016   // extern char *optarg;
00017 
00018   char c;
00019   while ((c = getopt(argc, argv, "vh")) != EOF)
00020   {
00021     switch(c)
00022     {
00023     default:
00024       std::cerr << "unknown option\n";
00025       return 1;
00026     }
00027   }
00028 
00029   NumEffectState state((CsaString(
00030                     "P1-KY *  *  * -KY * -FU-KE * \n"
00031                     "P2 *  *  *  * -OU *  *  *  * \n"
00032                     "P3 *  *  * -FU-FU+RY *  * -KY\n"
00033                     "P4-FU *  * -GI *  *  *  *  * \n"
00034                     "P5 *  *  *  *  *  *  *  *  * \n"
00035                     "P6+FU *  * +RY *  * +FU *  * \n"
00036                     "P7 * +FU * +FU+FU+FU *  *  * \n"
00037                     "P8 *  * +OU * -TO *  *  *  * \n"
00038                     "P9+KY *  *  *  *  *  * +KE * \n"
00039                     "P+00KI00GI00GI00GI00KE00KE00FU00FU00FU00KI\n"
00040                     "P-00KA00KA00KI00FU00FU00FU00FU00KI\n"
00041                     "-\n").getInitialState()));
00042 
00043   MoveVector moves;
00044   GenerateAllMoves::generate(state.turn(),state,moves);
00045 
00046   int count = 0;
00047   misc::PerfMon clock;
00048   for (size_t i=0; i<moves.size(); ++i)
00049   {
00050     if (move_classifier::Check<WHITE>::isMember
00051         (state, moves[i].ptype(), moves[i].from(), moves[i].to()))
00052       ++count;
00053   }
00054   clock.stop("total", moves.size());
00055   std::cerr << "checks " << count << " / " << moves.size() << "\n";
00056 }
00057 // ;;; Local Variables:
00058 // ;;; mode:c++
00059 // ;;; c-basic-offset:2
00060 // ;;; End:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines