Bot-Man-Toe/elo.py

34 lines
764 B
Python

"""
Create an ELO tracker that compares various server agents out there.
"""
from elo_tracker import EloTracker
from pyclient.games import TicTacToe
GAME_FILE = "games.jsonl"
PLAYER_FILE = "known_players.json"
def main() -> int:
tracker = EloTracker(
game_file_name=GAME_FILE,
player_file_name=PLAYER_FILE,
debug=True,
)
tracker.start_periodic_matches(
game=TicTacToe.empty(),
interval_seconds=10 * 60,
player_count=2,
)
try:
tracker.start_server(import_name=__name__)
except KeyboardInterrupt:
print("Noticed KeyboardInterrupt, stopping match daemon...")
tracker.stop_periodic_matches()
return 0
if __name__ == "__main__":
raise SystemExit(main())