22 using namespace osl::eval;
 
   23 using namespace osl::eval::endgame;
 
   28   cerr << 
"Usage: " << prog << 
" [-a] [-t raw|piece|attack|defense|endgame|progress] [-f pair-file-name] csa-filename" 
   33 void show(
const char *filename, 
const std::string&);
 
   36 int main(
int argc, 
char **argv)
 
   38   const char *program_name = argv[0];
 
   39   bool error_flag = 
false;
 
   41   std::string table_filename
 
   43   std::string eval_type = 
"piece";
 
   48   while ((c = getopt(argc, argv, 
"at:f:vh")) != EOF)
 
   54     case 'f':   table_filename = optarg;
 
   56     case 't':   eval_type = optarg;
 
   58     default:    error_flag = 
true;
 
   67   PiecePairPieceTable::Table.setUp(table_filename.c_str());
 
   69   for (
int i=0; i<argc; ++i)
 
   71     show(argv[i], eval_type);
 
   75 void show(
const SimpleState& state, 
const std::string& eval_type)
 
   84   if (eval_type == 
"progress")
 
   85     ProgressEval::setValues(state, values);
 
   86   else if (eval_type == 
"endgame")
 
   87     AttackDefense::setValues(state, values);
 
   88   else if (eval_type == 
"attack")
 
   90   else if (eval_type == 
"defense")
 
   92   else if (eval_type == 
"piece")
 
   93     PiecePairPieceEval::setValues(state, values);
 
   94   else if (eval_type == 
"raw")
 
   95     PiecePairRawEval::setValues(state, values);
 
   97     throw std::runtime_error(
"unknown function type "+eval_type);
 
   98   values.showValues(std::cout, state);
 
  101 void show(
const char *filename, 
const std::string& eval_type)
 
  103   CsaFile file(filename);
 
  104   const vector<osl::Move> 
moves = file.getRecord().getMoves();
 
  105   NumEffectState state(file.getInitialState());
 
  106   for (
unsigned int i=0; i<moves.size(); i++)
 
  109       show(state, eval_type);
 
  110     const Move m = moves[i];
 
  113   show(state, eval_type);