From f820aab0081dff11d5ffe7d29914a27c0ae2c40b Mon Sep 17 00:00:00 2001 From: Wenbo Hu Date: Tue, 12 Dec 2017 20:37:57 +0800 Subject: [PATCH 1/3] change mcts steps --- AlphaGo/strategy.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/AlphaGo/strategy.py b/AlphaGo/strategy.py index ff5d79f..327111d 100644 --- a/AlphaGo/strategy.py +++ b/AlphaGo/strategy.py @@ -246,7 +246,7 @@ class strategy(object): self.simulator.history = copy.copy(history) self.simulator.board = copy.copy(history[-1]) state = self.data_process(self.simulator.history, color) - mcts = MCTS(self.simulator, self.evaluator, state, self.simulator.size ** 2 + 1, inverse=True, max_step=100) + mcts = MCTS(self.simulator, self.evaluator, state, self.simulator.size ** 2 + 1, inverse=True, max_step=10) temp = 1 prob = mcts.root.N ** temp / np.sum(mcts.root.N ** temp) choice = np.random.choice(self.simulator.size ** 2 + 1, 1, p=prob).tolist()[0] From d52ee30259b2548391412926384fce56dd6ced08 Mon Sep 17 00:00:00 2001 From: Wenbo Hu Date: Tue, 12 Dec 2017 23:13:31 +0800 Subject: [PATCH 2/3] add nearby stones --- AlphaGo/game.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/AlphaGo/game.py b/AlphaGo/game.py index 2a60a06..597d834 100644 --- a/AlphaGo/game.py +++ b/AlphaGo/game.py @@ -202,6 +202,24 @@ class Executor: elif color_estimate < 0: return utils.WHITE + def _add_nearby_stones(self, neighbor_vertex_set, start_vertex_x, start_vertex_y, x_diff, y_diff, num_step): + ''' + add the nearby stones around the input vertex + :param neighbor_vertex_set: input list + :param start_vertex_x: x axis of the input vertex + :param start_vertex_y: y axis of the input vertex + :param x_diff: add x axis + :param y_diff: add y axis + :param num_step: number of steps to be added + :return: + ''' + for step in xrange(num_step): + new_neighbor_vertex = (start_vertex_x, start_vertex_y) + if self._in_board(new_neighbor_vertex): + neighbor_vertex_set.append((start_vertex_x, start_vertex_y)) + start_vertex_x += x_diff + start_vertex_y += y_diff + From 3f3d7b56f5368bed3f9fcf1e8aadc1b5d46fc730 Mon Sep 17 00:00:00 2001 From: Wenbo Hu Date: Tue, 12 Dec 2017 23:16:50 +0800 Subject: [PATCH 3/3] minor indent fix --- AlphaGo/game.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/AlphaGo/game.py b/AlphaGo/game.py index 597d834..919a5d5 100644 --- a/AlphaGo/game.py +++ b/AlphaGo/game.py @@ -202,7 +202,7 @@ class Executor: elif color_estimate < 0: return utils.WHITE - def _add_nearby_stones(self, neighbor_vertex_set, start_vertex_x, start_vertex_y, x_diff, y_diff, num_step): + def _add_nearby_stones(self, neighbor_vertex_set, start_vertex_x, start_vertex_y, x_diff, y_diff, num_step): ''' add the nearby stones around the input vertex :param neighbor_vertex_set: input list