Coverage Report

Created: 2025-09-03 03:49

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/nix/store/i1aar97n7b4yf8rk94p66if25brfvvdx-gqvzl8a5pvrg3xj44q0msrndcripi8dk-source/src/scoring/yakus/puredoublechi.cc
Line
Count
Source
1
#include "scoring/yakus/puredoublechi.h"
2
3
#include <cstddef>
4
#include <vector>
5
6
#include "analysis/handnode.h"
7
#include "scoring/yakus.h"
8
#include "scoring/yakus/twicepuredoublechi.h"
9
#include "types/gamestate.h"
10
#include "types/sets.h"
11
#include "types/yaku.h"
12
13
namespace mahjong::yaku {
14
bool isPureDoubleChi(const GameState& state, int player,
15
13
                     const std::vector<const mahjong::Node*>& branch) {
16
13
  if (state.hands.at(player).open) {
17
8
    return false;
18
8
  }
19
32
  for (size_t i = 0; i < branch.size(); i++) {
20
28
    if (branch.at(i)->type() != SetType::kChi) {
21
19
      continue;
22
19
    }
23
61
    for (size_t j = 0; j < branch.size(); j++) {
24
53
      if (i == j) {
25
9
        continue;
26
9
      }
27
44
      if (branch.at(i)->type() == branch[j]->type() &&
28
44
          branch.at(i)->start() == branch[j]->start()) {
29
1
        return !isTwicePureDoubleChi(state, player, branch);
30
1
      }
31
44
    }
32
9
  }
33
4
  return false;
34
5
}
35
36
REGISTER_YAKU({
37
    .id = "puredoublechi",
38
    .name = "PureDoubleChi",
39
    .type = Yaku::kClosed,
40
    .value = 1,
41
    .is_yaku_func = yaku::isPureDoubleChi,
42
});
43
}  // namespace mahjong::yaku