-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcolibri.cpp
76 lines (69 loc) · 1.62 KB
/
colibri.cpp
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
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <unistd.h>
#include "configfile.h"
#include "egtb.h"
#include "fileutil.h"
#include "logging.h"
#include "pns.h"
#include "precomp.h"
#include "queryserver.h"
#include "zobrist.h"
void setCommand(int *oldCmd, int newCmd) {
if (*oldCmd) {
die("Only one command out of -a and -s may be given.");
}
*oldCmd = newCmd;
}
int main(int argc, char **argv) {
//srand(time(NULL));
srand(1234);
loadConfigFile(CONFIG_FILE);
logInit(cfgLogFile.c_str());
precomputeAll();
initEgtb();
zobristInit();
string bookFile = cfgBookFile, position = "";
int command = 0;
int opt;
opterr = 0; // Suppresses error messages from getopt()
while ((opt = getopt(argc, argv, "a:f:s")) != -1) {
switch (opt) {
case 'f':
bookFile = optarg;
break;
case 'a':
setCommand(&command, CMD_ANALYZE);
position = optarg;
break;
case 's':
setCommand(&command, CMD_SERVER);
break;
default:
die("Unknown switch -%c", optopt);
}
}
Pns pn1(60000, 10000000);
Pns pn2(10000000, 100000000, &pn1, bookFile);
QueryServer qs(&pn2);
pn2.load();
switch (command) {
case CMD_ANALYZE:
qs.startAsync();
pn2.analyzeString(position);
pn2.save();
break;
case CMD_SERVER:
qs.startSync();
break;
default:
log(LOG_WARNING, "No command given. Resuming main() execution.");
}
// const char* table = "BPPvPP";
// generateEgtb(table);
// verifyEgtb(table);
// compressEgtb(table);
// generateAllEgtb(2, 2);
log(LOG_DEBUG, "shutting down");
}