Look & tools
Dwarven computing: logic gates from levers, water and animals
Some players look at a lever, a pressure plate and a door and see a switch. Put enough switches together and you have a computer, powered by dwarves and very confused animals.
Among the stranger things people do in Dwarf Fortress is build computers. Not metaphorical ones: working machines that take inputs, apply logic and produce outputs, assembled from the game's own parts. The official wiki's computing page describes it as building elaborate contraptions that carry out logic and arithmetic, preferably in the service of running some part of the fortress, and notes that because there are many ways to solve any one problem, invention is encouraged.
A little real-world background
A computer, at bottom, is built from logic gates. Wikipedia's article on logic gates defines a gate as a device that performs a Boolean function, taking one or more binary inputs and producing a single binary output. Most real gates are made of transistors, but the same article points out that they can also be built with relays, fluidic or pneumatic logic, optics, or even mechanical elements. That is the whole principle dwarven computing rests on: anything that can be on or off, and can switch something else on or off, can in principle compute.
Inputs, outputs and the signal
In the game, the signal is the linkage between a trigger and the things it controls. A lever or a pressure plate is linked, through mechanisms, to buildings such as doors, floodgates, hatches and bridges. The official page lists levers and pressure plates as the basic input devices, and notes that pressure plates can respond to water or magma depth, to the weight of a creature or a minecart, or even to your own dwarves. The outputs are the buildings they operate. Everything else is plumbing.
The mechanisms and power page covers how linking works in ordinary fortress life. Computing simply takes that everyday tool and arranges it cleverly.
The main disciplines
Fluid logic
Water flows when a floodgate opens and stops when it closes. Put a pressure plate where the water arrives and you have converted "gate open" into a signal that can open or close something else. Chain these together and water becomes the current flowing through your circuit. Fluid logic is slow and a little messy, and it needs a reliable water supply and somewhere for the water to go, which is where the pumps and drains come in.
Mechanical logic
Power from a water wheel or windmill travels along axles and gear assemblies. Gear assemblies can be switched between engaged and disengaged by a linked trigger, so a line of gears becomes a line of switches that either passes power along or does not. Mechanical logic reacts quickly and does not flood anything, which makes it popular.
Creature logic
The most famous and the most absurd approach uses animals. A creature penned in a small space will walk away from something it dislikes, or toward something it wants. If its movement steps on a pressure plate, the animal becomes part of the circuit. Players have built working gates from the predictable panic of penned animals, and there is something magnificently dwarven about a calculation that depends on a cat's opinion of a door.
Minecart logic
Minecarts rolling along tracks can trip pressure plates as they pass, and track switches can route them one way or the other. The result is a surprisingly compact way of building logic, and one of the more recent disciplines players have explored.
What people build
Starting from simple gates, players have built the same components that real computers are made of: adders that sum binary numbers, memory cells that hold a value until changed, repeaters that pulse on a regular beat, and clocks that tick through a sequence. The official page groups its examples into useful machines, proofs of concept and deliberately silly ones.
The useful machines are worth mentioning, because not all of this is a stunt. A repeater that opens and closes a floodgate on a schedule can run a farm's irrigation. A small circuit can make sure the outer drawbridge is always raised before the inner gate opens, so that an attacker can never find both open at once. A pressure plate that senses a water level can close the intake before the lower levels flood.
Why anyone does it
Partly because it is possible. The game never set out to include computing; it just simulated levers, water and animals faithfully, and players noticed that faithful simulation is enough. Building a working adder out of plates and floodgates is a puzzle with a satisfying answer and a completely unnecessary one, which is precisely its charm. It sits comfortably alongside the grand constructions on the megaprojects page.
Starting small
If you want to try, begin with one gate that does one visible job: two levers that must both be pulled to open a door. Watch it work. Then build a repeater that opens and closes a hatch on its own. Keep your experiments away from anything important until you trust them, because the only thing worse than a flooded fortress is a flooded fortress that was flooded by your own logic.