Vintage Computer FestivalVCF West 2026on the exhibit table
A 1983 decimal computer solves an ancient puzzle on a modern LED wall

THE TOWERS OF HANOI
ON A 1983 MICROCOMPUTER

A Kosmos CP1 — a 1983 decimal educational computer with only an accumulator and a six-digit display — computes the recursive Towers of Hanoi and streams every move to a 64×32 RGB LED matrix that animates the disks. Michael Wessel’s own machine-code original, up to thirteen disks tall.
The legend: 64 golden disks on three needles — when the last is moved, the world ends. At one move a second that is ≈ 585 billion years, more than 40× the age of the universe.
The feat: an 8-bit decimal machine with no call stack does true recursion — a software stack built by hand in memory — and drives a modern RGB panel over just four GPIO wires.
The real rig: a Kosmos CP1 (right) mid-solve, streaming each move over four jumper wires to an Arduino Mega 2560 that paints the disks on a 64×32 RGB LED matrix (left); the program is loaded as a cassette WAV through the CP1’s tape input.

01THE LEGEND OF THE TOWER OF BRAHMA

In a temple said to mark the centre of the world, sixty-four golden disks rest on three diamond needles. Since the day of creation, priests have moved the disks one at a time — never a larger disk upon a smaller — and the day they finish rebuilding the tower on the third needle, the temple crumbles to dust and the world ends.

Rest easy. Rebuilding a 64-disk tower takes 264−1 = 18,446,744,073,709,551,615 moves. At one move a second that is about 585 billion years — and the universe is only ~13.8 billion years old. The puzzle was invented by the French mathematician Édouard Lucas in 1883 and sold as the toy La Tour d’Hanoï; the doomsday legend was his marketing.

64golden disks
264−1moves required
585 bnyears @ 1/sec
42×the universe’s age

02THE TRICK — RECURSION ON A MACHINE WITH NO STACK

Towers of Hanoi is the textbook example of recursion: to move a stack of N disks, first move the top N−1 out of the way, move the big one, then put them back on top.

move(N, from→to, via):
   move(N−1, from→via, to)  ; clear the top N−1 onto the spare peg
   move disk N, from → to   ; move the biggest disk
   move(N−1, via→to, from)  ; stack them back on top

But the CP1 has only an accumulator and no call stack to remember every pending “put them back.” The solver builds one by hand in memory — four parallel software stacks (the three pegs plus return addresses) in cells 200–255, grown by a save_and_push prologue and unwound by pop_and_restore. A 1983 decimal trainer doing honest recursion — up to thirteen disks.

03FROM 1983 SILICON TO A MODERN LED WALL

As it solves, the CP1 streams each move — which disk, from which peg to which — over a four-bit GPIO protocol to an Arduino Mega 2560, which renders the tower on the 64×32 RGB LED matrix: disks rainbow-coloured by size, sliding between three pegs on a blue base. It is the very move protocol first built to drive a physical pan/tilt Hanoi robot — now painting pixels instead.

And getting the program onto the CP1 is painless: a modern development toolchain turns readable assembly into a cassette WAV you play straight into the tape input — no hand-keying 256 cells on the keypad.

▶  Watch it · build it

Full solve on the LED matrix, plus the CP1 & Microtronic source, the robot, and the code walk-through.

github.com/lambdamikel/towers-of-hanoi
youtu.be/CkCNBzWRjq4