-
Notifications
You must be signed in to change notification settings - Fork 1
User Documentation
To start and play the game:
- Open Tic-tac-toe.py on your machine and it should run the code.
- 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.)
- Player 0 should input their name and press enter.
(Any letter, number or symbol is allowed)
- Then, Player 1 should do the same.
(Any letter, number or symbol is allowed)
- 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')
- 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)
- After the turn, the board (without the indices) is printed, with the symbol in its selected space, and all unfilled spaces left blank.
- 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:
- A winner is declared when a player places 3 symbols in a row (vertically, horizontally or diagonally) OR
- 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)
Logs generated from the game can be found in the file game-log.py