Index Ai Academy
Glossary · Phase 7 · Software engineering

Game tree

Also written: game trees

Every position a game can reach, branching at each move. Game programs look ahead by searching it.

From any position you can list every move, then every reply to each move, and so on until each game ends. That branching picture is the game tree. A function that walks it is naturally recursive: the result for a position is built from the results for the positions after each move.

Try it now

Scores flow up the tree: each player takes the best option for themselves.

Learn it properly

Project: an unbeatable game opponent · Game state and rules, minimax with a cache, and an exhaustive test that proves it never loses. About 45 minutes.

Create a free account See what's in the lesson

Other terms from the same lesson

Never trained an AI?

Teach a small one to write, right in your browser. It takes about 20 seconds and needs no account.

Teach it to write