14 using namespace osl::eval;
19 cerr <<
"Usage: " << prog <<
" [-f pair-file-name] [-P player(0 for black, 1 for white)] [-p position(e.g. 11)] [-t ptype(e.g. 7 for PROOK)]"
21 <<
"if any of -Ppt options are specified, relation of [<specified-pieace*specified-pos>,<other-pieace*other-pos>] will be shown \n"
22 <<
"otherwise, relation of [<same-pieace*same-pos>,<same-pieace*same-pos>] will be shown \n"
30 int main(
int argc,
char **argv)
32 const char *program_name = argv[0];
33 bool error_flag =
false;
34 const char *pairFileName = 0;
38 int singleStateMode =
true;
43 while ((c = getopt(argc, argv,
"f:p:P:t:vh")) != EOF)
47 case 'f': pairFileName = optarg;
49 case 'p': pos =
Square(atoi(optarg)/10, atoi(optarg)%10);
50 singleStateMode =
false;
52 case 'P': player = (atoi(optarg) ?
WHITE :
BLACK);
53 singleStateMode =
false;
55 case 't': ptype = atoi(optarg);
56 singleStateMode =
false;
58 default: error_flag =
true;
64 if (error_flag || (! pairFileName))
67 PiecePairRawEval::setUp(pairFileName);
85 std::cout << player <<
", " << ptype <<
"\n";
86 for (
int y=1; y<=9; ++y)
88 for (
int x=9; x>=1; --x)
91 const unsigned int index1 = PiecePairIndex::indexOf(pos1,ptypeo);
92 std::cout << std::setw(4) << PiecePairRawTable::Table.valueOf(index1,index1);
97 const unsigned int index1 = PiecePairIndex::indexOf(pos1,ptypeo);
98 std::cout << pos1 <<
" " << std::setw(4) << PiecePairRawTable::Table.valueOf(index1,index1);
105 for (
int y=1; y<=9; ++y)
107 for (
int x=9; x>=1; --x)
110 const unsigned int index2 = PiecePairIndex::indexOf(pos2,ptypeo2);
111 std::cout << std::setw(4) << PiecePairRawTable::Table.valueOf(index1,index2);
116 const unsigned int index2 = PiecePairIndex::indexOf(pos2,ptypeo2);
117 std::cout << pos2 <<
" " << std::setw(4) << PiecePairRawTable::Table.valueOf(index1,index2);
124 std::cout << player <<
", " << pos1 <<
", " << ptype1 <<
"\n";
125 const unsigned int index1 = PiecePairIndex::indexOf(pos1,ptypeo1);
129 std::cout << player << ptype2 <<
" (<=> " << player << ptype1 <<
", " << pos1 <<
")\n";
131 std::cout <<
alt(player) << ptype2 <<
" (<=> " << player << ptype1 <<
", " << pos1 <<
")\n";