20 throw CsaIOError(
"not a csa PlayerCharacter "+std::string(1,c));
29 return Square::STAND();
36 for(
int i=0;i<16;i++){
38 return static_cast<Ptype>(i);
40 throw CsaIOError(
"unknown std::string in csa::strToPtype "+s);
44 strToMove(
const std::string& s,
const SimpleState& state)
47 return Move::DeclareWin();
49 return Move::INVALID();
51 return Move::PASS(state.turn());
57 if(fromPos==Square::STAND()){
59 throw CsaIOError(
"drop with promote ?! in csa::strToMove "+s);
60 return Move(toPos,ptype,pl);
63 Piece p0=state.pieceAt(fromPos);
64 Piece p1=state.pieceAt(toPos);
66 bool isPromote=(p0.
ptype()!=ptype);
68 throw CsaIOError(
"bad promotion in csa::strToMove "+s);
69 return Move(fromPos,toPos,ptype,
70 capturePtype,isPromote,pl);
78 assert(buf.size() >= offset+1);
79 buf[offset] = (player==
BLACK) ?
'+' :
'-';
86 assert(buf.capacity() >= 7);
88 if (move == Move::DeclareWin())
89 return buf =
"%KACHI";
91 return buf =
"%TORYO";
104 assert(buf.size() >= offset+2);
111 const int x = pos.
x();
112 const int y = pos.
y();
113 buf[offset+0] = x +
'0';
114 buf[offset+1] = y +
'0';
121 assert(buf.size() >= offset+2);
123 buf[0+offset] = name[0];
124 buf[1+offset] = name[1];
132 std::string buf(
"+7776FU");
133 return show(move, buf);
139 std::string ret =
show(move);
152 std::string buf(
"+");
153 return show(player, buf);
159 std::string buf(
"00");
160 return show(position, buf);
166 std::string buf(
"OU");
167 return show(ptype, buf);
187 std::ostringstream
out;
188 for (; first != last; ++first) {