kakinoki-to-csa.cc
Go to the documentation of this file.
00001 /* kakinoki-to-csa.cc
00002  */
00003 #include "osl/record/kakinoki.h"
00004 #include "osl/record/csa.h"
00005 #include "osl/record/record.h"
00006 #include <iostream>
00007 #include <sstream>
00008 
00009 using namespace osl;
00010 void convert(const char *filename)
00011 {
00012   KakinokiFile file(filename);
00013   vector<Move> moves;
00014   vector<int> time;
00015   vector<std::string> comment;
00016   vector<record::SearchInfo> move_comment;
00017   Record record = file.getRecord();
00018   std::cout << "N+" << record.getPlayer(BLACK) << std::endl;
00019   std::cout << "N-" << record.getPlayer(WHITE) << std::endl;
00020   record.getMoves(moves, time, comment, move_comment);
00021   NumEffectState state(file.getInitialState());
00022   std::cout << state;
00023   for (size_t i=0; i<moves.size(); ++i) 
00024   {
00025     std::cout << record::csa::show(moves[i]) << std::endl;
00026     if (i < comment.size()) 
00027     {
00028       std::istringstream is(comment[i]);
00029       std::string line;
00030       while (std::getline(is, line)) 
00031         std::cout << "'* " << line << std::endl;
00032     }
00033   }
00034 }
00035 
00036 int main(int argc, char **argv)
00037 {
00038   for (int i=1; i<argc; ++i)
00039     convert(argv[i]);
00040 }
00041 
00042 // ;;; Local Variables:
00043 // ;;; mode:c++
00044 // ;;; c-basic-offset:2
00045 // ;;; End:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines