|Part of a series on|
|Logic: Animal • Creature • Fluid • Mechanical • Minecart|
|Components: Adder • Memory • Repeater|
The addition of minecarts to Dwarf Fortress has opened up new and exciting logic and computing options for the ambitious fortress manager. Minecart-based logic gates and memory cells are easy to build (arguably easier than fluid logic systems), they are easy to reconfigure, and react quickly.
 Binary Memory Cells
Binary Memory Cells store binary data as a 1 or 0 (on or off). For minecarts this means a minecart occupies a pressure plate to create a 1 and by some means removed to make a 0.
 Load adjusted memory cell
The image is split into three versions to show where the minecarts go, what's beneath the minecarts and what's beneath the rollers and pressure plates.
The load adjusted memory cell utilizes a pressure plates' load adjusting feature to only trigger at certain weights. In this example the pressure plate is set to trigger at a weight of 350. The iron minecart occupying the plate weighs less then that so it doesn't trigger while the copper cart (being the heavier of the two at 357) would trigger it. Sending power to the northern roller (which pushes south) will push the copper cart into the iron cart, sending it to the southern roller (which pushes north but is currently inactive) before being pushed itself onto the pressure plate, triggering it. The reverse is done to turn the memory cell off.
This design is the most space-efficient of the memory cells but lacks the activation speed of the next design due to the first cart having to push the second cart before being allowed to trigger the pressure plate.
A modular example of this design, accounting for extra gears to allow complex logic gates:
Compared to the fluid-mechanical hybrid memory cell it's nearly 3x smaller and functions just the same without the hassle of getting water to where you need it.
 Newton's cradle memory cell
This design has the advantage of activating the pressure plate almost immediately upon power being sent, on par with the fluid-mechanical hybrid equivalent. Power is sent to the light green gear, pushing the top cart into the second cart. Like a Newton Cradle, the first cart transfers its momentum to the second cart, knocking it to the other end while the first cart rests on the pressure plate to send an on signal. The gear is then turned off. To turn it off power is sent to the dark green and the reverse happens. The modular design of the load adjusted memory cell can be applied to this as well to save space.
 Power-to-Signal Converters
A power-to-signal converter sends an on signal when power is applied and an off signal when power is cut.
 2x2 power-to-signal converter
When power is sent to the gear, the roller sends the cart around in a loop, passing over the pressure plate repeatedly to maintain on on signal. When power is cut the cart returns to the starting position and disengages the pressure plate. The roller in this example pushes the cart from E->W. Pay close attention to the track layout to make sure it works properly. The 2 walls at the top are all that's needed to keep it from derailing.
A modular layout:
 Single-carted power-to-signal converter
The rollers are directed towards the center, so when power is applied to any of the gears the minecart continuously passes over the pressure plate to maintain an on signal, reverting to an off signal when the power is cut.
A modular layout:
More gears than necessary were added to the example above to show how complex you can make the logic gates while maintaining a compact layout.
 Ramp-based power-to-signal converter
Arguably the most efficient design, a PSC that relies on a ramp to return the cart to the start position cuts out the need for a second set of rollers and the power and resource requirements therein.
The roller pushes the cart around the loop, over the pressure plate and on to the ramp, whereupon the minecart rolls back down and on to the rollers again. Rinse and repeat. When the rollers are deactivated the minecart rolls back on to them, allowing the pressure plate to reset. This design does not rely on the floor above being accessible to the minecart (no need to channel anything), the track ramp can be built with floor directly above it.
Obviously, this design could be set to be straight, or curved (as this one is). Straight-line ramp-based PSCs are probably easier to pack together in large numbers if required.
 Other Examples
Other components useful for computing in DF
 Modified load adjusted memory cell
Perhaps a power-to-signal converter, but perhaps not. I'll put it under other since i'm unsure.
This functions much like the memory cell, but with different linkages (and an axle). Both gears are off by default and power is connected to the dark green gear. Be it by lever or pressure plate, both gears are switched, sending power to both rollers (directed to the center). The copper cart pushes the iron one to the other side, but before the southern roller has time to push it back north the copper cart is rolled onto the pressure plate which is linked to the dark green gear, turning it (and the souther roller) off instantly. The light green gear is still engaged but no power is being sent to it.
Both gears are switched again when you want to turn it off, activating the dark green gear and disengaging the light green, sending both carts back to their starting points, deactivating the pressure plate which turns the dark green off again (but keeps the roller on long enough to push the iron cart thanks to the pressure plates 'off' delay).
With the other examples of power-to-signal converters, only 1 gear is needed to be switched to turn them on and off. If you treat both of these gears as you would a single gear then I guess you could also call it a power-to-signal converter, and would be the only one that has no moving water or minecarts when it's in the on position. Useful if you have a whole bunch of them and want to minimize lag.
 Potential as an independent logic discipline
Minecarts can also be set in motion by ramps and switched between different paths by buildings, opening the path for a powerless logic discipline. The basic binary logic gates can be built in this fashion and combined to perform other operations like counting or basic algebra. The circuits tend to look quite complicated, especially if they stretch over multiple levels.
This kind of minecart logic is primarily an alternative to creature logic. Since minecarts move relatively quickly and completely deterministically, simple minecart logic gates can be relatively small and quick. Since a minecart only reacts to the conditions of its current tile and the tile it tries to move into, creature logic will have an advantage when looking at multiple and long logic paths, where a creature instantly detects and chooses the open path, while the minecart has to check every tile and building separately.
For signal generation, memory cells, repeaters and adders, this kind of minecart logic offers a variety of options.