/nix/store/i1aar97n7b4yf8rk94p66if25brfvvdx-gqvzl8a5pvrg3xj44q0msrndcripi8dk-source/src/controllers/angrydiscardobot.h
Line | Count | Source |
1 | | #pragma once |
2 | | #include <cstddef> |
3 | | #include <memory> |
4 | | #include <string> |
5 | | #include <vector> |
6 | | |
7 | | #include "controllers/playercontroller.h" |
8 | | #include "types/event.h" |
9 | | #include "types/piecetype.h" |
10 | | #include "types/winds.h" |
11 | | |
12 | | namespace mahjong { |
13 | | |
14 | | // Always Calls (Angry) and Always Discards the tile it draws |
15 | | class AngryDiscardoBot : public PlayerController { |
16 | | public: |
17 | 28 | static std::unique_ptr<PlayerController> New() { |
18 | 28 | return std::make_unique<AngryDiscardoBot>(); |
19 | 28 | } |
20 | | |
21 | 16 | void GameStart(int _playerID) override {} |
22 | | void RoundStart(std::vector<Piece> hand, Wind /*seatWind*/, |
23 | 4 | Wind /*prevalentWind*/) override { |
24 | 4 | hand_ = hand; |
25 | 4 | lastEvent_.type = Event::kDiscard; |
26 | 4 | } |
27 | | |
28 | | void ReceiveEvent(Event e) override; |
29 | | Event RetrieveDecision() override; |
30 | | |
31 | 4 | std::string Name() override { return "AngryDiscardoBot"; }; |
32 | | |
33 | | private: |
34 | | std::vector<Piece> hand_; |
35 | | size_t n_ = 0; |
36 | | Event lastEvent_; |
37 | | }; |
38 | | |
39 | | } // namespace mahjong |