Planning when the world fights back: minimax, alpha–beta pruning, and evaluation functions.
Based on lecture material by Prof. Mustafa Jarrar (Birzeit University) and Russell & Norvig, AIMA 3rd ed., Ch. 5.
In ordinary search you make every move and the world stays still. In a game, an opponent moves between your moves, and wants the opposite of what you want.
MAX chooses at ▲ levels, MIN at ▼; one move is a ply. Leaves are terminal, scored by UTILITY from MAX's view (here +1 / 0 / −1).
Whatever move MAX makes, MIN will then steer to the worst leaf for MAX. So MAX should pick the move whose forced-worst outcome is the least bad.
Most leaves cannot change the root value. Alpha–beta proves a branch is irrelevant mid-search and skips it, returning exactly what minimax would.
Ordering does not change the answer, only the cost. Trying strong moves first tightens the window sooner, so more branches cut. (leaf counts below: one sample tree)
Practice the full interactive walkthrough and Jarrar's exercise tree in the Games companion.