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