Three in a row. X versus O.

A Python game, rebuilt so you can play it right here. Challenge a friend on the same screen or take on the computer, then see how the wins stack up on the leaderboard.

Built in PythonTwo game modesSaved scoresLive leaderboardWin chart
Player 1's turn
X goes first
Player 1 0 This session Player 2 0

All-time leaderboard

Every saved session adds to the totals, and the player with the most wins moves to the top. Person vs Person games count; games against the computer are just for practice.

Saved sessions

DatePlayer 1Player 2

Total wins

Saved sessions plus the one you're playing now.

How it works

The original runs in the terminal. Everything it does is here in the browser too.

A real 3×3 board

The board is a grid of rows and columns. After every move it checks all three rows, three columns and both diagonals for a winner, or calls a draw when the board fills up.

Two ways to play

Play a friend on the same screen, taking turns as X and O, or play against a computer that picks its spots at random. X always goes first.

Mistake-proof moves

Letters, numbers outside 0–2 and already-taken cells are all caught with a clear message, and the turn never switches on a bad move.

Results that last

When you save and exit, the session's date and scores are added to a results file without overwriting earlier sessions.

Sorted leaderboard

Saved wins and the current session are added together, then sorted so whoever is winning is always shown first.

Win chart

The summary draws a bar chart of total wins per player, so you can see the rivalry at a glance.