- 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.
Difference between revisions of "User:Larix/MPL/2"
Line 50: | Line 50: | ||
A door can be used to block a cart from exiting a ramp '''to''' a specific flat floor tile, while a hatch is best used to block a cart from exiting '''from''' a specific ramp tile. Doors can thus be combined with hatch covers to build logic gates consisting of a single 2x1 pit. | A door can be used to block a cart from exiting a ramp '''to''' a specific flat floor tile, while a hatch is best used to block a cart from exiting '''from''' a specific ramp tile. Doors can thus be combined with hatch covers to build logic gates consisting of a single 2x1 pit. | ||
− | A door-and-hatch AND gate would simply put a hatch cover on top of the output ramp and the door in the output tile. Only if both devices are opened, the cart can leave on the output side, otherwise it will be returned on the input side. A dual-function AND/NAND gate based on this design could be built by simply taking the NOT/identity gate above and adding a switchable door on the NW corner just east of the pit. | + | A door-and-hatch AND gate would simply put a hatch cover on top of the output ramp and the door in the output tile. Only if both devices are opened, the cart can leave on the output side, otherwise it will be returned on the input side. A dual-function AND/NAND gate based on this design could be built by simply taking the NOT/identity gate above and adding a switchable door on the NW corner just east of the pit. As a nice benefit, in such a circuit, both gates are in fact checked simultaneously - the cart's attempt to move out of the pit takes a single game step, and if on that step either building is shut, the cart will return, and only if both are open will it pass. |
'''Door-and-hatch OR gate:''' | '''Door-and-hatch OR gate:''' |
Revision as of 12:36, 30 May 2014
Basic logic gates in MPL
These designs all use straight track ramps in the pits and only use hatches for switching. They are very reliable, but slow and space-hungry, since every single bifurcation will require a one by two pit and entrance and exit tracks. They are constructed with a constantly-moving cart, waiting for input changes and adjusting their output according to the new logic condition with a moderate delay. They can be switched in full operation, and only the XOR/XNOR one runs a small risk of creating a false output when switched at the wrong moment. With some fancy pathing, all of these logic gates can also be used in their opposing function.
All designs were built and tested and have proven functional.
NOT/IDENTITY
The pressure plate is active only when the hatch cover is closed. If the hatch is open, the cart will move in a circle, never swinging out to the west. A pressure plate on the circle track gives an "identity" signal, useful if your input signal is generated by a device you do not wish to directly tamper with.
AND/NAND
The pressure plate to the southwest collects the AND, the one in the northeast the NAND signal. The AND plate is only activated when the cart can pass without hindrance through both pits.
To the north, a near-minimal AND gate (could be made one tile smaller), to the south an AND-based custom gate, designed to give a notable result if the first input is on and the second off.
OR/NOR
If both hatches are closed, the cart will bounce between the two ramps, constantly returned and sent to the other. To the far southeast there's a ramp directly against a wall, used to limit the speed of carts which got to pass through a ramp-pit. Carts passing through the E-W ramp will otherwise accelerate so much that they derail/jump and stop.
XOR/XNOR
In the centre, a 'bump ramp' to limit incoming carts' speed, to the southeast a "bunker", a two-pit EW ramp with the second ramp underground with no exit at all; this returns the cart onto its entrance tile, at a moderate speed, somewhere around what a medium-speed roller.does. When both inputs are equal, the cart passes over the northern pressure plate, if they're different, they pass over the southern plate. Some variations on this design work, too. As far as i could determine, this design stays in its state reliably and can be switched during operation, although opening the second hatch cover while the cart is on top of it may result in a temporary false result or too-long return time. If the gate is supposed to be built with no more than two switchable devices - hatch covers in this case - one of the paths must lead over a hatch cover, a design i prefer to avoid when possible.
The concept of the AND and OR gates can be expanded to accomodate additional inputs.
Four-input AND:
Three-input OR:
Cooking with doors
A door can be used to block a cart from exiting a ramp to a specific flat floor tile, while a hatch is best used to block a cart from exiting from a specific ramp tile. Doors can thus be combined with hatch covers to build logic gates consisting of a single 2x1 pit. A door-and-hatch AND gate would simply put a hatch cover on top of the output ramp and the door in the output tile. Only if both devices are opened, the cart can leave on the output side, otherwise it will be returned on the input side. A dual-function AND/NAND gate based on this design could be built by simply taking the NOT/identity gate above and adding a switchable door on the NW corner just east of the pit. As a nice benefit, in such a circuit, both gates are in fact checked simultaneously - the cart's attempt to move out of the pit takes a single game step, and if on that step either building is shut, the cart will return, and only if both are open will it pass.
Door-and-hatch OR gate:
This circuit doesn't use straight track ramps, the northern pit is engraved with a track crossing (NESW), the southern ramp is a normal NE corner track ramp. If the door is open, the cart will pass through the single pit to the north and leave to the west. If the door is closed but the hatch cover open, the cart will leave the pit from the southern ramp, going east. If both devices are closed, the cart will leave from the northern pit, going north. This design needs a fairly high operation speed, more than a dwarven push can produce, thus the impulse ramp to the east. In the form presented, the circuit can only perform "single-pass" checks. Since a cart passing straight across the northern hole gains no ramp acceleration, an additional accelerator would be required for long-term operation.
Esoteric use of bridges for switching
Since bridges really are treated like normal (all-direction) track by the game in their lowered/extended position and also overwrite the track features of the tile below, a retracting bridge over a flat tile of non-track floor can also change the behaviour of a minecart: a cart coming from ordinary floor will jump over a pit even if moving at low speed, but a cart coming from a track tile will enter a pit containing a track ramp unless it's moving at derail speed over flat floor. Thus, extending/retracting the bridge will switch the cart's behaviour between going down the ramp and ignoring the ramp and jumping over it.
Combining this feature with a two-long bridge on the other end of a straight double-ramp pit, i constructed a full bit-compare logic gate using only those two switchable devices to generate the four possible outputs for the four possible input signal combinations. It is a bit of a curiosity, since for most logical purposes, such distinctions are not needed and since only bridges can be used, the gate reacts with a significant delay to input and should not be switched during operation - a bridge changing state under a cart will throw the cart around and force it to stop.
http://www.bay12forums.com/smf/index.php?topic=135141.msg4881573#msg4881573 , paragraph on "universal logic gate", powerless logic. The displayed version combines the XOR outputs into a single path, at the cost of messing around with the level above and longer latency - i was using the additional minecart pathing oddity where carts jump past the tile behind a ramp when there's no ceiling above the ramp-pit and ramp end.