Skip to content

Tic Tac Toe project

  1. Print the display board
    Write a function to printout a board. Setup the board as a list, where indexes from 1-9 corresponds to the number on the board.
    Therefore, we get a 3 by 3 board representation.

  2. Assign the markers to the players
    Write a function that can take in a player input and assign their marker as 'X' or 'O'. Think about using while loops to continually ask until you get a correct answer.

  3. Randomly choose the first player
    Write a function that uses the random module to randomly decide which player goes first. You may want to lookup random.randint() Return a string of which player went first.

  4. Check whether the space is free or not
    Write a function that returns a boolean indicating whether a space on the board is freely available.

  5. Ask the player for the next position
    Write a function that asks for a player's next position (as a number 1-9) and then uses the function from step 4 to check if it's a free position. If it is, then return the position for later use.

  6. Assign the marker to the board as per the position provided by the player
    Write a function that takes in the board list object, a marker ('X' or 'O'), and a desired position (number 1-9) and assigns it to the board.

  7. Check Win conditions
    Write a function that takes in a board and a mark (X or O) and then checks to see if that mark has won.

  8. Check if the board is full
    Write a function that checks if the board is full and returns a boolean value. True if full, False otherwise.

  9. Ask the player, if he wants to replay
    Write a function that asks the player if they want to play again and returns a boolean True if they do want to play again.