-
Notifications
You must be signed in to change notification settings - Fork 37
/
mjai_client.hpp
37 lines (29 loc) · 981 Bytes
/
mjai_client.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#pragma once
#include "share/include.hpp"
#include <boost/bind.hpp>
#include "share/types.hpp"
#include "mjai_manager.hpp"
class MJAI_Interface {
public:
MJAI_Interface();
Moves game_record;
std::array<int, 4> scores_;
void push(const json11::Json &receive);
void push_start_game(const json11::Json &receive, const int kyoku_first, const bool aka_flag);
void clear();
void init_scores();
Moves get_best_move(const int my_pid, const bool out_console_input);
};
class TcpClient{
public:
/// ipとportで指定した相手にソケットを繋げる
TcpClient(const std::string &ip, const int port);
~TcpClient();
std::string ReadOneLine();
void SendCommand(const std::string &command);
protected:
boost::asio::io_service io_service_;
std::unique_ptr<boost::asio::ip::tcp::socket> socket_;
boost::system::error_code error_;
boost::asio::streambuf buffer_;
};