Class Resources

for HCC classes taught by Rylan Schubkegel

Course Homepage

Tic Tac Toe (part 2)

In part 1 of this project, you created the functions necessary to print a game board; in this part you will add the game state and player input 🕹️

Your program must follow these specifications:

Organize the Project

Previous projects have been simple enough to keep everything in a single file. Since this project is bigger, we are going to split it into multiple files!

Now, you can use the imported function to print the board variable each time through your loop!

Game State

The current “state” of the game is stored in the board variable. Each board is a “table” that includes 3 rows, each with 3 columns. A single “cell” of the table represents what piece has been placed on the board. At the beginning of the game, no move have been made, so the board is empty. You can initialize the empty board like this:

board = [
  [None, None, None],
  [None, None, None],
  [None, None, None],
]

As the game progresses, each player will add pieces to the board (represented by 'X' or 'O') so that a complete game board might have a value like this:

[
  ['X', None, 'O'],
  ['X', 'O', None],
  ['X', None, None],
]

Submit Assignment

When your program meets the requirements, download and submit tic_tac_toe.py (which is just part 2 of the project).

Submit Assignment