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/fasttanyao.h
Line
Count
Source
1
#pragma once
2
#include <cstdint>
3
#include <map>
4
#include <memory>
5
#include <string>
6
#include <vector>
7
8
#include "controllers/playercontroller.h"
9
#include "types/event.h"
10
#include "types/piecetype.h"
11
#include "types/winds.h"
12
13
namespace mahjong {
14
15
using pieceSet = std::map<uint8_t, uint8_t>;
16
17
// == Fast Tanyao Bot ==
18
// - Attempt to get to all simples **quickly**
19
// - Immediately dump all terminals and honors
20
// - Call on everything that isn't a terminal or honor
21
// - Disregard Defense (Where we're going, we don't need defense)
22
class FastTanyao : public PlayerController {
23
 public:
24
0
  static std::unique_ptr<PlayerController> New() {
25
0
    return std::make_unique<FastTanyao>();
26
0
  }
27
28
0
  void GameStart(int _playerID) override {}
29
  void RoundStart(std::vector<Piece> hand, Wind seatWind,
30
                  Wind prevalentWind) override;
31
  void ReceiveEvent(Event e) override;
32
  Event RetrieveDecision() override;
33
34
0
  std::string Name() override { return "FastTanyao"; };
35
36
 private:
37
  void IncrementPiece(Piece piece, pieceSet& set);
38
  void IncrementPiece(Piece piece, pieceSet& set, uint8_t count);
39
  static void DecrementPiece(Piece piece, pieceSet& set);
40
  static bool ShouldKeep(Piece piece);
41
  void ProcessNewPiece(Piece piece);
42
  Piece ChooseDiscard();
43
  void OutputSet(uint8_t id, const pieceSet& set);
44
45
  pieceSet possible_triples_;
46
  std::vector<Piece> immediate_discard_;
47
  std::vector<Piece> valid_doras_;
48
  Event decided_decision_;
49
  pieceSet all_discards_;
50
};
51
52
}  // namespace mahjong