Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def ruch(gracz):
- # Get position from player
- print(gracz + "'s turn.")
- pozycja = input("Choose a position from 1-9: ")
- # Whatever the user inputs, make sure it is a valid input, and the spot is open
- valid = False
- while not valid:
- # Make sure the input is valid
- while pozycja not in ["1", "2", "3", "4", "5", "6", "7", "8", "9"]:
- pozycja = input("Choose a position from 1-9: ")
- # Get correct index in our board list
- pozycja = int(pozycja) - 1
- # Then also make sure the spot is available on the board
- if plansza[pozycja] == "-":
- valid = True
- else:
- print("You can't go there. Go again.")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement