Created
December 1, 2019 20:28
-
-
Save davidADSP/19629c30793d2922cf74ad3df0e4ab2e to your computer and use it in GitHub Desktop.
backpropagate (https://arxiv.org/src/1911.08265v1/anc/pseudocode.py)
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
# At the end of a simulation, we propagate the evaluation all the way up the | |
# tree to the root. | |
def backpropagate(search_path: List[Node], value: float, to_play: Player, | |
discount: float, min_max_stats: MinMaxStats): | |
for node in search_path: | |
node.value_sum += value if node.to_play == to_play else -value | |
node.visit_count += 1 | |
min_max_stats.update(node.value()) | |
value = node.reward + discount * value |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment