import fiar game = fiar.FIAR(); def declareWinner(): game.printField(); print("And the winner is P", game.proveWinner(), "!") def isnumber(val): try: val = int(val) return True except ValueError: return False while True: game.printField(); player_input = input("P1, where do you put your stone? ") while not (isnumber(player_input) and 7 >= int(player_input) >= 1): player_input = input("P1, your input has to be a number between 1 and 7! New input: ") try: game.setStone(int(player_input)-1, 1); except OverflowError: print("This Column is already full, maybe try again next time...") if(game.proveWinner()): declareWinner() break # --------------- # game.printField(); player_input = input("P2, where do you put your stone? ") while not (isnumber(player_input) and 7 >= int(player_input) >= 1): player_input = input("P2, your input has to be a number between 1 and 7! New input: ") try: game.setStone(int(player_input)-1, 2); except OverflowError: print("This Column is already full, maybe try again next time...") if(game.proveWinner()): declareWinner() break