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/littlethreedragons.cc
Line
Count
Source
1
#include "scoring/yakus/littlethreedragons.h"
2
3
#include <vector>
4
5
#include "analysis/handnode.h"
6
#include "scoring/yakus.h"
7
#include "types/gamestate.h"
8
#include "types/hand.h"
9
#include "types/sets.h"
10
#include "types/yaku.h"
11
12
namespace mahjong::yaku {
13
bool isLittleThreeDragons(const GameState& /*state*/, const Hand& hand,
14
11
                          const std::vector<const mahjong::Node*>& branch) {
15
11
  bool pair = false;
16
11
  int pons = 0;
17
58
  for (const auto* node : branch) {
18
58
    switch (node->start().toUint8_t()) {
19
2
      case Piece::Type::kRedDragon:
20
16
      case Piece::Type::kGreenDragon:
21
17
      case Piece::Type::kWhiteDragon:
22
17
        break;
23
41
      default:
24
41
        continue;
25
58
    }
26
17
    if (node->type() == SetType::kPon) {
27
7
      pons++;
28
7
    }
29
17
    if (node->type() == SetType::kPair) {
30
6
      pair = true;
31
6
    }
32
17
  }
33
11
  if (!pair) {
34
5
    return false;
35
5
  }
36
6
  for (const auto& meld : hand.melds_range()) {
37
5
    switch (meld.start.toUint8_t()) {
38
0
      case Piece::Type::kRedDragon:
39
0
      case Piece::Type::kGreenDragon:
40
5
      case Piece::Type::kWhiteDragon:
41
5
        break;
42
0
      default:
43
0
        continue;
44
5
    }
45
5
    pons++;
46
5
  }
47
6
  return pons == 2 && pair;
48
6
}
49
50
REGISTER_YAKU({
51
    .id = "littlethreedragons",
52
    .name = "Little Three Dragons",
53
    .type = Yaku::kOpen,
54
    .value = 2,
55
    .is_yaku_func = yaku::isLittleThreeDragons,
56
});
57
}  // namespace mahjong::yaku