All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
last-position.cc
Go to the documentation of this file.
1 /*
2  *
3  */
4 #include "osl/record/csaRecord.h"
7 
8 #include <boost/foreach.hpp>
9 #include <fstream>
10 #include <iostream>
11 #include <cstdlib>
12 #include <cctype>
13 #include <unistd.h>
14 
15 using namespace osl;
16 
17 void usage(const char *prog)
18 {
19  using namespace std;
20  cerr << "Usage: " << prog << " csa-filenames "
21  << endl;
22  // kisenファイル と csaファイル を再生
23  exit(1);
24 }
25 
26 int main(int argc, char **argv)
27 {
28  try {
29  nice(20);
30 
31  //次に CSAファイルを処理
32  for (int i=1; i<argc; ++i) {
33  CsaFile file(argv [i]);
34  const vector<Move> moves=file.getRecord().getMoves();
35  NumEffectState state((SimpleState(HIRATE)));
36  BOOST_FOREACH(Move m, moves)
37  state.makeMove(m);
38  std::string new_name = std::string("tmp/")+argv[i];
39  std::ofstream os(new_name.c_str());
40  os << state;
41  }
42  }
43  catch (std::exception& e) {
44  std::cerr << e.what() << "\n";
45  return 1;
46  }
47 }
48 
49 // ;;; Local Variables:
50 // ;;; mode:c++
51 // ;;; c-basic-offset:2
52 // ;;; End: