From b473ec91727f5724cbd2c46f68a7e349603f9e1c Mon Sep 17 00:00:00 2001 From: Thefeli73 Date: Sat, 3 Oct 2020 17:50:00 +0200 Subject: [PATCH] end game and exit on exception with print --- main.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/main.py b/main.py index 612c45f..964df87 100644 --- a/main.py +++ b/main.py @@ -1,5 +1,6 @@ # import api import time +import sys from sys import exit from game_layer import GameLayer @@ -19,9 +20,15 @@ def main(): # exit game after timeout start_time = time.time() while game_layer.game_state.turn < game_layer.game_state.max_turns: - take_turn() + try: + take_turn() + except: + e = sys.exc_info()[0] + print(e) + game_layer.end_game() + exit() time_diff = time.time() - start_time - if time_diff > 5: + if time_diff > 40: game_layer.end_game() exit() print("Done with game: " + game_layer.game_state.game_id)