10 const int y = pos.
y();
13 result[1] = y +
'a' - 1;
22 case PAWN:
return 'P';
23 case LANCE:
return 'L';
26 case GOLD:
return 'G';
28 case ROOK:
return 'R';
29 case KING:
return 'K';
31 assert(
"unsupported ptype" == 0);
85 strToMove(
const std::string& str,
const SimpleState& s)
88 throw ParseError(
"Invalid move string: " + str);
94 return Move(to, ptype, s.turn());
98 const Ptype ptype = s.pieceOnBoard(from).ptype();
101 throw ParseError(
"No piece on square: " + str);
102 bool promotion =
false;
105 assert(str[4] ==
'+');
108 return Move(from, to, (promotion ?
promote(ptype) : ptype),
109 captured, promotion, s.turn());
115 assert(str.size() == 2);
116 const int x = str[0] -
'0';
117 const int y = str[1] -
'a' + 1;
118 if (x <= 0 || x > 9 || y <= 0 || y > 9)
119 throw ParseError(
"Invalid square character: " + str);
128 case 'P':
return PAWN;
129 case 'L':
return LANCE;
132 case 'G':
return GOLD;
134 case 'R':
return ROOK;
135 case 'K':
return KING;