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/angrydiscardobot.cc
Line
Count
Source
1
#include "controllers/angrydiscardobot.h"
2
3
#include "controllers/controllermanager.h"
4
#include "types/event.h"
5
6
namespace mahjong {
7
REGISTER_PLAYER_CONTROLLER(AngryDiscardoBot);
8
9
4
void AngryDiscardoBot::ReceiveEvent(Event e) {
10
4
  if (e.decision) {
11
0
    if (e.type <= lastEvent_.type) {
12
0
      lastEvent_ = e;
13
0
    }
14
4
  } else if (e.type == Event::kDiscard) {
15
0
    hand_.emplace_back(e.piece);
16
0
  }
17
4
}
18
19
0
Event AngryDiscardoBot::RetrieveDecision() {
20
0
  if (lastEvent_.type == Event::kDiscard) {
21
0
    lastEvent_.piece = hand_[n_].toUint8_t();
22
0
    n_ = (n_ + 1) % hand_.size();
23
0
  }
24
0
  Event e = lastEvent_;
25
0
  lastEvent_.type = Event::kDiscard;  // lowest """priority""" event type
26
0
  return e;
27
0
}
28
}  // namespace mahjong