# How 304 boxes never lose at tic-tac-toe, and how it’s used in creating Artificial Intelligence

5 min readJul 14, 2020

--

Machine Learning — the study and implementation of algorithms that make computers learn, is usually seen as an overcomplicated study that is out of reach for most people. After all, how do you write code, so that the code learns stuff you didn’t write? How do you code something to learn and pick up new strategies? Artificial Intelligence is a massive and complicated field in Computer Science, however, the fundamentals ideas can be simplified and understood. So before I answer how machines learn, I will first answer how do 304 boxes master tic-tac-toe.

Tic-tac-toe, even though only having 9 cells, has exactly 255,168 different game variations. However, to simplify and lower this number, we will only need to focus on the different possible positions. This comes to just under 6,000. So doesn’t matter how you play, the position on the board will always be one of 6,000. But if you take into account board rotation and symmetry, you can shrink this number down to as low as 304 (all the patterns below will count as 1 instead of 8).

So now that we have 304 possible positions on tic-tac-toe, what’s next? This is where Matchbox Educable Noughts and Crosses Engine (MENACE) comes in. MENACE is a matchbox computer (yes you read that right), that was made by Donald Michie in the 1960s to try and make a machine that would always win in tic-tac-toe — or at least tie when winning isn’t possible. Since in the 60s sophisticated learning models weren’t available, everything had to be done mechanically. So MENACE was a computer literally made out of matchboxes.