Game Evaluation Functions

When the game tree is too big to search to the end — cut off at k-ply, score the board statically, and back up as if it were terminal

The Simplest Explanation

Tic-Tac-Toe is small enough to search to the end. Chess is not — so search only k moves ahead (a k-ply search), then score each leaf position with a static evaluation function e(n)e(n), and run Minimax/Alpha-Beta exactly as if those leaves were real endings.

Remember This

e(n) is static (board → number), continuous in [−1, +1], positive = good for MAX. It replaces true game values at the horizon; everything above it is unchanged minimax machinery.

The Two Standard Components

Shannon's 1950 recipe for chess:

e(n)=f(material)+f(positional)e(n) = f(\text{material}) + f(\text{positional})

ComponentExamples
Materialpiece counts weighted by value (queen ≈ 9, rook ≈ 5, …)
Positionalcenter control, pawn structure, mobility, king safety

This framework underlies essentially every chess engine's leaf scoring.

Tic-Tac-Toe Worked Example

Eval: count open rows/columns/diagonals for MAX, subtract those open for MIN.

Position after MAX takes a corner and MIN takes the center:

  • MAX open lines: 4
  • MIN open lines: 5

e=4−5=−1e = 4 - 5 = -1

Note: Tic-Tac-Toe's true minimax value with perfect play is 0 (a draw) — the eval is only an estimate at a shallow horizon, and that gap is exactly why deeper search plays better.

  1. Grow the tree to depth k
  2. At horizon leaves compute e(n)e(n)
  3. Back up with min/max (α–β prunes along the way)
  4. Root's best child = move played; then search again after opponent replies

Deeper k ⇒ more accurate backups but exponential cost — α–β's bm/2b^{m/2} best case is what buys practical depth.

Properties

PropertyValue
Rangetypically [−1, +1] in this course
Static?Yes — inspects only the current board
Relation to heuristic hSame idea transplanted to adversarial search
Accuracy leverSearch depth k and eval quality trade off
QuizA k-ply search evaluates leaves because...
QuizShannon's chess evaluation combines...