-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathGTPClient.h
46 lines (36 loc) · 933 Bytes
/
GTPClient.h
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
38
39
40
41
42
43
44
45
46
/*
* GTPClient.h
*
* Created on: Apr 10, 2014
* Author: gongbingchen
*/
#ifndef GTPCLIENT_H_
#define GTPCLIENT_H_
#include <sys/types.h>
#include <unistd.h>
#include <stdio.h>
#include <string>
#include <cstdlib>
#include <sstream>
#include "GoBoard.h"
class GTPClient{
private:
static const char PositionXTable[];
static const char * ColorString[];
pid_t pid;
const std::string prog;
FILE *clientIn;
FILE *clientOut;
int seq;
void GTPFork();
bool GTPCommand(std::string cmd, std::stringstream &rets);
public:
GTPClient(const std::string prog);
bool Ping();
bool Move(PiecesPosition position, int color);
bool GenMove(int color, PiecesPosition &position);
bool ShowBoard(unsigned char PiecesMap[BOARDSIZE][BOARDSIZE], int &bc, int &wc);
std::string ShowResult(); // Added to show final score
~GTPClient();
};
#endif /* GTPCLIENT_H_ */