L1

Random Move

~200 Elo0 plies of lookahead<1 ms RandomMoveStrategy.java

Live Simulation — picking a random move every 1.6 s

e2–e4
d2–d4
Ng1–f3
f1–c4
O-O
e4×d5
Qd1–h5
Nb1–c3

All legal moves are equally likely — even blunders and sacrifices.

How It Works

Copy the legal-move list into an ArrayList, call Collections.shuffle(), return index 0. No evaluation. No lookahead. The engine is literally rolling dice.

Why It's Useful

A perfect baseline. Any algorithm must beat Random to be considered a chess AI at all. Also useful for variety in self-play training games.

Strengths
  • Instant response
  • Unpredictable
  • Simple to verify
Weaknesses
  • Hangs pieces freely
  • Never plans ahead
  • ~200 Elo ceiling
L2

Greedy (1-Ply)

~400 Elo1 ply of lookahead~5 ms GreedyStrategy.java

Score all moves — pick the highest bar

15
e4
25
Nf3
+900
Q×d8
5
h3
30
d4

Material captured this move (centipawns). Takes the queen → wins 900 cp.

How It Works

For every legal move: execute it on a trial board, call the evaluator (material + piece-square tables), undo. Keep the highest-scoring move. No recursion.

The Horizon Problem

Greedy always takes the queen — even if you'll lose your own queen on the very next move. It cannot see one move ahead. MiniMax solves this.

Strengths
  • Never hangs pieces
  • Captures freely
  • Fast (<5 ms)
Weaknesses
  • Falls into traps
  • No positional play
  • Horizon effect
L3

MiniMax

~700 Elo3 plies~200 ms MiniMaxStrategy.java

Full tree search — MAX then MIN then MAX …

Visited Best path
How It Works

Alternate between MAX (your best move) and MIN (opponent's best reply) until a fixed depth. Every leaf is scored. Scores propagate back up — MAX nodes keep the largest, MIN nodes keep the smallest.

Why Every Node?

MiniMax visits every node in the tree — bd nodes at depth d with branching factor b. At depth 3 with ~30 moves, that's 27,000 nodes. Alpha-Beta dramatically cuts this.

Tree in This Example

Root=MAX. Three MIN children (A, B, C) each with three leaves. Leaf scores: A=[3,1,7]→MIN=1 · B=[4,9,5]→MIN=4 · C=[2,8,6]→MIN=2. Root picks MAX(1,4,2)=4 → plays B.

Strengths
  • Sees 3 plies ahead
  • Avoids basic traps
  • Correct play guaranteed
Weaknesses
  • Searches everything
  • Slow at depth >4
  • No pruning
L4

Alpha-Beta Pruning

~1100 Elo4 plies~800 ms AlphaBetaStrategy.java

Same tree — pruned branches never searched

Visited Pruned Best path
The α-β Window

Two bounds travel through the tree: α (best MAX has found) and β (best MIN has found). When α ≥ β at any node, that branch can never affect the result — stop searching it immediately.

Pruning In This Example

After searching A=1 and B=4, root α=4. When C's first leaf returns 2, MIN at C will never exceed 2 — which can't beat 4. Leaves C2 and C3 are pruned (red ✕). Same answer, fewer nodes.

Move Ordering Matters

Alpha-Beta prunes most aggressively when the best moves are searched first. MVV-LVA capture ordering (big piece captured by small piece first) brings pruning close to the theoretical √bd speedup.

Strengths
  • Same result as MiniMax
  • Up to 99% fewer nodes
  • Enables depth 4+
Weaknesses
  • Fixed depth
  • No time management
  • No TT / hash
L5

Iterative Deepening + Transposition Table

~1500 Elo6-8 plies2 s time budget IterativeDeepeningStrategy.java

Search depth 1 → 2 → 3 → … until time runs out

Depth 1
Depth 2
Depth 3
Depth 4
2000 ms
Why Restart Each Depth?

Each completed depth is a guaranteed best move. If time runs out mid-depth-4, the depth-3 result is returned. Restarting is cheap because the Transposition Table caches all positions, so depth 3 re-search takes milliseconds.

Transposition Table

A 1M-entry hash map keyed by Zobrist hash (64-bit XOR fingerprint). Stores: score, search depth, bound type (EXACT / LOWER / UPPER). A cache hit avoids re-searching an entire subtree.

Aspiration Windows

Instead of searching (−∞, +∞), search a narrow ±50 centipawn window around the previous iteration's score. If the result falls outside the window, re-search with a wider window. Saves ~20% of nodes on average.

Strengths
  • Anytime algorithm
  • TT avoids repeats
  • Aspiration window savings
Weaknesses
  • No null-move pruning
  • No LMR
  • Horizon effect remains
L6

Advanced Alpha-Beta

~1900 Elo8–12 plies2 s time budget AdvancedAlphaBetaStrategy.java

Six stacked pruning techniques — all firing at once

Null-move pruned LMR reduced Quiescence ext. Futility pruned Full search
Null-Move Pruning

Before searching a node, try passing the move (opponent plays twice). If the position is still better than beta after this "free gift" to the opponent, the branch is pruned with reduction R=2. Skips ~30% of nodes in the middlegame.

Late Move Reduction (LMR)

Moves ordered later in the list are statistically worse. Search them at depth−2 first. Only if they raise alpha do we re-search at full depth. Applied to non-captures, non-promotions, after the 4th move at depth≥3.

Quiescence Search

At depth=0, keep searching captures until the position is "quiet." Prevents the horizon effect: the engine won't stop right before an obvious recapture that loses a piece.

Futility Pruning

At depth 1 (margin 200cp) and depth 2 (margin 400cp), if the static evaluation + margin < α, skip the move entirely — it can't possibly raise alpha. Jump straight to quiescence.

Strengths
  • 8–12 plies in 2 s
  • No horizon effect
  • Tactical + positional
Weaknesses
  • Null-move zugzwang risk
  • LMR can miss tactics
  • Complex to tune

Algorithm Comparison

LevelAlgorithmDepthNodes/Move ResponseKey TechniqueElo
L1 Random01<1 ms Collections.shuffle() ~200
L2 Greedy1~30~5 ms Static evaluation ~400
L3 MiniMax3~27 000~200 ms Recursive MAX/MIN ~700
L4 Alpha-Beta4~1 500~800 ms α-β window + MVV-LVA ~1100
L5 Iterative Deep.6–8~20 0002 s ID + TT + Aspiration ~1500
L6 Advanced AB8–12~8 0002 s NMP + LMR + Quiescence ~1900

See how it all fits together →