Created
December 1, 2019 16:29
-
-
Save davidADSP/5b9ac56aecf2664fc92b8a92ae4251a6 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| class Node(object): | |
| def __init__(self, prior: float): | |
| self.visit_count = 0 | |
| self.to_play = -1 | |
| self.prior = prior | |
| self.value_sum = 0 | |
| self.children = {} | |
| self.hidden_state = None | |
| self.reward = 0 | |
| def expanded(self) -> bool: | |
| return len(self.children) > 0 | |
| def value(self) -> float: | |
| if self.visit_count == 0: | |
| return 0 | |
| return self.value_sum / self.visit_count |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment