You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

44 lines
921 B
Python

import fiar
import nn
import lib
game = fiar.FIAR();
nn = lib.loadSingle(0)
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 = lib.nextNNmove(nn, game, 2);
if(game.proveWinner()):
declareWinner()
break