Six hundred years separate the copper flautist in a toy boat from Charles Babbage’s blueprints—and all that time, the idea of a programmable mechanism existed, but led nowhere.
In the upper reaches of the Tigris, in the city of Amid—today Diyarbakır in southeastern Turkey—stood the fortress of the Artuqid rulers. The Artuqids were a small Turkic dynasty, squeezed between Crusaders, Ayyubids, and Seljuk emirs. Their court did not aspire to the scale of Baghdad or Cairo, but it was here, on the edge of great empires, that a man worked whose full name takes up an entire line: Badi al-Zaman Abu al-Izz ibn Isma'il ibn al-Razzaz al-Jazari (1136–1206). “Al-Jazari” is a nisba indicating al-Jazira, the “island” between the Tigris and Euphrates. He spent twenty-five years at court as chief engineer, and in that time he did what engineers rarely do: he wrote everything down.
His book—“Kitāb fī maʿrifat al-ḥiyal al-handasiyya,” “The Book of Knowledge of Ingenious Mechanical Devices”—was completed in 1206 at the request of the ruler Nasir al-Din Mahmud (who reigned from 1201 to 1222). The earliest complete manuscript is held in Istanbul’s Topkapı Library under the number MS 3472, and was copied by Muhammad ibn Yusuf ibn Uthman al-Hisenkafi in April 1206—practically at the same time as the original was finished. The book contains descriptions of fifty devices, divided into six categories: water and candle clocks; vessels and figures for banquets; pitchers and basins for washing and bloodletting; fountains and perpetual flutes; water-raising machines; and—the final category—miscellaneous devices, from a palace door to a combination lock. Every description is accompanied by detailed illustrations and instructions for construction, including the dimensions of the parts.
There is one thing about al-Jazari that wins me over: he was a craftsman. His method was empirical; he himself writes of trial and error, of paper models and wooden templates that came before the metal parts. This is not the abstract mechanics of Heron of Alexandria, retold across the centuries. It is a manual for someone who wants to reproduce a device with their own hands—and therein lies both its immense value and, as will become clear later, its limitation.
The fourth automaton in the entertainment series is the musical boat. Picture a model vessel set afloat in a palace pool during a feast. On the upper deck sit motionless papier-mâché figures: the king and his retinue, a decorative crown that establishes the scene but does nothing. Everything interesting happens below, where the movable figures of musicians, made of jointed copper, are placed: a flautist, a harpist, and two tambourine players. They are commonly called qiyān—enslaved singer-musicians, a familiar element of court culture at the time.
The boat is powered by water. From a reservoir, every half hour, it drains into a tipping bucket—a simple but reliable device: the bucket fills, its center of gravity shifts, it tips over, pouring water onto the paddles of a scoop wheel. The wheel turns, and with it an axle fitted with pegs. This is where the essential part begins. The pegs are placed at specific points along the axle. As it turns, each peg presses against a lever at the right moment, lifting a rod connected to the arm of a copper figure. The arm strikes the tambourine or plucks the harp strings. Roughly speaking, the pegged axle works as an early prototype of a camshaft: rotational motion is converted into linear reciprocating motion—each projection on the shaft “triggers” an action at a strictly defined moment in the cycle.
The flautist works differently. Her sound is produced not by a mechanical arm, but by water forcing air into a sealed air vessel with a whistle. The principle was familiar from Hellenistic water organs—but here it is integrated into a single automaton, where several “instruments” of different kinds sound at once.
The most important feature of this construction is that the arrangement of pegs on the axle could be changed. Reposition the pegs, and you got a different rhythm, a different sequence of beats—a different “melody” from the drummers. The mechanism remained the same; only the instruction, inscribed on its surface, changed.
This is where we enter terrain on which it is easy to slip. Professor Noel Sharkey of the University of Sheffield studied the boat’s drummer and called it the first programmable robot. A bold claim, but one that still remains within the bounds of mechanics. In popular retellings, it quickly mutates into “the first computer,” “medieval code,” and “an Arab precursor to the processor.” Well—no.
A peg on a rotating shaft is not a bit of information in the electronic sense. It takes no part in computation. It is not processed by a logic gate. Al-Jazari’s device did not store a program in memory—it was the program, physically embodied in the arrangement of projections on a metal axle. The difference is fundamental: a modern computer separates hardware and instructions (the von Neumann architecture), while the musical boat is hardware into which the instructions are literally hammered with nails. Between “reposition the pegs” and “load a new program” lies a gulf the size of the formalization of universal computation.
Yet there is something that connects al-Jazari’s boat to the broader idea of programming: the separation of instruction from mechanism. To change the automaton’s behavior, there was no need to build a new automaton. It was enough to reconfigure the medium—to move the pegs. This is the same principle that centuries later would take shape in Jacquard loom cards, music-box cylinders, and the punched cards of Charles Babbage’s Analytical Engine. The principle is one; the implementations are different, and there is no direct line of inheritance between them.
In 1801, Joseph Marie Jacquard demonstrated a loom in which the pattern was set by punched cards. Each card was one row of the pattern: a hole lets a hook through; a solid surface does not. Change the set of cards, and you change the fabric design. The principle is identical to al-Jazari’s pegs: a physical medium encodes a sequence of mechanical actions, and it can be replaced. But Jacquard knew nothing of the boat from Amid. His sources were the French weaving experiments of Basile Bouchon (1725) and Jacques de Vaucanson (the 1740s), not Arabic treatises on mechanics.
Music boxes with metal cylinders studded with pegs appeared in Switzerland at the end of the XVIII century. The resemblance to al-Jazari’s construction is striking—a rotating shaft, projections that catch the teeth of a comb and sound notes. But here, too, no genealogical connection can be traced: European clockmakers developed their own tradition of automata, reaching back to the mechanical clocks of the XIV century and the jacquemart figures on tower clocks.
In the 1830s, Charles Babbage designed the Analytical Engine, borrowing from Jacquard the idea of punched cards for controlling a computational device. Babbage took a step no one before him had taken: he separated the “mill” (the processor) from the “store” (memory), and provided for conditional branching—the ability to alter the order of operations depending on intermediate results. This was already the architecture of a general-purpose computing machine, even if it was not realized in his lifetime.
The three lines—Islamic automata, European musical mechanisms, Jacquard weaving—demonstrate the same idea, but grew from different roots. They resemble one another as a bird’s wings resemble a bat’s wings: convergent evolution, not a common ancestor. The temptation to arrange them into a single staircase of progress is great, but the facts do not support it.
In his book, al-Jazari described an impressive range of mechanisms: the first known crankshaft, a crank-and-connecting-rod mechanism, a two-cylinder piston pump with valves, conical valves, segment gears, combination locks. His water clocks are a subject of their own: there are clocks with automated drummers striking the hours, and a peacock clock. Washing devices are a genre in themselves: a hand-washing automaton with a drainage mechanism, and a peacock dispensing water from its beak. A man capable of conceiving and building all this plainly possessed engineering instincts of the highest order. So why did his ideas not give rise to an industrial revolution?
The first and most prosaic answer is the manuscript transmission of knowledge. Al-Jazari’s book was copied by hand. Several manuscripts survive, scattered among libraries in Istanbul, Oxford, and Leiden—but each copy required months of work by a skilled scribe, and each inevitably lost details. Compare that with the output of Gutenberg’s printing press: hundreds of identical copies, available simultaneously to dozens of workshops. A manuscript is a message in a bottle; a printed book is a radio broadcast.
The second answer is the social function of automata. The musical boat was a courtly marvel, a luxury object, entertainment for a feast. It solved no economic problem. No one needed the mass production of copper flautists. Al-Jazari’s piston pump raised water—that was more useful—but even it remained a one-off object, made by a master for a specific patron. There was no mass machine industry in Upper Mesopotamia of the XIII century that could reproduce such mechanisms—as there was nowhere in the world before the XVIII century.
The third answer is deeper and more unpleasant: Eurocentric historiography of computing long ignored non-European sources. The canonical line—“Pascal — Leibniz — Babbage — Turing”—took shape in the XIX–XX centuries, when the history of technology was written predominantly by Europeans and for Europeans. Al-Jazari entered English-language awareness largely thanks to Donald Hill’s translation in 1974. Before that, his book was available only to those who could read Arabic manuscripts—and such people among historians of computing were, to put it mildly, few.
There is a temptation to turn this story into an indictment: that the West stole the East’s ideas, or, conversely, that the East failed to develop its own inventions. Both versions reduce reality to caricature.
Al-Jazari worked in a tradition that included the Banū Mūsā—three brothers from Baghdad in the IX century, authors of The Book of Ingenious Devices—Heron of Alexandria (whose texts were translated into Arabic), and perhaps Indian and Persian sources that have not survived. He stood on the shoulders of predecessors, just as Babbage stood on Jacquard’s shoulders, and Jacquard on Vaucanson’s. Inventions do not arise in a vacuum, but neither do they pass automatically across centuries and cultures.
The principle of a “replaceable instruction medium”—pegs that can be repositioned—arose repeatedly and independently in the history of technology. It appeared wherever a master faced the problem of making a mechanism do different things without rebuilding the mechanism itself. It is such a natural solution that it would be stranger if only one person had found it. A pegged axle is an answer to a question craftsmen at opposite ends of Eurasia asked themselves: how do you separate “what to do” from “what to do it with”?
It seems to me that the most honest conclusion is a different one: his time was asking different questions. The phrase “ahead of his time” usually means only that we failed to understand his time. A court engineer of the XIII century optimized not production, but astonishment. His task was to amaze the guests at Nasir al-Din Mahmud’s feast. No one in that hall needed faster calculations or cheaper cloth. The musical boat performed its task magnificently.
Manuscript MS 3472 lies in Topkapı, and several times in recent decades enthusiasts have reconstructed al-Jazari’s devices from his drawings. They work. The scoop wheel turns, the pegs lift the levers, the copper hands strike the tambourines. A construction described eight hundred years ago can be reproduced—and that is the best proof that al-Jazari was an engineer through and through.
The question we began with—why a mechanism that made it possible to change the “program” in the XIII century did not become the beginning of a computer revolution—has an answer devoid of drama. Programmability is necessary, but far from sufficient, for a computing machine. You also need the formalization of logic (Boole, 1854), the concept of universal computation (Turing, 1936), the mass production of precision parts, electricity, semiconductors. A peg on a shaft is the beginning of a long conversation, the first syllable, after which centuries of silence passed before someone spoke the next one. But that syllable was spoken—in a workshop on the bank of the Tigris, for the ruler of a small state whose name is remembered today chiefly because his engineer wrote down how a boat with musicians worked.