The Dark Ages. That's the label that stuck. A thousand years of mud and superstition between the fall of Rome and the Renaissance, a long waiting room before the real story started. The very name tells you everything: dark, middle ages, as in nothing to see here, as in let's skip ahead to the good part. That's the story we tell ourselves. It's also bollocks.
While Europe was fumbling toward its first cathedrals, the courts of Baghdad, Cairo, Córdoba, and Isfahan were running hospitals, libraries, observatories, and universities. Scholars were translating Greek philosophy, advancing algebra, mapping the stars. Engineers were building machines that wouldn't be matched for centuries. This wasn't a gap between two golden ages. It was a golden age, but the western narrative has spent six hundred years pretending it didn't happen.
Let's get our bearings. It's the twelfth century. The Crusades were raging. The Silk Road was humming. And in a small city in southeastern Türkiye, something super funky was ticking. The city was called Amid, known today as Diyarbakır. This was the heart of the Artuqid dynasty, a Turkoman clan who'd carved out a decent little kingdom in the region known as Diyar Bakr. They were cultured, wealthy, and absolutely obsessed with spectacle. They had the cash and the taste to commission the finest minds of the age, and they weren't interested in the mundane or the practical. They wanted wonder. They wanted machines that moved, that sang, that made people question reality. This was a society where engineering wasn't just functional craft – it was performance art, a way to demonstrate power and to dazzle.
And into this world, in 1136 CE, was born our man: Badi al-Zaman Abu al-Izz Ismail ibn al-Razzaz al-Jazari. Badi al-Zaman. It means, quite literally, the "Unique One of the Age." Which is a hell of a flex for a name, but he fucking earned it. He wasn't some theoretician lost in abstraction. His father was a craftsman, a maker, a builder. Badi grew up with his hands in the grease, learning the properties of wood, of brass, of water. He understood materials on a level we would now call molecular – long before the concept of a molecule was even a glimmer, before John Dalton and Amedeo Avogadro got to work in the early 1800s and formalised what he already knew in his fingertips. By his late thirties, he was the chief engineer (Ra'is al-A'mal) for the Artuqid court, a position he held for over thirty years, from around 1174 until his death in 1206. He lived to be about seventy – a remarkable age for the period, testament to a life of purpose and, one imagines, good plumbing.
His life's work, his magnum opus, was a book he completed in 1206, the same year he died. The man timed his exit to his master delivery; how about a mic drop. It's called The Book of Knowledge of Ingenious Mechanical Devices. And it is, without exaggeration, one of the most important engineering manuals ever written. It documents over a hundred devices – water clocks, fountains, musical automata, water-raising pumps – and, most importantly, it includes detailed instructions and diagrams on how to build every single one of them. This is the beating heart of Badi's legacy. He wasn't just an inventor; he was an evangelist. He didn't hoard his secrets. He wrote it all down, every gear ratio, every valve size, every goddamn trick. He wanted people to understand the magic, not just gawp at it. He was the OG open-source developer. The term "open source" wouldn't be coined until a strategy session in Palo Alto in February 1998. Badi was doing it eight hundred years earlier. He was the original go-open-source motherfucker, documenting his code, commenting his functions, and leaving the manual for anyone brave enough to read it.
Right. Let's talk about the crown jewel, the big one: the Castle Clock. This wasn't some dainty little timepiece. This thing was a monument. It stood about eleven feet tall – over three metres. We're talking a multi-tonne structure of brass, wood, and copper that dominated the palace courtyard. It wasn't just a clock; it was a statement. Every official, every foreign envoy, every rival ruler who walked through those gates would look up at this behemoth and think, "Fucking hell, these Artuqids aren't messing about."
The design was pure theatre. A massive archway, ornamented with complex geometric patterns. At the top, a crescent moon and a zodiac ring that rotated slowly, tracking the stars – astronomy, not astrology, but a celestial calendar, because in the medieval world, astronomy was life-or-death science, a precise mathematical discipline used for timekeeping, navigation, and understanding the cosmos, not a fucking horoscope. Below that, a row of doors that opened and closed like magic. And at the very bottom, a pair of brass falcons with their beaks wide open, ready to catch falling brass balls. This wasn't just a clock; it was a show. A theatrical performance that repeated every single hour, on the hour, without fail.
Now for the real genius. Hidden behind that ornate facade was a continuous-flow hydraulic system that Badi perfected through decades of obsessive tinkering. The core of it was a large water tank, calibrated to a tolerance that would make a modern machinist weep. Water dripped into it at a steady rate, controlled by siphons and regulators that Badi designed to compensate for changes in water pressure and temperature. The man understood fluid dynamics before fluid dynamics was even a thing. Daniel Bernoulli wouldn't publish Hydrodynamica until 1738. That's over five hundred years later. Schoolkids today still learn about Bernoulli's principle in their first physics course. Badi was implementing it in brass and water half a millennium earlier. Let that sink in. In fact, about eight hundred years later, a certain tech trillionaire would walk into Twitter's headquarters carrying a ceramic sink for a photo op. Badi did it with an actual working sink. In brass. In 1180. Let that sink in.
Inside that tank sat a float – a bobber, but one that had been thought about for decades. As the water level dropped, the float descended with it. Slowly. Predictably. Unstoppably. This descent was the clock's heartbeat, its central processing cycle. The float sank, millimetre by millimetre, hour after hour, without pause, without deviation. Every tick, every tock, every single movement of this massive machine was driven by that float sinking through the water. It was an inexorable process – from the Latin inexorabilis, meaning "not to be persuaded or moved by entreaty." Relentless. Impossible to prevent. A slow-motion march that nothing could halt or hasten. The only way to stop it would be to fuck with it – to plug the hole, to break the mechanism, to intervene with intention. Short of that, the descent was absolute. Inexorable.
When the float hit certain predetermined levels, it would trip mechanical relays. Now, a relay, in this context, is a physical switch. A tripwire. A mechanism that, when triggered, sets off another mechanism. It's the fundamental building block of any complex machine, from a medieval water clock to a modern computer. And Badi's relays were pure poetry. They were made of wood and brass, strings and pulleys. As the float descended, it pulled a chain that rotated a series of camshafts – cylinders with carefully shaped bumps on them. Each bump was an instruction. When a bump pushed a lever, that lever would pull a string, which would open a door or release a brass ball. It was a physical program, a sequence of instructions encoded in brass and wood – a concept that would echo down the centuries, finding its kin in the punch cards of Jacquard looms and early IBM computers. Every single action – the doors swinging open, the balls dropping into the falcon beaks, the zodiac disks rotating, the drums being struck – was orchestrated by that one, single, inexorable float sinking through the water. Minimise the mechanism to maximise the magic.
Let's break down the components, because this is where the genius really gets granular:
- The Float: The descending heart of the machine. The "clock cycle" that powers everything.
- The Camshaft: The rotating cylinder with bumps. This is the "code," the instruction set. The sequence of bumps determines the sequence of actions.
- The Siphons and Regulators: The "clock speed" controls. Badi designed these to maintain a steady flow of water, ensuring the clock kept accurate time regardless of temperature or pressure changes.
- The Levers and Strings: The "logic gates." They transmit the force from the camshaft to the output devices. If cam bump A, then pull string B. If cam bump C, then release ball D.
- The Counterweights: These balance the float's movement, ensuring it descends smoothly and doesn't get stuck. Elegant, simple, effective.
- The Zodiac Ring: A rotating disk that tracked the stars – a celestial calendar, not a horoscope.
- The Falcon Beaks: Brass receptacles that catch the falling balls. Pure spectacle, but also functional: the balls reset the mechanism for the next cycle.
Badi documented all of this in exquisite detail. In his book, he drew diagrams of every component, labelled every part, and explained exactly how to build it. He even included instructions for calibrating the water flow for different seasons. The man wrote the manual. The complete manual. No proprietary secrets. No "trust me, bro." Just pure, open-source engineering.
Now, put yourself in the sandals of a medieval onlooker standing in that courtyard. You've been on a pilgrimage for days. You're tired. You're thirsty. You're probably hallucinating a bit. And you see this. This massive, eleven-foot-tall monument of brass and wood. And it does stuff. Every hour, on the hour, the doors swing open. Brass balls drop into falcon beaks with a satisfying clink. Drums sound. Zodiac disks turn. The whole thing feels alive, like it's thinking, like it has a soul.
To you, this is magic. This is the work of sorcerers or djinns. The Castle Clock appears to "know" the time, to act with independent agency. It's an illusion of intelligence, of course. There's no consciousness in the clock. It's purely physical logic executing a pre-arranged script through better design, materials, and fluid dynamics. But to that medieval motherfucker, standing there after days of trudging through the desert, watching this mechanical marvel perform its hourly ritual? That's artificial intelligence. That's a machine that looks, for all the world, like it's thinking.
And that, right there, is the parallel that obsesses us today. Because when you look at a large language model generating professor-like text, or an AI diagnosing diseases, or a robot navigating a warehouse... what are you really looking at? A float sinking through water, just with extra steps.
Badi al-Zaman al-Jazari wasn't just a clockmaker. He was the world's first software engineer. He designed a system with hardware, a clock cycle, an instruction set, and a user interface. He documented it, shared it, and made it reproducible. What he built would echo through the ages – though he couldn't have known that. He lived eight hundred years before software existed, eight hundred years before anyone would use the word "engineer" the way we do now. He couldn't have imagined the machines that would come after him. But that's the thing about his work: he didn't need to. He just drew it clearly enough that we could recognise it, eight centuries later, as the same pattern we're still using. Badi built a clock. But what he really built was proof that a machine could be programmed.
Al-Jazari's clock is the historical mirror of modern software engineering: what looks like magic or "artificial intelligence" to the casual spectator is merely an intricate stack of abstractions, hidden mechanics, and deterministic loops running on physical hardware. And that is the thesis that will echo through every chapter of this essay: we have been building gods out of gears and water since the beginning, and we have never stopped believing they are real.
Written by a human, revised with large language models over many passes. A full accounting — which models, for what, how many tokens — comes later in the series. It seemed dishonest to write a book about machines pretending to think without telling you exactly how much I used them.
Top comments (0)