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/statefunctions/gamestates/riichi.cc
Line
Count
Source
1
#include <array>
2
#include <cstdint>
3
#include <memory>
4
#include <vector>
5
6
#include "analysis/util.h"
7
#include "statefunctions/router.h"
8
#include "statefunctions/stateutilities.h"
9
#include "types/event.h"
10
#include "types/gamestate.h"
11
#include "types/hand.h"
12
#include "types/piecetype.h"
13
#include "types/statefunction.h"
14
15
namespace mahjong {
16
17
namespace {
18
0
std::unique_ptr<GameState> Riichi(std::unique_ptr<GameState> state) {
19
0
  Hand& hand = state->hands[state->currentPlayer];
20
0
  hand.riichiRound = state->turnNum;
21
0
  hand.riichiPieceDiscard = hand.discards_count;
22
0
  hand.riichi = true;
23
24
  // TODO(#22): Ask the players if they want to riichi
25
0
  state->pendingPiece = getPossibleWaits(hand).begin()->second.front();
26
0
  state->riichiSticks++;
27
28
0
  AlertPlayers(*state,
29
0
               Event{
30
0
                   .type = Event::kRiichi,          // type
31
0
                   .player = state->currentPlayer,  // player
32
0
                   .piece = static_cast<int16_t>(
33
0
                       Piece(state->pendingPiece).toUint8_t()),  // piece
34
0
                   .decision = false,                            // decision
35
0
               });
36
37
0
  state->nextState = StateFunctionType::kDiscard;
38
0
  return state;
39
0
}
40
}  // namespace
41
42
REGISTER_ROUTE(Riichi, StateFunctionType::kRiichi);
43
}  // namespace mahjong