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.

40d:Computing

From Dwarf Fortress Wiki
Revision as of 03:04, 28 November 2007 by SL (talk | contribs) (→‎Borg Logic)
Jump to navigation Jump to search

Computing in dwarf fortress is the practice of setting up your fortress in such a way that allows logical operations like AND, OR, NOT, and etc to exist and be used. Computing in dwarf fortress is an EXTREMELY young concept with lots of room for improvement and development. Innovation and invention is encouraged.

Basics

Binary logic takes one or two inputs and creates an output based on them. The devices that perform these operations are commonly called logic gates.

NOT takes one input and returns true if that input is false

AND takes two inputs and returns true if both inputs are true

OR takes two inputs and returns true if at least one input is true

XOR takes two inputs and returns true if exactly one input is true

NAND takes two inputs and returns true if either input is false

NOR takes two inputs and returns true if both inputs are false

A B  AND  OR   XOR  NAND NOR
0 0  0    0    0    1    1
0 1  0    1    1    1    0
1 0  0    1    1    1    0
1 1  1    1    0    0    0

The most human-understandable logic system requires NOT, AND and OR gates, but having a design for either a NAND or a NOR gate is enough to build any of the other ports.

Additionally, two-dimensional logic design requires a 'jumper' gate that crosses two signals without affecting their contents. This may only be an issue in DF if you are considering magma-based circuits.

Fluid Logic

Fluid logic utilizes the tendency of fluids in dwarf fortress to, umm, flow. It takes advantage of the ability of pressure plates in the new version to be triggered by water (or magma) resting on top of them. This allows systems of pumps, floodgates, doors, bridges, and anything else operated by pressure plate to be incorporated into a machine.

To get you started, a pressure plate set to trigger on water level 0-3 and linked to a floodgate will CLOSE the floodgate when the tile has deep water. If the pressure plate is set for water level 4-7, then the floodgate will OPEN when the tile has deep water.

Machine Logic

Machine logic uses the also new system of gears, axles, windmills, and waterwheels to solve problems. Power sources (windmills and waterwheels) transfer power to machine parts (axles and gears). If there is not enough pwoer in a system to allow all the parts to move, it will shut down entirely. Individual gears can also be shut down by levers to interrupt or otherwise alter the transfer of power throughout the machine. All sorts of logic gates can be created based on those rules alone. Currently four have been created in a proof-of-concept sort of way in a relatively quick and cheap manner:

Logic.gif In the above picture, the four basic logic operations are shown. Gears connected to outside power are circled in red. Gears that can be deactivated by lever are color-coded to the lever that deactivates them. For the purposes of binary logic, a lever is TRUE if it is pointing LEFT. Levers pointing RIGHT are FALSE.

In AND, two adjacent gears are connected to levers. Power is only transferred to the one-tile output axle if both levers are set to true.

In OR, two power sources are connected to an output gear and axle. If either lever is set to true, the axle will be connected to power and also be true.

In XOR, 40 units of power are transferred to a central gear. To power the output axle, it must be connected to it by switching one of the levers to true. However, if both levers are set to true, then the machine requires 42 units of power to run, and thus shuts down due to lack of power.

in NOT, there is a powered gear connected directly to the output axle. If the lever is set to true, the powered gear connects to 3 other unpowered gears, which causes the machine to shut down due to lack of power.

Borg Logic

Borg logic is the experimental version of fluid logic. It consists of creating a way for your dwarves to travel constantly in a predictable way through your fortress through constant hauling jobs or military designations. Pressure plates are used in similar setups to those in the fluid logic method. It is theorized that Borg logic would be quicker and easier to set up than fluid logic, although it would require a very large population dedicated to nothing but borging. The consequences of dwarves quitting to eat, sleep, drink, etc are unknown. There are no known examples of borg logic, and it is purely theoretical at this time. <-- Could someone with more free time than me give this a shot? Just some proof-of-concept gates and a picture should be enough. -->

Note: Borg Logic is probably impossible at the moment due to a bug in 33c (and possibly earlier versions): The 'citizens trigger' setting on pressure plates does not actually cause the pressure plate to trigger when citizens step on it. It does, however, trigger when *pets* step on it, if they satisfy the pressure plate's size settings. (Bug thread).

Animal Logic

Animals have a natural 'follow the leader' tendency and never starve. Pitting an animal into a maze with movable exits can force the animal to shuttle around and computate.