From 8ed1f8c05a11e7bf4d73714dce041be1f1e31610 Mon Sep 17 00:00:00 2001 From: Hykilpikonna Date: Sat, 19 Feb 2022 22:08:49 -0500 Subject: [PATCH] [+] A2 P3.2 run_learning_algorithm --- assignments/A2/a2_part3.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/assignments/A2/a2_part3.py b/assignments/A2/a2_part3.py index 752bf2e..02bbf71 100644 --- a/assignments/A2/a2_part3.py +++ b/assignments/A2/a2_part3.py @@ -112,7 +112,15 @@ def run_learning_algorithm(exploration_probabilities: list[float], # Play games using the ExploringPlayer and update the GameTree after each one results_so_far = [] - # Write your loop here, according to the description above. + # Loop through each probability, play games + for exp_prob in exploration_probabilities: + # Run game + winner, seq = a2_minichess.run_game(ExploringPlayer(game_tree, exp_prob), + a2_minichess.RandomPlayer()) + # After the game, insert move sequence with white win probability + game_tree.insert_move_sequence(seq, float(winner == 'White')) + # Print progress + print(f'Winner: {winner}') if show_stats: a2_minichess.plot_game_statistics(results_so_far)