minor improvements
This commit is contained in:
parent
1f11ca9009
commit
0f8b6ec693
|
@ -1,3 +1,7 @@
|
||||||
|
#keep my sepcial bot secret
|
||||||
|
ml.py
|
||||||
|
|
||||||
|
|
||||||
# ---> Python
|
# ---> Python
|
||||||
# Byte-compiled / optimized / DLL files
|
# Byte-compiled / optimized / DLL files
|
||||||
__pycache__/
|
__pycache__/
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
from time import sleep
|
from time import sleep
|
||||||
import requests
|
import requests
|
||||||
import numpy as np
|
import numpy as np
|
||||||
|
@ -272,8 +274,12 @@ def play_game(gameid, players, strategy):
|
||||||
for player in players:
|
for player in players:
|
||||||
mov = do_move(gameid, player, filter_strategy=strategy)
|
mov = do_move(gameid, player, filter_strategy=strategy)
|
||||||
if game_over(game_id):
|
if game_over(game_id):
|
||||||
print(f"Game Over {player} won")
|
#get the score of the players
|
||||||
break
|
score = []
|
||||||
|
for player in players:
|
||||||
|
score.append(get_score(gameid, player))
|
||||||
|
print(f"Game Over, scores: {score}")
|
||||||
|
return score
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
parser = argparse.ArgumentParser(description='Play a game with specified strategies.')
|
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('--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('--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.')
|
parser.add_argument('--ozai_url', type=str, default='http://localhost:8000/api/', help='The url to the ozai server.')
|
||||||
|
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
game_id = args.game_id
|
game_id = args.game_id
|
||||||
players = args.players
|
players = args.players
|
||||||
strategy = args.strategy
|
strategy = args.strategy
|
||||||
|
|
Loading…
Reference in New Issue