32 SEQ, TRI, BIFACE, CLAMP, SIDE, PAIR, FREE
46 bool num = head.isNum();
47 assert((type != Type::SEQ || (num && v <= 7))
48 && (type != Type::BIFACE || (num && 2 <= v && v <= 7))
49 && (type != Type::CLAMP || (num && v <= 7))
50 && (type != Type::SIDE || (num && (v == 1 || v == 8))));
54 C34(
const C34 ©) =
default;
55 C34 &operator=(
const C34 &assign) =
default;
91 return { h, h.next(), h.nnext() };
95 return { h, h.next() };
97 return { h, h.nnext() };
99 return { h, h.next() };
116 const int v = h.val();
124 return { h.prev(), h.nnext() };
128 return { h.val() == 1 ? h.nnext() : h.prev() };
135 return { h, h.next(), h.nnext() };
137 return { h.prev(), h, h.next(), h.nnext() };
139 return { h.pprev(), h.prev(), h, h.next() };
141 return { h.pprev(), h.prev(), h };
143 return { h.pprev(), h.prev(), h, h.next(), h.nnext() };
149 bool has(
T34 t)
const 151 const auto &ts = t34s();
152 return std::find(ts.begin(), ts.end(), t) != ts.end();
157 return mType == Type::SEQ || mType == Type::TRI;
162 return isSeq2() || mType == Type::PAIR;
167 return mType == Type::BIFACE || mType == Type::CLAMP || mType == Type::SIDE;
184 auto need = [
this](
T34 t) {
return !has(t); };
185 std::copy_if(tar.begin(), tar.end(), std::back_inserter(res), need);
189 bool operator==(
const C34 &that)
const 191 return mType == that.mType && mHead == that.mHead;
194 bool operator!=(
const C34 &that)
const 196 return !(*
this == that);
199 bool operator<(
const C34 &that)
const 201 if (mType != that.mType) {
202 int a =
static_cast<int>(mType);
203 int b =
static_cast<int>(that.mType);
207 return mHead < that.mHead;
217 inline std::ostream &operator<<(std::ostream &os,
C34 c)
219 int v = c.head().val();
220 char s = T34::charOf(c.head().suit());
223 return os << v << (v + 1) << (v + 2) << s;
225 return os << v << v << v << s;
226 case C34::Type::BIFACE:
227 return os << v << (v + 1) << s;
228 case C34::Type::CLAMP:
229 return os << v << (v + 2) << s;
230 case C34::Type::SIDE:
231 return os << v << (v + 1) << s;
232 case C34::Type::PAIR:
233 return os << v << v << s;
234 case C34::Type::FREE:
235 return os << c.head();
242 inline std::ostream &operator<<(std::ostream &os, const util::Stactor<C34, MAX> &cs)
264 #endif // SAKI_COMELD_H util::Stactor< T34, 5 > effA4() const
Get first-class effective tiles assuming this comeld is a waiter.
Definition: comeld.h:112
util::Stactor< T34, 3 > tilesTo(const util::Stactor< T34, 3 > &tar) const
Tiles needed to form this to tar.
Definition: comeld.h:181
util::Stactor< T34, 3 > tilesTo(const C34 &that) const
Tiles needed to transform from this into that.
Definition: comeld.h:173
Comeld, a meld or a part of a meld.
Definition: comeld.h:18
Type
Definition: comeld.h:30
Stactor = statically allocated vector.
Definition: stactor.h:247
C34()
Garbage value.
Definition: comeld.h:36