/nix/store/rr0r40cw3mzzbz0sxrnkvnrjpzb82wpc-j27cjzgh5nmq3y8k6hwa6zpi3qgcjia8-source/src/scoring/yakus/bigfourwinds.cc
Line | Count | Source |
1 | | #include "scoring/yakus/bigfourwinds.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 isBigFourWinds(const GameState& /*state*/, const Hand& hand, |
14 | 0 | const std::vector<const mahjong::Node*>& branch) { |
15 | 0 | int pons = 0; |
16 | 0 | for (const auto* node : branch) { |
17 | 0 | switch (node->start().toUint8_t()) { |
18 | 0 | case Piece::Type::kEastWind: |
19 | 0 | case Piece::Type::kSouthWind: |
20 | 0 | case Piece::Type::kWestWind: |
21 | 0 | case Piece::Type::kNorthWind: |
22 | 0 | break; |
23 | 0 | default: |
24 | 0 | continue; |
25 | 0 | } |
26 | 0 | if (node->type() == SetType::kPair) { |
27 | 0 | return false; |
28 | 0 | } |
29 | 0 | pons++; |
30 | 0 | } |
31 | 0 | for (const auto& meld : hand.melds_range()) { |
32 | 0 | switch (meld.start.toUint8_t()) { |
33 | 0 | case Piece::Type::kEastWind: |
34 | 0 | case Piece::Type::kSouthWind: |
35 | 0 | case Piece::Type::kWestWind: |
36 | 0 | case Piece::Type::kNorthWind: |
37 | 0 | break; |
38 | 0 | default: |
39 | 0 | continue; |
40 | 0 | } |
41 | 0 | pons++; |
42 | 0 | } |
43 | 0 | return pons == 4; |
44 | 0 | } |
45 | | |
46 | | REGISTER_YAKU({ |
47 | | .id = "bigfourwinds", |
48 | | .name = "Big Four Winds", |
49 | | .type = Yaku::kYakuman, |
50 | | .value = 13, |
51 | | .is_yaku_func = yaku::isBigFourWinds, |
52 | | }); |
53 | | } // namespace mahjong::yaku |