Go to the documentation of this file.
3 #ifndef OSL_PIECESTAND_H
4 #define OSL_PIECESTAND_H
53 int knightCount,
int silverCount,
54 int goldCount,
int bishopCount,
55 int rookCount,
int kingCount)
71 assert(num == (num &
mask[type]));
78 assert(num == (num &
mask[type]));
79 assert(
get(type) >= num);
161 return hasMoreThan<BLACK>(other);
163 return hasMoreThan<WHITE>(other);
176 unsigned int my_mask = mask0-((mask0&0x40000024)>>2);
178 my_mask -= (mask0&0x08022200)>>3;
180 my_mask -= (mask0&0x00800000)>>5;
191 const unsigned int mask0=diff0&
carryMask;
194 const unsigned int mask02=(mask0&0x40000024u)+(mask0&0x48022224u);
195 unsigned int my_mask=mask0-(mask02>>3);
198 my_mask -= (mask0&0x00800000)>>5;
268 std::ostream&
operator<<(std::ostream&, PieceStand l);
void trySub(Ptype type)
1枚以上持っていれば減らす
static const CArray< unsigned char, PTYPE_MAX+1 > mask
void subAtmostOnePiece(PieceStand const &ps)
unsigned int getFlags() const
const PieceStand max2(PieceStand other) const
種類毎に this と other の持駒の多い方を取る (max のalternative)
bool isSuperiorOrEqualTo(PieceStand other) const
bool carryUnchangedAfterSub(const PieceStand &original, const PieceStand &other) const
PieceStand(unsigned int value=0)
static std::istream & readNumbers(std::istream &, PieceStand &stand)
void sub(Ptype type, unsigned int num=1)
static const unsigned int carryMask
PieceStand(int pawnCount, int lanceCount, int knightCount, int silverCount, int goldCount, int bishopCount, int rookCount, int kingCount)
void addAtmostOnePiece(PieceStand const &ps)
pieceStand同士の加算,減算.
std::ostream & operator<<(std::ostream &os, Player player)
const PieceStand nextStand(Player pl, Move move) const
Ptype capturePtype() const
const PieceStand nextStand(Move move) const
bool isBasic(Ptype ptype)
ptypeが基本型(promoteしていない)かのチェック
unsigned int testCarries() const
bool carryUnchangedAfterAdd(const PieceStand &original, const PieceStand &other) const
bool isNormal() const
INVALID でも PASS でもない.
void add(Ptype type, unsigned int num=1)
static const CArray< Ptype, 7 > order
持駒の表示で良く使われる順番.
const PieceStand previousStand(Player pl, Move move) const
bool hasMoreThan(Player P, PieceStand other) const
bool operator<(Offset l, Offset r)
bool operator==(Square l, Square r)
bool operator!=(Offset l, Offset r)
static const CArray< unsigned char, PTYPE_MAX+1 > shift
bool any() const
どれかの駒を一枚でも持っている
bool canAdd(Ptype type) const
bool hasMoreThan(PieceStand other) const
this と other が BLACK の持駒と考えた時に, this の方が同じか沢山持っていれば真.
unsigned int get(Ptype type) const
const PieceStand previousStand(Move move) const
void tryAdd(Ptype type)
加算可能なら加える.
bool atMostOneKind() const
一種類の駒しかない
Ptype unpromote(Ptype ptype)
ptypeがpromote後の型の時に,promote前の型を返す. promoteしていない型の時はそのまま返す
const PieceStand max(PieceStand other) const
種類毎に this と other の持駒の多い方を取る
static std::ostream & writeNumbers(std::ostream &, const PieceStand &stand)
持駒の数を空白区切で出力する.