-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.cpp
62 lines (57 loc) · 1.44 KB
/
main.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
#include "RLGoBang.hpp"
#include "Player.hpp"
#include "leveldb/db.h"
#include <iostream>
int main()
{
RLGoBang game1("/tmp/data2");
// create a empty database
for (int i = 0; i < 100; i++)
{
// learn data without trained data
game1.learn();
}
// leveldb::DB *db;
// leveldb::Options options;
// options.create_if_missing = false;
// leveldb::Status status = leveldb::DB::Open(options, "/tmp/data1", &db);
// // load trained data
// RLGoBang game2("/tmp/data2");
// // create a empty database
// for (int i = 0; i < 100000000; i++)
// {
// // learn data based on trained data
// game1.learn(db); // bug
// }
// RLGoBang game3("/tmp/data1");
// // open a existed database
// for (int i = 0; i < 100; i++)
// {
// // learn data without trained data
// game1.learn();
// }
// use trained data to play with palyer
Player winner;
while (true)
{
game1.ComputerPlayBest(P1);
game1.PrintChessBoard();
if (game1.Victory())
{
winner = P1;
std::cout << "P1" << std::endl;
return 0;
}
Point pt;
std::cin >> pt.x >> pt.y;
game1.PlayerPlay(P2, pt);
game1.PrintChessBoard();
if (game1.Victory())
{
winner = P2;
std::cout << "P2" << std::endl;
return 0;
}
}
return 0;
}