| |||||||||
Tic-tac-toe, also called noughts and crosses and many other names, is a paper and pencil game between two players, O and X, who alternate in marking the spaces in a 3×3 board. A player wins by getting three of their own marks in a horizontal, vertical or diagonal row.
This game is won by the first player, X:
This game is drawn:
Players soon discover that best play leads to a draw, regardless of where the first player plays. So tic-tac-toe is most often played by very young children; when they have discovered an unbeatable strategy they move on to more sophisticated games such as dots and boxes.
But the very simplicity of tic-tac-toe makes it ideal as a pedagogical tool for teaching the concepts of game theory and the branch of artificial intelligence that deals with the searching of game trees. It's straightforward to write a computer program to play tic-tac-toe perfectly, to enumerate the 765 essentially different positions (the state space complexity), or the 26,830 possible games (the game tree complexity).
Many games share the element of trying to be the first to get n-in-a-row: three men's morris, nine men's morris, pente, gomoku, Connect Four, Quarto. The m,n,k-games are a family of generalized games based on tic-tac-toe.