Created
October 23, 2020 17:05
-
-
Save masouduut94/ae58380344b6812c1a776d17dc9c24d5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def search(self, time_budget: int) -> None: | |
""" | |
Search and update the search tree for a | |
specified amount of time in seconds. | |
""" | |
start_time = clock() | |
num_rollouts = 0 | |
# do until we exceed our time budget | |
while clock() - start_time < time_budget: | |
node, state = self.select_node() | |
turn = state.turn() | |
outcome = self.roll_out(state) | |
self.backup(node, turn, outcome) | |
num_rollouts += 1 | |
run_time = clock() - start_time | |
node_count = self.tree_size() | |
self.run_time = run_time | |
self.node_count = node_count | |
self.num_rollouts = num_rollouts |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment