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