diff --git a/tic_tac_toe.py b/tic_tac_toe.py index f0a032b..20d1e9b 100644 --- a/tic_tac_toe.py +++ b/tic_tac_toe.py @@ -7,10 +7,23 @@ import json float_formatter = "{:.3f}".format np.set_printoptions(formatter={'float_kind': float_formatter}) +REPORT_INTERVAL = 1000 +report_counter = REPORT_INTERVAL + + +def report(k): + global report_counter + if report_counter > 0: + report_counter -= 1 + else: + report_counter = REPORT_INTERVAL-1 + print(f"Iteration: {k:8d}") + def play(player_provider: PlayerProvider, k_max=10000, with_debug=False): player_provider.set_debug(with_debug) for k in range(0, k_max): + report(k) players = player_provider.choose() state = create_empty_state() move = 1