/nix/store/i1aar97n7b4yf8rk94p66if25brfvvdx-gqvzl8a5pvrg3xj44q0msrndcripi8dk-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/sets.h" |
9 | | #include "types/yaku.h" |
10 | | |
11 | | namespace mahjong::yaku { |
12 | | bool isBigFourWinds(const GameState& state, int player, |
13 | 0 | const std::vector<const mahjong::Node*>& branch) { |
14 | 0 | int pons = 0; |
15 | 0 | for (const auto* node : branch) { |
16 | 0 | switch (node->start().toUint8_t()) { |
17 | 0 | case Piece::Type::kEastWind: |
18 | 0 | case Piece::Type::kSouthWind: |
19 | 0 | case Piece::Type::kWestWind: |
20 | 0 | case Piece::Type::kNorthWind: |
21 | 0 | break; |
22 | 0 | default: |
23 | 0 | continue; |
24 | 0 | } |
25 | 0 | if (node->type() == SetType::kPair) { |
26 | 0 | return false; |
27 | 0 | } |
28 | 0 | pons++; |
29 | 0 | } |
30 | 0 | for (const auto& meld : state.hands.at(player).melds) { |
31 | 0 | switch (meld.start.toUint8_t()) { |
32 | 0 | case Piece::Type::kEastWind: |
33 | 0 | case Piece::Type::kSouthWind: |
34 | 0 | case Piece::Type::kWestWind: |
35 | 0 | case Piece::Type::kNorthWind: |
36 | 0 | break; |
37 | 0 | default: |
38 | 0 | continue; |
39 | 0 | } |
40 | 0 | pons++; |
41 | 0 | } |
42 | 0 | return pons == 4; |
43 | 0 | } |
44 | | |
45 | | REGISTER_YAKU({ |
46 | | .id = "bigfourwinds", |
47 | | .name = "Big Four Winds", |
48 | | .type = Yaku::kYakuman, |
49 | | .value = 13, |
50 | | .is_yaku_func = yaku::isBigFourWinds, |
51 | | }); |
52 | | } // namespace mahjong::yaku |