7 #include <boost/tuple/tuple.hpp>
8 #include <boost/tuple/tuple_comparison.hpp>
22 SimpleState board = (org.turn() ==
BLACK) ? org : org.rotate180();
23 CArray<boost::tuple<
int,bool,
int ,
Square>, Piece::SIZE> pieces;
24 for (
int i=0; i<Piece::SIZE; ++i)
26 const Piece p = board.pieceOf(i);
30 std::sort(pieces.begin(), pieces.end());
31 for (
int i=0; i<Piece::SIZE; ++i)
33 data[i] = OPiece::position2Bits(pieces[i].get<3>());
34 data[Piece::SIZE + i/8] |=
playerToIndex(static_cast<Player>(pieces[i].get<2>())) << (i%8);
35 data[Piece::SIZE + i/8 + 5] |= pieces[i].get<1>() << (i%8);
42 if (src.size() != data.size())
43 throw std::runtime_error(
"bad argument in MiniBoardChar50::MiniBoardChar50(const std::string&)");
44 std::copy(src.begin(), src.end(), data.begin());
53 for (
int i = 0; i<Piece::SIZE; i++)
55 const Square position = OPiece::bits2Square(data[i]);
57 const bool promoted = (data[40+i/8+5] >> (i%8)) & 1;
61 state.setPiece(owner, position, ptype);
66 state = state.rotate180();
67 assert(state.turn() == turn);
74 return std::string(data.begin(), data.end());
79 return std::lexicographical_compare(l.
data.begin(), l.
data.end(),
84 return std::equal(l.
data.begin(), l.
data.end(), r.
data.begin());