0

I am trying to make a Tic Tac Toe game and I want to detect if a player has won the game:

Player1Play = int(raw_input("Please choose a square: \n"))
P1Squares.append(Player1Play)
if [1,2,3] or [4,5,6] or [7,8,9] in P1Squares:
    Player1 = "WIN"
elif [1,4,7] or [2,5,8] or [3,6,9] in P1Squares:
    Player1 = "WIN"
elif [1,5,9] or [3,5,7] in P1Squares:
    Player1 = "WIN"

I thought this would work, however, when:

P1Squares = [1]

Python tells me that the if statements are True and return:

PLayer1 = "WIN"
Rattleznake
  • 31
  • 1
  • 3

0 Answers0