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/pinfu.cc
Line
Count
Source
1
#include "scoring/yakus/pinfu.h"
2
3
#include <vector>
4
5
#include "analysis/handnode.h"
6
#include "analysis/util.h"
7
#include "scoring/yakus.h"
8
#include "statefunctions/stateutilities.h"
9
#include "types/gamestate.h"
10
#include "types/hand.h"
11
#include "types/pieces.h"
12
#include "types/sets.h"
13
#include "types/yaku.h"
14
15
namespace mahjong::yaku {
16
bool isPinfu(const GameState& state, const Hand& hand,
17
6
             const std::vector<const mahjong::Node*>& branch) {
18
6
  if (hand.open) {
19
1
    return false;
20
1
  }
21
26
  for (const auto* node : branch) {
22
26
    switch (node->type()) {
23
1
      case SetType::kPon:
24
1
      case SetType::kConcealedKan:
25
1
      case SetType::kKan:
26
2
      case SetType::kSingle:
27
2
        return false;
28
29
18
      case SetType::kChi:
30
24
      case SetType::kPair: {
31
24
        if (node->start() == kRedDragon || node->start() == kWhiteDragon ||
32
24
            node->start() == kGreenDragon) {
33
0
          return false;
34
0
        }
35
24
        if (node->start() == kSouthWind && state.roundNum > 3) {
36
0
          return false;
37
0
        }
38
24
        if (node->start() == kEastWind && state.roundNum < 4) {
39
0
          return false;
40
0
        }
41
24
        if (node->start() ==
42
24
            Piece::fromWind(GetSeat(state.roundNum, hand.id))) {
43
0
          return false;
44
0
        }
45
24
      }
46
26
    }
47
26
  }
48
3
  return getWaits(hand, state.pendingPiece).size() >= 2;
49
5
}
50
51
REGISTER_YAKU({
52
    .id = "pinfu",
53
    .name = "Pinfu",
54
    .type = Yaku::kClosed,
55
    .value = 1,
56
    .is_yaku_func = yaku::isPinfu,
57
});
58
}  // namespace mahjong::yaku