-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_mcts.py
More file actions
29 lines (23 loc) · 723 Bytes
/
test_mcts.py
File metadata and controls
29 lines (23 loc) · 723 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
import numpy as np
import tensorflow as tf
from othello import *
from mcts import MCTS
from alphello_net import Othello_Network as ONET
from tqdm import tqdm, trange
class fakeCNN(object):
def __init__(self):
self.policy = np.random.rand(65)
self.policy /= self.policy.sum()
def estimate_policy(self, state):
return self.policy
def estimate_value(self, state):
return np.random.rand()*2 - 1
if __name__ == '__main__':
game = Othello()
board = np.abs(game.board)
player = game.player
print(check_game_over(board, player))
playing_net = fakeCNN()
mcts = MCTS(1, board, game.player, playing_net,c=1)
for i in trange(100):
mcts.build_tree()