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
35 for (
Ptype ptype: PieceStand::order)
44 return (static_cast<int>(
get(type)) != max);
64 std::cerr << original <<
" + " << other <<
" = " << *
this <<
"\n";
73 std::cerr << original <<
" - " << other <<
" = " << *
this <<
"\n";
80 for (
Ptype ptype: PieceStand::order)
82 os <<
' ' << stand.
get(ptype);
91 for (
Ptype ptype: PieceStand::order) {
92 os << stand.
get(ptype) <<
" ";
100 for (
Ptype ptype: PieceStand::order) {
103 stand.
add(ptype, val);
void add(Ptype type, unsigned int num=1)
static int countBit(Integer mask)
int countPiecesOnStand(Player pl, Ptype ptype) const
持駒の枚数を数える
static const CArray< unsigned char, PTYPE_MAX+1 > shift
std::ostream & operator<<(std::ostream &os, Player player)
unsigned int get(Ptype type) const
bool atMostOneKind() const
一種類の駒しかない
unsigned int testCarries() const
static const CArray< unsigned char, PTYPE_MAX+1 > mask
const PtypeTable Ptype_Table
static std::istream & readNumbers(std::istream &, PieceStand &stand)
bool canAdd(Ptype type) const
bool carryUnchangedAfterSub(const PieceStand &original, const PieceStand &other) const
unsigned int getFlags() const
void tryAdd(Ptype type)
加算可能なら加える.
int getIndexLimit(Ptype ptype) const
static const unsigned int carryMask
static const CArray< Ptype, 7 > order
持駒の表示で良く使われる順番.
bool carryUnchangedAfterAdd(const PieceStand &original, const PieceStand &other) const
const PieceStand max(PieceStand other) const
種類毎に this と other の持駒の多い方を取る
static std::ostream & writeNumbers(std::ostream &, const PieceStand &stand)
持駒の数を空白区切で出力する.
int getIndexMin(Ptype ptype) const
PieceStand(unsigned int value=0)