sort.cc
Go to the documentation of this file.
00001 /*
00002  * 
00003  */
00004 
00005 #include "osl/search/sortCaptureMoves.h"
00006 #include "osl/state/numEffectState.h"
00007 #include "osl/move_generator/allMoves.h"
00008 #include "osl/effect_util/effectUtil.h"
00009 #include "osl/record/csaRecord.h"
00010 #include "osl/container/moveVector.h"
00011 
00012 #include <iostream>
00013 #include <cstdlib>
00014 #include <cstdio>
00015 #include <unistd.h>
00016 
00017 using namespace osl;
00018 
00019 int main(int argc, char **argv)
00020 {
00021   // const char *program_name = argv[0];
00022   bool error_flag = false;
00023   bool verbose = false;
00024   // const char *kisenFilename = 0;
00025   
00026   // extern char *optarg;
00027   extern int optind;
00028   char c;
00029   // size_t num_records = 1;
00030   while ((c = getopt(argc, argv, "vh")) != EOF) {
00031     switch(c)
00032     {
00033     case 'v': verbose = true;
00034       break;
00035     default:    error_flag = true;
00036     }
00037   }
00038   argc -= optind;
00039   argv += optind;
00040 
00041   if (error_flag)
00042     return 1;
00043 
00044   try {
00045     nice(20);
00046     // size_t record_processed = 0;
00047       
00048     for (int i=0; i<argc; ++i) {
00049       CsaFile file(argv [i]);
00050       const Record record = file.getRecord();
00051       NumEffectState state(record.getInitialState());
00052 
00053       MoveVector moves;
00054       GenerateAllMoves::generate(state.turn(), state, moves);
00055       search::SortCaptureMoves::sortByTakeBack(state, moves);
00056       std::cout << state << moves << "\n";
00057     }
00058   }
00059   catch (std::exception& e) {
00060     std::cerr << e.what() << "\n";
00061     return 1;
00062   }
00063 }
00064 
00065 // ;;; Local Variables:
00066 // ;;; mode:c++
00067 // ;;; c-basic-offset:2
00068 // ;;; End:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines