/nix/store/i1aar97n7b4yf8rk94p66if25brfvvdx-gqvzl8a5pvrg3xj44q0msrndcripi8dk-source/src/scoring/yakus/fourkans.cc
Line | Count | Source |
1 | | #include "scoring/yakus/fourkans.h" |
2 | | |
3 | | #include <vector> |
4 | | |
5 | | #include "analysis/handnode.h" |
6 | | #include "scoring/yakus.h" |
7 | | #include "types/gamestate.h" |
8 | | #include "types/sets.h" |
9 | | #include "types/yaku.h" |
10 | | |
11 | | namespace mahjong::yaku { |
12 | | bool isFourKans(const GameState& state, int player, |
13 | 0 | const std::vector<const mahjong::Node*>& /*branch*/) { |
14 | 0 | int kans = 0; |
15 | 0 | for (const auto& meld : state.hands.at(player).melds) { |
16 | 0 | if (meld.type >= SetType::kKan) { |
17 | 0 | kans++; |
18 | 0 | } |
19 | 0 | } |
20 | 0 | return kans == 4; |
21 | 0 | } |
22 | | |
23 | | REGISTER_YAKU({ |
24 | | .id = "fourkans", |
25 | | .name = "Four Kans", |
26 | | .type = Yaku::kYakuman, |
27 | | .value = 1, |
28 | | .is_yaku_func = yaku::isFourKans, |
29 | | }); |
30 | | } // namespace mahjong::yaku |