/nix/store/rr0r40cw3mzzbz0sxrnkvnrjpzb82wpc-j27cjzgh5nmq3y8k6hwa6zpi3qgcjia8-source/src/scoring/yakus/allterminalsandhonors.cc
Line | Count | Source |
1 | | #include "scoring/yakus/allterminalsandhonors.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/yaku.h" |
10 | | |
11 | | namespace mahjong::yaku { |
12 | | bool isAllTerminalsAndHonors( |
13 | | const GameState& /*state*/, const Hand& hand, |
14 | 21 | const std::vector<const mahjong::Node*>& /*branch*/) { |
15 | 191 | for (const auto& piece : hand.live_range()) { |
16 | 191 | if (!piece.isHonor() && !piece.isTerminal()) { |
17 | 19 | return false; |
18 | 19 | } |
19 | 191 | } |
20 | 2 | for (const auto& meld : hand.melds_range()) { |
21 | 1 | if (!meld.start.isHonor() && !meld.start.isTerminal()) { |
22 | 0 | return false; |
23 | 0 | } |
24 | 1 | } |
25 | 2 | return true; |
26 | 2 | } |
27 | | |
28 | | REGISTER_YAKU({ |
29 | | .id = "allterminalsandhonors", |
30 | | .name = "All Terminals and Honors", |
31 | | .type = Yaku::kOpen, |
32 | | .value = 2, |
33 | | .is_yaku_func = yaku::isAllTerminalsAndHonors, |
34 | | }); |
35 | | } // namespace mahjong::yaku |