video

Sebastian Lague: Coding Adventure — Chess AI

by Sebastian Lague

Programming challenges tackled with elegant visualizations and thoughtful explanations.

Why it’s worth your time

In "Coding Adventure: Making a Better Chess Bot" (2023), Sebastian Lague revisits the chess engine he wrote two years earlier and sets out to make it strong enough to play people online. Every change is tested the same way, in a thousand games against the previous version from balanced openings, so you watch the engine improve step by step: fixes to iterative deepening and the transposition table (including a bug that left it a thousandth of its intended size), search extensions, better endgame evaluation of kings and pawns, magic bitboards for faster move generation, killer moves and late move reductions.

It's an hour long and generous with the dead ends — changes that made no difference, bugs found on camera — which is what makes it such a good picture of real engineering. By the end the bot beats its original version 898 games to 27, beats Lague himself, reaches a blitz rating just under 2300 on Lichess, and still loses every game to Stockfish.

Where to start

  1. Coding Adventure: Chess

    The 2021 original, where the engine was first built.

  2. I Ran a Chess Programming Tournament!

    A later video running a tournament for viewers' own chess bots.

  3. Main Page - Chess Programming Wiki

    The reference he leans on throughout.

About Sebastian Lague

Sebastian Lague makes Coding Adventures, a YouTube series in which he builds programming projects from scratch — chess bots, ray tracers, fluid and smoke simulations, a Rubik's cube solver — and explains them with clear visualizations.

Everything by Sebastian Lague

About this channel

Exploring how to create stuff out of code

DKJoined October 2011293 videos

Related

Related dispatches

All dispatches