Tic Tac Toe

The classic strategy game, AKA Noughts and Crosses.In this version you have to beat the computer which has it’s own artificial intelligence.

Learn to code the strategy game Tic Tac Toe in Python. This free programming game project includes all of the code, images and audio files required.

Starter Code Files

Download “Starter Python File: Tic Tac Toe” File size: 642 B


Download and unzip this Python starter code file to your Tic Tac Toe project folder

Images and Audio

Download “Images and audio for Tic Tac Toe” File size: 23 KB


Download and unzip these image and audio files to your Tic Tac Toe project folder

Book of Code

Download “Book of Code: Tic Tac Toe” File size: 526 KB


Copy the Tic Tac Toe program from the Book of Code into your IDE

Video Tutorials

1. String Concatenation

Learn how to join Python strings together to give the user more meaningful messages and feedback.

Watch First: Alien Invasion Strings

Difficulty: 2

2. Displaying Text

Learn how to display text on screen using Pygame and build the Tic Tac Toe scoreboard.

Watch first: Alien Invasion Coordinates

Difficulty: 3


Introducing Echo Show 5 – Compact smart display with Alexa, White, available on Amazon

3. Parameter Passing 2

n Python a parameter is a variable which is declared within a function definition. This tutorial explains more about Python parameters and how they are used within Tic Tac Toe functions.

Watch first: Alien Invasion Parameter Passing

Difficulty: 5

4. 2D Lists

You have already learned that a list in Python is a structure for storing multiple data items. In this video we explain how to use a 2D Python list to store the Tic Tac Toe game board.

Watch first: Golf Hole Strokes List

Difficulty: 5

5. Nested Loops

You have already learned that a for loop in Python is used to repeat something a certain number of times. In this tutorial we explain how to use a nested for loop.

Watch first: Golf For Loop

Difficulty: 5

6. While Loops

A while loop continues to repeat while a certain condition is True. This is different from a for loop which repeats a specific number of times.

Watch First: Golf For Loop

Difficulty: 4

7. Tic Tac Toe Game Design

In this tutorial we explain the design of the Python game of Tic Tac Toe, and discuss the main steps involved in coding the player and computer moves.

Watch First: Golf Move Ball Logic

Difficulty: 3

8. Computer Turn Logic

In this tutorial we explain the logic used to determine the computer turn in the game of Tic Tac Toe.

Watch first: Tic Tac Toe Game Design

Difficulty: 5

9. Winning Line Logic

In this video we explain the logic and Python code required to determine if there are 3 pieces in a row in the game of Tic Tac Toe.

Watch first: Tic Tac Toe 2D Lists

Difficulty: 5


Ring Video Doorbell 2 | 1080p HD Video, Two-Way Talk, Motion Detection, Wi-Fi Connected, available on Amazon