/nix/store/i1aar97n7b4yf8rk94p66if25brfvvdx-gqvzl8a5pvrg3xj44q0msrndcripi8dk-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/yaku.h" |
11 | | |
12 | | namespace mahjong::yaku { |
13 | | bool isIppatsu(const GameState& state, int player, |
14 | 2 | const std::vector<const mahjong::Node*>& /*branch*/) { |
15 | 2 | return (isRiichi(state, player) || isDoubleRiichi(state, player)) && |
16 | 2 | (state.turnNum - state.hands.at(player).riichiRound <= 4 && |
17 | 1 | state.lastCall < state.hands.at(player).riichiRound); |
18 | 2 | } |
19 | | |
20 | | REGISTER_YAKU({ |
21 | | .id = "Ippastsu", |
22 | | .name = "Ippastsu", |
23 | | .type = Yaku::kClosed, |
24 | | .value = 1, |
25 | | .is_yaku_func = yaku::isIppatsu, |
26 | | }); |
27 | | } // namespace mahjong::yaku |