add missing file

This commit is contained in:
Maximilian Keßler 2023-11-20 16:45:53 +01:00
parent 1484d0d90f
commit beecacb897
Signed by: max
GPG Key ID: BCC5A619923C0BA5
1 changed files with 19 additions and 0 deletions

19 Normal file
View File

@ -0,0 +1,19 @@
import subprocess
from games import get_game_json, GAMES_PATH
def run_strategy(game_id: int, strategy: str):
if strategy not in ['cheat', 'info', 'random']:
print('Strategy has to be one of cheat, info or random')
result =['./rust_hanabi', '--file', str((GAMES_PATH / str(game_id))), '--json-output', '%-' + strategy, '--strategy', strategy])
if result.returncode != 0:
print('Failed to run game {} with cheating stratgey'.format(game_id))
def ensure_bot_game_exists(game_id: int, strategy: str):
filename = GAMES_PATH / '{}-{}'.format(game_id, strategy)
if not filename.exists():
run_strategy(game_id, strategy)