Claude Code Powers TeXCCChess as Coding Agents Build Chess Engine in Pure TeX
Photo by Alexandre Debiève on Unsplash
Blog reports that Claude Code, a 2026 coding agent, built a full chess engine in pure TeX—handling board representation, move generation, recursive tree search and evaluation—without any prior design or step‑by‑step guidance.
Quick Summary
- •Blog reports that Claude Code, a 2026 coding agent, built a full chess engine in pure TeX—handling board representation, move generation, recursive tree search and evaluation—without any prior design or step‑by‑step guidance.
- •Key company: Claude Code
Claude Code’s feat reads like a programming‑language dare‑devil stunt. The Anthropic agent, running on the Claude Opus 4.6 model, was handed a blank slate—no design doc, no step‑by‑step plan—and asked to produce a complete chess engine in TeX, the macro language that powers LaTeX documents. Within a single session the model generated a working engine, TeXCCChess, that compiles with pdflatex, represents the board, generates legal moves (including castling, en passant and promotion), runs a recursive minimax search with pruning, and evaluates positions well enough to earn roughly 1,280 Elo—a casual tournament level, according to the blog author’s tests (Blog).
The technical gymnastics required to pull this off are extraordinary because TeX was never meant for general‑purpose computation. As the blog notes, TeX lacks arrays, functions that return values, local variables, and even integers larger than 2³¹‑1. Its macro‑expansion engine is Turing‑complete, but recursion quickly runs into engine limits and there is no conventional call stack. The only numeric storage available are the 32,768 integer registers introduced by e‑TeX extensions, which the agent cleverly repurposes as a makeshift memory space for the board and search tree. “That turns out to be just barely enough to implement a chess engine,” the post explains, highlighting how Claude Code squeezed a full game‑playing AI out of a language designed for typesetting (Blog).
What makes TeXCCChess more than a novelty is its role as a litmus test for the originality of coding agents. The author scoured CTAN, GitHub and TeX Stack Exchange and found no existing TeX chess engine, only rendering packages like chessboard and xskak. Because the engine is the first of its kind, the likelihood that Claude Code simply regurgitated a memorized codebase is minimal. The blog argues that this “counterpoint to the plausible critique that coding agents just regurgitate training data” demonstrates genuine synthesis: the model combined knowledge of TeX macro mechanics, chess algorithms, and the constraints of the TeX engine to produce a novel artifact (Blog).
Running the engine is surprisingly straightforward. Users can compile the source with a standard pdflatex installation and play against the AI either locally or via an Overleaf demo linked in the post (Blog). The compiled PDF displays a chessboard that updates after each move, with the engine’s decisions driven entirely by TeX macros. The author measured its playing strength by pitting it against established open‑source engines and reported an Elo rating around 1,280, placing it on par with a casual club player (Blog). While nowhere near the strength of modern C++ or Rust engines, the result is impressive given the language’s limitations.
Beyond the headline‑grabbing novelty, TeXCCChess hints at broader implications for AI‑assisted software development. If a coding agent can marshal a Turing‑complete but austere environment like TeX into a functional AI opponent, it suggests that future agents might be able to generate useful code in other constrained or legacy systems where human developers balk. The experiment also underscores the importance of “agentic” tools that can iterate, test, and debug autonomously—Claude Code did not receive a step‑by‑step blueprint, yet it produced a coherent, testable program (Blog). As AI coding assistants become more prevalent, such boundary‑pushing demonstrations will help define the realistic limits of what they can create without human scaffolding.
Sources
This article was created using AI technology and reviewed by the SectorHQ editorial team for accuracy and quality.