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.

Editing Animal logic

Jump to navigation Jump to search

Warning: You are not logged in.
Your IP address will be recorded in this page's edit history.

If you are creating a redirect to the current version's page, do not use any namespace. For example: use #REDIRECT [[Cat]], not #REDIRECT [[Main:Cat]] or #REDIRECT [[cv:Cat]]. See DF:Versions for more information.

The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then save the changes below to finish undoing the edit.

Latest revision Your text
Line 1: Line 1:
{{Quality|Unrated}}
+
{{Quality|Exceptional|07:53, 2 June 2010 (UTC)}}
 
{{Computing}}
 
{{Computing}}
 
{{av}}
 
{{av}}
'''Animal logic''' functions by taking advantage of the pathfinding algorithm in ''Dwarf Fortress''; all domestic animals seek to find the shortest (lowest cost) path to their desired targets (activity zone, parents, dwarves, valuable objects, etc.) Furthermore, animals tend to continue to path through tightly closed doors, despite them not being able to pass. This defines the difference between animal and [[creature logic]]: animal logic does not need to regulate paths actually travelled by a creature, only potential paths. Using these features of animal pathfinding, it is possible to create very complex logic gates.  
+
Animal logic functions by taking advantage of the path finding algorithm in Dwarf Fortress; all domestic animals seek to find the shortest (lowest cost) path to their desired targets (activity zone, parents, dwarves, valuable objects, etc.) Furthermore, animals tend to continue to path through tightly closed doors, despite them not being able to pass. This defines the difference between animal and [[creature logic]]: animal logic does not need to regulate paths actually travelled by a creature, only potential paths. Using these features of animal pathfinding, it is possible to create very complex logic gates.  
  
Animal logic has three principal advantages: speed, compactness, and simplified functions. However, animal logic is slower than mechanical logic, and less reliable than either fluid or mechanical logic.
+
Animal logic has three principal advantages: speed, compactness, and simplified functions. However, animal logic is slower than mechanical logic and less reliable than either fluid or mechanical logic.
  
 
==Definitions==
 
==Definitions==
Line 10: Line 10:
 
For clarity, definitions of the terms used in animal logic are listed here:  
 
For clarity, definitions of the terms used in animal logic are listed here:  
  
'''Ground''': for simplicity, the thing the animal is pathing to is referred to as ''ground'', as that is the ground state which it wishes to reach. Ground is always the left unless otherwise noted.
+
'''Ground''': for simplicity the thing the animal is pathing to is referred to as ground as that is the ground state which it wishes to reach. Ground is always the left unless otherwise noted.
  
 
'''Purge''': Path to ground with no inputs
 
'''Purge''': Path to ground with no inputs
Line 38: Line 38:
 
For a better explanation of gates see:http://en.wikipedia.org/wiki/Logic_gate
 
For a better explanation of gates see:http://en.wikipedia.org/wiki/Logic_gate
  
Notation:  
+
Notation: #:wall ^:pressure plate X:floodgate,grate,bars,bridge,etc. (explained per entry) D:door,open, but kept tightly shut(pet impassable) d:door, input value not specified Letters:doors/floodgates,grates,bar,etc. Specified inputs(these are generally interchangeable, if not this will be noted in the entry), generally controlled by mechanism g:Ground, some entries need it for clarity. C: Either an input in diagrams, or the state Carry is refereed to as a state within an adder.
:'''#''': wall  
 
:'''^''': pressure plate  
 
:'''X''': floodgate, grate, bars, bridge, etc. (explained per entry)  
 
:'''D''': door, open, but kept tightly shut(pet impassable)
 
:'''d''': door
 
:'''input value not specified Letters''': doors/floodgates, grates, bar, etc. Specified inputs(these are generally interchangeable, if not this will be noted in the entry), generally controlled by mechanism  
 
:'''g''': Ground, some entries need it for clarity.  
 
:'''C''': Either an input in diagrams, or the state Carry is refereed to as a state within an adder.
 
  
 
Gates will always be capitalized in the way they are within the entry, e.g. AND, OR, ANDOR, XNOR, etc.
 
Gates will always be capitalized in the way they are within the entry, e.g. AND, OR, ANDOR, XNOR, etc.
 +
  
 
Since animal logic is based on the interaction between animals and this particular setting of doors, all doors not wired to mechanisms need to be unlocked but tightly closed.
 
Since animal logic is based on the interaction between animals and this particular setting of doors, all doors not wired to mechanisms need to be unlocked but tightly closed.
 +
  
 
There are three principal logic gates in any logic system, AND, OR, and NOT. Animal logic can easily create all logic gates and is able to handle multi input-output, and fusion gates. The principal reason for this is pathfinding always prefers the shortest path to ground, and by controlling this path you can control the animal within the gate. The advantage of animal pathing is that the gate can have multiple states allowing more than a single ON or OFF signal. For simplicity and streamlining these systems only use binary information, but theoretically they could be made to compute in decimal or some other system; however, such gates are maddeningly complex and very hard if not impossible to build.
 
There are three principal logic gates in any logic system, AND, OR, and NOT. Animal logic can easily create all logic gates and is able to handle multi input-output, and fusion gates. The principal reason for this is pathfinding always prefers the shortest path to ground, and by controlling this path you can control the animal within the gate. The advantage of animal pathing is that the gate can have multiple states allowing more than a single ON or OFF signal. For simplicity and streamlining these systems only use binary information, but theoretically they could be made to compute in decimal or some other system; however, such gates are maddeningly complex and very hard if not impossible to build.
Line 57: Line 51:
  
 
There are two primary ways to make a gate, single path and dual path, the single path gate only allows the animal a single exit and this forces it into a non pathing state until there is input at which point it will "wake up" and move; however, this kind of gate is slow and unreliable. Dual path gates always have an open path keeping the animal constantly pathing out of its enclosure. This constant pathing allows the gate to respond more quickly and retain higher reliability; however, the constant pathing may cause noticeable frame rate drops with large logic sets. I will only be discussing the dual path gates, as they're more effective for general use.
 
There are two primary ways to make a gate, single path and dual path, the single path gate only allows the animal a single exit and this forces it into a non pathing state until there is input at which point it will "wake up" and move; however, this kind of gate is slow and unreliable. Dual path gates always have an open path keeping the animal constantly pathing out of its enclosure. This constant pathing allows the gate to respond more quickly and retain higher reliability; however, the constant pathing may cause noticeable frame rate drops with large logic sets. I will only be discussing the dual path gates, as they're more effective for general use.
 +
  
 
===AND===
 
===AND===
Line 64: Line 59:
 
   ABCD^ D
 
   ABCD^ D
 
  #########
 
  #########
 +
  
 
===Multi AND===
 
===Multi AND===
Line 70: Line 66:
 
   ANYNUMD^ D
 
   ANYNUMD^ D
 
  ############
 
  ############
 +
  
 
===NAND===
 
===NAND===
Line 77: Line 74:
 
   ABCD ^D
 
   ABCD ^D
 
  #########
 
  #########
 +
  
 
===OR===
 
===OR===
Line 85: Line 83:
 
  B####
 
  B####
 
  #####
 
  #####
 +
  
 
===Multi OR===
 
===Multi OR===
Line 96: Line 95:
 
  M #####
 
  M #####
 
  #######
 
  #######
 +
  
 
===NOR===
 
===NOR===
Line 104: Line 104:
 
  B####
 
  B####
 
  #####
 
  #####
 +
  
 
===NOT===
 
===NOT===
Line 111: Line 112:
 
   AD ^D
 
   AD ^D
 
  #######
 
  #######
 +
  
 
==Compound Gates==
 
==Compound Gates==
Line 128: Line 130:
 
  #        #
 
  #        #
 
  ##########
 
  ##########
AND path cost: 4<br />
+
AND path cost: 4
OR path cost: 10<br />
+
OR path cost: 10
 
Purge path cost: 14
 
Purge path cost: 14
 +
  
 
===XNOR===
 
===XNOR===
Line 145: Line 148:
 
  ######    #
 
  ######    #
 
  ###########
 
  ###########
AND path cost: 4<br />
+
AND path cost: 4
OR path cost: 10<br />
+
OR path cost: 10
 
Purge path cost: 15
 
Purge path cost: 15
 +
 +
  
 
===Complex Compound gate, Octal display ALU===
 
===Complex Compound gate, Octal display ALU===
  
Inputs are 1, 2, 4 these correspond to the binary values of the inputs, outputs are A, B, C, D, E, F, G, H being 0, 1, 2, 3, 4, 5, 6, 7 respectively in the output display. I used octal for sanity, but this could be easily scaled to work for decimal (up to 10, beyond that you need a converter not an if switch) or hexadecimal(hex will be easy to handle, and probably easier to convert down to decimal)
+
Inputs are 1,2,4 these correspond to the binary values of the inputs, outputs are A,B,C,D,E,F,G,H being 0,1,2,3,4,5,6,7 respectively in the output display. I used octal for sanity, but this could be easily scaled to work for decimal (up to 10, beyond that you need a converter not an if switch) or hexadecimal(hex will be easy to handle, and probably easier to convert down to decimal)
  
 
  #################
 
  #################
Line 179: Line 184:
 
  #    D #
 
  #    D #
 
  ########
 
  ########
 +
  
 
==Fusion gates==
 
==Fusion gates==
  
 
These are gates which are constructed by physically combining the two gates to get a specific output.
 
These are gates which are constructed by physically combining the two gates to get a specific output.
 +
  
 
===ANDOR===
 
===ANDOR===
Line 192: Line 199:
 
  C#####
 
  C#####
 
  ######
 
  ######
 +
  
 
===NANDOR===
 
===NANDOR===
Line 201: Line 209:
 
  C#####
 
  C#####
 
  ######
 
  ######
 +
  
 
===ORANDOR===
 
===ORANDOR===
Line 210: Line 219:
 
  BED^ D
 
  BED^ D
 
  ######
 
  ######
 +
  
 
===ORANDAND===
 
===ORANDAND===
Line 219: Line 229:
 
  BCED^ D
 
  BCED^ D
 
  #######
 
  #######
 +
  
 
==Complex Gates==
 
==Complex Gates==
Line 226: Line 237:
 
==Adders==
 
==Adders==
 
A full adder can be made as a Compound Fusion gate, by combining AND, ANDOR, and OR gates
 
A full adder can be made as a Compound Fusion gate, by combining AND, ANDOR, and OR gates
 +
  
 
===Binary Adder===
 
===Binary Adder===
  
A binary adder is constructed of two or three "sum" gates and a purge path. A half adder only adds two numbers and only needs two sum gates, 1 and 2. Full adders using carry to allow chaining require three sum gates, 1, 2 and 3. Because binary is base two that translates to 01, 10, 11 as the sums, when the second bit is a 1, the gate is "carrying" the value up to the next level.
+
A binary adder is constructed of two or three "sum" gates and a purge path. A half adder only adds two numbers and only needs two sum gates, 1 and 2. Full adders using carry to allow chaining require three sum gates, 1,2 and 3. Because binary is base two that translates to 01,10,11 as the sums, when the second bit is a 1, the gate is "carrying" the value up to the next level.
  
 
When building the adder, the highest path must have the most preferential path to ground or it will not properly function.
 
When building the adder, the highest path must have the most preferential path to ground or it will not properly function.
Line 241: Line 253:
  
 
Hatches can be used in many logic designs for alternate designs.  A hatch over a ramp serves as a door that cannot be wedged open; a hatch over a channel functions as a naturally inverted door, blocking pathing when open rather than when closed.  Although the designs on this page all use doors to restrict path, careful use of hatches can be more effective for some circuits.
 
Hatches can be used in many logic designs for alternate designs.  A hatch over a ramp serves as a door that cannot be wedged open; a hatch over a channel functions as a naturally inverted door, blocking pathing when open rather than when closed.  Although the designs on this page all use doors to restrict path, careful use of hatches can be more effective for some circuits.
 +
  
 
Reference pictures
 
Reference pictures
Line 254: Line 267:
 
Image:9bit adder prototype 10100010notes.PNG|9bit adder, notes show the decimal value of each adder's bit
 
Image:9bit adder prototype 10100010notes.PNG|9bit adder, notes show the decimal value of each adder's bit
 
</gallery>
 
</gallery>
 +
  
 
===Decimal Adder===
 
===Decimal Adder===
 +
  
 
While it can be done, it's significantly more complex than simply making a set of decimal converters working with binary adders.
 
While it can be done, it's significantly more complex than simply making a set of decimal converters working with binary adders.
 +
  
 
===Hexadecimal Adder===
 
===Hexadecimal Adder===
Line 266: Line 282:
  
 
Inverse adder, simple but not yet tested.
 
Inverse adder, simple but not yet tested.
 +
 +
  
 
==Animals==
 
==Animals==
Line 273: Line 291:
 
===Minimum weight===
 
===Minimum weight===
  
A creature must have a size of 10, 000 in order to trigger pressure plates at all. Everything smaller will not generate output. This excludes cats and many children of animals like puppies.  
+
A creature must have a size of 10,000 in order to trigger pressure plates at all. Everything smaller will not generate output. This excludes cats and many children of animals like puppies.  
  
 
For reference, this [[List of creatures by adult size]] gives a full listing of ''average'' sizes of creatures, with relevant cutoffs for pressure plates already marked in.
 
For reference, this [[List of creatures by adult size]] gives a full listing of ''average'' sizes of creatures, with relevant cutoffs for pressure plates already marked in.
Line 283: Line 301:
 
Children are presumed superior to adults due to an extra pathing goal (to their mother), but keep in mind that they are generally much smaller than adults and thus may be too small to activate pressure plates.
 
Children are presumed superior to adults due to an extra pathing goal (to their mother), but keep in mind that they are generally much smaller than adults and thus may be too small to activate pressure plates.
  
Female animals can become pregnant and have children. Such children may disrupt the pathing of their mother or send signals by themselves. [[Grazer]]s are likely to starve to death before you get any logic out of them.
+
Female animals can become pregnant and have children, even if locked away far from others of their kind. Such children may disrupt the pathing of their mother or send signals by themselves. [[Grazer]]s are likely to starve to death before you get any logic out of them.
  
 
Exotic animals undeniably add style to your computing zone. A GCS powered computer would be awesome. Such uses prevent other potential applications, like using the spider to create valuable silk. Flyers may ignore hatch-based logic blocks.
 
Exotic animals undeniably add style to your computing zone. A GCS powered computer would be awesome. Such uses prevent other potential applications, like using the spider to create valuable silk. Flyers may ignore hatch-based logic blocks.
Line 290: Line 308:
  
 
Invaders such as elves or goblins will not work with any of the designs on this page, unless you managed to dehand them before capture-- securely closed doors are no barrier to them.  Any mounts or warbeasts, on the other hand, might work, and exotics are unlikely to bear any children, and can be extraordinarily long-lived.  Job cancellation may be a problem with more complicated designs.  Invader animals path to the map edge following capture.  Be careful of any flyers or building destroyers.
 
Invaders such as elves or goblins will not work with any of the designs on this page, unless you managed to dehand them before capture-- securely closed doors are no barrier to them.  Any mounts or warbeasts, on the other hand, might work, and exotics are unlikely to bear any children, and can be extraordinarily long-lived.  Job cancellation may be a problem with more complicated designs.  Invader animals path to the map edge following capture.  Be careful of any flyers or building destroyers.
 +
  
 
==Putting it all together==
 
==Putting it all together==
Line 299: Line 318:
 
{{Category|Computing}}
 
{{Category|Computing}}
 
{{Category|Logic}}
 
{{Category|Logic}}
[[ru:Animal logic]]
 

Please note that all contributions to Dwarf Fortress Wiki are considered to be released under the GFDL & MIT (see Dwarf Fortress Wiki:Copyrights for details). If you do not want your writing to be edited mercilessly and redistributed at will, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource. Do not submit copyrighted work without permission!

To protect the wiki against automated edit spam, we kindly ask you to solve the following CAPTCHA:

Cancel Editing help (opens in new window)

This page is a member of 1 hidden category: