From 0f8b6ec6931dc0c83cfbff3d6df9e173c42c535a Mon Sep 17 00:00:00 2001 From: Adrian Gunnar Lauterer Date: Sun, 7 Apr 2024 00:34:08 +0200 Subject: [PATCH] minor improvements --- .gitignore | 4 ++++ main.py | 14 +++++++++++--- 2 files changed, 15 insertions(+), 3 deletions(-) mode change 100644 => 100755 main.py diff --git a/.gitignore b/.gitignore index 5d381cc..9976cb4 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,7 @@ +#keep my sepcial bot secret +ml.py + + # ---> Python # Byte-compiled / optimized / DLL files __pycache__/ diff --git a/main.py b/main.py old mode 100644 new mode 100755 index c974682..9352515 --- a/main.py +++ b/main.py @@ -1,3 +1,5 @@ +#!/usr/bin/env python3 + from time import sleep import requests import numpy as np @@ -272,8 +274,12 @@ def play_game(gameid, players, strategy): for player in players: mov = do_move(gameid, player, filter_strategy=strategy) if game_over(game_id): - print(f"Game Over {player} won") - break + #get the score of the players + score = [] + for player in players: + score.append(get_score(gameid, player)) + print(f"Game Over, scores: {score}") + return score if __name__ == "__main__": parser = argparse.ArgumentParser(description='Play a game with specified strategies.') @@ -281,8 +287,10 @@ if __name__ == "__main__": parser.add_argument('--players', nargs='+', default=["a", "b"], help='The names of the players.') parser.add_argument('--strategy', type=str, default="", help='The strategy to use. Can be "1", "2", or "" for random.') parser.add_argument('--ozai_url', type=str, default='http://localhost:8000/api/', help='The url to the ozai server.') - args = parser.parse_args() + + + game_id = args.game_id players = args.players strategy = args.strategy