-
Notifications
You must be signed in to change notification settings - Fork 3
/
gomoku_test.cpp
45 lines (42 loc) · 1.15 KB
/
gomoku_test.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
#include <iostream>
#include <vector>
#include "gomoku.h"
#include "mcts.h"
const char *best_path = "./model-best.pt";
int main()
{
Gomoku game(10, 5);
game.display();
game.execute_move(0);
game.execute_move(11);
game.execute_move(22);
game.execute_move(33);
game.execute_move(44);
game.execute_move(55);
game.execute_move(66);
game.execute_move(77);
game.execute_move(88);
std::vector<int> res = game.get_game_status();
std::cout << res[0] << "," << res[1] << std::endl;
game.reset(-1);
game.display();
game.execute_move(0);
game.execute_move(11);
game.execute_move(22);
game.display();
Gomoku game1(19, 5);
game1.execute_move(0);
game1.execute_move(20);
game1.execute_move(40);
game1.display();
Human player1, player2;
//game.start_play(&player1, &player2, false, true);
//game1.start_play(&player1, &player2, true, true);
Gomoku game2(8, 5);
PolicyValueNet network(best_path, true, 5, game2.get_n(), game2.get_action_dim());
MCTS mcts(&network, 4, 5, 1, 400, 3, game2.get_action_dim(), true);
std::vector<at::Tensor> states, probs;
std::vector<float> values;
mcts.self_play(&game2, states, probs, values, 1, 20, true, true);
return 0;
}