Created
October 21, 2017 20:27
-
-
Save DanielSlater/7d245dad115f8e2a4a626d9e794052f5 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
if all((state in state_samples) for _, state in move_states): | |
log_total_samples = math.log(sum(state_samples[s] for s in move_states.values())) | |
move, state = max(move_states, | |
key=lambda _, s:upper_confidence_bounds(state_results[s],state_samples[s], log_total_samples)) | |
else: | |
move = random.choice(list(move_states.keys())) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment