AI & ML Atlas
Artificial IntelligencealgorithmInteractive simulation
Game Tree Search
Exploring the tree of possible moves and replies to choose a move.
The idea
Positions are nodes, legal moves are edges. Searching the tree to a fixed depth and scoring the leaves lets a program compare moves. Minimax with alpha-beta pruning, iterative deepening and transposition tables form the classic recipe.
Watch it run
This is a real computation, not a drawing. Pause, step, change the settings, or try new random data.
- MAX
- MIN
- now
- pruned
Blue circles are MAX (wants a high score), purple are MIN (wants low). Squares are final scores. Minimax visits every leaf.
- leaves evaluated:
- 0
1/81
Try new data: alpha-beta always returns the same value as minimax, with fewer leaves.
Step by step
- 1Generate the legal moves from the position.
- 2Recursively search the replies to a set depth.
- 3Evaluate the leaf positions with a heuristic.
- 4Back the values up the tree and choose the best move.
Where it is used
Board-game engines, puzzle solvers.
Watch out for
The horizon effect: a danger just beyond the search depth is invisible.