Professional Documents
Culture Documents
Tic-Tac-Toe How To
Tic-Tac-Toe How To
Tic-Tac-Toe How To
12.
valid!
On the next line, run the function player1play() in order to
reiterate through the function
Create an else statement to check and see if the specific
Try again!
On the next line, run the function player1play() in order to
13.
argument
14.
Ask user for row number in raw input and set it equal to
variable named row
15.
Ask user for column number in raw input and set it equal to
variable named column
16.
Assign each row and column variable to an int version of
themselves.
Example: row = int (row)
17.
Now to account for situation when user may enter a value
outside the 3 x 3 grid, create an if statement that checks to see if
row or column number entered is greater than 2 or less than 0
(only numbers 0,1, and 2 are valid row and column numbers)
If row or column is greater than 2 or less than 0, print Not
valid!
On the next line, run the function player2play() in order to
reiterate through the function
Create an else statement to check and see if the specific
18.
19.
20.
Try again!
On the next line, run the function player2play() in order to
21.
variable board
22.
Create another for loop under the for loop that iterates
through each spot in the row
23.
Under the 2nd for loop, if the spot does not equal __, raise
the count by 1 (Use += operator)
24.
After both for loops have been iterated (move back to
original indentation!), create an if statement to see if count
equals to 9
25.
If count equals 9, under the if statement, return True (This
means all 9 spots in the tic-tac-toe board has been filled up)
26.
Create an else statement and under the else statement,
return False
15.