Coverage Report

Created: 2026-11-14 03:38

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/nix/store/rr0r40cw3mzzbz0sxrnkvnrjpzb82wpc-j27cjzgh5nmq3y8k6hwa6zpi3qgcjia8-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/hand.h"
11
#include "types/sets.h"
12
#include "types/yaku.h"
13
14
namespace mahjong::yaku {
15
bool isPureDoubleChi(const GameState& state, const Hand& hand,
16
14
                     const std::vector<const mahjong::Node*>& branch) {
17
14
  if (hand.open) {
18
8
    return false;
19
8
  }
20
38
  for (size_t i = 0; i < branch.size(); i++) {
21
33
    if (branch.at(i)->type() != SetType::kChi) {
22
20
      continue;
23
20
    }
24
85
    for (size_t j = 0; j < branch.size(); j++) {
25
73
      if (i == j) {
26
13
        continue;
27
13
      }
28
60
      if (branch.at(i)->type() == branch[j]->type() &&
29
60
          branch.at(i)->start() == branch[j]->start()) {
30
1
        return !isTwicePureDoubleChi(state, hand, branch);
31
1
      }
32
60
    }
33
13
  }
34
5
  return false;
35
6
}
36
37
REGISTER_YAKU({
38
    .id = "puredoublechi",
39
    .name = "PureDoubleChi",
40
    .type = Yaku::kClosed,
41
    .value = 1,
42
    .is_yaku_func = yaku::isPureDoubleChi,
43
});
44
}  // namespace mahjong::yaku