-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
33 lines (30 loc) · 983 Bytes
/
main.cpp
File metadata and controls
33 lines (30 loc) · 983 Bytes
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
#include <cstring>
#include "ap.h"
int main(int argc, char** argv)
{
if (argc == 1) return 0;
ArtificialPlayer *p1 = new ArtificialPlayer;
if (strcmp(argv[1],"new") == 0) {
uint32_t * nl = new uint32_t[1+2*std::atoi(argv[6])];
for (int i = 0; i < 1+2*std::atoi(argv[6]); i++) {
nl[i] = std::atoi(argv[7+i]);
}
p1->Initialize(std::atoi(argv[3]),std::atoi(argv[4]),std::atoi(argv[5]),std::atoi(argv[6]),nl);
p1->SaveProgress(argv[2]);
} else if (strcmp(argv[1],"learn") == 0) {
p1->LoadProgress(argv[2]);
if (argc == 4) { p1->Training(std::atoi(argv[3])); }
else if (argc == 5) { p1->Training(std::atoi(argv[3]),argv[2],std::atoi(argv[4])); }
p1->SaveProgress(argv[2]);
} else if (strcmp(argv[1],"play") == 0) {
p1->LoadProgress(argv[2]);
char c;
p1->ShowPlay();
while (std::cin >> c) {
std::cout << "===============================\n";
if (c=='q') break;
p1->ShowPlay();
}
}
return 0;
}