Lab experiment

Chess vs Claude

A chess board in the browser where you play Claude Haiku, Sonnet or Opus, or Stockfish, with a plain-language coach for beginners.

Technologies Used:

Node.jsExpressClaude APIStockfish (WASM)chess.js
Chess vs Claude - image 1

The experiment

Language models are bad at chess in a specific way: they suggest moves that are not legal. I wanted to see how they play once that is taken off the table.

How the illegal moves are gone

The browser sends only the move history. The server replays it with chess.js (it never trusts a position the client sends), lists every legal move, and asks Claude for a structured answer whose move field is an enum of exactly those moves. Claude can think about anything it wants; it cannot answer with a move that does not exist.

What I found

Effort matters more than I expected. Haiku runs at low effort, Sonnet at medium, Opus at high. At medium, Opus barely thought: 49 output tokens for a move. At high it found Légal’s mate. The thinking summary is shown next to the board as “Claude’s thoughts”, which is the most interesting part to watch.

Cost was the other question. Haiku comes out around $0.0001 per move, Opus at high effort around $0.016. The bots run behind a daily budget and a per-IP move limit so a busy day cannot run up the bill.

The coach

I am a chess beginner myself, so there is a coach. A second Stockfish worker in the browser grades every move you make, warns about threats, names the opening and tells you what to play in plain words (“knight g1 to f3”, with an arrow), without chess jargon.

Key Features

  • Three Claude opponents at different thinking levels, plus Stockfish at four strengths
  • Claude can only answer with a legal move: the move field is an enum of the legal moves
  • Stockfish runs in the visitor's browser as WebAssembly, so the engine costs nothing
  • A coach that grades each move and suggests a concrete one, in plain language
  • Daily spending cap and per-IP move limit on the Claude bots

Results

  • Measured cost per move: about $0.0001 with Haiku, about $0.016 with Opus at high effort

Do you like this project?

Let's discuss how we can create a similar solution for your business.

Get Your Free Consultation

Or call me directly: +359 896 86 3508