Libsaki
Core library of Pancake Mahjong
table_server_ai3.h
1 #ifndef SAKI_APP_SERVER_AI3_H
2 #define SAKI_APP_SERVER_AI3_H
3 
4 #include "table_server.h"
5 #include "../table/table_tester.h"
6 
7 #include <iterator>
8 
9 
10 
11 namespace saki
12 {
13 
14 
15 
17 {
18 public:
19  using Ai3 = std::array<std::unique_ptr<TableDecider>, 3>;
20  TableServerAi3(Table::InitConfig config, std::vector<TableObserver *> obs,
21  const TableEnv &env, Ai3 &&ais);
22 
23  using Msgs = std::vector<TableMsgContent>;
24  using MsgBackInserter = std::back_insert_iterator<Msgs>;
25 
26  Msgs start();
27  Msgs action(const Action &action);
28 
29  const Table &table();
30 
31 private:
32  Msgs filterMsgs(const TableServer::Msgs &srcs);
33  void filterSystemMsg(const TableMsgContent &content, MsgBackInserter it);
34  void filterUserMsg(const TableMsg &msg, MsgBackInserter it);
35  void addBotAction(Who who, const Action &action, int nonce, MsgBackInserter it);
36  void addFakeBotDelay(const TableMsgContent &content, MsgBackInserter it);
37 
38 private:
39  TableServer mServer;
40  std::array<std::unique_ptr<TableDecider>, 3> mAis;
41 };
42 
43 
44 
45 } // namespace saki
46 
47 
48 
49 #endif // SAKI_APP_SERVER_AI3_H
Definition: table_server_ai3.h:16
Definition: table.h:87
Definition: table_env.h:11
Definition: action.h:27
Definition: ai.cpp:18
Definition: table_msg.h:35
Definition: table_msg.h:63
Definition: table_server.h:14
Definition: who.h:14