/nix/store/rr0r40cw3mzzbz0sxrnkvnrjpzb82wpc-j27cjzgh5nmq3y8k6hwa6zpi3qgcjia8-source/src/scoring/yakus/fourconcealedpon.cc
Line | Count | Source |
1 | | #include "scoring/yakus/fourconcealedpon.h" |
2 | | |
3 | | #include <vector> |
4 | | |
5 | | #include "analysis/handnode.h" |
6 | | #include "scoring/yakus.h" |
7 | | #include "types/gamestate.h" |
8 | | #include "types/hand.h" |
9 | | #include "types/sets.h" |
10 | | #include "types/yaku.h" |
11 | | |
12 | | namespace mahjong::yaku { |
13 | | bool isFourConcealedPon(const GameState& /*state*/, const Hand& hand, |
14 | 0 | const std::vector<const mahjong::Node*>& branch) { |
15 | 0 | if (hand.open) { |
16 | 0 | return false; |
17 | 0 | } |
18 | 0 | int concealed_pons = 0; |
19 | 0 | for (const auto* node : branch) { |
20 | 0 | if (node->type() == SetType::kPon) { |
21 | 0 | concealed_pons++; |
22 | 0 | } |
23 | 0 | } |
24 | 0 | for (const auto& meld : hand.melds_range()) { |
25 | 0 | if (meld.type == SetType::kConcealedKan) { |
26 | 0 | concealed_pons++; |
27 | 0 | } |
28 | 0 | } |
29 | 0 | return concealed_pons == 4; |
30 | 0 | } |
31 | | |
32 | | REGISTER_YAKU({ |
33 | | .id = "fourconcealedpon", |
34 | | .name = "Four Concealed Pon", |
35 | | .type = Yaku::kYakuman, |
36 | | .value = 13, |
37 | | .is_yaku_func = yaku::isFourConcealedPon, |
38 | | }); |
39 | | } // namespace mahjong::yaku |