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/littlefourwinds.cc
Line
Count
Source
1
#include "scoring/yakus/littlefourwinds.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 isLittleFourWinds(const GameState& /*state*/, const Hand& hand,
14
0
                       const std::vector<const mahjong::Node*>& branch) {
15
0
  bool pair = false;
16
0
  int pons = 0;
17
0
  for (const auto* node : branch) {
18
0
    switch (node->start().toUint8_t()) {
19
0
      case Piece::Type::kEastWind:
20
0
      case Piece::Type::kSouthWind:
21
0
      case Piece::Type::kWestWind:
22
0
      case Piece::Type::kNorthWind:
23
0
        break;
24
0
      default:
25
0
        continue;
26
0
    }
27
0
    if (node->type() != SetType::kPair) {
28
0
      pons++;
29
0
    } else {
30
0
      if (pair) {
31
0
        return false;
32
0
      }
33
0
      pair = true;
34
0
    }
35
0
  }
36
0
  if (!pair) {
37
0
    return false;
38
0
  }
39
0
  for (const auto& meld : hand.melds_range()) {
40
0
    switch (meld.start.toUint8_t()) {
41
0
      case Piece::Type::kEastWind:
42
0
      case Piece::Type::kSouthWind:
43
0
      case Piece::Type::kWestWind:
44
0
      case Piece::Type::kNorthWind:
45
0
        break;
46
0
      default:
47
0
        continue;
48
0
    }
49
0
    pons++;
50
0
  }
51
0
  return pons == 3 && pair;
52
0
}
53
54
REGISTER_YAKU({
55
    .id = "littlefourwinds",
56
    .name = "Little Four Winds",
57
    .type = Yaku::kYakuman,
58
    .value = 13,
59
    .is_yaku_func = yaku::isLittleFourWinds,
60
});
61
}  // namespace mahjong::yaku