6 #include <initializer_list> 23 CHII, PON, DAIMINKAN, ANKAN, KAKAN
27 M37(
const M37 ©) =
default;
28 M37 &operator=(
const M37 &assign) =
default;
31 static M37 chii(
const T37 &l,
const T37 &m,
const T37 &r,
int lay)
33 M37 bark(Type::CHII, lay, { l, m, r });
37 static M37 pon(
const T37 &l,
const T37 &m,
const T37 &r,
int lay)
39 assert(lay == 0 || lay == 1 || lay == 2);
40 M37 bark(Type::PON, lay, { l, m, r });
44 static M37 daiminkan(
const T37 &l,
const T37 &m,
const T37 &r,
const T37 &x,
47 assert(lay == 0 || lay == 1 || lay == 2);
48 M37 bark(Type::DAIMINKAN, lay, { l, m, r, x });
52 static M37 ankan(
const T37 &l,
const T37 &m,
const T37 &r,
const T37 &x)
54 M37 bark(Type::ANKAN, -1, { l, m, r, x });
58 void kakan(
const T37 &x)
60 assert(mType == Type::PON);
75 unsigned uLayIndex()
const 77 return static_cast<unsigned>(mLay);
85 const T37 &operator[](
int i)
const 87 return mTiles[
static_cast<size_t>(i)];
92 return mType == Type::CHII
94 || mType == Type::DAIMINKAN;
99 return mType == Type::DAIMINKAN
100 || mType == Type::ANKAN
101 || mType == Type::KAKAN;
104 bool has(
T34 t)
const 108 return t == mTiles[0] || t == mTiles[1] || t == mTiles[2];
110 return t == mTiles[0];
115 M37(Type type,
int lay, std::initializer_list<T37> tiles)
128 inline int operator%(
T34 ind,
const M37 &m)
130 const auto &ts = m.tiles();
131 auto res = std::count(ts.begin(), ts.end(), ind.dora());
132 return static_cast<int>(res);
135 inline std::ostream &operator<<(std::ostream &os,
const M37 &m)
137 for (
const T37 &t : m.tiles()) {
138 os << (t.isAka5() ? 0 : t.val());
141 os << T34::charOf(m[0].suit());
151 #endif // SAKI_MELD_H
Stactor = statically allocated vector.
Definition: stactor.h:247