Skip to content

User Documentation

jturbeville edited this page Dec 5, 2020 · 6 revisions

To start and play the game:

  1. Open Tic-tac-toe.py on your machine and it should run the code.
  2. Read the rules as they are displayed on screen, and examine the game board diagram.

(The board is a 3x3 grid, where the indices of each space are 1,2,3 left-to-right across the top row, 4,5,6 across the middle row, and 7,8,9 across the bottom row.)

  1. Player 0 should input their name and press enter.

(Any letter, number or symbol is allowed)

  1. Then, Player 1 should do the same.

(Any letter, number or symbol is allowed)

  1. The first player will be randomly selected, and should choose their symbol either 'X' or 'O'.

(The input must be an 'X', 'x', 'O' or 'o')

  1. The first player is then prompted, "make your selection" and takes their turn by inputting the index of the space on the board where they wish to place their symbol.

(The input must be an integer 1-9)

  1. After the turn, the board (without the indices) is printed, with the symbol in its selected space, and all unfilled spaces left blank.
  2. The second player is then prompted, "make your selection" and takes their turn by inputting the index of the space on the board where they wish to place their symbol.

(The input must be an integer 1-9. If they select an index that is already filled, they will be prompted to choose another index.)

Players alternate taking turns. After each turn, the board is printed to display the symbols in their spaces, and the unfilled spaces are left blank.

To end the game: Players continue alternating turns until either:

  1. A winner is declared when a player places 3 symbols in a row (vertically, horizontally or diagonally) OR
  2. A draw is declared if all spaces on the board are filled, and no player has earned 3 in a row (vertically, horizontally nor diagonally)

After the game has ended, the players can choose to begin another game or quit the program.

(The input must be 'p' to play another game, or 'q' to quit the program)

To view the logs that record information on the game, after the game is finished, navigate to the repository folder on your computer and open the file "game-log.log"

Clone this wiki locally