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/twicepuredoublechi.cc
Line
Count
Source
1
#include "scoring/yakus/twicepuredoublechi.h"
2
3
#include <cstddef>
4
#include <vector>
5
6
#include "analysis/handnode.h"
7
#include "scoring/yakus.h"
8
#include "types/gamestate.h"
9
#include "types/hand.h"
10
#include "types/sets.h"
11
#include "types/yaku.h"
12
13
namespace mahjong::yaku {
14
bool isTwicePureDoubleChi(const GameState& /*state*/, const Hand& hand,
15
9
                          const std::vector<const mahjong::Node*>& branch) {
16
9
  if (hand.open) {
17
4
    return false;
18
4
  }
19
5
  int pairs = 0;
20
31
  for (size_t i = 0; i < branch.size(); i++) {
21
26
    if (branch.at(i)->type() != SetType::kChi) {
22
10
      continue;
23
10
    }
24
46
    for (size_t j = i + 1; j < branch.size(); j++) {
25
30
      if (branch.at(j)->type() == SetType::kChi &&
26
30
          branch.at(i)->start() == branch.at(j)->start()) {
27
4
        pairs++;
28
4
      }
29
30
    }
30
16
  }
31
5
  return pairs == 2;
32
9
}
33
34
REGISTER_YAKU({
35
    .id = "twicepuredoublechi",
36
    .name = "Twice Pure Double Chi",
37
    .type = Yaku::kClosed,
38
    .value = 3,
39
    .is_yaku_func = yaku::isTwicePureDoubleChi,
40
});
41
}  // namespace mahjong::yaku