13 Minimax Search

done←leaves((S,E))done \leftarrow leaves((S, E))

# Minimax search
done ← leaves((S, E))
while done ≠ S:
    next ← { s' ∈ S ∖ done | children(s', (S, E)) ⊆ done }
    for s ∈ next:
        C ← children(s, (S, E))
        if owner(s) = 1:
            O ← arg max_{s' ∈ C} u(s')        # maximise
        else:
            O ← arg min_{s' ∈ C} u(s')        # minimise
        s'' ← any element of O
        u(s) ← u(s'')                         # back score up
        done ← done ∪ {s}

13.1 Depth-limited minimax with heuristics

In practice, real game trees are too large for full backward induction. We want to use depth-limited search. We then have to replace the exact utilities at new leaves with some heuristic evaluations. For example, in chess it might be h(s)=9Q+5R+3Bh(s) = 9Q + 5R + 3B.

13.2 Alpha-beta pruning

An optimisation for minimax.

image