v50 Steam/Premium information for editors
  • v50 information can now be added to pages in the main namespace. v0.47 information can still be found in the DF2014 namespace. See here for more details on the new versioning policy.
  • Use this page to report any issues related to the migration.
This notice may be cached—the current version can be found here.

Difference between revisions of "v0.34:Minecart logic"

From Dwarf Fortress Wiki
Jump to navigation Jump to search
(+)
m (→‎Resetting bridge-derailment AND: clean up, typos fixed: the exact same → exactly the same, ie, → i.e.,)
 
(8 intermediate revisions by 3 users not shown)
Line 3: Line 3:
 
{{av}}
 
{{av}}
  
The addition of [[minecart]]s 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.
+
The addition of [[minecart]]s 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, quick to react, and can even be built without power, water, or creatures.  The training your [[doctor]]s will receive is just one of many reasons to compute with minecarts!
  
== Binary Memory Cells ==
+
==Techniques and Circuits==
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.
 
  
 +
There exist a great number of different techniques by which a minecart can receive input, compute, and deliver output.  This article does not aim for a comprehensive list of techniques and circuits; the interested reader is encouraged to investigate further.  The following examples were chosen to demonstrate both a variety of techniques and a few commonly used gates.
  
=== Load adjusted memory cell ===
+
====Key====
 +
Adequately diagramming minecart logic devices can be difficult; each tile on each z-level might need to display up to four slices (track, [[ramp]], [[furniture]], minecart) that can lay on top of each other.  Ramps are displayed on the furniture layer for the sake of simplicity, and some slices may be omitted when unnecessary.  Components of each lower slice are displayed on the higher slice when unchanged by new components to give the reader a sense of position.  Wall {{Raw Tile|O|#FFF|#000}} is typically displayed only where it is essential to the operation of the circuit, and drawn only as sequences of pillars to avoid confusion with track.  Unengraved floor {{Raw Tile|,|#FFF|#000}} is sometimes needed for other components, but of course can be smoothed as desired.  Track direction is laid out with {{Raw Tile|║|#FFF|#000}}{{Raw Tile|═|#FFF|#000}}{{Raw Tile|╗|#FFF|#000}}{{Raw Tile|╝|#FFF|#000}}{{Raw Tile|╚|#FFF|#000}}{{Raw Tile|╔|#FFF|#000}}{{Raw Tile|╩|#FFF|#000}} and ends in a tile with {{Raw Tile|╨|#FFF|#000}}{{Raw Tile|╥|#FFF|#000}}{{Raw Tile|╡|#FFF|#000}}{{Raw Tile|╞|#FFF|#000}}.  Minecarts {{Raw Tile|■|#FFF|#000}} are accelerated by rollers to the east {{Raw Tile|╟|#FFF|#000}} west {{Raw Tile|╢|#FFF|#000}} north {{Raw Tile|╧|#FFF|#000}} or south {{Raw Tile|╤|#FFF|#000}} and decelerated by track stops {{Raw Tile|≡|#FFF|#000}}.  Rollers are controlled via [[Gear_assembly|gear assemblies]], either engaged {{Raw Tile|☼|#FFF|#000}} or disengaged {{Raw Tile|☼|#777|#000}}, typically connected to sufficient [[power]] {{Raw Tile|P|#0F0|#000}}.  [[Pressure plate]]s {{Raw Tile|^|#FFF|#000}} provide output and, in some cases, modulate the circuit itself.  Up {{Raw Tile|▲|#FFF|#000}} and down {{Raw Tile|▼|#FFF|#000}} ramps may be necessary to travel z-levels or alter minecart velocity; they may be roofed or covered with empty space {{Raw Tile|.|#0FF|#000}} in some views.  [[Hatch]]es {{Raw Tile|¢|#FFF|#000}} and retractable [[bridge]]s {{Raw Tile|╬|#000|#CCC}} are commonly used to control the path of minecarts.  Where necessary, clarification can be found in the descriptions of each circuit.
  
[[File:3tdcbm.png|thumb|left|210px]] {{clear}}
+
===Power to signal===
 +
{{diagram|spaces=yes|\
 +
  O      O
 +
  ╥,      ╤☼
 +
  ║      [#F0F]^[#0F0]P
 +
  ╨,      ╧☼
 +
  O      O
 +
track furniture}}
  
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.
+
In this, the simplest of all designs, the output plate sends an '''on''' signal when the gear assemblies {{Raw Tile|☼|#FFF|#000}} are powered {{Raw Tile|P|#0F0|#000}}. When power is lost, the minecart settles onto either the northern or southern roller spaces, and the output plate sends an '''off''' signal.
 +
 +
This device is very general purpose.  Left as an exercise for the reader, alternate construction can result in edge detection or in a [[repeater]] design.
  
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.
+
===Newton's Cradle Memory===
 +
{{diagram|spaces=yes|\
 +
  O      O        O
 +
  ╥,      ╤[#0C0]☼[#0F0]P      [#000][#0f0]■[#0C0]☼[#0F0]P
 +
  ║      ║        ║
 +
  ║      [#F0F]^        [#000][#ff0]■
 +
  ╨,      ╧[#CC0]☼[#0F0]P      ╧[#CC0]☼[#0F0]P
 +
  O      O        O
 +
track furniture minecart}}
  
A modular example of this design, accounting for extra gears to allow complex logic gates:
 
  
[[File:Modular3tdcbm.png]]
+
[[User:TinyPirate|TinyPirate]]'s Newton's Cradle [[Memory_(computing)|memory]] cell is notable both for its small footprint and for demonstrating an important principle of minecarts.  When the northern gear assembly {{Raw Tile|☼|#0C0|#000}} is briefly engaged, the northern roller {{Raw Tile|╤|#FFF|#000}} becomes powered, launching the northern minecart {{Raw Tile|■|#000|#0F0}} into the southern minecart {{Raw Tile|■|#000|#FF0}}. The southern minecart then leaves the output plate {{Raw Tile|^|#F0F|#000}} and settles on the southern (unpowered) roller.  When the southern gear assembly is briefly engaged, the situation reverses: the southern minecart settles on the output plate, knocking the northern minecart onto the northern (unpowered) roller-- as in its original state.
  
Compared to the [http://dwarffortresswiki.org/index.php/DF2012:Latch#Mechanical_Logic 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.
+
===Continuous roller OR===
 +
{{diagram|spaces=yes|\
 +
╔═╗═╗  ╔═╗═╗
 +
║ ║O║  ║ [#F0F]^O║
 +
║ ║O║  ╤[#0F0]☼╧O║
 +
║ ║O║  [#0F0]P╤[#FF0]☼╧O║
 +
╚═╩═╝  ╚═╧═╝
 +
track  furniture}}
 +
[http://www.bay12forums.com/smf/index.php?topic=114923.msg3891809#msg3891809 Veylon's] roller OR continuously evaluates two operands via a minecart traveling counter-clockwise using principles of power transmission through single tile rollers.  Should either input {{Raw Tile|☼|#0F0|#000}} or {{Raw Tile|☼|#FF0|#000}} be engaged, power {{Raw Tile|P|#0F0|#000}} is transmitted to the southernmost, S->N roller {{Raw Tile|╧|#FFF|#000}}.  Although the minecart is left with diagonal velocity, walls prevent derailment.  When neither input is engaged, the minecart continues over the T-junction to the east, missing the output plate {{Raw Tile|^|#F0F|#000}}.
  
=== Newton's cradle memory cell ===
+
===Roller switched AND===
 +
{{diagram|spaces=yes|\
 +
  ║      ║
 +
  ╔╗    [#0F0]P[#0F0]╧╗
 +
  ║║      ║║
 +
  ╔╗    [#0F0]P[#FF0]╧╗
 +
  ║║      [#F0F]^║
 +
  ╚╗      ╚╗
 +
track  furniture}}
 +
[[User:Larix|Larix]]'s roller-switched AND takes advantage of the behavior of rollers to avoid troublesome diagonal velocity.  It is potentially confusing both for the counter-intuitive direction of its rollers as well as the way that rollers respond to signals.  When the minecart encounters either activated (that is, the last signal received was an '''off''') S->N roller {{Raw Tile|╧|#FF0|#000}} or {{Raw Tile|╧|#0F0|#000}}, its velocity is completely rewritten and reversed, sending it onto the alternate (clockwise) path.  Should neither roller be activated (that is, the last signal received by both was an '''on'''), the track bends will be ignored and the minecart will travel directly south, over the output plate {{Raw Tile|^|#F0F|#000}}.
  
[[File:Tpmch.png]]
+
===Resetting bridge-derailment AND===
 +
{{diagram|spaces=yes|\
 +
O[#0FF].═[#0FF]. O▼═▼  O[#FF0]¢═▼
 +
     
 +
     
 +
     
 +
track ramp furniture
 +
z+1
 +
O╔O╗ O▲O▲  O▲O▲
 +
  ╚═╚  ╚═▲    [#000][#0f0]╬[#F0F]^▲
 +
  ╚═╝  ╚═╝    ╚═╝
 +
track ramp furniture
 +
z+0}}
  
This design has the advantage of activating the pressure plate almost immediately upon power being sent, on par with the [http://dwarffortresswiki.org/index.php/DF2012:Latch#Mechanical_Logic 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.
+
When both the yellow hatch {{Raw Tile|¢|#FF0|#000}} and the green retractable bridge {{Raw Tile|╬|#000|#0F0}} are open, minecarts on this circuit make a continuous loop, triggering the output plate {{Raw Tile|^|#F0F|#000}}. If either is closed, the plate is never activated.  If the bridge is closed, the minecart derails to the southern path, avoiding the plate. If the hatch is closed, the minecart is unable to drop into the northwest ramp, and so sits on the upper, northwestern tile until the hatch opens.
  
== Power-to-Signal Converters ==
+
There are many concerns when using a gate like this.  Minecarts can be flung when a bridge changes state underneath them, and unfortunately, hatch covers cannot provide the same derailment effect on flat track.  Additionally, because your minecart never evaluates both operands at exactly the same moment, it's possible for this gate to output when neither operand is actually true (i.e., last received an '''on''' signal) at the same moment.
  
A power-to-signal converter sends an on signal when power is applied and an off signal when power is cut.
+
It's not always a problem, but this behavior is common to AND gates.  Paradoxically, one solution is to moderate your inputs via an extra AND gate; this design shows how that can be done.  When a large number of circuits such as that shown are created and the hatches of all of them are linked to a single lever, a quick flick (on and off) of that lever can guarantee that all of your circuits fire at the same time-- that is, that all of your inputs for the next computation change state simultaneously.  The minecarts then return to their position atop the hatches, ready for another flick of your clock lever.
  
=== 2x2 power-to-signal converter ===
+
Worth noting, as well, is the central eastern impulse ramp that allows the minecart to maintain enough velocity to complete this circuit.  Impulse ramps like this can be used to make unpowered gates.  However, their behavior is unintuitive, and they should only be used with extreme caution.  For example, in the diagram above, such a device used for continuous AND evaluation (rather than the resetting AND suggested in the text) is likely to accelerate the minecart on each pass, such that the minecart will stop moving after some number of circuits.
  
[[File:2x2pts.png]]
+
===MPL NOT===
 +
{{diagram|spaces=yes|\
 +
 +
O,      O,
 +
track    ramp
 +
z+2
 +
  ╔═╗      ╔═╗      ╔═╗
 +
O══[#0FF].[#0FF].╝  O▲═▼▼╝  O▲[#F0F]^▼[#0F0]¢╝
 +
track    ramp  furniture
 +
z+1
 +
 +
OOO══O  OOO▲▲O
 +
track    ramp
 +
z+0
 +
}}
  
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.
+
Larix's [[User:Larix/MPL/2|powerless logic gates]] avoid the reliability and latency issues that plague many minecart designs through the use of paired impulse ramps and hatches that control not just path, but direction of movement.  A minecart traveling the pictured circuit while the input hatch {{Raw Tile|¢|#0F0|#000}} is open will settle into a counter-clockwise path, regardless of the direction of its initial velocity. Yet when the hatch becomes closed, the minecart cannot travel counter-clockwise, but instead is accelerated in the clockwise direction, onto the output plate {{Raw Tile|^|#F0F|#000}}. It will then oscillate between the far east and far west ramps until the hatch is opened, at which point it will resume counter-clockwise motion.
  
A modular layout:
+
Use of ramps with high-velocity minecarts may necessitate ceilings as demonstrated on z+2.  The exact nature of the ceiling (floor, wall) is unimportant.  Some diagrammed walls are unnecessary for the design and are drawn to help the reader in orientation.
  
[[File:Modular2x2pts.png]]
+
===Other techniques and gates===
 +
Any logic gate can be made with a combination of those shown.  NAND, for instance, is NOT AND; XOR is OR AND (NOT AND).  Clocks and edge detection are suggested and proven designs exist, if not on this page.  But the examples above were chosen for the disparate techniques they demonstrate.  The interested reader is encouraged to further research, or the design of his or her own gates.
  
=== Single-carted power-to-signal converter ===
+
Doors can be used to block the travel of a minecart through a circuit, or to prevent derailment, although for reliability's sake, care needs to be taken that the door cannot change state while the minecart is in motion, or it may jam on top of the minecart.  [[Floodgate]]s won't jam in this fashion, although they do introduce some latency.  Minecarts of multiple weights, with pressure plates that trigger only on the weight of one, may be used in certain designs; Bloodbeard's fantastically tiny [http://www.bay12forums.com/smf/index.php?topic=114923.msg3532411#msg3532411 load-adjusted memory cell] is a good example.  Rollers can be used perpendicularly to a track to derail a cart and impart diagonal velocity.  Switchable track stops can prevent or permit derailment.  The possibilities are far from exhausted-- and that's assuming one is only interested in ''practical'' techniques.
  
[[File:Scpts.png]]
+
==Integration with other disciplines==
 +
There's no reason minecart logic needs to be used in isolation.  Combining it with other logical disciplines allows one to use each where it is strong, and avoid each where it is weak.
  
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.
+
===[[Mechanical logic]]===
 +
This is the most obvious choice.  Mechanical logic offers the potential for incredible speed, yet requires a medium to generate useful signals or to create delay (hence, to create repeaters), and it's hard to use gear assemblies as memory cells.  Minecart logic excels at precisely these tasks.  Minecart-based power-to-signal and memory are tiny and fast.  Minecart-based delay is precisely tunable.  The superiority of minecart logic has made water obsolete for these purposes.
  
A modular layout:
+
===[[Creature logic]]===
 +
Minecart logic, particularly Larix's powerless MPL logic, has replaced creature logic as the logic-of-last-resort (for when power and fluid are unavailable) or first-resort (for when computation is desired before power can be set up or fluid accessed).  However, for the borg logic hobbyist, integration with minecarts suggests interesting possibilities.  It is difficult to imagine a simpler clock than a minecart with a "push always after x days" condition, and guided minecarts offer unprecedented control over the path of [[dwarf|dwarves]].
  
[[File:Modularscpts.png]]
+
===[[Fluid logic]]===
 
+
Minecart logic outperforms fluid logic sufficiently to have mostly replaced it. However, the problem of automated fluid delivery may be best solved through some fluid logic techniques, and may suggest some [[stupid dwarf trick]]s for those that want to use the fluid capacity of minecarts to compute.
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 ===
 
 
 
[[file:Pscdesign.png]]
 
 
 
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 ===
 
 
 
[[File:Dcpts.png]]
 
 
 
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.
 
  
 
== See Also ==
 
== See Also ==
 
* BloodBeard's [http://www.bay12forums.com/smf/index.php?topic=114923.0 Minecart Dwarfputing Ideas] thread.
 
* BloodBeard's [http://www.bay12forums.com/smf/index.php?topic=114923.0 Minecart Dwarfputing Ideas] thread.
 
* TinyPirate's [http://www.youtube.com/watch?v=jrt9qRTWFmY Minecart Logic 101] instructional video.
 
* TinyPirate's [http://www.youtube.com/watch?v=jrt9qRTWFmY Minecart Logic 101] instructional video.
 +
* [[User:Larix/MPL|Powerless logic]] based on hatch-switched minecarts. [[User:Larix/MPL/2|Logic gates]] built under this design doctrine.
  
 
{{Category|Fortress mode}}
 
{{Category|Fortress mode}}
 
{{Category|Computing}}
 
{{Category|Computing}}
 
{{Category|Logic}}
 
{{Category|Logic}}

Latest revision as of 22:55, 8 April 2014

This article is about an older version of DF.

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, quick to react, and can even be built without power, water, or creatures. The training your doctors will receive is just one of many reasons to compute with minecarts!

Techniques and Circuits[edit]

There exist a great number of different techniques by which a minecart can receive input, compute, and deliver output. This article does not aim for a comprehensive list of techniques and circuits; the interested reader is encouraged to investigate further. The following examples were chosen to demonstrate both a variety of techniques and a few commonly used gates.

Key[edit]

Adequately diagramming minecart logic devices can be difficult; each tile on each z-level might need to display up to four slices (track, ramp, furniture, minecart) that can lay on top of each other. Ramps are displayed on the furniture layer for the sake of simplicity, and some slices may be omitted when unnecessary. Components of each lower slice are displayed on the higher slice when unchanged by new components to give the reader a sense of position. Wall O is typically displayed only where it is essential to the operation of the circuit, and drawn only as sequences of pillars to avoid confusion with track. Unengraved floor , is sometimes needed for other components, but of course can be smoothed as desired. Track direction is laid out with and ends in a tile with . Minecarts are accelerated by rollers to the east west north or south and decelerated by track stops . Rollers are controlled via gear assemblies, either engaged or disengaged , typically connected to sufficient power P. Pressure plates ^ provide output and, in some cases, modulate the circuit itself. Up and down ramps may be necessary to travel z-levels or alter minecart velocity; they may be roofed or covered with empty space . in some views. Hatches ¢ and retractable bridges are commonly used to control the path of minecarts. Where necessary, clarification can be found in the descriptions of each circuit.

Power to signal[edit]

O O
,
^ P
,
O O
t r a c k f u r n i t u r e


In this, the simplest of all designs, the output plate sends an on signal when the gear assemblies are powered P. When power is lost, the minecart settles onto either the northern or southern roller spaces, and the output plate sends an off signal.

This device is very general purpose. Left as an exercise for the reader, alternate construction can result in edge detection or in a repeater design.

Newton's Cradle Memory[edit]

O O O
, P P
^
, P P
O O O
t r a c k f u r n i t u r e m i n e c a r t


TinyPirate's Newton's Cradle memory cell is notable both for its small footprint and for demonstrating an important principle of minecarts. When the northern gear assembly is briefly engaged, the northern roller becomes powered, launching the northern minecart into the southern minecart . The southern minecart then leaves the output plate ^ and settles on the southern (unpowered) roller. When the southern gear assembly is briefly engaged, the situation reverses: the southern minecart settles on the output plate, knocking the northern minecart onto the northern (unpowered) roller-- as in its original state.

Continuous roller OR[edit]

O ^ O
O O
O P O
t r a c k f u r n i t u r e

Veylon's roller OR continuously evaluates two operands via a minecart traveling counter-clockwise using principles of power transmission through single tile rollers. Should either input or be engaged, power P is transmitted to the southernmost, S->N roller . Although the minecart is left with diagonal velocity, walls prevent derailment. When neither input is engaged, the minecart continues over the T-junction to the east, missing the output plate ^.

Roller switched AND[edit]

P
P
^
t r a c k f u r n i t u r e

Larix's roller-switched AND takes advantage of the behavior of rollers to avoid troublesome diagonal velocity. It is potentially confusing both for the counter-intuitive direction of its rollers as well as the way that rollers respond to signals. When the minecart encounters either activated (that is, the last signal received was an off) S->N roller or , its velocity is completely rewritten and reversed, sending it onto the alternate (clockwise) path. Should neither roller be activated (that is, the last signal received by both was an on), the track bends will be ignored and the minecart will travel directly south, over the output plate ^.

Resetting bridge-derailment AND[edit]

O . . O O ¢
t r a c k r a m p f u r n i t u r e
z + 1
O O O O O O
^
t r a c k r a m p f u r n i t u r e
z + 0

When both the yellow hatch ¢ and the green retractable bridge are open, minecarts on this circuit make a continuous loop, triggering the output plate ^. If either is closed, the plate is never activated. If the bridge is closed, the minecart derails to the southern path, avoiding the plate. If the hatch is closed, the minecart is unable to drop into the northwest ramp, and so sits on the upper, northwestern tile until the hatch opens.

There are many concerns when using a gate like this. Minecarts can be flung when a bridge changes state underneath them, and unfortunately, hatch covers cannot provide the same derailment effect on flat track. Additionally, because your minecart never evaluates both operands at exactly the same moment, it's possible for this gate to output when neither operand is actually true (i.e., last received an on signal) at the same moment.

It's not always a problem, but this behavior is common to AND gates. Paradoxically, one solution is to moderate your inputs via an extra AND gate; this design shows how that can be done. When a large number of circuits such as that shown are created and the hatches of all of them are linked to a single lever, a quick flick (on and off) of that lever can guarantee that all of your circuits fire at the same time-- that is, that all of your inputs for the next computation change state simultaneously. The minecarts then return to their position atop the hatches, ready for another flick of your clock lever.

Worth noting, as well, is the central eastern impulse ramp that allows the minecart to maintain enough velocity to complete this circuit. Impulse ramps like this can be used to make unpowered gates. However, their behavior is unintuitive, and they should only be used with extreme caution. For example, in the diagram above, such a device used for continuous AND evaluation (rather than the resetting AND suggested in the text) is likely to accelerate the minecart on each pass, such that the minecart will stop moving after some number of circuits.

MPL NOT[edit]

O , O ,
t r a c k r a m p
z + 2
O . . O O ^ ¢
t r a c k r a m p f u r n i t u r e
z + 1
O O O O O O O O
t r a c k r a m p
z + 0

Larix's powerless logic gates avoid the reliability and latency issues that plague many minecart designs through the use of paired impulse ramps and hatches that control not just path, but direction of movement. A minecart traveling the pictured circuit while the input hatch ¢ is open will settle into a counter-clockwise path, regardless of the direction of its initial velocity. Yet when the hatch becomes closed, the minecart cannot travel counter-clockwise, but instead is accelerated in the clockwise direction, onto the output plate ^. It will then oscillate between the far east and far west ramps until the hatch is opened, at which point it will resume counter-clockwise motion.

Use of ramps with high-velocity minecarts may necessitate ceilings as demonstrated on z+2. The exact nature of the ceiling (floor, wall) is unimportant. Some diagrammed walls are unnecessary for the design and are drawn to help the reader in orientation.

Other techniques and gates[edit]

Any logic gate can be made with a combination of those shown. NAND, for instance, is NOT AND; XOR is OR AND (NOT AND). Clocks and edge detection are suggested and proven designs exist, if not on this page. But the examples above were chosen for the disparate techniques they demonstrate. The interested reader is encouraged to further research, or the design of his or her own gates.

Doors can be used to block the travel of a minecart through a circuit, or to prevent derailment, although for reliability's sake, care needs to be taken that the door cannot change state while the minecart is in motion, or it may jam on top of the minecart. Floodgates won't jam in this fashion, although they do introduce some latency. Minecarts of multiple weights, with pressure plates that trigger only on the weight of one, may be used in certain designs; Bloodbeard's fantastically tiny load-adjusted memory cell is a good example. Rollers can be used perpendicularly to a track to derail a cart and impart diagonal velocity. Switchable track stops can prevent or permit derailment. The possibilities are far from exhausted-- and that's assuming one is only interested in practical techniques.

Integration with other disciplines[edit]

There's no reason minecart logic needs to be used in isolation. Combining it with other logical disciplines allows one to use each where it is strong, and avoid each where it is weak.

Mechanical logic[edit]

This is the most obvious choice. Mechanical logic offers the potential for incredible speed, yet requires a medium to generate useful signals or to create delay (hence, to create repeaters), and it's hard to use gear assemblies as memory cells. Minecart logic excels at precisely these tasks. Minecart-based power-to-signal and memory are tiny and fast. Minecart-based delay is precisely tunable. The superiority of minecart logic has made water obsolete for these purposes.

Creature logic[edit]

Minecart logic, particularly Larix's powerless MPL logic, has replaced creature logic as the logic-of-last-resort (for when power and fluid are unavailable) or first-resort (for when computation is desired before power can be set up or fluid accessed). However, for the borg logic hobbyist, integration with minecarts suggests interesting possibilities. It is difficult to imagine a simpler clock than a minecart with a "push always after x days" condition, and guided minecarts offer unprecedented control over the path of dwarves.

Fluid logic[edit]

Minecart logic outperforms fluid logic sufficiently to have mostly replaced it. However, the problem of automated fluid delivery may be best solved through some fluid logic techniques, and may suggest some stupid dwarf tricks for those that want to use the fluid capacity of minecarts to compute.

See Also[edit]