Coverage Report

Created: 2025-09-03 03:49

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/nix/store/i1aar97n7b4yf8rk94p66if25brfvvdx-gqvzl8a5pvrg3xj44q0msrndcripi8dk-source/src/controllers/totobot.cc
Line
Count
Source
1
#include "controllers/totobot.h"
2
3
#include <vector>
4
5
#include "controllers/controllermanager.h"
6
#include "types/event.h"
7
#include "types/piecetype.h"
8
#include "types/winds.h"
9
10
namespace mahjong {
11
REGISTER_PLAYER_CONTROLLER(TotoBot);
12
13
0
void TotoBot::GameStart(int /*playerID*/) {}
14
15
void TotoBot::RoundStart(std::vector<Piece> hand, Wind /*seatWind*/,
16
0
                         Wind /*prevalentWind*/) {
17
0
  hand_ = hand;
18
0
  lastEvent_.type = Event::kDiscard;
19
0
}
20
21
0
void TotoBot::ReceiveEvent(Event e) {
22
0
  if (e.decision) {
23
0
    if (e.type <= lastEvent_.type) {
24
0
      lastEvent_ = e;
25
0
    }
26
0
  } else if (e.type == Event::kDiscard) {
27
0
    hand_.emplace_back(e.piece);
28
0
  }
29
0
}
30
31
0
Event TotoBot::RetrieveDecision() {
32
0
  if (lastEvent_.type != Event::kDiscard) {
33
0
    lastEvent_.type = Event::kDecline;
34
0
  }
35
0
  Event e = lastEvent_;
36
0
  lastEvent_.type = Event::kDiscard;  // lowest """priority""" event type
37
0
  return e;
38
0
}
39
}  // namespace mahjong