Chess

Play a friend, a random mover, or a minimax engine you can dial up or down.

White to move
Human ยท Even position (0.0)
Black
Minimax AI ยท depth 4
White
Human

Under the hood

How the Chess AI thinks

Chess is far too big to solve, so the engine does what real engines do: it looks several moves ahead, spends its time on the most promising lines, and judges positions by more than just counting pieces.

search alpha-beta + iterative deepeningdepth 1โ€“12 pliesspeed ~1M positions/seceval tapered, 7 factors
01

It looks at good moves first

Alpha-beta pruning only pays off if the best move is tried early. So captures are ordered by what they win (a pawn taking a queen goes first), and quiet moves that caused cutoffs before, 'killer' and 'history' moves, come next. A transposition table remembers positions it has already solved.

02

It doesn't stop mid-fight

At the end of its search a naive engine can see 'I take a queen' without seeing the recapture. This one keeps searching captures until things calm down (quiescence search), which removes most of the horizon-effect blunders.

03

It reads the whole board, not just material

Beyond piece values it scores square placement (tapered between middlegame and endgame, so kings hide early and march late), piece mobility, passed and doubled pawns, rooks on open files, the bishop pair and pawn cover in front of the king.

04

It skips what it can prove is useless

If passing the move still leaves it winning, the position is cut off (null-move pruning). Late quiet moves are searched less deeply unless they surprise it (late-move reductions), and checks are searched one move deeper.

Find the horizon

Depth is how many moves ahead it looks. At depth 2โ€“3 it still falls for tricks that pay off a few moves later, such as a sacrifice that wins material back. Try a quiet sacrifice, then raise the depth and see if the same trick still works.