Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Let's play tic-tac-toe together. You should play well and try to win. Follow all of the instructions below.
- After the instructions, we can start playing. Whoever is player X will go first.
- I will declare who is X and who is O.
- ------------------------------------------
- {{{ BEGIN INSTRUCTIONS }}}
- ------------------------------------------
- ## Board
- Format for an empty board:
- ```
- . . .
- . . .
- . . .
- ```
- Numeric labels for each board position:
- 123
- 456
- 789
- ------------------------------------------
- ## Game-Over-Check
- Process for checking if the game is over:
- - Write out the board position numbers and values for every possible 3-in-a-row
- - Check each of the written combinations and see if there is a valid 3-in-a-row
- - Announce the game is over if there is a valid 3-in-a-row
- - Rows:
- - R1 - pos 1,2,3: Val Val Val
- - R2 - pos 4,5,6: Val Val Val
- - R3 - pos 7,8,9: Val Val Val
- - Columns:
- - C1 - pos 1,4,7: Val Val Val
- - C2 - pos 2,5,8: Val Val Val
- - C3 - pos 3,6,9: Val Val Val
- - Diagonals:
- - D1 - pos 1,5,9: Val Val Val
- - D2 - pos 3,5,7: Val Val Val
- ------------------------------------------
- ## Example 1 of running Game-Over-Check
- Board:
- ```
- X . O
- X X .
- O O .
- ```
- Run Game-Over-Check
- - Rows:
- - R1 - pos 1,2,3: X . O
- - R2 - pos 4,5,6: X X .
- - R3 - pos 7,8,9: O O .
- - Columns:
- - C1 - pos 1,4,7: X X O
- - C2 - pos 2,5,8: . X O
- - C3 - pos 3,6,9: O . .
- - Diagonals:
- - D1 - pos 1,5,9: X X .
- - D2 - pos 3,5,7: O X O
- Result: No 3-in-a-row, game is ongoing.
- ------------------------------------------
- ## Example 2 of running Game-Over-Check
- Board:
- ```
- . . X
- . O .
- O X .
- ```
- Run GOC:
- - Rows:
- - R1 - pos 1,2,3: . . X
- - R2 - pos 4,5,6: . O .
- - R3 - pos 7,8,9: O X .
- - Columns:
- - C1 - pos 1,4,7: . . O
- - C2 - pos 2,5,8: . O X
- - C3 - pos 3,6,9: X . .
- - Diagonals:
- - D1 - pos 1,5,9: . O .
- - D2 - pos 3,5,7: X O O
- Result: No 3-in-a-row, game is ongoing.
- ------------------------------------------
- ## Example 3 of running Game-Over-Check
- Board:
- ```
- X . O
- X O .
- X . O
- ```
- Run Game-Over-Check:
- - Rows:
- - R1 - pos 1,2,3: X . O
- - R2 - pos 4,5,6: X O .
- - R3 - pos 7,8,9: X . O
- - Columns:
- - C1 - pos 1,4,7: X X X
- - C2 - pos 2,5,8: . O .
- - C3 - pos 3,6,9: O . O
- - Diagonals:
- - D1 - pos 1,5,9: X O O
- - D2 - pos 3,5,7: O O X
- Result: Column 1 has a 3 X's in a row! Player X wins.
- ------------------------------------------
- ## Example 4 of running Game-Over-Check
- Board:
- ```
- X X O
- . O X
- O . X
- ```
- Run Game-Over-Check:
- - Rows:
- - R1 - pos 1,2,3: X X O
- - R2 - pos 4,5,6: . O X
- - R3 - pos 7,8,9: O . X
- - Columns:
- - C1 - pos 1,4,7: X . O
- - C2 - pos 2,5,8: X O .
- - C3 - pos 3,6,9: O X X
- - Diagonals:
- - D1 - pos 1,5,9: X O X
- - D2 - pos 3,5,7: O O O
- Result: Diagonal 2, top-right to bottom left, has a 3 O's in a row! Player O wins.
- ------------------------------------------
- ## Play Instructions
- - We take turns. I'll make a move, then you make a move, then back to me. And so on.
- On your turn:
- - After my move, before you make a move, run Game-Over-Check using the updated board
- - Then make your move.
- - Display the updated board
- - Run Game-Over-Check again using the updated board
- ------------------------------------------
- {{{ END INSTRUCTIONS }}}
- ------------------------------------------
- Let's start the game :)
- I'll be player X, you will play O.
- I play an X at position 5. Your turn.
Add Comment
Please, Sign In to add comment