Trying to teach a machine learning system to play TicTacToe is a silly waste of computing power since you can easily specify the logic by which a computer — or a person — can routinely win or at least tie a game: Always first check if you need to block your opponent from winning, try to occupy three corners…that sort of thing. But suppose you’re trying to learn about machine learning, so you decide to train a system to play TicTacToe by giving it no rules or hints. Instead you give it thousands of completed games to learn from. Just suppose.

The whole point of machine learning is that it’ll learn from data rather than having to be explicitly instructed in the rules or logic of the domain it’s making predictions about. So, your machine learning system will analyze the games you’ve input, looking for statistical relationships among the moves. Then its algorithms will build a complex web — a neural network — of those relationships so that it’s able to output a probabilistic suggestion about the best next move, just as other machine learning apps suggest the next book you might like to read, the best way to Santa Jose, or the likelihood of a tornado forming.

So, let’s feed it thousands of games. But what’s a game to a computer? In one interpretation, it’s a series of moves, each resulting in a new state of the board. For example, one complete game might consist of these boards, reading from left to right:

Now you want to translate those images into data that expresses the information in those images as succinctly as possible. For example, we might assume that for a computer, the best representation of the game depicted in Figure 2 might be:

where each three-line grid represents a board, and each character is the sort of thing you might type on a keyboard.

But there’s an issue. To the computer, each three-line grid in Figure 3 doesn’t look like nine symbols but like eleven: the nine plus the carriage returns (or, as we say in techier lingo, the “newline” characters) at the end of the first two lines of each 3×3. They may be invisible to us, but not to the computer. To a computer, the first board in Figure 2 in fact looks like this sequence: