Tic-tac-toe is a fairly simple game. Each player takes a turn marking a square, and the first player to claim 3 in a line wins. A computer is very good at this game, and won’t ever get anything worse than a draw. Give it a try!
But how does it do it? We need a way to represent this problem before we can try to have a computer solve it. Trees can work well because we can enumerate every move and its resulting state. Make a move to see how we traverse the tree.