Minimax with alpha-beta pruning. MAX nodes (▲) maximize; MIN nodes (▽) minimize. Red branches are pruned.