-
Notifications
You must be signed in to change notification settings - Fork 0
/
XboardCommand.h
133 lines (116 loc) · 5.2 KB
/
XboardCommand.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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
#pragma once
#include <string>
#include "Engine.h"
namespace chess {
class XboardCommand;
typedef bool (XboardCommand::* CommandFunc)(const std::string& input, std::string& output);
class XboardCommand {
struct CommandFuncMap {
std::string name;
CommandFunc func;
};
CommandFuncMap m[47] = {
{"xboard", &XboardCommand::hXboard},
{"protover", &XboardCommand::hProtover},
{"accepted", &XboardCommand::hAccepted},
{"rejected", &XboardCommand::hRejected},
{"new", &XboardCommand::hNew},
{"variant", &XboardCommand::hVariant},
{"quit", &XboardCommand::hQuit},
{"random", &XboardCommand::hRandom},
{"force", &XboardCommand::hForce},
{"go", &XboardCommand::hGo},
{"playother", &XboardCommand::hPlayother},
{"white", &XboardCommand::hWhite},
{"black", &XboardCommand::hBlack},
{"level", &XboardCommand::hLevel},
{"st", &XboardCommand::hSt},
{"sd", &XboardCommand::hSd},
{"nps", &XboardCommand::hNps},
{"time", &XboardCommand::hTime},
{"otim", &XboardCommand::hOtim},
{"usermove", &XboardCommand::hUsermove},
{"?", &XboardCommand::hQuestionmark},
{"ping", &XboardCommand::hPing},
{"draw", &XboardCommand::hDraw},
{"result", &XboardCommand::hResult},
{"setboard", &XboardCommand::hSetboard},
{"edit", &XboardCommand::hEdit},
{"hint", &XboardCommand::hHint},
{"bk", &XboardCommand::hBk},
{"undo", &XboardCommand::hUndo},
{"remove", &XboardCommand::hRemove},
{"hard", &XboardCommand::hHard},
{"easy", &XboardCommand::hEasy},
{"post", &XboardCommand::hPost},
{"nopost", &XboardCommand::hNopost},
{"analyze", &XboardCommand::hAnalyze},
{".", &XboardCommand::hDot},
{"exit", &XboardCommand::hExit},
{"name", &XboardCommand::hName},
{"rating", &XboardCommand::hRating},
{"ics", &XboardCommand::hIcs},
{"computer", &XboardCommand::hComputer},
{"pause", &XboardCommand::hPause},
{"resume", &XboardCommand::hResume},
{"memory", &XboardCommand::hMemory},
{"cores", &XboardCommand::hCores},
{"egtpath", &XboardCommand::hEgtpath},
{"option", &XboardCommand::hOption}
};
size_t mapSize;
Engine &engine;
bool hXboard(const std::string& input, std::string& output);
bool hProtover(const std::string& input, std::string& output);
bool hAccepted(const std::string& input, std::string& output);
bool hRejected(const std::string& input, std::string& output);
bool hNew(const std::string& input, std::string& output);
bool hVariant(const std::string& input, std::string& output);
bool hQuit(const std::string& input, std::string& output);
bool hRandom(const std::string& input, std::string& output);
bool hForce(const std::string& input, std::string& output);
bool hGo(const std::string& input, std::string& output);
bool hPlayother(const std::string& input, std::string& output);
bool hWhite(const std::string& input, std::string& output);
bool hBlack(const std::string& input, std::string& output);
bool hLevel(const std::string& input, std::string& output);
bool hSt(const std::string& input, std::string& output);
bool hSd(const std::string& input, std::string& output);
bool hNps(const std::string& input, std::string& output);
bool hTime(const std::string& input, std::string& output);
bool hOtim(const std::string& input, std::string& output);
bool hUsermove(const std::string& input, std::string& output);
bool hQuestionmark(const std::string& input, std::string& output);
bool hPing(const std::string& input, std::string& output);
bool hDraw(const std::string& input, std::string& output);
bool hResult(const std::string& input, std::string& output);
bool hSetboard(const std::string& input, std::string& output);
bool hEdit(const std::string& input, std::string& output);
bool hHint(const std::string& input, std::string& output);
bool hBk(const std::string& input, std::string& output);
bool hUndo(const std::string& input, std::string& output);
bool hRemove(const std::string& input, std::string& output);
bool hHard(const std::string& input, std::string& output);
bool hEasy(const std::string& input, std::string& output);
bool hPost(const std::string& input, std::string& output);
bool hNopost(const std::string& input, std::string& output);
bool hAnalyze(const std::string& input, std::string& output);
bool hDot(const std::string& input, std::string& output);
bool hExit(const std::string& input, std::string& output);
bool hName(const std::string& input, std::string& output);
bool hRating(const std::string& input, std::string& output);
bool hIcs(const std::string& input, std::string& output);
bool hComputer(const std::string& input, std::string& output);
bool hPause(const std::string& input, std::string& output);
bool hResume(const std::string& input, std::string& output);
bool hMemory(const std::string& input, std::string& output);
bool hCores(const std::string& input, std::string& output);
bool hEgtpath(const std::string& input, std::string& output);
bool hOption(const std::string& input, std::string& output);
bool hMove(const std::string& input, std::string& output);
public:
XboardCommand(Engine& e);
bool process(const std::string& input, std::string& output);
~XboardCommand();
};
}