/nix/store/rr0r40cw3mzzbz0sxrnkvnrjpzb82wpc-j27cjzgh5nmq3y8k6hwa6zpi3qgcjia8-source/src/scoring/yakus/ippatsu.cc
Line | Count | Source |
1 | | #include "scoring/yakus/ippatsu.h" |
2 | | |
3 | | #include <vector> |
4 | | |
5 | | #include "analysis/handnode.h" |
6 | | #include "scoring/yakus.h" |
7 | | #include "scoring/yakus/doubleriichi.h" |
8 | | #include "scoring/yakus/riichi.h" |
9 | | #include "types/gamestate.h" |
10 | | #include "types/hand.h" |
11 | | #include "types/yaku.h" |
12 | | |
13 | | namespace mahjong::yaku { |
14 | | bool isIppatsu(const GameState& state, const Hand& hand, |
15 | 2 | const std::vector<const mahjong::Node*>& /*branch*/) { |
16 | 2 | return (isRiichi(state, hand) || isDoubleRiichi(state, hand)) && |
17 | 2 | (state.turnNum - hand.riichiRound <= 4 && |
18 | 1 | state.lastCall < hand.riichiRound); |
19 | 2 | } |
20 | | |
21 | | REGISTER_YAKU({ |
22 | | .id = "Ippastsu", |
23 | | .name = "Ippastsu", |
24 | | .type = Yaku::kClosed, |
25 | | .value = 1, |
26 | | .is_yaku_func = yaku::isIppatsu, |
27 | | }); |
28 | | } // namespace mahjong::yaku |