22 CArray<std::tuple<
int,bool,
int ,
Square>, Piece::SIZE> pieces;
23 for (
int i=0; i<Piece::SIZE; ++i)
29 std::sort(pieces.begin(), pieces.end());
30 for (
int i=0; i<Piece::SIZE; ++i)
32 data[i] = OPiece::position2Bits(std::get<3>(pieces[i]));
33 data[Piece::SIZE + i/8] |=
playerToIndex(static_cast<Player>(std::get<2>(pieces[i]))) << (i%8);
34 data[Piece::SIZE + i/8 + 5] |= std::get<1>(pieces[i]) << (i%8);
41 if (src.size() != data.size())
42 throw std::runtime_error(
"bad argument in MiniBoardChar50::MiniBoardChar50(const std::string&)");
43 std::copy(src.begin(), src.end(), data.begin());
52 for (
int i = 0; i<Piece::SIZE; i++)
54 const Square position = OPiece::bits2Square(data[i]);
56 const bool promoted = (data[40+i/8+5] >> (i%8)) & 1;
60 state.
setPiece(owner, position, ptype);
66 assert(state.
turn() == turn);
73 return std::string(data.begin(), data.end());
Ptype unpromote(Ptype ptype)
ptypeがpromote後の型の時に,promote前の型を返す. promoteしていない型の時はそのまま返す ...
void setPiece(Player player, Square sq, Ptype ptype)
bool operator==(const CompactBoard &, const CompactBoard &)
局面を比較する.
bool operator<(const MiniBoardChar50 &, const MiniBoardChar50 &)
Ptype promote(Ptype ptype)
promote可能なptypeに対して,promote後の型を返す promote不可のptypeを与えてはいけない. ...
const Piece pieceOf(int num) const
const PtypeTable Ptype_Table
const SimpleState toSimpleState(Player turn=BLACK) const
bool isPromoted() const
promoteした駒かどうかをチェックする
constexpr int playerToIndex(Player player)
const PieceTable Piece_Table
CArray< uint8_t, 50 > data
const Square square() const
constexpr Player indexToPlayer(int n)
const SimpleState rotate180() const
Ptype getPtypeOf(int num) const
const std::string toString() const
int getIndexMin(Ptype ptype) const
void setTurn(Player player)