Whether you call it tic-tac-toe or naughts and crosses (Diffblue is a British company, after all), this game has been around in one form or another since ancient Egyptian times. I am sure that we all remember playing it as children—at least, until we realized the most likely outcome is a tie. Given the game’s futility, how has it stuck around for so long and what do its more modern iterations look like?

Tic-tac-toe and AI in Film

Back in 1983, tic-tac-toe featured in a favorite from my early life: the film WarGames. (Spoilers ahead). In the movie, tic-tac-toe was used to teach a computer that the only likely outcome from the game is a draw. The computer played against itself repeatedly until it realized the only way to avoid not winning was not to play at all.


Still from the movie WarGames (1983).


Tic-tac-toe’s Long History with Software Development

Tic-tac-toe has been used many times in tutorials for programming languages. Typically with a simple text-based output, people have learned the basics of logic, arrays and other programming concepts while re-creating this game.

sample of tic-tac-toe game, also known as noughts and crosses

It’s even been used as an educational tool for learning how to write unit tests

Tic-tac-toe and AI in the Modern Era

It’s been possible to play tic-tac-toe against a computer for a long time. But over the last few years, Diffblue has been using tic-tac-toe to demonstrate our AI in Diffblue Cover. Here, we’re showing how Java unit tests can be written for a deliberately convoluted implementation of the game. The AI for Code engine that powers Diffblue Cover can write a complete unit test suite in a few seconds:

Code sample showing a complete unit test suite generated by Diffblue Cover for tic-tac-toe

Tic-tac-toe has grown with technology through the generations and continues to be played and used today. So why is it so successful? In part, as new generations arrive, the lessons imparted by tic-tac-toe need to be learned by new generations. Taking these lessons even further, since the game is such a key part of childhood development, organizations that are looking for easy to understand demonstrations of their AI technologies are reviving these childhood games.

Which leaves us with a simple question: What’s next for this humble game?