10 static_assert(
sizeof(
unsigned int)*8>=32,
"PieceStand");
20 28, 24, 18, 14, 10, 6, 3, 0,
25 (1<<2)-1, (1<<3)-1, (1<<5)-1, (1<<3)-1, (1<<3)-1, (1<<3)-1, (1<<2)-1, (1<<2)-1
44 return (
static_cast<int>(get(type)) != max);
64 std::cerr << original <<
" + " << other <<
" = " << *
this <<
"\n";
73 std::cerr << original <<
" - " << other <<
" = " << *
this <<
"\n";
82 os <<
' ' << stand.
get(ptype);
92 os << stand.
get(ptype) <<
" ";
103 stand.
add(ptype, val);
static const CArray< unsigned char, PTYPE_MAX+1 > shift
void add(Ptype type, unsigned int num=1)
static const unsigned int carryMask
unsigned int testCarries() const
void tryAdd(Ptype type)
加算可能なら加える.
static const CArray< unsigned char, PTYPE_MAX+1 > mask
bool canAdd(Ptype type) const
PieceStand(unsigned int value=0)
bool carryUnchangedAfterSub(const PieceStand &original, const PieceStand &other) const
bool carryUnchangedAfterAdd(const PieceStand &original, const PieceStand &other) const
bool atMostOneKind() const
一種類の駒しかない
unsigned int get(Ptype type) const
static const CArray< Ptype, 7 > order
持駒の表示で良く使われる順番.
int getIndexLimit(Ptype ptype) const
int getIndexMin(Ptype ptype) const
int countPiecesOnStand(Player pl, Ptype ptype) const
持駒の枚数を数える
const PtypeTable Ptype_Table
std::ostream & operator<<(std::ostream &os, Player player)
static std::ostream & writeNumbers(std::ostream &, const PieceStand &stand)
持駒の数を空白区切で出力する.
static std::istream & readNumbers(std::istream &, PieceStand &stand)
static int countBit(Integer mask)