CSC 494 · Introduction to Artificial Intelligence
Our notes
2 min readGames as search
Two-player, turn-taking, zero-sum games with perfect information (chess, draughts, tic-tac-toe, ayo/oware in its standard form). Define: initial state, players, actions, result, terminal test, and utility (win +1, loss −1, draw 0).
Minimax
MAX tries to maximise the utility, MIN to minimise it. Values are backed up from the leaves:
- MAX node: the maximum of its children's values.
- MIN node: the minimum.
Minimax gives optimal play against an optimal opponent. Time O(b^m), space O(bm).
Worked example
MAX at the root has two moves leading to MIN nodes L and R.
- L's leaves: 3, 12, 8 → MIN value 3.
- R's leaves: 2, 4, 6 → MIN value 2.
- Root (MAX) = max(3, 2) = 3: MAX should play towards L.
Alpha-beta pruning
Gives the same answer as minimax but skips branches that cannot change the decision.
- α = best value MAX can guarantee so far; β = best value MIN can guarantee so far.
- Prune when α ≥ β.
In the example: after L, α = 3 at the root. At R the first leaf is 2, so R's value is at most 2, already worse for MAX than 3: the leaves 4 and 6 are pruned.
With perfect move ordering, alpha-beta examines about O(b^(m/2)) nodes: it can search about twice as deep in the same time.
Evaluation functions
Real games are too big to search to the end (chess has about 35 moves per position). Search to a depth limit and score positions with an evaluation function, such as a weighted sum of features: material (pawn 1, knight 3, bishop 3, rook 5, queen 9), mobility, king safety. Problems: the horizon effect (a bad event just beyond the depth limit); quiescence search helps.
Beyond minimax
- Games of chance (backgammon, ludo): expectiminimax adds chance nodes with probability-weighted averages.
- Monte Carlo tree search with learned neural networks (AlphaGo, AlphaZero) plays Go and chess at superhuman level.
Exams usually ask
- Apply minimax to a game tree and give the root value and best move.
- Show which branches alpha-beta prunes.
- Explain evaluation functions and the horizon effect.
Common mistake
Thinking alpha-beta can change the minimax value. Pruning only saves work; the chosen move and value are the same.
Written by the UniHive team in our own words. Spotted a mistake? Tell us on WhatsApp.
Read
-
Minimax
(opens en.wikipedia.org in a new tab)
Wikipedia, Minimax, CC BY-SA 4.0 · licence
-
Alpha–beta pruning
(opens en.wikipedia.org in a new tab)
Wikipedia, Alpha–beta pruning, CC BY-SA 4.0 · licence
-
NPTEL: Artificial Intelligence: Search Methods for Problem Solving (IIT Madras, whole course)
Prof. Deepak Khemani: state space search, DFS and BFS, heuristic search, A*, problem decomposition, game playing with minimax and alpha-beta. Video lectures, many hours in all: watch on Wi-Fi where you can.
(opens nptel.ac.in in a new tab)
NPTEL, NPTEL: Artificial Intelligence: Search Methods for Problem Solving (IIT Madras, whole course), CC BY-NC-SA 4.0 · licence
Watch
-
Best pick Adversarial Search : Horizon Effect, Game Databases & Other Ideas
30 min · ≈ 135 MB · about ₦76
(opens youtube.com in a new tab)
-
Artificial Intelligence - 5.1 - Adversarial search and games, Game theory
23 min · ≈ 104 MB · about ₦58
(opens youtube.com in a new tab)
-
Game playing | Scope of AI | Artificial intelligence | Lec-43 | Bhanu Priya
8 min · ≈ 36 MB · about ₦20
(opens youtube.com in a new tab)
-
Game Theory in Adversarial Search in Artificial Intelligence || Game Tree Representation
7 min · ≈ 32 MB · about ₦18
(opens youtube.com in a new tab)
-
1. MiniMax Search Algorithm Solved Example | Min Max Search Artificial Intelligence by Mahesh Huddar
8 min · ≈ 36 MB · about ₦20
(opens youtube.com in a new tab)
We link to free material and never copy it. Every link was opened by our team before it went up; video data is a rough guide at 360p.