/nix/store/i1aar97n7b4yf8rk94p66if25brfvvdx-gqvzl8a5pvrg3xj44q0msrndcripi8dk-source/src/controllers/thricebot.h
Line | Count | Source |
1 | | #pragma once |
2 | | #include <array> |
3 | | #include <cstdint> |
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 | | class ThriceBot : public PlayerController { |
16 | | public: |
17 | | struct HandTile { |
18 | | Piece piece; |
19 | | float weight{}; |
20 | | }; |
21 | | |
22 | 0 | static std::unique_ptr<PlayerController> New() { |
23 | 0 | return std::make_unique<ThriceBot>(); |
24 | 0 | } |
25 | | |
26 | 0 | void GameStart(int player_id) override { pid_ = player_id; } |
27 | | void RoundStart(std::vector<Piece> hand, Wind seatWind, |
28 | | Wind prevalentWind) override; |
29 | | void ReceiveEvent(Event e) override; |
30 | | Event RetrieveDecision() override; |
31 | | |
32 | 0 | std::string Name() override { return "ThriceBot"; }; |
33 | | |
34 | | private: |
35 | | void assignweights(); |
36 | | Piece popDiscard(); |
37 | | HandTile assignTileWeight(HandTile h1); |
38 | | void checkDiscard(); |
39 | | bool checkTile(Piece p); |
40 | | |
41 | | std::vector<HandTile> hand_; |
42 | | std::array<uint8_t, Piece::kPiecesize> discarded_ = {}; |
43 | | Event lastEvent_; |
44 | | Wind swind_; |
45 | | Wind pwind_; |
46 | | int pid_; |
47 | | }; |
48 | | |
49 | | } // namespace mahjong |