Projects

Dynamic Noughts and Crosses AI

A desktop noughts and crosses game against an AI.

2023A-Level Project

Runthrough of playing the game

Overview

A desktop game where the board keeps growing. Beat the AI on a 3x3 and the next round is 4x4, then 5x5, and so on, with the run needed to win growing more slowly than the board itself. Draw and the target drops by one, down to a floor of three. Lose and you start over.

The AI holds back on purpose in the scoring mode, varying how far ahead it looks and playing the occasional random move so it stays beatable. A separate mode drops the handicap and searches the full 3x3 tree, where a draw is the best result available.

A local two player mode takes any board size and win length. Finished games can be stepped back through move by move. Accounts and high scores live in a local SQLite database, with a leaderboard covering everyone who has played on that machine.

Stack

  • Python
  • PyGame
  • SQLite
  • Minimax