Skip to content

Instantly share code, notes, and snippets.

@fsndzomga
Created March 11, 2024 20:46
Show Gist options
  • Save fsndzomga/cf166cadbf05e1ca049367b6498e7ecc to your computer and use it in GitHub Desktop.
Save fsndzomga/cf166cadbf05e1ca049367b6498e7ecc to your computer and use it in GitHub Desktop.
# Number of games to play
n_games = 5
# Initialize a dictionary to store the results
results = {"Agent wins": 0, "Stockfish wins": 0, "Draw": 0}
# Run the game n times
for i in range(n_games):
# print(f"Starting game {i+1}...")
result = play_game()
print(result)
# Update the results dictionary based on the outcome of the game
if "Agent wins" in result:
results["Agent wins"] += 1
elif "Stockfish wins" in result:
results["Stockfish wins"] += 1
else:
results["Draw"] += 1
# print(f"Game {i+1} finished.\n\n")
# Print the final results
print("Final results after playing", n_games, "games:")
print("Agent won:", results["Agent wins"], "games")
print("Stockfish won:", results["Stockfish wins"], "games")
print("Draw:", results["Draw"], "games")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment