<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>http://dwarffortresswiki.org/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=LordOOTFD</id>
	<title>Dwarf Fortress Wiki - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="http://dwarffortresswiki.org/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=LordOOTFD"/>
	<link rel="alternate" type="text/html" href="http://dwarffortresswiki.org/index.php/Special:Contributions/LordOOTFD"/>
	<updated>2026-04-30T02:29:49Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.35.11</generator>
	<entry>
		<id>http://dwarffortresswiki.org/index.php?title=File:And,Or,AndOr,_Prototype_adder_STATE_2.PNG&amp;diff=143980</id>
		<title>File:And,Or,AndOr, Prototype adder STATE 2.PNG</title>
		<link rel="alternate" type="text/html" href="http://dwarffortresswiki.org/index.php?title=File:And,Or,AndOr,_Prototype_adder_STATE_2.PNG&amp;diff=143980"/>
		<updated>2011-04-02T20:38:24Z</updated>

		<summary type="html">&lt;p&gt;LordOOTFD: uploaded a new version of &amp;quot;File:And,Or,AndOr, Prototype adder STATE 2.PNG&amp;quot;:&amp;amp;#32;realized the doors were all open, this one looks better.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;a=1,b=1,c=0 Sum=10&lt;/div&gt;</summary>
		<author><name>LordOOTFD</name></author>
	</entry>
	<entry>
		<id>http://dwarffortresswiki.org/index.php?title=File:And,Or,AndOr,_Prototype_adder_STATE_3.PNG&amp;diff=132399</id>
		<title>File:And,Or,AndOr, Prototype adder STATE 3.PNG</title>
		<link rel="alternate" type="text/html" href="http://dwarffortresswiki.org/index.php?title=File:And,Or,AndOr,_Prototype_adder_STATE_3.PNG&amp;diff=132399"/>
		<updated>2010-11-25T22:05:23Z</updated>

		<summary type="html">&lt;p&gt;LordOOTFD: uploaded a new version of &amp;quot;File:And,Or,AndOr, Prototype adder STATE 3.PNG&amp;quot;:&amp;amp;#32;Fixed bit sticking problem, Updated for DF2010&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;a=1,b=1,c=1 Sum=11&lt;/div&gt;</summary>
		<author><name>LordOOTFD</name></author>
	</entry>
	<entry>
		<id>http://dwarffortresswiki.org/index.php?title=File:And,Or,AndOr,_Prototype_adder_STATE_2.PNG&amp;diff=132398</id>
		<title>File:And,Or,AndOr, Prototype adder STATE 2.PNG</title>
		<link rel="alternate" type="text/html" href="http://dwarffortresswiki.org/index.php?title=File:And,Or,AndOr,_Prototype_adder_STATE_2.PNG&amp;diff=132398"/>
		<updated>2010-11-25T22:04:51Z</updated>

		<summary type="html">&lt;p&gt;LordOOTFD: uploaded a new version of &amp;quot;File:And,Or,AndOr, Prototype adder STATE 2.PNG&amp;quot;:&amp;amp;#32;Fixed bit sticking problem, Updated for DF2010&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;a=1,b=1,c=0 Sum=10&lt;/div&gt;</summary>
		<author><name>LordOOTFD</name></author>
	</entry>
	<entry>
		<id>http://dwarffortresswiki.org/index.php?title=File:And,Or,AndOr,_Prototype_adder_STATE_1.PNG&amp;diff=132397</id>
		<title>File:And,Or,AndOr, Prototype adder STATE 1.PNG</title>
		<link rel="alternate" type="text/html" href="http://dwarffortresswiki.org/index.php?title=File:And,Or,AndOr,_Prototype_adder_STATE_1.PNG&amp;diff=132397"/>
		<updated>2010-11-25T22:04:28Z</updated>

		<summary type="html">&lt;p&gt;LordOOTFD: uploaded a new version of &amp;quot;File:And,Or,AndOr, Prototype adder STATE 1.PNG&amp;quot;:&amp;amp;#32;Fixed bit sticking problem, Updated for DF2010&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;a=1,b=0,c=0 Sum=0&lt;/div&gt;</summary>
		<author><name>LordOOTFD</name></author>
	</entry>
	<entry>
		<id>http://dwarffortresswiki.org/index.php?title=File:And,Or,AndOr,_Prototype_adder_STATE_0.PNG&amp;diff=132396</id>
		<title>File:And,Or,AndOr, Prototype adder STATE 0.PNG</title>
		<link rel="alternate" type="text/html" href="http://dwarffortresswiki.org/index.php?title=File:And,Or,AndOr,_Prototype_adder_STATE_0.PNG&amp;diff=132396"/>
		<updated>2010-11-25T22:02:19Z</updated>

		<summary type="html">&lt;p&gt;LordOOTFD: uploaded a new version of &amp;quot;File:And,Or,AndOr, Prototype adder STATE 0.PNG&amp;quot;:&amp;amp;#32;Reverted to version as of 22:01, 25 November 2010&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;a=0,b=0,c=0 sum=0&lt;/div&gt;</summary>
		<author><name>LordOOTFD</name></author>
	</entry>
	<entry>
		<id>http://dwarffortresswiki.org/index.php?title=File:And,Or,AndOr,_Prototype_adder_STATE_0.PNG&amp;diff=132395</id>
		<title>File:And,Or,AndOr, Prototype adder STATE 0.PNG</title>
		<link rel="alternate" type="text/html" href="http://dwarffortresswiki.org/index.php?title=File:And,Or,AndOr,_Prototype_adder_STATE_0.PNG&amp;diff=132395"/>
		<updated>2010-11-25T22:01:58Z</updated>

		<summary type="html">&lt;p&gt;LordOOTFD: uploaded a new version of &amp;quot;File:And,Or,AndOr, Prototype adder STATE 0.PNG&amp;quot;:&amp;amp;#32;Wrong image&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;a=0,b=0,c=0 sum=0&lt;/div&gt;</summary>
		<author><name>LordOOTFD</name></author>
	</entry>
	<entry>
		<id>http://dwarffortresswiki.org/index.php?title=File:And,Or,AndOr,_Prototype_adder_STATE_0.PNG&amp;diff=132394</id>
		<title>File:And,Or,AndOr, Prototype adder STATE 0.PNG</title>
		<link rel="alternate" type="text/html" href="http://dwarffortresswiki.org/index.php?title=File:And,Or,AndOr,_Prototype_adder_STATE_0.PNG&amp;diff=132394"/>
		<updated>2010-11-25T22:01:09Z</updated>

		<summary type="html">&lt;p&gt;LordOOTFD: uploaded a new version of &amp;quot;File:And,Or,AndOr, Prototype adder STATE 0.PNG&amp;quot;:&amp;amp;#32;Fixed bit sticking problem, Updated for DF2010&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;a=0,b=0,c=0 sum=0&lt;/div&gt;</summary>
		<author><name>LordOOTFD</name></author>
	</entry>
	<entry>
		<id>http://dwarffortresswiki.org/index.php?title=v0.31:Animal_logic&amp;diff=62759</id>
		<title>v0.31:Animal logic</title>
		<link rel="alternate" type="text/html" href="http://dwarffortresswiki.org/index.php?title=v0.31:Animal_logic&amp;diff=62759"/>
		<updated>2010-02-08T04:13:08Z</updated>

		<summary type="html">&lt;p&gt;LordOOTFD: forgot something elementary there, if someone can make this clearer go right on ahead.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Animal logic functions by taking advantage of the path finding algorithm in dwarf fortress, all animals seek to find the shortest (lowest cost) path to their desired targets (activity zone, parents, dwarfs, valuable objects, etc) this can be used to create very very complex logic gates. Animal logic has three principle advantages, speed, compactness, and simplified functions; however, animal logic is slower than mechanical logic and less reliable than either fluid of mechanical logic.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Definitions==&lt;br /&gt;
&lt;br /&gt;
For clarity definitions of the terms used in animal logic are listed here: &lt;br /&gt;
&lt;br /&gt;
'''Ground''': for simplicity the thing the animal is pathing to is refereed to as ground as that is the ground state which it wishes to reach. Ground is always the left unless otherwise noted.&lt;br /&gt;
&lt;br /&gt;
'''Purge''': Path to ground with no inputs&lt;br /&gt;
&lt;br /&gt;
'''Path cost''': The number of steps the animal must make to reach ground&lt;br /&gt;
&lt;br /&gt;
'''Fusion Gate''': Simply one or more logic gates built into the same system (this is more than simply stringing gates)&lt;br /&gt;
&lt;br /&gt;
'''Compund Gate''': Gate which uses two or more gates set to different path costs.&lt;br /&gt;
&lt;br /&gt;
'''And Gate''': And takes x inputs and output TRUE if ALL are TRUE.&lt;br /&gt;
&lt;br /&gt;
'''NAnd Gate''': NAnd takes x inputs and returns TRUE if ALL are FALSE. &lt;br /&gt;
&lt;br /&gt;
'''AndOr Gate''': AndOr takes x inputs and returns TRUE if X-Y are TRUE. (this gate is exclusive to animal logic, and is a single step fusion of And, and Or)&lt;br /&gt;
&lt;br /&gt;
'''Or Gate''': Or takes x input and output TRUE if ANY are true.&lt;br /&gt;
&lt;br /&gt;
'''Not Gate''': Not takes a single input and inverts it to the oposite state TRUE if FALSE. &lt;br /&gt;
&lt;br /&gt;
'''XOr Gate''': XOr takes 2 or more inputs and output TRUE if ONLY ONE is TRUE but NOT ALL are TRUE. &lt;br /&gt;
&lt;br /&gt;
'''NOr Gate''': NOr takes x input and returns TRUE if ALL inputs are FALSE. &lt;br /&gt;
&lt;br /&gt;
'''XNOr Gate''': XNOr takes 2 or more inputs and returns TRUE if ALL are TRUE, OR FALSE.&lt;br /&gt;
&lt;br /&gt;
For a better explanation of gates see:http://en.wikipedia.org/wiki/Logic_gate&lt;br /&gt;
&lt;br /&gt;
Notation: #:always 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) 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.&lt;br /&gt;
&lt;br /&gt;
Gates will always be capitalized in the way they are within the entry, I.E. And, Or, AndOr, XNOr, etc&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The basics of construction for an animal logic takes advantage of an animal's tendency to continue to path through tightly closed doors, despite them not being able to pass. it goes without saying that all doors not wired to mechanisms need to be tightly closed.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
There are three principle 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 principle 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, these gates are maddeningly complex and very hard if not impossible to build.&lt;br /&gt;
&lt;br /&gt;
==SIMPLE GATES==&lt;br /&gt;
&lt;br /&gt;
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 &amp;quot;wake up&amp;quot; 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 it's 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.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''And'''&lt;br /&gt;
&lt;br /&gt;
This simple gate is made by confining the animal into a straight coridor; the ground path will have two or more doors which are connected to the input, while the second longer path remains clear. the gate can be configured as an NAnd gate by simply moving the pressure plate. if the plate is by the ground path it functions as an And gate returning TRUE if the ground path is open, and if the plate is by the purge path it will return FALSE when the inputs are TRUE&lt;br /&gt;
 #########&lt;br /&gt;
  ABCD^ D&lt;br /&gt;
 #########&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Multi And'''&lt;br /&gt;
&lt;br /&gt;
 ############&lt;br /&gt;
  ANYNUMD^ D&lt;br /&gt;
 ############&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''NAnd'''&lt;br /&gt;
&lt;br /&gt;
Reconfigured And gate, see And.&lt;br /&gt;
 #########&lt;br /&gt;
  ABCD ^D&lt;br /&gt;
 #########&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Or'''&lt;br /&gt;
&lt;br /&gt;
Basic gate, returns true if either input is true. &lt;br /&gt;
 #####&lt;br /&gt;
 AD^ D&lt;br /&gt;
 B####&lt;br /&gt;
 #####&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Multi Or'''&lt;br /&gt;
&lt;br /&gt;
 #######&lt;br /&gt;
 A #####&lt;br /&gt;
 N #####&lt;br /&gt;
 Y D^ D&lt;br /&gt;
 N #####&lt;br /&gt;
 M #####&lt;br /&gt;
 #######&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''NOr'''&lt;br /&gt;
&lt;br /&gt;
Basically a reconfigured Or gate&lt;br /&gt;
 #####&lt;br /&gt;
 AD ^D&lt;br /&gt;
 B####&lt;br /&gt;
 #####&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Not'''&lt;br /&gt;
&lt;br /&gt;
The simplest gate, It takes a single input and inverts it. False-&amp;gt;True, True-&amp;gt;False&lt;br /&gt;
 #######&lt;br /&gt;
  AD ^D&lt;br /&gt;
 #######&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Compound Gates==&lt;br /&gt;
&lt;br /&gt;
Basically two or more gates arranged with different path costs to ground. These gates can be configured in a number of different ways, these being the simplest. It may be possible to make these gates as single gates but that would require inverting some of the input. Simple compound gates use two simple gates and handle two inputs, complex compund gates have more then two simple gates and need more than two inputs. a Complex compound gate might be used to convert decimal numbers into binary using And gates.&lt;br /&gt;
&lt;br /&gt;
'''XOr'''&lt;br /&gt;
&lt;br /&gt;
Compound of And and Or, when ONLY ONE is TRUE returns TRUE&lt;br /&gt;
If A and B are false the animal moves to the FALSE position by Purge, if A or B is true, the animal moves to the TRUE position at the Or gate, if both A and B are true the animal moves to the FALSE position by the And gate.&lt;br /&gt;
&lt;br /&gt;
 #g########&lt;br /&gt;
 # ABD  D #&lt;br /&gt;
 # ####^# #&lt;br /&gt;
 # ####D# #&lt;br /&gt;
 # ###BA# #&lt;br /&gt;
 #        #&lt;br /&gt;
 ##########&lt;br /&gt;
And path cost: 4&lt;br /&gt;
Or path cost: 10&lt;br /&gt;
Purge path cost: 14&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''XNor'''&lt;br /&gt;
&lt;br /&gt;
Inverse of XOr: Return TRUE if BOTH are TRUE OR FALSE&lt;br /&gt;
If A and B are false the animal move to the TRUE position by Purge, if A or B is true, the animal moves to the FALSE position at the Or gate, if both A and B are true the animal moves to the TRUE postion by the And gate.&lt;br /&gt;
&lt;br /&gt;
 #g#########&lt;br /&gt;
 #         #&lt;br /&gt;
 ##B###### #&lt;br /&gt;
 ###A## DA # &lt;br /&gt;
 ####D^##B #&lt;br /&gt;
 #####D### #&lt;br /&gt;
 ######    #&lt;br /&gt;
 ###########&lt;br /&gt;
And path cost: 4&lt;br /&gt;
Or path cost: 10&lt;br /&gt;
Purge path cost: 15&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Complex Compound gate, Octal display ALU'''&lt;br /&gt;
&lt;br /&gt;
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)&lt;br /&gt;
&lt;br /&gt;
 #################&lt;br /&gt;
                 #&lt;br /&gt;
 # # # # # # #1# #&lt;br /&gt;
 # # #1# #1#2#2# #&lt;br /&gt;
 #1#2#2#4#4#4#4# #&lt;br /&gt;
 #D#D#D#D#D#D#D#D#&lt;br /&gt;
 #               #&lt;br /&gt;
 #################&lt;br /&gt;
&lt;br /&gt;
 # ######&lt;br /&gt;
 # 1  D #&lt;br /&gt;
 # #### #&lt;br /&gt;
 # 2  D #&lt;br /&gt;
 # #### #&lt;br /&gt;
 # 12 D #&lt;br /&gt;
 # #### #&lt;br /&gt;
 # 4  D #&lt;br /&gt;
 # #### #&lt;br /&gt;
 # 14 D #&lt;br /&gt;
 # #### #&lt;br /&gt;
 # 24 D #&lt;br /&gt;
 # #### #&lt;br /&gt;
 # 124D #&lt;br /&gt;
 # #### #&lt;br /&gt;
 #    D #&lt;br /&gt;
 ########&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Fusion gates==&lt;br /&gt;
&lt;br /&gt;
These are gates which are constructed by physically combining the two gates to get a specific output.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''AndOr'''&lt;br /&gt;
&lt;br /&gt;
This gate will evaluate if either of x And statements are TRUE. This gate is built as a straight line similar to the And gate&lt;br /&gt;
 ######&lt;br /&gt;
 #C####&lt;br /&gt;
 ABD^ D&lt;br /&gt;
 C#####&lt;br /&gt;
 ######&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''NAndOr'''&lt;br /&gt;
&lt;br /&gt;
Reconfigured AndOr gate, see AndOr&lt;br /&gt;
 ######&lt;br /&gt;
 #C####&lt;br /&gt;
 ABD ^D&lt;br /&gt;
 C#####&lt;br /&gt;
 ######&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''OrandOr'''&lt;br /&gt;
&lt;br /&gt;
This gate returns true if either A or B and either C or D is true.&lt;br /&gt;
&lt;br /&gt;
 ######&lt;br /&gt;
 AC####&lt;br /&gt;
 BED^ D&lt;br /&gt;
 ######&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''OrandAnd'''&lt;br /&gt;
&lt;br /&gt;
This gate returns true if either A or B is true, and E and C are true.&lt;br /&gt;
&lt;br /&gt;
 #######&lt;br /&gt;
 A######&lt;br /&gt;
 BCED^ D&lt;br /&gt;
 #######&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Complex Gates==&lt;br /&gt;
&lt;br /&gt;
The development of more complex gates requires carful calibration of the path cost of each path to allow the gate to switch states correctly and display the correct result.&lt;br /&gt;
&lt;br /&gt;
==Adders==&lt;br /&gt;
A Full adder can be made as a Compound Fusion gate, by combining, And, AndOr, and Or gates&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Binary Adder'''&lt;br /&gt;
&lt;br /&gt;
A binary adder is constrcuted of two or three &amp;quot;sum&amp;quot; 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 &amp;quot;carrying&amp;quot; the value up to the next level.&lt;br /&gt;
&lt;br /&gt;
An building the adder the higest path must have the most preferential path to ground or it will not properly function.&lt;br /&gt;
&lt;br /&gt;
Stand alone Adders (they don't carry into another adder) require 22 mechanisms, and 14 doors.&lt;br /&gt;
Start Adders (They feed into the next Adder and include a carry) require 32 mechanisms, and 14 doors.&lt;br /&gt;
Chain Adders (The receive Carry, and pass a Carry bit up) require 32 mechanisms, and 14 doors&lt;br /&gt;
While Materials intensive the gates only take up 13x9 urists, ideal for chaining along mining tunnels.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Reference pictures&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery&amp;gt;&lt;br /&gt;
Image:Xnor,Xor,Nand,Or prototype adder STATE 1.PNG|Prototype digital adder&lt;br /&gt;
Image:And,Or,AndOr, Prototype adder STATE 3.PNG|sum 11&lt;br /&gt;
Image:And,Or,AndOr, Prototype adder STATE 2.PNG|sum 10&lt;br /&gt;
Image:And,Or,AndOr, Prototype adder STATE 1.PNG|sum 01&lt;br /&gt;
Image:And,Or,AndOr, Prototype adder STATE 0.PNG|sum 00&lt;br /&gt;
Image:9bit adder prototype interface pannel.PNG|9bit adder interface&lt;br /&gt;
Image:9bit adder prototype.PNG|9bit adder&lt;br /&gt;
Image:9bit adder prototype 10100010notes.PNG|9bit adder, notes show the decimal value of each adder's bit&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The above design is flawed as the Sum 1, and 2 paths can become &amp;quot;stuck&amp;quot; if the adder improperly cycles. It can be manually readjusted however this defeats the purpose. A new design which solves these problems is forthcoming, however simply lengthening the coridoors will solve the problem. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Decimal Adder'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
While it can be done, It's significantly more complex than simply making a set of decimal converters working with binary adders.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''hexadecimal adder'''&lt;br /&gt;
&lt;br /&gt;
A hexidecimal adder works on a simmilar level to the binary adder, however it uses 64 sum gates ranging from 0 to 31. [[User:LordOOTFD]] is developing a prototype adder which utilizes a floating carry bit to function as a full adder.&lt;br /&gt;
&lt;br /&gt;
'''Subtractors'''&lt;br /&gt;
&lt;br /&gt;
inverse adder, simple but not yet tested.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Animals==&lt;br /&gt;
&lt;br /&gt;
Choosing the animal which works as the logic core for an animal logic systems is somewhat important, depending on your needs and the available animals. however pretty much anything will do as long as you can remember which animal fits into which gate (to avoid designating the same animal for more than one pit).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Kittens'''&lt;br /&gt;
&lt;br /&gt;
While kittens are the most reliable cores for logic gates because of their three pathing goals they're also problematic as they grow into cats which only have two, and may cause catsplosions inside your logical cores. Ideally kittens should be replaced yearly or biyearly as their growth defines.&lt;br /&gt;
Kittens path to the activity zone, their parents, and vermin.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Puppies'''&lt;br /&gt;
&lt;br /&gt;
Puppies are quite reliable with Two pathing goals, but retain the problem of maturation.&lt;br /&gt;
Puppies path to the activity zone, and their parents.&lt;br /&gt;
&lt;br /&gt;
'''Animal Children'''&lt;br /&gt;
&lt;br /&gt;
Using the non matured animals for something useful before butchering may be quite effective, however they still must be flushed when they mature.&lt;br /&gt;
Animal children path to the activity zone, and their parents.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Cats'''&lt;br /&gt;
&lt;br /&gt;
Aggravating animals, throw them into the computer and get some worth out of them. Otherwise useless cats become useful when used for logic, with two pathing goals they're responsive, and multiply quickly. watch out for catsplosions while using these critters&lt;br /&gt;
Cats path to the activity zone, and Vermin.&lt;br /&gt;
&lt;br /&gt;
'''Dogs'''&lt;br /&gt;
&lt;br /&gt;
While dogs may seem an attractive option for logic cores, they will be far more useful as wardogs or hunting dogs to protect dorfs. &lt;br /&gt;
Dogs path to the activity zone.&lt;br /&gt;
&lt;br /&gt;
'''Cattle'''&lt;br /&gt;
&lt;br /&gt;
Large lumbering bovines, the advantage of Cattle is you can tell the sexes apart, they also make the pressure plates continue to work even if you forget to reassign the trigger weight.&lt;br /&gt;
Cattle path to the activity zone.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Other animals'''&lt;br /&gt;
&lt;br /&gt;
Any animals work, but the above are probably your best choice, excluding any modded animals. however if you have a GCS handy a GCS powered computer would be awesome, so take this as you will.&lt;br /&gt;
Other animals have different pathing goals, but most only path to the activity zone.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Goblins'''&lt;br /&gt;
&lt;br /&gt;
Goblin powered logic is highly ironic, especially if it involves controlling your goblin killing magma trap. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Putting it all together==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
When it comes time to automate your systems the first thing you need to know is what needs to automated and what should remain manual. an obsidian farm with completely autonomous control of the casting process is all well and good, until it drowns all your legendary miners when it prematurely triggers. all systems should have manual controls and failsafes to help avoid FUN! (but because we all love FUN sometimes you forget to fully connect that emergency drain, or that failsafe system you built somehow failed.)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
once you know the steps you need in your system it comes time to select the parts you need to automate, whether it be basic logic gates or more sophisticated multiple trigger systems.&lt;/div&gt;</summary>
		<author><name>LordOOTFD</name></author>
	</entry>
	<entry>
		<id>http://dwarffortresswiki.org/index.php?title=v0.31:Animal_logic&amp;diff=62756</id>
		<title>v0.31:Animal logic</title>
		<link rel="alternate" type="text/html" href="http://dwarffortresswiki.org/index.php?title=v0.31:Animal_logic&amp;diff=62756"/>
		<updated>2010-02-08T04:07:38Z</updated>

		<summary type="html">&lt;p&gt;LordOOTFD: Reposting stuff from my user page in formal format, appologies for the delay.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Animal logic functions by taking advantage of the path finding algorithm in dwarf fortress, all animals seek to find the shortest (lowest cost) path to their desired targets (activity zone, parents, dwarfs, valuable objects, etc) this can be used to create very very complex logic gates. Animal logic has three principle advantages, speed, compactness, and simplified functions; however, animal logic is slower than mechanical logic and less reliable than either fluid of mechanical logic.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Definitions==&lt;br /&gt;
&lt;br /&gt;
For clarity definitions of the terms used in animal logic are listed here: &lt;br /&gt;
&lt;br /&gt;
'''Ground''': for simplicity the thing the animal is pathing to is refereed to as ground as that is the ground state which it wishes to reach. Ground is always the left unless otherwise noted.&lt;br /&gt;
&lt;br /&gt;
'''Purge''': Path to ground with no inputs&lt;br /&gt;
&lt;br /&gt;
'''Path cost''': The number of steps the animal must make to reach ground&lt;br /&gt;
&lt;br /&gt;
'''Fusion Gate''': Simply one or more logic gates built into the same system (this is more than simply stringing gates)&lt;br /&gt;
&lt;br /&gt;
'''Compund Gate''': Gate which uses two or more gates set to different path costs.&lt;br /&gt;
&lt;br /&gt;
'''And Gate''': And takes x inputs and output TRUE if ALL are TRUE.&lt;br /&gt;
&lt;br /&gt;
'''NAnd Gate''': NAnd takes x inputs and returns TRUE if ALL are FALSE. &lt;br /&gt;
&lt;br /&gt;
'''AndOr Gate''': AndOr takes x inputs and returns TRUE if X-Y are TRUE. (this gate is exclusive to animal logic, and is a single step fusion of And, and Or)&lt;br /&gt;
&lt;br /&gt;
'''Or Gate''': Or takes x input and output TRUE if ANY are true.&lt;br /&gt;
&lt;br /&gt;
'''Not Gate''': Not takes a single input and inverts it to the oposite state TRUE if FALSE. &lt;br /&gt;
&lt;br /&gt;
'''XOr Gate''': XOr takes 2 or more inputs and output TRUE if ONLY ONE is TRUE but NOT ALL are TRUE. &lt;br /&gt;
&lt;br /&gt;
'''NOr Gate''': NOr takes x input and returns TRUE if ALL inputs are FALSE. &lt;br /&gt;
&lt;br /&gt;
'''XNOr Gate''': XNOr takes 2 or more inputs and returns TRUE if ALL are TRUE, OR FALSE.&lt;br /&gt;
&lt;br /&gt;
For a better explanation of gates see:http://en.wikipedia.org/wiki/Logic_gate&lt;br /&gt;
&lt;br /&gt;
Notation: #:always 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) 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.&lt;br /&gt;
&lt;br /&gt;
Gates will always be capitalized in the way they are within the entry, I.E. And, Or, AndOr, XNOr, etc&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
There are three principle 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 principle 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, these gates are maddeningly complex and very hard if not impossible to build.&lt;br /&gt;
&lt;br /&gt;
==SIMPLE GATES==&lt;br /&gt;
&lt;br /&gt;
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 &amp;quot;wake up&amp;quot; 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 it's 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.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''And'''&lt;br /&gt;
&lt;br /&gt;
This simple gate is made by confining the animal into a straight coridor; the ground path will have two or more doors which are connected to the input, while the second longer path remains clear. the gate can be configured as an NAnd gate by simply moving the pressure plate. if the plate is by the ground path it functions as an And gate returning TRUE if the ground path is open, and if the plate is by the purge path it will return FALSE when the inputs are TRUE&lt;br /&gt;
 #########&lt;br /&gt;
  ABCD^ D&lt;br /&gt;
 #########&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Multi And'''&lt;br /&gt;
&lt;br /&gt;
 ############&lt;br /&gt;
  ANYNUMD^ D&lt;br /&gt;
 ############&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''NAnd'''&lt;br /&gt;
&lt;br /&gt;
Reconfigured And gate, see And.&lt;br /&gt;
 #########&lt;br /&gt;
  ABCD ^D&lt;br /&gt;
 #########&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Or'''&lt;br /&gt;
&lt;br /&gt;
Basic gate, returns true if either input is true. &lt;br /&gt;
 #####&lt;br /&gt;
 AD^ D&lt;br /&gt;
 B####&lt;br /&gt;
 #####&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Multi Or'''&lt;br /&gt;
&lt;br /&gt;
 #######&lt;br /&gt;
 A #####&lt;br /&gt;
 N #####&lt;br /&gt;
 Y D^ D&lt;br /&gt;
 N #####&lt;br /&gt;
 M #####&lt;br /&gt;
 #######&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''NOr'''&lt;br /&gt;
&lt;br /&gt;
Basically a reconfigured Or gate&lt;br /&gt;
 #####&lt;br /&gt;
 AD ^D&lt;br /&gt;
 B####&lt;br /&gt;
 #####&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Not'''&lt;br /&gt;
&lt;br /&gt;
The simplest gate, It takes a single input and inverts it. False-&amp;gt;True, True-&amp;gt;False&lt;br /&gt;
 #######&lt;br /&gt;
  AD ^D&lt;br /&gt;
 #######&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Compound Gates==&lt;br /&gt;
&lt;br /&gt;
Basically two or more gates arranged with different path costs to ground. These gates can be configured in a number of different ways, these being the simplest. It may be possible to make these gates as single gates but that would require inverting some of the input. Simple compound gates use two simple gates and handle two inputs, complex compund gates have more then two simple gates and need more than two inputs. a Complex compound gate might be used to convert decimal numbers into binary using And gates.&lt;br /&gt;
&lt;br /&gt;
'''XOr'''&lt;br /&gt;
&lt;br /&gt;
Compound of And and Or, when ONLY ONE is TRUE returns TRUE&lt;br /&gt;
If A and B are false the animal moves to the FALSE position by Purge, if A or B is true, the animal moves to the TRUE position at the Or gate, if both A and B are true the animal moves to the FALSE position by the And gate.&lt;br /&gt;
&lt;br /&gt;
 #g########&lt;br /&gt;
 # ABD  D #&lt;br /&gt;
 # ####^# #&lt;br /&gt;
 # ####D# #&lt;br /&gt;
 # ###BA# #&lt;br /&gt;
 #        #&lt;br /&gt;
 ##########&lt;br /&gt;
And path cost: 4&lt;br /&gt;
Or path cost: 10&lt;br /&gt;
Purge path cost: 14&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''XNor'''&lt;br /&gt;
&lt;br /&gt;
Inverse of XOr: Return TRUE if BOTH are TRUE OR FALSE&lt;br /&gt;
If A and B are false the animal move to the TRUE position by Purge, if A or B is true, the animal moves to the FALSE position at the Or gate, if both A and B are true the animal moves to the TRUE postion by the And gate.&lt;br /&gt;
&lt;br /&gt;
 #g#########&lt;br /&gt;
 #         #&lt;br /&gt;
 ##B###### #&lt;br /&gt;
 ###A## DA # &lt;br /&gt;
 ####D^##B #&lt;br /&gt;
 #####D### #&lt;br /&gt;
 ######    #&lt;br /&gt;
 ###########&lt;br /&gt;
And path cost: 4&lt;br /&gt;
Or path cost: 10&lt;br /&gt;
Purge path cost: 15&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Complex Compound gate, Octal display ALU'''&lt;br /&gt;
&lt;br /&gt;
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)&lt;br /&gt;
&lt;br /&gt;
 #################&lt;br /&gt;
                 #&lt;br /&gt;
 # # # # # # #1# #&lt;br /&gt;
 # # #1# #1#2#2# #&lt;br /&gt;
 #1#2#2#4#4#4#4# #&lt;br /&gt;
 #D#D#D#D#D#D#D#D#&lt;br /&gt;
 #               #&lt;br /&gt;
 #################&lt;br /&gt;
&lt;br /&gt;
 # ######&lt;br /&gt;
 # 1  D #&lt;br /&gt;
 # #### #&lt;br /&gt;
 # 2  D #&lt;br /&gt;
 # #### #&lt;br /&gt;
 # 12 D #&lt;br /&gt;
 # #### #&lt;br /&gt;
 # 4  D #&lt;br /&gt;
 # #### #&lt;br /&gt;
 # 14 D #&lt;br /&gt;
 # #### #&lt;br /&gt;
 # 24 D #&lt;br /&gt;
 # #### #&lt;br /&gt;
 # 124D #&lt;br /&gt;
 # #### #&lt;br /&gt;
 #    D #&lt;br /&gt;
 ########&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Fusion gates==&lt;br /&gt;
&lt;br /&gt;
These are gates which are constructed by physically combining the two gates to get a specific output.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''AndOr'''&lt;br /&gt;
&lt;br /&gt;
This gate will evaluate if either of x And statements are TRUE. This gate is built as a straight line similar to the And gate&lt;br /&gt;
 ######&lt;br /&gt;
 #C####&lt;br /&gt;
 ABD^ D&lt;br /&gt;
 C#####&lt;br /&gt;
 ######&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''NAndOr'''&lt;br /&gt;
&lt;br /&gt;
Reconfigured AndOr gate, see AndOr&lt;br /&gt;
 ######&lt;br /&gt;
 #C####&lt;br /&gt;
 ABD ^D&lt;br /&gt;
 C#####&lt;br /&gt;
 ######&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''OrandOr'''&lt;br /&gt;
&lt;br /&gt;
This gate returns true if either A or B and either C or D is true.&lt;br /&gt;
&lt;br /&gt;
 ######&lt;br /&gt;
 AC####&lt;br /&gt;
 BED^ D&lt;br /&gt;
 ######&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''OrandAnd'''&lt;br /&gt;
&lt;br /&gt;
This gate returns true if either A or B is true, and E and C are true.&lt;br /&gt;
&lt;br /&gt;
 #######&lt;br /&gt;
 A######&lt;br /&gt;
 BCED^ D&lt;br /&gt;
 #######&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Complex Gates==&lt;br /&gt;
&lt;br /&gt;
The development of more complex gates requires carful calibration of the path cost of each path to allow the gate to switch states correctly and display the correct result.&lt;br /&gt;
&lt;br /&gt;
==Adders==&lt;br /&gt;
A Full adder can be made as a Compound Fusion gate, by combining, And, AndOr, and Or gates&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Binary Adder'''&lt;br /&gt;
&lt;br /&gt;
A binary adder is constrcuted of two or three &amp;quot;sum&amp;quot; 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 &amp;quot;carrying&amp;quot; the value up to the next level.&lt;br /&gt;
&lt;br /&gt;
An building the adder the higest path must have the most preferential path to ground or it will not properly function.&lt;br /&gt;
&lt;br /&gt;
Stand alone Adders (they don't carry into another adder) require 22 mechanisms, and 14 doors.&lt;br /&gt;
Start Adders (They feed into the next Adder and include a carry) require 32 mechanisms, and 14 doors.&lt;br /&gt;
Chain Adders (The receive Carry, and pass a Carry bit up) require 32 mechanisms, and 14 doors&lt;br /&gt;
While Materials intensive the gates only take up 13x9 urists, ideal for chaining along mining tunnels.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Reference pictures&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery&amp;gt;&lt;br /&gt;
Image:Xnor,Xor,Nand,Or prototype adder STATE 1.PNG|Prototype digital adder&lt;br /&gt;
Image:And,Or,AndOr, Prototype adder STATE 3.PNG|sum 11&lt;br /&gt;
Image:And,Or,AndOr, Prototype adder STATE 2.PNG|sum 10&lt;br /&gt;
Image:And,Or,AndOr, Prototype adder STATE 1.PNG|sum 01&lt;br /&gt;
Image:And,Or,AndOr, Prototype adder STATE 0.PNG|sum 00&lt;br /&gt;
Image:9bit adder prototype interface pannel.PNG|9bit adder interface&lt;br /&gt;
Image:9bit adder prototype.PNG|9bit adder&lt;br /&gt;
Image:9bit adder prototype 10100010notes.PNG|9bit adder, notes show the decimal value of each adder's bit&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The above design is flawed as the Sum 1, and 2 paths can become &amp;quot;stuck&amp;quot; if the adder improperly cycles. It can be manually readjusted however this defeats the purpose. A new design which solves these problems is forthcoming, however simply lengthening the coridoors will solve the problem. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Decimal Adder'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
While it can be done, It's significantly more complex than simply making a set of decimal converters working with binary adders.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''hexadecimal adder'''&lt;br /&gt;
&lt;br /&gt;
A hexidecimal adder works on a simmilar level to the binary adder, however it uses 64 sum gates ranging from 0 to 31. [[User:LordOOTFD]] is developing a prototype adder which utilizes a floating carry bit to function as a full adder.&lt;br /&gt;
&lt;br /&gt;
'''Subtractors'''&lt;br /&gt;
&lt;br /&gt;
inverse adder, simple but not yet tested.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Animals==&lt;br /&gt;
&lt;br /&gt;
Choosing the animal which works as the logic core for an animal logic systems is somewhat important, depending on your needs and the available animals. however pretty much anything will do as long as you can remember which animal fits into which gate (to avoid designating the same animal for more than one pit).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Kittens'''&lt;br /&gt;
&lt;br /&gt;
While kittens are the most reliable cores for logic gates because of their three pathing goals they're also problematic as they grow into cats which only have two, and may cause catsplosions inside your logical cores. Ideally kittens should be replaced yearly or biyearly as their growth defines.&lt;br /&gt;
Kittens path to the activity zone, their parents, and vermin.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Puppies'''&lt;br /&gt;
&lt;br /&gt;
Puppies are quite reliable with Two pathing goals, but retain the problem of maturation.&lt;br /&gt;
Puppies path to the activity zone, and their parents.&lt;br /&gt;
&lt;br /&gt;
'''Animal Children'''&lt;br /&gt;
&lt;br /&gt;
Using the non matured animals for something useful before butchering may be quite effective, however they still must be flushed when they mature.&lt;br /&gt;
Animal children path to the activity zone, and their parents.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Cats'''&lt;br /&gt;
&lt;br /&gt;
Aggravating animals, throw them into the computer and get some worth out of them. Otherwise useless cats become useful when used for logic, with two pathing goals they're responsive, and multiply quickly. watch out for catsplosions while using these critters&lt;br /&gt;
Cats path to the activity zone, and Vermin.&lt;br /&gt;
&lt;br /&gt;
'''Dogs'''&lt;br /&gt;
&lt;br /&gt;
While dogs may seem an attractive option for logic cores, they will be far more useful as wardogs or hunting dogs to protect dorfs. &lt;br /&gt;
Dogs path to the activity zone.&lt;br /&gt;
&lt;br /&gt;
'''Cattle'''&lt;br /&gt;
&lt;br /&gt;
Large lumbering bovines, the advantage of Cattle is you can tell the sexes apart, they also make the pressure plates continue to work even if you forget to reassign the trigger weight.&lt;br /&gt;
Cattle path to the activity zone.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Other animals'''&lt;br /&gt;
&lt;br /&gt;
Any animals work, but the above are probably your best choice, excluding any modded animals. however if you have a GCS handy a GCS powered computer would be awesome, so take this as you will.&lt;br /&gt;
Other animals have different pathing goals, but most only path to the activity zone.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Goblins'''&lt;br /&gt;
&lt;br /&gt;
Goblin powered logic is highly ironic, especially if it involves controlling your goblin killing magma trap. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Putting it all together==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
When it comes time to automate your systems the first thing you need to know is what needs to automated and what should remain manual. an obsidian farm with completely autonomous control of the casting process is all well and good, until it drowns all your legendary miners when it prematurely triggers. all systems should have manual controls and failsafes to help avoid FUN! (but because we all love FUN sometimes you forget to fully connect that emergency drain, or that failsafe system you built somehow failed.)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
once you know the steps you need in your system it comes time to select the parts you need to automate, whether it be basic logic gates or more sophisticated multiple trigger systems.&lt;/div&gt;</summary>
		<author><name>LordOOTFD</name></author>
	</entry>
	<entry>
		<id>http://dwarffortresswiki.org/index.php?title=40d:Computing&amp;diff=61945</id>
		<title>40d:Computing</title>
		<link rel="alternate" type="text/html" href="http://dwarffortresswiki.org/index.php?title=40d:Computing&amp;diff=61945"/>
		<updated>2010-01-29T06:30:21Z</updated>

		<summary type="html">&lt;p&gt;LordOOTFD: Link to my user page section on animal logic.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Computing in dwarf fortress is the practice of setting up complex constructions to perform logical operations and calculations, ideally to control some functionality of your fortress, or such a doddle. Even if it isn't a young concept anymore, there is still lots of room for improvement and development. One reason is that there are many ways to solve one problem. Innovation and invention is encouraged.&lt;br /&gt;
== General ==&lt;br /&gt;
&amp;lt;!-- ''&amp;quot;So, what is computing? Let's pretend to be stupid ...&amp;quot;'' [http://en.wikipedia.org/wiki/Die_Feuerzangenbowle Die Feuerzangenbowle]&amp;lt;br /&amp;gt; --&amp;gt;&lt;br /&gt;
Concepts of computing in dwarf fortress are far away from what you can call a programmable computer. Even though all necessary components are proven to exist, a construction working like a real computer may be too complex to be built in dwarf fortress. Nevertheless, early computing machines and electronic devices are comparably simple. These concepts can be easily transferred into dwarf fortress. So dwarfputing is more or less a kind of electronics, casting logic in hardware.&lt;br /&gt;
&lt;br /&gt;
== Basics ==&lt;br /&gt;
=== Binary information ===&lt;br /&gt;
Binary information can have one of two possible states: true or false, respectively 1 or 0. In dwarf fortress they can be represented by different entities:&lt;br /&gt;
* on/off state or signal of a [[trigger]]&lt;br /&gt;
* power or connection state of a [[machine component]]&lt;br /&gt;
* open or closed state of a [[door]] or similar buildings&lt;br /&gt;
* [[pressure plate|low/high]] or [[flow|flowing/standing]] [[water|fluid]]&lt;br /&gt;
* present [[creature]]s and [[dwarf|borgs]]&lt;br /&gt;
* ...&lt;br /&gt;
Electronic devices and computers base on this elementary form of information, and if you want to go into computing, you’ll have to familiarize with it. [http://en.wikipedia.org/wiki/Propositional_calculus propositional calculus]&lt;br /&gt;
=== Input/Output ===&lt;br /&gt;
Input can be any trigger - [[lever]] or [[pressure plate]]. Typically your dwarfs are pulling levers, creatures are walking over your pressure plates, or fluid is covering those plates to initiate computing. The bottom line is you'll always have levers, pressure plates, or a combination of both sending binary signals: on/off.&amp;lt;br /&amp;gt;&lt;br /&gt;
Note: Although [[pressure plates]] can be constructed to trigger at different fluid levels, the output will always be just a binary on/off. So everything you build will have a binary base.&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
Input elements&lt;br /&gt;
* manual: [[lever]] -&amp;gt; binary on/off signal&lt;br /&gt;
* triggered: [[pressure plate]] -&amp;gt; binary on/off signal&lt;br /&gt;
&lt;br /&gt;
According to input, output can be anything that is able to react to an on/off signal. This can be doors, bridges, floodgates allowing or stopping flow, gears controlling pumps and much more. Just refer to the [[lever#On/Off states|lever]] page for a detailed list. Independent of what you finally want to control with your dwarfputer, there are always pressure plates generating this signal. In some special configurations - when [[mechanical logic]] is involved - output may not be a on/off signal but power, thus running or not running a machine component.&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
Output elements&lt;br /&gt;
* signal: [[pressure plate]] -&amp;gt; binary on/off signal -&amp;gt; linkable Object(s)&lt;br /&gt;
* power: [[gear assembly]] -&amp;gt; binary power on/power off -&amp;gt; machine&lt;br /&gt;
&lt;br /&gt;
=== Binary logic ===&lt;br /&gt;
Basic binary logic takes one or two input bits and creates an output based on them. The devices that perform these operations are commonly called '''logic gates'''.&amp;lt;br /&amp;gt;&lt;br /&gt;
* NOT - takes one input and returns the opposite of the input&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=1&lt;br /&gt;
|-&lt;br /&gt;
! input A &lt;br /&gt;
! NOT&lt;br /&gt;
|-&lt;br /&gt;
| 0&lt;br /&gt;
| 1&lt;br /&gt;
|-&lt;br /&gt;
| 1&lt;br /&gt;
| 0&lt;br /&gt;
|}&amp;lt;br /&amp;gt;&lt;br /&gt;
* AND - takes two inputs and returns true if both inputs are true&lt;br /&gt;
* OR - takes two inputs and returns true if at least one input is true&lt;br /&gt;
* XOR - takes two inputs and returns true if exactly one input is true&lt;br /&gt;
* NAND - takes two inputs and returns true if either input is false&lt;br /&gt;
* NOR - takes two inputs and returns true if both inputs are false&lt;br /&gt;
* NXOR - takes two inputs and returns true if both inputs are identical&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=1&lt;br /&gt;
|-&lt;br /&gt;
! input A &lt;br /&gt;
! input B&lt;br /&gt;
! AND&lt;br /&gt;
! OR&lt;br /&gt;
! XOR&lt;br /&gt;
! NAND&lt;br /&gt;
! NOR&lt;br /&gt;
! NXOR&lt;br /&gt;
|-&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 1&lt;br /&gt;
| 1&lt;br /&gt;
| 1&lt;br /&gt;
|-&lt;br /&gt;
| 0&lt;br /&gt;
| 1&lt;br /&gt;
| 0&lt;br /&gt;
| 1&lt;br /&gt;
| 1&lt;br /&gt;
| 1&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
|-&lt;br /&gt;
| 1&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 1&lt;br /&gt;
| 1&lt;br /&gt;
| 1&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
|-&lt;br /&gt;
| 1&lt;br /&gt;
| 1&lt;br /&gt;
| 1&lt;br /&gt;
| 1&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 0&lt;br /&gt;
| 1&lt;br /&gt;
|}&amp;lt;br /&amp;gt;&lt;br /&gt;
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 gates. Some gates are easier to create or need fewer components than others depending on what discipline your logic relies on.&lt;br /&gt;
=== Complex gates ===&lt;br /&gt;
* [[Latch]] - storing and reading a single binary value&lt;br /&gt;
* [[Repeater]] - sending a repeating signal&lt;br /&gt;
* [[Counter]]/[[Adder]] - binary calculation&lt;br /&gt;
== Disciplines ==&lt;br /&gt;
There are 4 main disciplines of dwarfputing, depending on what will drive the dwarfputer. Each of them has its assets and drawbacks. &lt;br /&gt;
=== Fluid logic ===&lt;br /&gt;
[[Fluid logic]] is controlling the ''flow of fluid'' over different pressure plates. Fluid logic can be easily constructed and every known logic gate in dwarf fortress has already been built with it. On the other hand this discipline depends on a somehow unlimited source of the used fluid to deal with its [[evaporation]] and [[Water#Water_in_Fortress_Mode|destruction]].&lt;br /&gt;
=== Mechanical logic ===&lt;br /&gt;
[[Mechanical logic]] uses systems of axles and [[gear assemblies]] to build logical gates. Mechanical logic reacts very fast and can be easily constructed. Especially the feature of gears to toggle on every signal instead of reacting different to on/off signals makes mechanical logic gates very flexible. On the other hand this discipline depends on much mechanical power. And because of the lack of some kind of rotation sensor, you will generally need a pump, a pressure plate and any fluid to convert power into on/off signals.&lt;br /&gt;
=== Borg logic ===&lt;br /&gt;
[[Borg logic]] controlling the path of your dwarves to direct them over pressure plates. They will be driven by 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 tendency of dwarves to eat, sleep, drink, makes this discipline quite unreliable. There are no known examples of borg logic, and it is purely theoretical at this time. Maybe the discovery of [[one-way]] ramps will push its development.&lt;br /&gt;
=== Animal logic ===&lt;br /&gt;
[[Animal logic]] is like borg logic but uses animals or captured hostiles to trigger pressure plates. Animals have a natural 'follow the leader' tendency and never starve. Hostiles will always target your dwarves and will also need no food or sleep.&lt;br /&gt;
== Examples ==&lt;br /&gt;
There are few examples of a really useful dwarfputer and some concepts which have the potential to become useful for others. But in most cases they are made just for fun. What doesn't mean to diminish their designers achievements, because these are in general the more complex ones.&amp;lt;br /&amp;gt;At the moment there are no known examples of animal or borg logic.&lt;br /&gt;
=== Useful ===&lt;br /&gt;
* Magma trap&lt;br /&gt;
** This is an example of an useful dwarfputer controlling a magma trap. It automatically floods an area with lava, cleans up and resets afterwards. The timing is perfectly adjusted to let the victims vanish only leaving their valuable metal behind.&amp;lt;br /&amp;gt;video: http://mkv25.net/dfma/movie-1808-perfectmagmatrap&amp;lt;br /&amp;gt;design: http://i576.photobucket.com/albums/ss208/kanddak/magmatrap.png&lt;br /&gt;
&lt;br /&gt;
=== Concepts ===&lt;br /&gt;
* repeater&lt;br /&gt;
** mechanical logic http://mkv25.net/dfma/movie-1370-pump-basedautorepeater&lt;br /&gt;
* adding machine&lt;br /&gt;
** mechanical logic, 6-bit: http://mkv25.net/dfma/movie-1561-addingmachine&lt;br /&gt;
** fluid logic, 8-bit: http://mkv25.net/dfma/movie-1084-numberabbeydemonstration&lt;br /&gt;
=== Such a doddle ===&lt;br /&gt;
* decimal display for 4-bit binary input&lt;br /&gt;
** mechanical logic, decimal with overflow-bit: http://mkv25.net/dfma/movie-1745-dwarfputerv01&lt;br /&gt;
** probably fluid logic: http://mkv25.net/dfma/movie-1657-7segmentlcddisplay&lt;br /&gt;
** fluid logic, hexadecimal: http://mkv25.net/dfma/movie-1092-7-segmentdisplaydemonstration&lt;br /&gt;
* tic tac toe&lt;br /&gt;
** mechanical logic http://mkv25.net/dfma/movie-1813-tictactoev10simple&lt;br /&gt;
&lt;br /&gt;
== See Also ==&lt;br /&gt;
* [[Fluid logic]]&lt;br /&gt;
* [[Mechanical logic]]&lt;br /&gt;
* [[Repeater]]&lt;br /&gt;
== Related user pages ==&lt;br /&gt;
[[User:BaronW]] - A calculator capable of addition and subtraction with inputs of up to 1023.&lt;br /&gt;
&lt;br /&gt;
[[User:SL/Logic Gates]] - These use mechanisms for connecting gates and devices and so forth, but fluid for logic. They're built on top of a body of water, and require power (for a pump or two per gate).&lt;br /&gt;
&lt;br /&gt;
[[User:Kyace/Adder]] - A full adder built using fluid logic, with a video of a rough prototype. Trivial to combine 8 of these to make a fluid device capable of adding two 8 bit numbers together.&lt;br /&gt;
&lt;br /&gt;
[[User:Soundandfury#Logic_Gates]] - These have a water supply reservoir above and a drain below.  The drained water can be pumped back to the supply reservoir.&lt;br /&gt;
&lt;br /&gt;
[[User:Bidok]] - Animal logic with all gates, memory, repeater and counter. All powered by kittens.&lt;br /&gt;
&lt;br /&gt;
[[User:LordOOTFD#Animal_Logic]] - Animal logic with fast complex gates, building upon Bidok's kitten powered systems.&lt;br /&gt;
&lt;br /&gt;
[[User:Hussell#Assorted_Devices]] - Fluid logic&lt;br /&gt;
&lt;br /&gt;
[[User:Gammon]] - Fluid logic. Very detailed CMOS gates.&lt;br /&gt;
[[Category:Guides]]&lt;br /&gt;
[[Category:Computing]]&lt;/div&gt;</summary>
		<author><name>LordOOTFD</name></author>
	</entry>
	<entry>
		<id>http://dwarffortresswiki.org/index.php?title=User:LordOOTFD&amp;diff=61944</id>
		<title>User:LordOOTFD</title>
		<link rel="alternate" type="text/html" href="http://dwarffortresswiki.org/index.php?title=User:LordOOTFD&amp;diff=61944"/>
		<updated>2010-01-29T06:25:22Z</updated>

		<summary type="html">&lt;p&gt;LordOOTFD: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;please excuse my terrible formatting, I'm still figuring it out as my copious edit count will show.&lt;br /&gt;
&lt;br /&gt;
==Animal Logic==&lt;br /&gt;
&lt;br /&gt;
Animal logic works as a function of the path finding algorithm in dwarf fortress, as all animals seek to find the lowest cost path to their desired objects (activity zone, parents, dwarfs, valuable objects, etc) this can be used to create very very complex logic gates. Animal logic has three principle advantages, speed, compactness, and simplified functions; however, animal logic is slower than mechanical logic, less reliable than either, and logic is often inverted.&lt;br /&gt;
&lt;br /&gt;
Throughout this document I will be using a number of terms which may not be immediately obvious so I'll list them here: &lt;br /&gt;
&lt;br /&gt;
'''Ground''': for simplicity the thing the animal is pathing to is refereed to as ground as that is the ground state which it wishes to reach. Ground is always the left unless otherwise noted.&lt;br /&gt;
&lt;br /&gt;
'''Purge''': Path to ground with no inputs&lt;br /&gt;
&lt;br /&gt;
'''Path cost''': The number of steps the animal must make to reach ground&lt;br /&gt;
&lt;br /&gt;
'''Fusion Gate''': Simply one or more logic gates built into the same system (this is more than simply stringing gates)&lt;br /&gt;
&lt;br /&gt;
'''Compund Gate''': Gate which uses two or more gates set to different path costs.&lt;br /&gt;
&lt;br /&gt;
'''And Gate''': And takes x inputs and output TRUE if ALL are TRUE.&lt;br /&gt;
&lt;br /&gt;
'''NAnd Gate''': NAnd takes x inputs and returns TRUE if ALL are FALSE. &lt;br /&gt;
&lt;br /&gt;
'''AndOr Gate''': AndOr takes x inputs and returns TRUE if X-Y are TRUE. (this gate is exclusive to animal logic, and is a single step fusion of And, and Or)&lt;br /&gt;
&lt;br /&gt;
'''Or Gate''': Or takes x input and output TRUE if ANY are true.&lt;br /&gt;
&lt;br /&gt;
'''Not Gate''': Not takes a single input and inverts it to the oposite state TRUE if FALSE. &lt;br /&gt;
&lt;br /&gt;
'''XOr Gate''': XOr takes 2 or more inputs and output TRUE if ONLY ONE is TRUE but NOT ALL are TRUE. &lt;br /&gt;
&lt;br /&gt;
'''NOr Gate''': NOr takes x input and returns TRUE if ALL inputs are FALSE. &lt;br /&gt;
&lt;br /&gt;
'''XNOr Gate''': XNOr takes 2 or more inputs and returns TRUE if ALL are TRUE, OR FALSE.&lt;br /&gt;
&lt;br /&gt;
For a better explanation of gates see:http://en.wikipedia.org/wiki/Logic_gate&lt;br /&gt;
&lt;br /&gt;
Notation: #:always 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) 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.&lt;br /&gt;
&lt;br /&gt;
Gates will always be capitalized in the way they are within the entry, I.E. And, Or, AndOr, XNOr, etc&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
There are three principle 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 principle reason for this is pathfinding always prefers the shortest path to ground, 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, more than a single on or off signal. For simplicity and streamlining the systems I have designed only use binary outputs, but theoretically they could be made to compute in decimal or some other system; however, this is maddening and all attempts have resulted in abominations which I do not wish to remember.&lt;br /&gt;
&lt;br /&gt;
==SIMPLE GATES==&lt;br /&gt;
&lt;br /&gt;
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 &amp;quot;wake up&amp;quot; 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 it's enclosure this allows the gate to respond faster 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 I find them to be better in general use.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''And'''&lt;br /&gt;
&lt;br /&gt;
This simple gate is made by confining the animal into a straight coridor; the ground path will have two or more doors which are connected to the input, while the second longer path remains clear. the gate can be configured as an NAnd gate by simply moving the pressure plate. if the plate is by the ground path it functions as an And gate returning TRUE if the ground path is open, and if the plate is by the purge path it will return FALSE when the inputs are TRUE&lt;br /&gt;
 #########&lt;br /&gt;
  ABCD^ D&lt;br /&gt;
 #########&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Multi And'''&lt;br /&gt;
&lt;br /&gt;
 ############&lt;br /&gt;
  ANYNUMD^ D&lt;br /&gt;
 ############&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''NAnd'''&lt;br /&gt;
&lt;br /&gt;
Reconfigured And gate, see And.&lt;br /&gt;
 #########&lt;br /&gt;
  ABCD ^D&lt;br /&gt;
 #########&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Or'''&lt;br /&gt;
&lt;br /&gt;
Basic gate&lt;br /&gt;
 #####&lt;br /&gt;
 AD^ D&lt;br /&gt;
 B####&lt;br /&gt;
 #####&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Multi Or'''&lt;br /&gt;
&lt;br /&gt;
 #######&lt;br /&gt;
 A #####&lt;br /&gt;
 N #####&lt;br /&gt;
 Y D^ D&lt;br /&gt;
 N #####&lt;br /&gt;
 M #####&lt;br /&gt;
 #######&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''NOr'''&lt;br /&gt;
&lt;br /&gt;
Basically a reconfigured Or gate&lt;br /&gt;
 #####&lt;br /&gt;
 AD ^D&lt;br /&gt;
 B####&lt;br /&gt;
 #####&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Not'''&lt;br /&gt;
&lt;br /&gt;
The simplest gate, It only takes a single imput.&lt;br /&gt;
 #######&lt;br /&gt;
  AD^ D&lt;br /&gt;
 #######&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Compound Gates==&lt;br /&gt;
&lt;br /&gt;
Basically two or more gates arranged with different path costs to ground. These gates can be configured in a number of different ways, these being the simplest. It may be possible to make these gates as single gates but that would require inverting some of the input. Simple compound gates use two simple gates and handle two inputs, complex compund gates have more then two simple gates and need more than two inputs. a Complex compound gate might be used to convert decimal numbers into binary using And gates&lt;br /&gt;
&lt;br /&gt;
'''XOr'''&lt;br /&gt;
&lt;br /&gt;
Compound of And and Or, when ONLY ONE is TRUE returns TRUE&lt;br /&gt;
If A and B are false the animal moves to the FALSE position by Purge, if A or B is true, the animal moves to the TRUE position at the Or gate, if both A and B are true the animal moves to the FALSE position by the And gate.&lt;br /&gt;
&lt;br /&gt;
 #g########&lt;br /&gt;
 # ABD  D #&lt;br /&gt;
 # ####^# #&lt;br /&gt;
 # ####D# #&lt;br /&gt;
 # ###BA# #&lt;br /&gt;
 #        #&lt;br /&gt;
 ##########&lt;br /&gt;
And path cost: 4&lt;br /&gt;
Or path cost: 10&lt;br /&gt;
Purge path cost: 14&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''XNor'''&lt;br /&gt;
&lt;br /&gt;
Inverse of XOr: Return TRUE if BOTH are TRUE OR FALSE&lt;br /&gt;
If A and B are false the animal move to the TRUE position by Purge, if A or B is true, the animal moves to the FALSE position at the Or gate, if both A and B are true the animal moves to the TRUE postion by the And gate.&lt;br /&gt;
&lt;br /&gt;
 #g#########&lt;br /&gt;
 #         #&lt;br /&gt;
 ##B###### #&lt;br /&gt;
 ###A## DA # &lt;br /&gt;
 ####D^##B #&lt;br /&gt;
 #####D### #&lt;br /&gt;
 ######    #&lt;br /&gt;
 ###########&lt;br /&gt;
And path cost: 4&lt;br /&gt;
Or path cost: 10&lt;br /&gt;
Purge path cost: 15&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Complex Compound gate, Octal display ALU'''&lt;br /&gt;
&lt;br /&gt;
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)&lt;br /&gt;
&lt;br /&gt;
 #################&lt;br /&gt;
                 #&lt;br /&gt;
 # # # # # # #1# #&lt;br /&gt;
 # # #1# #1#2#2# #&lt;br /&gt;
 #1#2#2#4#4#4#4# #&lt;br /&gt;
 #D#D#D#D#D#D#D#D#&lt;br /&gt;
 #               #&lt;br /&gt;
 #################&lt;br /&gt;
&lt;br /&gt;
 # ######&lt;br /&gt;
 # 1  D #&lt;br /&gt;
 # #### #&lt;br /&gt;
 # 2  D #&lt;br /&gt;
 # #### #&lt;br /&gt;
 # 12 D #&lt;br /&gt;
 # #### #&lt;br /&gt;
 # 4  D #&lt;br /&gt;
 # #### #&lt;br /&gt;
 # 14 D #&lt;br /&gt;
 # #### #&lt;br /&gt;
 # 24 D #&lt;br /&gt;
 # #### #&lt;br /&gt;
 # 124D #&lt;br /&gt;
 # #### #&lt;br /&gt;
 #    D #&lt;br /&gt;
 ########&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Fusion gates==&lt;br /&gt;
&lt;br /&gt;
These are gates which are constructed by physically combining the two gates to get a specific output.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''AndOr'''&lt;br /&gt;
&lt;br /&gt;
This gate will evaluate if either of x And statements are TRUE. This gate is built as a straight line similar to the And gate&lt;br /&gt;
 ######&lt;br /&gt;
 #C####&lt;br /&gt;
 ABD^ D&lt;br /&gt;
 C#####&lt;br /&gt;
 ######&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''NAndOr'''&lt;br /&gt;
&lt;br /&gt;
Reconfigured AndOr gate, see AndOr&lt;br /&gt;
 ######&lt;br /&gt;
 #C####&lt;br /&gt;
 ABD ^D&lt;br /&gt;
 C#####&lt;br /&gt;
 ######&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''OrandOr'''&lt;br /&gt;
&lt;br /&gt;
This gate returns true if either A or B and either C or D is true.&lt;br /&gt;
&lt;br /&gt;
 ######&lt;br /&gt;
 AC####&lt;br /&gt;
 BED^ D&lt;br /&gt;
 ######&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''OrandAnd'''&lt;br /&gt;
&lt;br /&gt;
This gate returns true if either A or B is true, and E and C are true.&lt;br /&gt;
&lt;br /&gt;
 #######&lt;br /&gt;
 A######&lt;br /&gt;
 BCED^ D&lt;br /&gt;
 #######&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Complex Gates==&lt;br /&gt;
&lt;br /&gt;
==Adders==&lt;br /&gt;
A Full adder can be made as a Compound Fusion gate, by combining, And, AndOr, and Or gates&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Binary Adder'''&lt;br /&gt;
&lt;br /&gt;
The first binary adder I attempted was structured like an electronic adder using an array of simple gates. It contained five animals and used grates to control the logic, based off of bidok's logic gates. This adder functioned correctly but it was very inefficient with space, and highly unreliable often taking ten plus minutes to properly align. I refined this design by lining the gates up into a linear arrangement, but this failed to solve the efficiency problems.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
I then realized that simply limiting my Adder to using Electronic gates was silly realizing the key point of animal logic I designed a single stage gate, which had four output states: 0,1,C,1&amp;amp;C. this allowed me to compress the Adder into a single circuit. Modifying the design further the use of doors allows the new design to function at approximately 4-6 times the speed of the prototype adder.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The Binary Adder function by adding three values, A,B, and Carry. Carry is only involved if the previous adder had a result of 2, or 3. the adder works by detecting if (A Or B Or C = True)Sum=1, Or (A And B, Or, A And C, Or B And C = True)Sum=2, Or (A And B And C = True)Sum=3, Or (A And B And C = False)Sum=0. With this basic logic one simply needs to configure the output for 1 if the answer is 1, C if the answer is 2, and 1 and C if the answer is 3. the gates must also be arranged so the Highest Sum has the shortest path to ground as otherwise the gate would return nonsense.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Stand alone Adders (they don't carry into another adder) require 22 mechanisms, and 14 doors.&lt;br /&gt;
Start Adders (They feed into the next Adder and include a carry) require 32 mechanisms, and 14 doors.&lt;br /&gt;
Chain Adders (The receive Carry, and pass a Carry bit up) require 32 mechanisms, and 14 doors&lt;br /&gt;
While Materials intensive the gates only take up 13x9 urists, ideal for chaining along mining tunnels.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Reference pictures&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery&amp;gt;&lt;br /&gt;
Image:Xnor,Xor,Nand,Or prototype adder STATE 1.PNG|Prototype digital adder&lt;br /&gt;
Image:And,Or,AndOr, Prototype adder STATE 3.PNG|sum 11&lt;br /&gt;
Image:And,Or,AndOr, Prototype adder STATE 2.PNG|sum 10&lt;br /&gt;
Image:And,Or,AndOr, Prototype adder STATE 1.PNG|sum 01&lt;br /&gt;
Image:And,Or,AndOr, Prototype adder STATE 0.PNG|sum 00&lt;br /&gt;
Image:9bit adder prototype interface pannel.PNG|9bit adder interface&lt;br /&gt;
Image:9bit adder prototype.PNG|9bit adder&lt;br /&gt;
Image:9bit adder prototype 10100010notes.PNG|9bit adder, notes show the decimal value of each adder's bit&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
By chaining these gates you can perform most binary math, the easiest of which is addition. In my old fort I built and tested my initial 9 Bit Addition computer. the design failed in two circumstances, the AndOr gate of bit 32 had a lower path cost than the And gate when the animal was at Sum 2, and the Or gate in bit 4 had a lower path cost than ground if the lower door was open.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The gates in the Super Snail adder can be reset to the correct positions by forbidding the doors which fault. I'm working on a more reliable compact adder. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Decimal Adder'''&lt;br /&gt;
&lt;br /&gt;
While it can be done, It's massively more complex than simply making a set of decimal converters working with numbers over 10,&lt;br /&gt;
&lt;br /&gt;
'''hexadecimal adder'''&lt;br /&gt;
&lt;br /&gt;
The hex adder makes use of 32 sum gates per side of a single adder, making it geometrically more complex than the binary adder, however it does make animal management more streamlined. more information to come.&lt;br /&gt;
&lt;br /&gt;
Status&lt;br /&gt;
Sum gates 0-31           done&lt;br /&gt;
layout                   pending&lt;br /&gt;
working prototype        pending&lt;br /&gt;
finished dorfputer       pending&lt;br /&gt;
&lt;br /&gt;
'''Subtractors'''&lt;br /&gt;
&lt;br /&gt;
inverse adder, simple but not yet tested.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Animals==&lt;br /&gt;
&lt;br /&gt;
Choosing the animal which works as the logic core for an animal logic systems is somewhat important, depending on your needs and the available animals. however pretty much anything will do as long as you can remember which animal fits into which gate (to avoid designating the same animal for more than one pit).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Kittens'''&lt;br /&gt;
&lt;br /&gt;
Put those worthless cats to work, load them into your fortress's logic core and make them work for their keep. while kittens are the most reliable cores for logic gates with their 3 pathing goals they're also problematic as they grow into cats which only have two, and may cause catsplosions inside your logical cores. Ideally kittens should be replaced yearly or biyearly as their growth defines.&lt;br /&gt;
Kittens path to the activity zone, their parents, and vermin.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Puppies'''&lt;br /&gt;
&lt;br /&gt;
Why should your fortresses working animals only work once they grow up? throw the puppies into the logic core and have them work from the day of their birth. Puppies are quite reliable with their two pathing goals, but retain the problem of maturation.&lt;br /&gt;
Puppies path to the activity zone, and their parents.&lt;br /&gt;
&lt;br /&gt;
'''Animal Children'''&lt;br /&gt;
&lt;br /&gt;
Using the non matured animals for something useful before butchering may be quite effective, however they still must be flushed when they mature.&lt;br /&gt;
Animal children path to the activity zone, and their parents.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Cats'''&lt;br /&gt;
&lt;br /&gt;
Aggravating animals, throw them into the computer and get some worth out of them. Otherwise useless cats become useful when used for logic, with two pathing goals they're responsive, and multiply quickly. watch out for catsplosions while using these critters&lt;br /&gt;
Cats path to the activity zone, and Vermin.&lt;br /&gt;
&lt;br /&gt;
'''Dogs'''&lt;br /&gt;
&lt;br /&gt;
The workhorse of your fortress, because horses can't do anything useful. I'd recommend not using dogs as they're put to better use as wardogs to protect your dorfs.&lt;br /&gt;
Dogs path to the activity zone.&lt;br /&gt;
&lt;br /&gt;
'''Cattle'''&lt;br /&gt;
&lt;br /&gt;
Large lumbering bovines, the advantage of Cattle is you can tell the sexes apart, they also make the pressure plates continue to work if you forget to reassign the trigger weight.&lt;br /&gt;
Cattle path to the activity zone.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Other animals'''&lt;br /&gt;
&lt;br /&gt;
Any animals work, but the above are probably your best choice, excluding any modded animals. however if you have a GCS handy a GCS powered computer would be awesome, so take this as you will.&lt;br /&gt;
Other animals have different pathing goals, but most only path to the activity zone.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Goblins'''&lt;br /&gt;
&lt;br /&gt;
I'm working on an incremental goblin powered system, results pending.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Putting it all together==&lt;br /&gt;
&lt;br /&gt;
When it comes time to automate your systems the first thing you need to know is what needs to automated and what should remain manual. an obsidian farm with completely autonomous control of the casting process is all well and good, until it drowns all your legendary miners when it prematurely triggers. all systems should have manual controls and failsafes to help avoid FUN! (but because we all love FUN sometimes you forget to fully connect that emergency drain, or that failsafe system you built somehow failed.)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
once you know the steps you need in your system it comes time to select the parts you need to automate, whether it be basic logic gates or more sophisticated multiple trigger systems.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This is mainly pure logic and I can't really help with that, but post a requirement in the talk page and if I see it I'll work on it. Consult the computing page on this wiki, and look up digital logic on Wikipedia. past that it's pretty fundamental and I don't really think I can adequately describe it.&lt;/div&gt;</summary>
		<author><name>LordOOTFD</name></author>
	</entry>
	<entry>
		<id>http://dwarffortresswiki.org/index.php?title=User:LordOOTFD&amp;diff=61943</id>
		<title>User:LordOOTFD</title>
		<link rel="alternate" type="text/html" href="http://dwarffortresswiki.org/index.php?title=User:LordOOTFD&amp;diff=61943"/>
		<updated>2010-01-29T06:24:11Z</updated>

		<summary type="html">&lt;p&gt;LordOOTFD: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;please excuse my terrible formatting, I'm still figuring it out as my copious edit count will show.&lt;br /&gt;
&lt;br /&gt;
==Animal Logic==&lt;br /&gt;
&lt;br /&gt;
Animal logic works as a function of the path finding algorithm in dwarf fortress, as all animals seek to find the lowest cost path to their desired objects (activity zone, parents, dwarfs, valuable objects, etc) this can be used to create very very complex logic gates. Animal logic has three principle advantages, speed, compactness, and simplified functions; however, animal logic is slower than mechanical logic, less reliable than either, and logic is often inverted.&lt;br /&gt;
&lt;br /&gt;
Throughout this document I will be using a number of terms which may not be immediately obvious so I'll list them here: &lt;br /&gt;
&lt;br /&gt;
'''Ground''': for simplicity the thing the animal is pathing to is refereed to as ground as that is the ground state which it wishes to reach. Ground is always the left unless otherwise noted.&lt;br /&gt;
&lt;br /&gt;
'''Purge''': Path to ground with no inputs&lt;br /&gt;
&lt;br /&gt;
'''Path cost''': The number of steps the animal must make to reach ground&lt;br /&gt;
&lt;br /&gt;
'''Fusion Gate''': Simply one or more logic gates built into the same system (this is more than simply stringing gates)&lt;br /&gt;
&lt;br /&gt;
'''Compund Gate''': Gate which uses two or more gates set to different path costs.&lt;br /&gt;
&lt;br /&gt;
'''And Gate''': And takes x inputs and output TRUE if ALL are TRUE.&lt;br /&gt;
&lt;br /&gt;
'''NAnd Gate''': NAnd takes x inputs and returns TRUE if ALL are FALSE. &lt;br /&gt;
&lt;br /&gt;
'''AndOr Gate''': AndOr takes x inputs and returns TRUE if X-Y are TRUE. (this gate is exclusive to animal logic, and is a single step fusion of And, and Or)&lt;br /&gt;
&lt;br /&gt;
'''Or Gate''': Or takes x input and output TRUE if ANY are true.&lt;br /&gt;
&lt;br /&gt;
'''Not Gate''': Not takes a single input and inverts it to the oposite state TRUE if FALSE. &lt;br /&gt;
&lt;br /&gt;
'''XOr Gate''': XOr takes 2 or more inputs and output TRUE if ONLY ONE is TRUE but NOT ALL are TRUE. &lt;br /&gt;
&lt;br /&gt;
'''NOr Gate''': NOr takes x input and returns TRUE if ALL inputs are FALSE. &lt;br /&gt;
&lt;br /&gt;
'''XNOr Gate''': XNOr takes 2 or more inputs and returns TRUE if ALL are TRUE, OR FALSE.&lt;br /&gt;
&lt;br /&gt;
For a better explanation of gates see:http://en.wikipedia.org/wiki/Logic_gate&lt;br /&gt;
&lt;br /&gt;
Notation: #:always 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) 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.&lt;br /&gt;
&lt;br /&gt;
Gates will always be capitalized in the way they are within the entry, I.E. And, Or, AndOr, XNOr, etc&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
There are three principle 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 principle reason for this is pathfinding always prefers the shortest path to ground, 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, more than a single on or off signal. For simplicity and streamlining the systems I have designed only use binary outputs, but theoretically they could be made to compute in decimal or some other system; however, this is maddening and all attempts have resulted in abominations which I do not wish to remember.&lt;br /&gt;
&lt;br /&gt;
==SIMPLE GATES==&lt;br /&gt;
&lt;br /&gt;
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 &amp;quot;wake up&amp;quot; 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 it's enclosure this allows the gate to respond faster 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 I find them to be better in general use.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''And'''&lt;br /&gt;
&lt;br /&gt;
This simple gate is made by confining the animal into a straight coridor; the ground path will have two or more doors which are connected to the input, while the second longer path remains clear. the gate can be configured as an NAnd gate by simply moving the pressure plate. if the plate is by the ground path it functions as an And gate returning TRUE if the ground path is open, and if the plate is by the purge path it will return FALSE when the inputs are TRUE&lt;br /&gt;
 #########&lt;br /&gt;
  ABCD^ D&lt;br /&gt;
 #########&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Multi And'''&lt;br /&gt;
&lt;br /&gt;
 ############&lt;br /&gt;
  ANYNUMD^ D&lt;br /&gt;
 ############&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''NAnd'''&lt;br /&gt;
&lt;br /&gt;
Reconfigured And gate, see And.&lt;br /&gt;
 #########&lt;br /&gt;
  ABCD ^D&lt;br /&gt;
 #########&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Or'''&lt;br /&gt;
&lt;br /&gt;
Basic gate&lt;br /&gt;
 #####&lt;br /&gt;
 AD^ D&lt;br /&gt;
 B####&lt;br /&gt;
 #####&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Multi Or'''&lt;br /&gt;
&lt;br /&gt;
 #######&lt;br /&gt;
 A #####&lt;br /&gt;
 N #####&lt;br /&gt;
 Y D^ D&lt;br /&gt;
 N #####&lt;br /&gt;
 M #####&lt;br /&gt;
 #######&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''NOr'''&lt;br /&gt;
&lt;br /&gt;
Basically a reconfigured Or gate&lt;br /&gt;
 #####&lt;br /&gt;
 AD ^D&lt;br /&gt;
 B####&lt;br /&gt;
 #####&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Not'''&lt;br /&gt;
&lt;br /&gt;
The simplest gate, It only takes a single imput.&lt;br /&gt;
 #######&lt;br /&gt;
  AD^ D&lt;br /&gt;
 #######&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Compound Gates==&lt;br /&gt;
&lt;br /&gt;
Basically two or more gates arranged with different path costs to ground. These gates can be configured in a number of different ways, these being the simplest. It may be possible to make these gates as single gates but that would require inverting some of the input. Simple compound gates use two simple gates and handle two inputs, complex compund gates have more then two simple gates and need more than two inputs. a Complex compound gate might be used to convert decimal numbers into binary using And gates&lt;br /&gt;
&lt;br /&gt;
'''XOr'''&lt;br /&gt;
&lt;br /&gt;
Compound of And and Or, when ONLY ONE is TRUE returns TRUE&lt;br /&gt;
If A and B are false the animal moves to the FALSE position by Purge, if A or B is true, the animal moves to the TRUE position at the Or gate, if both A and B are true the animal moves to the FALSE position by the And gate.&lt;br /&gt;
&lt;br /&gt;
 #g########&lt;br /&gt;
 # ABD  D #&lt;br /&gt;
 # ####^# #&lt;br /&gt;
 # ####D# #&lt;br /&gt;
 # ###BA# #&lt;br /&gt;
 #        #&lt;br /&gt;
 ##########&lt;br /&gt;
And path cost: 4&lt;br /&gt;
Or path cost: 10&lt;br /&gt;
Purge path cost: 14&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''XNor'''&lt;br /&gt;
&lt;br /&gt;
Inverse of XOr: Return TRUE if BOTH are TRUE OR FALSE&lt;br /&gt;
If A and B are false the animal move to the TRUE position by Purge, if A or B is true, the animal moves to the FALSE position at the Or gate, if both A and B are true the animal moves to the TRUE postion by the And gate.&lt;br /&gt;
&lt;br /&gt;
 #g#########&lt;br /&gt;
 #         #&lt;br /&gt;
 ##B###### #&lt;br /&gt;
 ###A## DA # &lt;br /&gt;
 ####D^##B #&lt;br /&gt;
 #####D### #&lt;br /&gt;
 ######    #&lt;br /&gt;
 ###########&lt;br /&gt;
And path cost: 4&lt;br /&gt;
Or path cost: 10&lt;br /&gt;
Purge path cost: 15&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Complex Compound gate, Octal display ALU'''&lt;br /&gt;
&lt;br /&gt;
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)&lt;br /&gt;
&lt;br /&gt;
 #################&lt;br /&gt;
                 #&lt;br /&gt;
 # # # # # # #1# #&lt;br /&gt;
 # # #1# #1#2#2# #&lt;br /&gt;
 #1#2#2#4#4#4#4# #&lt;br /&gt;
 #D#D#D#D#D#D#D#D#&lt;br /&gt;
 #               #&lt;br /&gt;
 #################&lt;br /&gt;
&lt;br /&gt;
 # ######&lt;br /&gt;
 # 1  D #&lt;br /&gt;
 # #### #&lt;br /&gt;
 # 2  D #&lt;br /&gt;
 # #### #&lt;br /&gt;
 # 12 D #&lt;br /&gt;
 # #### #&lt;br /&gt;
 # 4  D #&lt;br /&gt;
 # #### #&lt;br /&gt;
 # 14 D #&lt;br /&gt;
 # #### #&lt;br /&gt;
 # 24 D #&lt;br /&gt;
 # #### #&lt;br /&gt;
 # 124D #&lt;br /&gt;
 # #### #&lt;br /&gt;
 #    D #&lt;br /&gt;
 ########&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Fusion gates==&lt;br /&gt;
&lt;br /&gt;
These are gates which are constructed by physically combining the two gates to get a specific output.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''AndOr'''&lt;br /&gt;
&lt;br /&gt;
This gate will evaluate if either of x And statements are TRUE. This gate is built as a straight line similar to the And gate&lt;br /&gt;
 ######&lt;br /&gt;
 #C####&lt;br /&gt;
 ABD^ D&lt;br /&gt;
 C#####&lt;br /&gt;
 ######&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''NAndOr'''&lt;br /&gt;
&lt;br /&gt;
Reconfigured AndOr gate, see AndOr&lt;br /&gt;
 ######&lt;br /&gt;
 #C####&lt;br /&gt;
 ABD ^D&lt;br /&gt;
 C#####&lt;br /&gt;
 ######&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''OrandOr'''&lt;br /&gt;
&lt;br /&gt;
This gate returns true if either A or B and either C or D is true.&lt;br /&gt;
&lt;br /&gt;
 ######&lt;br /&gt;
 AC####&lt;br /&gt;
 BED^ D&lt;br /&gt;
 ######&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''OrandAnd'''&lt;br /&gt;
&lt;br /&gt;
This gate returns true if either A or B is true, and E and C are true.&lt;br /&gt;
&lt;br /&gt;
 #######&lt;br /&gt;
 A######&lt;br /&gt;
 BCED^ D&lt;br /&gt;
 #######&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Complex Gates==&lt;br /&gt;
&lt;br /&gt;
==Adders==&lt;br /&gt;
A Full adder can be made as a Compound Fusion gate, by combining, And, AndOr, and Or gates&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Binary Adder'''&lt;br /&gt;
&lt;br /&gt;
The first binary adder I attempted was structured like an electronic adder using an array of simple gates. It contained five animals and used grates to control the logic, based off of bidok's logic gates. This adder functioned correctly but it was very inefficient with space, and highly unreliable often taking ten plus minutes to properly align. I refined this design by lining the gates up into a linear arrangement, but this failed to solve the efficiency problems.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
I then realized that simply limiting my Adder to using Electronic gates was silly realizing the key point of animal logic I designed a single stage gate, which had four output states: 0,1,C,1&amp;amp;C. this allowed me to compress the Adder into a single circuit. Modifying the design further the use of doors allows the new design to function at approximately 4-6 times the speed of the prototype adder.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The Binary Adder function by adding three values, A,B, and Carry. Carry is only involved if the previous adder had a result of 2, or 3. the adder works by detecting if (A Or B Or C = True)Sum=1, Or (A And B, Or, A And C, Or B And C = True)Sum=2, Or (A And B And C = True)Sum=3, Or (A And B And C = False)Sum=0. With this basic logic one simply needs to configure the output for 1 if the answer is 1, C if the answer is 2, and 1 and C if the answer is 3. the gates must also be arranged so the Highest Sum has the shortest path to ground as otherwise the gate would return nonsense.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Stand alone Adders (they don't carry into another adder) require 22 mechanisms, and 14 doors.&lt;br /&gt;
Start Adders (They feed into the next Adder and include a carry) require 32 mechanisms, and 14 doors.&lt;br /&gt;
Chain Adders (The receive Carry, and pass a Carry bit up) require 32 mechanisms, and 14 doors&lt;br /&gt;
While Materials intensive the gates only take up 13x9 urists, ideal for chaining along mining tunnels.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Reference pictures&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery&amp;gt;&lt;br /&gt;
Image:Xnor,Xor,Nand,Or prototype adder STATE 1.PNG|Prototype digital adder&lt;br /&gt;
Image:And,Or,AndOr, Prototype adder STATE 3.PNG|sum 11&lt;br /&gt;
Image:And,Or,AndOr, Prototype adder STATE 2.PNG|sum 10&lt;br /&gt;
Image:And,Or,AndOr, Prototype adder STATE 1.PNG|sum 01&lt;br /&gt;
Image:And,Or,AndOr, Prototype adder STATE 0.PNG|sum 00&lt;br /&gt;
Image:9bit adder prototype interface pannel.PNG|9bit adder interface&lt;br /&gt;
Image:9bit adder prototype.PNG|9bit adder&lt;br /&gt;
'''Bold text'''Image:9bit adder prototype 10100010notes.PNG|9bit adder, notes show the decimal value of each adder's bit&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
By chaining these gates you can perform most binary math, the easiest of which is addition. In my old fort I built and tested my initial 9 Bit Addition computer. the design failed in two circumstances, the AndOr gate of bit 32 had a lower path cost than the And gate when the animal was at Sum 2, and the Or gate in bit 4 had a lower path cost than ground if the lower door was open.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The gates in the Super Snail adder can be reset to the correct positions by forbidding the doors which fault. I'm working on a more reliable compact adder. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Decimal Adder'''&lt;br /&gt;
&lt;br /&gt;
While it can be done, It's massively more complex than simply making a set of decimal converters working with numbers over 10,&lt;br /&gt;
&lt;br /&gt;
'''hexadecimal adder'''&lt;br /&gt;
&lt;br /&gt;
The hex adder makes use of 32 sum gates per side of a single adder, making it geometrically more complex than the binary adder, however it does make animal management more streamlined. more information to come.&lt;br /&gt;
&lt;br /&gt;
Status&lt;br /&gt;
Sum gates 0-31           done&lt;br /&gt;
layout                   pending&lt;br /&gt;
working prototype        pending&lt;br /&gt;
finished dorfputer       pending&lt;br /&gt;
&lt;br /&gt;
'''Subtractors'''&lt;br /&gt;
&lt;br /&gt;
inverse adder, simple but not yet tested.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Animals==&lt;br /&gt;
&lt;br /&gt;
Choosing the animal which works as the logic core for an animal logic systems is somewhat important, depending on your needs and the available animals. however pretty much anything will do as long as you can remember which animal fits into which gate (to avoid designating the same animal for more than one pit).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Kittens'''&lt;br /&gt;
&lt;br /&gt;
Put those worthless cats to work, load them into your fortress's logic core and make them work for their keep. while kittens are the most reliable cores for logic gates with their 3 pathing goals they're also problematic as they grow into cats which only have two, and may cause catsplosions inside your logical cores. Ideally kittens should be replaced yearly or biyearly as their growth defines.&lt;br /&gt;
Kittens path to the activity zone, their parents, and vermin.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Puppies'''&lt;br /&gt;
&lt;br /&gt;
Why should your fortresses working animals only work once they grow up? throw the puppies into the logic core and have them work from the day of their birth. Puppies are quite reliable with their two pathing goals, but retain the problem of maturation.&lt;br /&gt;
Puppies path to the activity zone, and their parents.&lt;br /&gt;
&lt;br /&gt;
'''Animal Children'''&lt;br /&gt;
&lt;br /&gt;
Using the non matured animals for something useful before butchering may be quite effective, however they still must be flushed when they mature.&lt;br /&gt;
Animal children path to the activity zone, and their parents.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Cats'''&lt;br /&gt;
&lt;br /&gt;
Aggravating animals, throw them into the computer and get some worth out of them. Otherwise useless cats become useful when used for logic, with two pathing goals they're responsive, and multiply quickly. watch out for catsplosions while using these critters&lt;br /&gt;
Cats path to the activity zone, and Vermin.&lt;br /&gt;
&lt;br /&gt;
'''Dogs'''&lt;br /&gt;
&lt;br /&gt;
The workhorse of your fortress, because horses can't do anything useful. I'd recommend not using dogs as they're put to better use as wardogs to protect your dorfs.&lt;br /&gt;
Dogs path to the activity zone.&lt;br /&gt;
&lt;br /&gt;
'''Cattle'''&lt;br /&gt;
&lt;br /&gt;
Large lumbering bovines, the advantage of Cattle is you can tell the sexes apart, they also make the pressure plates continue to work if you forget to reassign the trigger weight.&lt;br /&gt;
Cattle path to the activity zone.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Other animals'''&lt;br /&gt;
&lt;br /&gt;
Any animals work, but the above are probably your best choice, excluding any modded animals. however if you have a GCS handy a GCS powered computer would be awesome, so take this as you will.&lt;br /&gt;
Other animals have different pathing goals, but most only path to the activity zone.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Goblins'''&lt;br /&gt;
&lt;br /&gt;
I'm working on an incremental goblin powered system, results pending.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Putting it all together==&lt;br /&gt;
&lt;br /&gt;
When it comes time to automate your systems the first thing you need to know is what needs to automated and what should remain manual. an obsidian farm with completely autonomous control of the casting process is all well and good, until it drowns all your legendary miners when it prematurely triggers. all systems should have manual controls and failsafes to help avoid FUN! (but because we all love FUN sometimes you forget to fully connect that emergency drain, or that failsafe system you built somehow failed.)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
once you know the steps you need in your system it comes time to select the parts you need to automate, whether it be basic logic gates or more sophisticated multiple trigger systems.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This is mainly pure logic and I can't really help with that, but post a requirement in the talk page and if I see it I'll work on it. Consult the computing page on this wiki, and look up digital logic on Wikipedia. past that it's pretty fundamental and I don't really think I can adequately describe it.&lt;/div&gt;</summary>
		<author><name>LordOOTFD</name></author>
	</entry>
	<entry>
		<id>http://dwarffortresswiki.org/index.php?title=User:LordOOTFD&amp;diff=61942</id>
		<title>User:LordOOTFD</title>
		<link rel="alternate" type="text/html" href="http://dwarffortresswiki.org/index.php?title=User:LordOOTFD&amp;diff=61942"/>
		<updated>2010-01-29T06:07:18Z</updated>

		<summary type="html">&lt;p&gt;LordOOTFD: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;please excuse my terrible formatting, I'm still figuring it out as my copious edit count will show.&lt;br /&gt;
&lt;br /&gt;
==Animal Logic==&lt;br /&gt;
&lt;br /&gt;
Animal logic works as a function of the path finding algorithm in dwarf fortress, as all animals seek to find the lowest cost path to their desired objects (activity zone, parents, dwarfs, valuable objects, etc) this can be used to create very very complex logic gates. Animal logic has three principle advantages, speed, compactness, and simplified functions; however, animal logic is slower than mechanical logic, less reliable than either, and logic is often inverted.&lt;br /&gt;
&lt;br /&gt;
Throughout this document I will be using a number of terms which may not be immediately obvious so I'll list them here: &lt;br /&gt;
&lt;br /&gt;
'''Ground''': for simplicity the thing the animal is pathing to is refereed to as ground as that is the ground state which it wishes to reach. Ground is always the left unless otherwise noted.&lt;br /&gt;
&lt;br /&gt;
'''Purge''': Path to ground with no inputs&lt;br /&gt;
&lt;br /&gt;
'''Path cost''': The number of steps the animal must make to reach ground&lt;br /&gt;
&lt;br /&gt;
'''Fusion Gate''': Simply one or more logic gates built into the same system (this is more than simply stringing gates)&lt;br /&gt;
&lt;br /&gt;
'''Compund Gate''': Gate which uses two or more gates set to different path costs.&lt;br /&gt;
&lt;br /&gt;
'''And Gate''': And takes x inputs and output TRUE if ALL are TRUE.&lt;br /&gt;
&lt;br /&gt;
'''NAnd Gate''': NAnd takes x inputs and returns TRUE if ALL are FALSE. &lt;br /&gt;
&lt;br /&gt;
'''AndOr Gate''': AndOr takes x inputs and returns TRUE if X-Y are TRUE. (this gate is exclusive to animal logic, and is a single step fusion of And, and Or)&lt;br /&gt;
&lt;br /&gt;
'''Or Gate''': Or takes x input and output TRUE if ANY are true.&lt;br /&gt;
&lt;br /&gt;
'''Not Gate''': Not takes a single input and inverts it to the oposite state TRUE if FALSE. &lt;br /&gt;
&lt;br /&gt;
'''XOr Gate''': XOr takes 2 or more inputs and output TRUE if ONLY ONE is TRUE but NOT ALL are TRUE. &lt;br /&gt;
&lt;br /&gt;
'''NOr Gate''': NOr takes x input and returns TRUE if ALL inputs are FALSE. &lt;br /&gt;
&lt;br /&gt;
'''XNOr Gate''': XNOr takes 2 or more inputs and returns TRUE if ALL are TRUE, OR FALSE.&lt;br /&gt;
&lt;br /&gt;
For a better explanation of gates see:http://en.wikipedia.org/wiki/Logic_gate&lt;br /&gt;
&lt;br /&gt;
Notation: #:always 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) 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.&lt;br /&gt;
&lt;br /&gt;
Gates will always be capitalized in the way they are within the entry, I.E. And, Or, AndOr, XNOr, etc&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
There are three principle 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 principle reason for this is pathfinding always prefers the shortest path to ground, 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, more than a single on or off signal. For simplicity and streamlining the systems I have designed only use binary outputs, but theoretically they could be made to compute in decimal or some other system; however, this is maddening and all attempts have resulted in abominations which I do not wish to remember.&lt;br /&gt;
&lt;br /&gt;
==SIMPLE GATES==&lt;br /&gt;
&lt;br /&gt;
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 &amp;quot;wake up&amp;quot; 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 it's enclosure this allows the gate to respond faster 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 I find them to be better in general use.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''And'''&lt;br /&gt;
&lt;br /&gt;
This simple gate is made by confining the animal into a straight coridor; the ground path will have two or more doors which are connected to the input, while the second longer path remains clear. the gate can be configured as an NAnd gate by simply moving the pressure plate. if the plate is by the ground path it functions as an And gate returning TRUE if the ground path is open, and if the plate is by the purge path it will return FALSE when the inputs are TRUE&lt;br /&gt;
 #########&lt;br /&gt;
  ABCD^ D&lt;br /&gt;
 #########&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Multi And'''&lt;br /&gt;
&lt;br /&gt;
 ############&lt;br /&gt;
  ANYNUMD^ D&lt;br /&gt;
 ############&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''NAnd'''&lt;br /&gt;
&lt;br /&gt;
Reconfigured And gate, see And.&lt;br /&gt;
 #########&lt;br /&gt;
  ABCD ^D&lt;br /&gt;
 #########&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Or'''&lt;br /&gt;
&lt;br /&gt;
Basic gate&lt;br /&gt;
 #####&lt;br /&gt;
 AD^ D&lt;br /&gt;
 B####&lt;br /&gt;
 #####&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Multi Or'''&lt;br /&gt;
&lt;br /&gt;
 #######&lt;br /&gt;
 A #####&lt;br /&gt;
 N #####&lt;br /&gt;
 Y D^ D&lt;br /&gt;
 N #####&lt;br /&gt;
 M #####&lt;br /&gt;
 #######&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''NOr'''&lt;br /&gt;
&lt;br /&gt;
Basically a reconfigured Or gate&lt;br /&gt;
 #####&lt;br /&gt;
 AD ^D&lt;br /&gt;
 B####&lt;br /&gt;
 #####&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Not'''&lt;br /&gt;
&lt;br /&gt;
The simplest gate, It only takes a single imput.&lt;br /&gt;
 #######&lt;br /&gt;
  AD^ D&lt;br /&gt;
 #######&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Compound Gates==&lt;br /&gt;
&lt;br /&gt;
Basically two or more gates arranged with different path costs to ground. These gates can be configured in a number of different ways, these being the simplest. It may be possible to make these gates as single gates but that would require inverting some of the input. Simple compound gates use two simple gates and handle two inputs, complex compund gates have more then two simple gates and need more than two inputs. a Complex compound gate might be used to convert decimal numbers into binary using And gates&lt;br /&gt;
&lt;br /&gt;
'''XOr'''&lt;br /&gt;
&lt;br /&gt;
Compound of And and Or, when ONLY ONE is TRUE returns TRUE&lt;br /&gt;
If A and B are false the animal moves to the FALSE position by Purge, if A or B is true, the animal moves to the TRUE position at the Or gate, if both A and B are true the animal moves to the FALSE position by the And gate.&lt;br /&gt;
&lt;br /&gt;
 #g########&lt;br /&gt;
 # ABD  D #&lt;br /&gt;
 # ####^# #&lt;br /&gt;
 # ####D# #&lt;br /&gt;
 # ###BA# #&lt;br /&gt;
 #        #&lt;br /&gt;
 ##########&lt;br /&gt;
And path cost: 4&lt;br /&gt;
Or path cost: 10&lt;br /&gt;
Purge path cost: 14&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''XNor'''&lt;br /&gt;
&lt;br /&gt;
Inverse of XOr: Return TRUE if BOTH are TRUE OR FALSE&lt;br /&gt;
If A and B are false the animal move to the TRUE position by Purge, if A or B is true, the animal moves to the FALSE position at the Or gate, if both A and B are true the animal moves to the TRUE postion by the And gate.&lt;br /&gt;
&lt;br /&gt;
 #g#########&lt;br /&gt;
 #         #&lt;br /&gt;
 ##B###### #&lt;br /&gt;
 ###A## DA # &lt;br /&gt;
 ####D^##B #&lt;br /&gt;
 #####D### #&lt;br /&gt;
 ######    #&lt;br /&gt;
 ###########&lt;br /&gt;
And path cost: 4&lt;br /&gt;
Or path cost: 10&lt;br /&gt;
Purge path cost: 15&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Complex Compound gate, Octal display ALU'''&lt;br /&gt;
&lt;br /&gt;
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)&lt;br /&gt;
&lt;br /&gt;
 #################&lt;br /&gt;
                 #&lt;br /&gt;
 # # # # # # #1# #&lt;br /&gt;
 # # #1# #1#2#2# #&lt;br /&gt;
 #1#2#2#4#4#4#4# #&lt;br /&gt;
 #D#D#D#D#D#D#D#D#&lt;br /&gt;
 #               #&lt;br /&gt;
 #################&lt;br /&gt;
&lt;br /&gt;
 # ######&lt;br /&gt;
 # 1  D #&lt;br /&gt;
 # #### #&lt;br /&gt;
 # 2  D #&lt;br /&gt;
 # #### #&lt;br /&gt;
 # 12 D #&lt;br /&gt;
 # #### #&lt;br /&gt;
 # 4  D #&lt;br /&gt;
 # #### #&lt;br /&gt;
 # 14 D #&lt;br /&gt;
 # #### #&lt;br /&gt;
 # 24 D #&lt;br /&gt;
 # #### #&lt;br /&gt;
 # 124D #&lt;br /&gt;
 # #### #&lt;br /&gt;
 #    D #&lt;br /&gt;
 ########&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Fusion gates==&lt;br /&gt;
&lt;br /&gt;
These are gates which are constructed by physically combining the two gates to get a specific output.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''AndOr'''&lt;br /&gt;
&lt;br /&gt;
This gate will evaluate if either of x And statements are TRUE. This gate is built as a straight line similar to the And gate&lt;br /&gt;
 ######&lt;br /&gt;
 #C####&lt;br /&gt;
 ABD^ D&lt;br /&gt;
 C#####&lt;br /&gt;
 ######&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''NAndOr'''&lt;br /&gt;
&lt;br /&gt;
Reconfigured AndOr gate, see AndOr&lt;br /&gt;
 ######&lt;br /&gt;
 #C####&lt;br /&gt;
 ABD ^D&lt;br /&gt;
 C#####&lt;br /&gt;
 ######&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''OrandOr'''&lt;br /&gt;
&lt;br /&gt;
This gate returns true if either A or B and either C or D is true.&lt;br /&gt;
&lt;br /&gt;
 ######&lt;br /&gt;
 AC####&lt;br /&gt;
 BED^ D&lt;br /&gt;
 ######&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''OrandAnd'''&lt;br /&gt;
&lt;br /&gt;
This gate returns true if either A or B is true, and E and C are true.&lt;br /&gt;
&lt;br /&gt;
 #######&lt;br /&gt;
 A######&lt;br /&gt;
 BCED^ D&lt;br /&gt;
 #######&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Complex Gates==&lt;br /&gt;
&lt;br /&gt;
==Adders==&lt;br /&gt;
A Full adder can be made as a Compound Fusion gate, by combining, And, AndOr, and Or gates&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Binary Adder'''&lt;br /&gt;
&lt;br /&gt;
The first binary adder I attempted was structured like an electronic adder using an array of simple gates. It contained five animals and used grates to control the logic, based off of bidok's logic gates. This adder functioned correctly but it was very inefficient with space, and highly unreliable often taking ten plus minutes to properly align. I refined this design by lining the gates up into a linear arrangement, but this failed to solve the efficiency problems.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
I then realized that simply limiting my Adder to using Electronic gates was silly realizing the key point of animal logic I designed a single stage gate, which had four output states: 0,1,C,1&amp;amp;C. this allowed me to compress the Adder into a single circuit. Modifying the design further the use of doors allows the new design to function at approximately 4-6 times the speed of the prototype adder.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The Binary Adder function by adding three values, A,B, and Carry. Carry is only involved if the previous adder had a result of 2, or 3. the adder works by detecting if (A Or B Or C = True)Sum=1, Or (A And B, Or, A And C, Or B And C = True)Sum=2, Or (A And B And C = True)Sum=3, Or (A And B And C = False)Sum=0. With this basic logic one simply needs to configure the output for 1 if the answer is 1, C if the answer is 2, and 1 and C if the answer is 3. the gates must also be arranged so the Highest Sum has the shortest path to ground as otherwise the gate would return nonsense.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Stand alone Adders (they don't carry into another adder) require 22 mechanisms, and 14 doors.&lt;br /&gt;
Start Adders (They feed into the next Adder and include a carry) require 32 mechanisms, and 14 doors.&lt;br /&gt;
Chain Adders (The receive Carry, and pass a Carry bit up) require 32 mechanisms, and 14 doors&lt;br /&gt;
While Materials intensive the gates only take up 13x9 urists, ideal for chaining along mining tunnels.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Reference pictures&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery&amp;gt;&lt;br /&gt;
Image:Xnor,Xor,Nand,Or prototype adder STATE 1.PNG|Prototype digital adder&lt;br /&gt;
Image:And,Or,AndOr, Prototype adder STATE 3.PNG|sum 11&lt;br /&gt;
Image:And,Or,AndOr, Prototype adder STATE 2.PNG|sum 10&lt;br /&gt;
Image:And,Or,AndOr, Prototype adder STATE 1.PNG|sum 01&lt;br /&gt;
Image:And,Or,AndOr, Prototype adder STATE 0.PNG|sum 00&lt;br /&gt;
Image:9bit adder prototype interface pannel.PNG|9bit adder interface&lt;br /&gt;
Image:9bit adder prototype.PNG|9bit adder&lt;br /&gt;
'''Bold text'''Image:9bit adder prototype 10100010notes.PNG|9bit adder, notes show the decimal value of each adder's bit&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
By chaining these gates you can perform most binary math, the easiest of which is addition. In my old fort I built and tested my initial 9 Bit Addition computer. the design failed in two circumstances, the AndOr gate of bit 32 had a lower path cost than the And gate when the animal was at Sum 2, and the Or gate in bit 4 had a lower path cost than ground if the lower door was open.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The gates in the Super Snail adder can be reset to the correct positions by forbidding the doors which fault. I'm working on a more reliable compact adder. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Decimal Adder'''&lt;br /&gt;
&lt;br /&gt;
While it can be done, It's massively more complex than simply making a set of decimal converters working with numbers over 10,&lt;br /&gt;
&lt;br /&gt;
'''hexadecimal adder'''&lt;br /&gt;
&lt;br /&gt;
The hex adder makes use of 32 sum gates per side of a single adder, making it geometrically more complex than the binary adder, however it does make animal management more streamlined. more information to come.&lt;br /&gt;
&lt;br /&gt;
Status&lt;br /&gt;
Sum gates 0-31           done&lt;br /&gt;
layout                   pending&lt;br /&gt;
working prototype        pending&lt;br /&gt;
finished dorfputer       pending&lt;br /&gt;
&lt;br /&gt;
'''Subtractors'''&lt;br /&gt;
&lt;br /&gt;
inverse adder, simple but not yet tested.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Animals==&lt;br /&gt;
&lt;br /&gt;
Choosing the animal which works as the logic core for an animal logic systems is somewhat important, depending on your needs and the available animals. however pretty much anything will do as long as you can remember which animal fits into which gate (to avoid designating the same animal for more than one pit).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Kittens'''&lt;br /&gt;
&lt;br /&gt;
Put those worthless cats to work, load them into your fortress's logic core and make them work for their keep. while kittens are the most reliable cores for logic gates with their 3 pathing goals they're also problematic as they grow into cats which only have two, and may cause catsplosions inside your logical cores. Ideally kittens should be replaced yearly or biyearly as their growth defines.&lt;br /&gt;
Kittens path to the activity zone, their parents, and vermin.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Puppies'''&lt;br /&gt;
&lt;br /&gt;
Why should your fortresses working animals only work once they grow up? throw the puppies into the logic core and have them work from the day of their birth. Puppies are quite reliable with their two pathing goals, but retain the problem of maturation.&lt;br /&gt;
Puppies path to the activity zone, and their parents.&lt;br /&gt;
&lt;br /&gt;
'''Animal Children'''&lt;br /&gt;
&lt;br /&gt;
Using the non matured animals for something useful before butchering may be quite effective, however they still must be flushed when they mature.&lt;br /&gt;
Animal children path to the activity zone, and their parents.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Cats'''&lt;br /&gt;
&lt;br /&gt;
Aggravating animals, throw them into the computer and get some worth out of them. Otherwise useless cats become useful when used for logic, with two pathing goals they're responsive, and multiply quickly. watch out for catsplosions while using these critters&lt;br /&gt;
Cats path to the activity zone, and Vermin.&lt;br /&gt;
&lt;br /&gt;
'''&lt;br /&gt;
Dogs'''&lt;br /&gt;
&lt;br /&gt;
The workhorse of your fortress, because horses can't do anything useful. I'd recommend not using dogs as they're put to better use as wardogs to protect your dorfs.&lt;br /&gt;
Dogs path to the activity zone.&lt;br /&gt;
&lt;br /&gt;
'''&lt;br /&gt;
Cattle'''&lt;br /&gt;
&lt;br /&gt;
Large lumbering bovines, the advantage of Cattle is you can tell the sexes apart, they also make the pressure plates continue to work if you forget to reassign the trigger weight.&lt;br /&gt;
Cattle path to the activity zone.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Other animals'''&lt;br /&gt;
&lt;br /&gt;
Any animals work, but the above are probably your best choice, excluding any modded animals. however if you have a GCS handy a GCS powered computer would be awesome, so take this as you will.&lt;br /&gt;
Other animals have different pathing goals, but most only path to the activity zone.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Goblins'''&lt;br /&gt;
&lt;br /&gt;
I'm working on an incremental goblin powered system, results pending.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Putting it all together==&lt;br /&gt;
&lt;br /&gt;
When it comes time to automate your systems the first thing you need to know is what needs to automated and what should remain manual. an obsidian farm with completely autonomous control of the casting process is all well and good, until it drowns all your legendary miners when it prematurely triggers. all systems should have manual controls and failsafes to help avoid FUN! (but because we all love FUN sometimes you forget to fully connect that emergency drain, or that failsafe system you built somehow failed.)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
once you know the steps you need in your system it comes time to select the parts you need to automate, whether it be basic logic gates or more sophisticated multiple trigger systems.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This is mainly pure logic and I can't really help with that, but post a requirement in the talk page and if I see it I'll work on it. Consult the computing page on this wiki, and look up digital logic on Wikipedia. past that it's pretty fundamental and I don't really think I can adequately describe it.&lt;/div&gt;</summary>
		<author><name>LordOOTFD</name></author>
	</entry>
	<entry>
		<id>http://dwarffortresswiki.org/index.php?title=User:LordOOTFD&amp;diff=61941</id>
		<title>User:LordOOTFD</title>
		<link rel="alternate" type="text/html" href="http://dwarffortresswiki.org/index.php?title=User:LordOOTFD&amp;diff=61941"/>
		<updated>2010-01-29T06:06:23Z</updated>

		<summary type="html">&lt;p&gt;LordOOTFD: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;please excuse my terrible formatting, I'm still figuring it out as my copious edit count will show.&lt;br /&gt;
&lt;br /&gt;
==Animal Logic==&lt;br /&gt;
&lt;br /&gt;
Animal logic works as a function of the path finding algorithm in dwarf fortress, as all animals seek to find the lowest cost path to their desired objects (activity zone, parents, dwarfs, valuable objects, etc) this can be used to create very very complex logic gates. Animal logic has three principle advantages, speed, compactness, and simplified functions; however, animal logic is slower than mechanical logic, less reliable than either, and logic is often inverted.&lt;br /&gt;
&lt;br /&gt;
Throughout this document I will be using a number of terms which may not be immediately obvious so I'll list them here: &lt;br /&gt;
&lt;br /&gt;
'''Ground''': for simplicity the thing the animal is pathing to is refereed to as ground as that is the ground state which it wishes to reach. Ground is always the left unless otherwise noted.&lt;br /&gt;
'''&lt;br /&gt;
Purge''': Path to ground with no inputs&lt;br /&gt;
'''&lt;br /&gt;
Path cost''': The number of steps the animal must make to reach ground&lt;br /&gt;
&lt;br /&gt;
'''Fusion Gate''': Simply one or more logic gates built into the same system (this is more than simply stringing gates)&lt;br /&gt;
&lt;br /&gt;
'''Compund Gate''': Gate which uses two or more gates set to different path costs.&lt;br /&gt;
'''&lt;br /&gt;
And Gate''': And takes x inputs and output TRUE if ALL are TRUE.&lt;br /&gt;
'''&lt;br /&gt;
NAnd Gate''': NAnd takes x inputs and returns TRUE if ALL are FALSE. &lt;br /&gt;
&lt;br /&gt;
'''AndOr Gate''': AndOr takes x inputs and returns TRUE if X-Y are TRUE. (this gate is exclusive to animal logic, and is a single step fusion of And, and Or)&lt;br /&gt;
&lt;br /&gt;
'''Or Gate''': Or takes x input and output TRUE if ANY are true.&lt;br /&gt;
'''&lt;br /&gt;
Not Gate''': Not takes a single input and inverts it to the oposite state TRUE if FALSE. &lt;br /&gt;
'''&lt;br /&gt;
XOr Gate''': XOr takes 2 or more inputs and output TRUE if ONLY ONE is TRUE but NOT ALL are TRUE. &lt;br /&gt;
'''&lt;br /&gt;
NOr Gate''': NOr takes x input and returns TRUE if ALL inputs are FALSE. &lt;br /&gt;
&lt;br /&gt;
'''XNOr Gate''': XNOr takes 2 or more inputs and returns TRUE if ALL are TRUE, OR FALSE.&lt;br /&gt;
&lt;br /&gt;
For a better explanation of gates see:http://en.wikipedia.org/wiki/Logic_gate&lt;br /&gt;
&lt;br /&gt;
Notation: #:always 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) 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.&lt;br /&gt;
&lt;br /&gt;
Gates will always be capitalized in the way they are within the entry, I.E. And, Or, AndOr, XNOr, etc&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
There are three principle 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 principle reason for this is pathfinding always prefers the shortest path to ground, 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, more than a single on or off signal. For simplicity and streamlining the systems I have designed only use binary outputs, but theoretically they could be made to compute in decimal or some other system; however, this is maddening and all attempts have resulted in abominations which I do not wish to remember.&lt;br /&gt;
&lt;br /&gt;
==SIMPLE GATES==&lt;br /&gt;
&lt;br /&gt;
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 &amp;quot;wake up&amp;quot; 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 it's enclosure this allows the gate to respond faster 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 I find them to be better in general use.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''And'''&lt;br /&gt;
&lt;br /&gt;
This simple gate is made by confining the animal into a straight coridor; the ground path will have two or more doors which are connected to the input, while the second longer path remains clear. the gate can be configured as an NAnd gate by simply moving the pressure plate. if the plate is by the ground path it functions as an And gate returning TRUE if the ground path is open, and if the plate is by the purge path it will return FALSE when the inputs are TRUE&lt;br /&gt;
 #########&lt;br /&gt;
  ABCD^ D&lt;br /&gt;
 #########&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Multi And'''&lt;br /&gt;
&lt;br /&gt;
 ############&lt;br /&gt;
  ANYNUMD^ D&lt;br /&gt;
 ############&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''NAnd'''&lt;br /&gt;
&lt;br /&gt;
Reconfigured And gate, see And.&lt;br /&gt;
 #########&lt;br /&gt;
  ABCD ^D&lt;br /&gt;
 #########&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Or'''&lt;br /&gt;
&lt;br /&gt;
Basic gate&lt;br /&gt;
 #####&lt;br /&gt;
 AD^ D&lt;br /&gt;
 B####&lt;br /&gt;
 #####&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Multi Or'''&lt;br /&gt;
&lt;br /&gt;
 #######&lt;br /&gt;
 A #####&lt;br /&gt;
 N #####&lt;br /&gt;
 Y D^ D&lt;br /&gt;
 N #####&lt;br /&gt;
 M #####&lt;br /&gt;
 #######&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''NOr'''&lt;br /&gt;
&lt;br /&gt;
Basically a reconfigured Or gate&lt;br /&gt;
 #####&lt;br /&gt;
 AD ^D&lt;br /&gt;
 B####&lt;br /&gt;
 #####&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Not'''&lt;br /&gt;
&lt;br /&gt;
The simplest gate, It only takes a single imput.&lt;br /&gt;
 #######&lt;br /&gt;
  AD^ D&lt;br /&gt;
 #######&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Compound Gates==&lt;br /&gt;
&lt;br /&gt;
Basically two or more gates arranged with different path costs to ground. These gates can be configured in a number of different ways, these being the simplest. It may be possible to make these gates as single gates but that would require inverting some of the input. Simple compound gates use two simple gates and handle two inputs, complex compund gates have more then two simple gates and need more than two inputs. a Complex compound gate might be used to convert decimal numbers into binary using And gates&lt;br /&gt;
&lt;br /&gt;
'''XOr'''&lt;br /&gt;
&lt;br /&gt;
Compound of And and Or, when ONLY ONE is TRUE returns TRUE&lt;br /&gt;
If A and B are false the animal moves to the FALSE position by Purge, if A or B is true, the animal moves to the TRUE position at the Or gate, if both A and B are true the animal moves to the FALSE position by the And gate.&lt;br /&gt;
&lt;br /&gt;
 #g########&lt;br /&gt;
 # ABD  D #&lt;br /&gt;
 # ####^# #&lt;br /&gt;
 # ####D# #&lt;br /&gt;
 # ###BA# #&lt;br /&gt;
 #        #&lt;br /&gt;
 ##########&lt;br /&gt;
And path cost: 4&lt;br /&gt;
Or path cost: 10&lt;br /&gt;
Purge path cost: 14&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''XNor'''&lt;br /&gt;
&lt;br /&gt;
Inverse of XOr: Return TRUE if BOTH are TRUE OR FALSE&lt;br /&gt;
If A and B are false the animal move to the TRUE position by Purge, if A or B is true, the animal moves to the FALSE position at the Or gate, if both A and B are true the animal moves to the TRUE postion by the And gate.&lt;br /&gt;
&lt;br /&gt;
 #g#########&lt;br /&gt;
 #         #&lt;br /&gt;
 ##B###### #&lt;br /&gt;
 ###A## DA # &lt;br /&gt;
 ####D^##B #&lt;br /&gt;
 #####D### #&lt;br /&gt;
 ######    #&lt;br /&gt;
 ###########&lt;br /&gt;
And path cost: 4&lt;br /&gt;
Or path cost: 10&lt;br /&gt;
Purge path cost: 15&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Complex Compound gate, Octal display ALU'''&lt;br /&gt;
&lt;br /&gt;
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)&lt;br /&gt;
&lt;br /&gt;
 #################&lt;br /&gt;
                 #&lt;br /&gt;
 # # # # # # #1# #&lt;br /&gt;
 # # #1# #1#2#2# #&lt;br /&gt;
 #1#2#2#4#4#4#4# #&lt;br /&gt;
 #D#D#D#D#D#D#D#D#&lt;br /&gt;
 #               #&lt;br /&gt;
 #################&lt;br /&gt;
&lt;br /&gt;
 # ######&lt;br /&gt;
 # 1  D #&lt;br /&gt;
 # #### #&lt;br /&gt;
 # 2  D #&lt;br /&gt;
 # #### #&lt;br /&gt;
 # 12 D #&lt;br /&gt;
 # #### #&lt;br /&gt;
 # 4  D #&lt;br /&gt;
 # #### #&lt;br /&gt;
 # 14 D #&lt;br /&gt;
 # #### #&lt;br /&gt;
 # 24 D #&lt;br /&gt;
 # #### #&lt;br /&gt;
 # 124D #&lt;br /&gt;
 # #### #&lt;br /&gt;
 #    D #&lt;br /&gt;
 ########&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Fusion gates==&lt;br /&gt;
&lt;br /&gt;
These are gates which are constructed by physically combining the two gates to get a specific output.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''AndOr'''&lt;br /&gt;
&lt;br /&gt;
This gate will evaluate if either of x And statements are TRUE. This gate is built as a straight line similar to the And gate&lt;br /&gt;
 ######&lt;br /&gt;
 #C####&lt;br /&gt;
 ABD^ D&lt;br /&gt;
 C#####&lt;br /&gt;
 ######&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''NAndOr'''&lt;br /&gt;
&lt;br /&gt;
Reconfigured AndOr gate, see AndOr&lt;br /&gt;
 ######&lt;br /&gt;
 #C####&lt;br /&gt;
 ABD ^D&lt;br /&gt;
 C#####&lt;br /&gt;
 ######&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''OrandOr'''&lt;br /&gt;
&lt;br /&gt;
This gate returns true if either A or B and either C or D is true.&lt;br /&gt;
&lt;br /&gt;
 ######&lt;br /&gt;
 AC####&lt;br /&gt;
 BED^ D&lt;br /&gt;
 ######&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''OrandAnd'''&lt;br /&gt;
&lt;br /&gt;
This gate returns true if either A or B is true, and E and C are true.&lt;br /&gt;
&lt;br /&gt;
 #######&lt;br /&gt;
 A######&lt;br /&gt;
 BCED^ D&lt;br /&gt;
 #######&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Complex Gates==&lt;br /&gt;
&lt;br /&gt;
==Adders==&lt;br /&gt;
A Full adder can be made as a Compound Fusion gate, by combining, And, AndOr, and Or gates&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Binary Adder'''&lt;br /&gt;
&lt;br /&gt;
The first binary adder I attempted was structured like an electronic adder using an array of simple gates. It contained five animals and used grates to control the logic, based off of bidok's logic gates. This adder functioned correctly but it was very inefficient with space, and highly unreliable often taking ten plus minutes to properly align. I refined this design by lining the gates up into a linear arrangement, but this failed to solve the efficiency problems.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
I then realized that simply limiting my Adder to using Electronic gates was silly realizing the key point of animal logic I designed a single stage gate, which had four output states: 0,1,C,1&amp;amp;C. this allowed me to compress the Adder into a single circuit. Modifying the design further the use of doors allows the new design to function at approximately 4-6 times the speed of the prototype adder.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The Binary Adder function by adding three values, A,B, and Carry. Carry is only involved if the previous adder had a result of 2, or 3. the adder works by detecting if (A Or B Or C = True)Sum=1, Or (A And B, Or, A And C, Or B And C = True)Sum=2, Or (A And B And C = True)Sum=3, Or (A And B And C = False)Sum=0. With this basic logic one simply needs to configure the output for 1 if the answer is 1, C if the answer is 2, and 1 and C if the answer is 3. the gates must also be arranged so the Highest Sum has the shortest path to ground as otherwise the gate would return nonsense.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Stand alone Adders (they don't carry into another adder) require 22 mechanisms, and 14 doors.&lt;br /&gt;
Start Adders (They feed into the next Adder and include a carry) require 32 mechanisms, and 14 doors.&lt;br /&gt;
Chain Adders (The receive Carry, and pass a Carry bit up) require 32 mechanisms, and 14 doors&lt;br /&gt;
While Materials intensive the gates only take up 13x9 urists, ideal for chaining along mining tunnels.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Reference pictures&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery&amp;gt;&lt;br /&gt;
Image:Xnor,Xor,Nand,Or prototype adder STATE 1.PNG|Prototype digital adder&lt;br /&gt;
Image:And,Or,AndOr, Prototype adder STATE 3.PNG|sum 11&lt;br /&gt;
Image:And,Or,AndOr, Prototype adder STATE 2.PNG|sum 10&lt;br /&gt;
Image:And,Or,AndOr, Prototype adder STATE 1.PNG|sum 01&lt;br /&gt;
Image:And,Or,AndOr, Prototype adder STATE 0.PNG|sum 00&lt;br /&gt;
Image:9bit adder prototype interface pannel.PNG|9bit adder interface&lt;br /&gt;
Image:9bit adder prototype.PNG|9bit adder&lt;br /&gt;
'''Bold text'''Image:9bit adder prototype 10100010notes.PNG|9bit adder, notes show the decimal value of each adder's bit&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
By chaining these gates you can perform most binary math, the easiest of which is addition. In my old fort I built and tested my initial 9 Bit Addition computer. the design failed in two circumstances, the AndOr gate of bit 32 had a lower path cost than the And gate when the animal was at Sum 2, and the Or gate in bit 4 had a lower path cost than ground if the lower door was open.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The gates in the Super Snail adder can be reset to the correct positions by forbidding the doors which fault. I'm working on a more reliable compact adder. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Decimal Adder'''&lt;br /&gt;
&lt;br /&gt;
While it can be done, It's massively more complex than simply making a set of decimal converters working with numbers over 10,&lt;br /&gt;
&lt;br /&gt;
'''hexadecimal adder'''&lt;br /&gt;
&lt;br /&gt;
The hex adder makes use of 32 sum gates per side of a single adder, making it geometrically more complex than the binary adder, however it does make animal management more streamlined. more information to come.&lt;br /&gt;
&lt;br /&gt;
Status&lt;br /&gt;
Sum gates 0-31           done&lt;br /&gt;
layout                   pending&lt;br /&gt;
working prototype        pending&lt;br /&gt;
finished dorfputer       pending&lt;br /&gt;
&lt;br /&gt;
'''Subtractors'''&lt;br /&gt;
&lt;br /&gt;
inverse adder, simple but not yet tested.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Animals==&lt;br /&gt;
&lt;br /&gt;
Choosing the animal which works as the logic core for an animal logic systems is somewhat important, depending on your needs and the available animals. however pretty much anything will do as long as you can remember which animal fits into which gate (to avoid designating the same animal for more than one pit).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Kittens'''&lt;br /&gt;
&lt;br /&gt;
Put those worthless cats to work, load them into your fortress's logic core and make them work for their keep. while kittens are the most reliable cores for logic gates with their 3 pathing goals they're also problematic as they grow into cats which only have two, and may cause catsplosions inside your logical cores. Ideally kittens should be replaced yearly or biyearly as their growth defines.&lt;br /&gt;
Kittens path to the activity zone, their parents, and vermin.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Puppies'''&lt;br /&gt;
&lt;br /&gt;
Why should your fortresses working animals only work once they grow up? throw the puppies into the logic core and have them work from the day of their birth. Puppies are quite reliable with their two pathing goals, but retain the problem of maturation.&lt;br /&gt;
Puppies path to the activity zone, and their parents.&lt;br /&gt;
&lt;br /&gt;
'''Animal Children'''&lt;br /&gt;
&lt;br /&gt;
Using the non matured animals for something useful before butchering may be quite effective, however they still must be flushed when they mature.&lt;br /&gt;
Animal children path to the activity zone, and their parents.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Cats'''&lt;br /&gt;
&lt;br /&gt;
Aggravating animals, throw them into the computer and get some worth out of them. Otherwise useless cats become useful when used for logic, with two pathing goals they're responsive, and multiply quickly. watch out for catsplosions while using these critters&lt;br /&gt;
Cats path to the activity zone, and Vermin.&lt;br /&gt;
&lt;br /&gt;
'''&lt;br /&gt;
Dogs'''&lt;br /&gt;
&lt;br /&gt;
The workhorse of your fortress, because horses can't do anything useful. I'd recommend not using dogs as they're put to better use as wardogs to protect your dorfs.&lt;br /&gt;
Dogs path to the activity zone.&lt;br /&gt;
&lt;br /&gt;
'''&lt;br /&gt;
Cattle'''&lt;br /&gt;
&lt;br /&gt;
Large lumbering bovines, the advantage of Cattle is you can tell the sexes apart, they also make the pressure plates continue to work if you forget to reassign the trigger weight.&lt;br /&gt;
Cattle path to the activity zone.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Other animals'''&lt;br /&gt;
&lt;br /&gt;
Any animals work, but the above are probably your best choice, excluding any modded animals. however if you have a GCS handy a GCS powered computer would be awesome, so take this as you will.&lt;br /&gt;
Other animals have different pathing goals, but most only path to the activity zone.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Goblins'''&lt;br /&gt;
&lt;br /&gt;
I'm working on an incremental goblin powered system, results pending.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Putting it all together==&lt;br /&gt;
&lt;br /&gt;
When it comes time to automate your systems the first thing you need to know is what needs to automated and what should remain manual. an obsidian farm with completely autonomous control of the casting process is all well and good, until it drowns all your legendary miners when it prematurely triggers. all systems should have manual controls and failsafes to help avoid FUN! (but because we all love FUN sometimes you forget to fully connect that emergency drain, or that failsafe system you built somehow failed.)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
once you know the steps you need in your system it comes time to select the parts you need to automate, whether it be basic logic gates or more sophisticated multiple trigger systems.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This is mainly pure logic and I can't really help with that, but post a requirement in the talk page and if I see it I'll work on it. Consult the computing page on this wiki, and look up digital logic on Wikipedia. past that it's pretty fundamental and I don't really think I can adequately describe it.&lt;/div&gt;</summary>
		<author><name>LordOOTFD</name></author>
	</entry>
	<entry>
		<id>http://dwarffortresswiki.org/index.php?title=User:LordOOTFD&amp;diff=61940</id>
		<title>User:LordOOTFD</title>
		<link rel="alternate" type="text/html" href="http://dwarffortresswiki.org/index.php?title=User:LordOOTFD&amp;diff=61940"/>
		<updated>2010-01-29T05:54:52Z</updated>

		<summary type="html">&lt;p&gt;LordOOTFD: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Animal logic works as a function of the path finding algorithm in dwarf fortress, as all animals seek to find the lowest cost path to their desired objects (activity zone, parents, dwarfs, valuable objects, etc) this can be used to create very very complex logic gates. Animal logic has three principle advantages, speed, compactness, and simplified functions; however, animal logic is slower than mechanical logic, less reliable than either, and logic is often inverted.&lt;br /&gt;
&lt;br /&gt;
Throughout this document I will be using a number of terms which may not be immediately obvious so I'll list them here: &lt;br /&gt;
&lt;br /&gt;
Ground: for simplicity the thing the animal is pathing to is refereed to as ground as that is the ground state which it wishes to reach. Ground is always the left unless otherwise noted.&lt;br /&gt;
&lt;br /&gt;
Purge: Path to ground with no inputs&lt;br /&gt;
&lt;br /&gt;
Path cost: The number of steps the animal must make to reach ground&lt;br /&gt;
&lt;br /&gt;
Fusion Gate: Simply one or more logic gates built into the same system (this is more than simply stringing gates)&lt;br /&gt;
&lt;br /&gt;
Compund Gate: Gate which uses two or more gates set to different path costs.&lt;br /&gt;
&lt;br /&gt;
And Gate: And takes x inputs and output TRUE if ALL are TRUE.&lt;br /&gt;
&lt;br /&gt;
NAnd Gate: NAnd takes x inputs and returns TRUE if ALL are FALSE. &lt;br /&gt;
&lt;br /&gt;
AndOr Gate: AndOr takes x inputs and returns TRUE if X-Y are TRUE. (this gate is exclusive to animal logic, and is a single step fusion of And, and Or)&lt;br /&gt;
&lt;br /&gt;
Or Gate: Or takes x input and output TRUE if ANY are true.&lt;br /&gt;
&lt;br /&gt;
Not Gate: Not takes a single input and inverts it to the oposite state TRUE if FALSE. &lt;br /&gt;
&lt;br /&gt;
XOr Gate: XOr takes 2 or more inputs and output TRUE if ONLY ONE is TRUE but NOT ALL are TRUE. &lt;br /&gt;
&lt;br /&gt;
NOr Gate: NOr takes x input and returns TRUE if ALL inputs are FALSE. &lt;br /&gt;
&lt;br /&gt;
XNOr Gate: XNOr takes 2 or more inputs and returns TRUE if ALL are TRUE, OR FALSE.&lt;br /&gt;
&lt;br /&gt;
For a better explanation of gates see:http://en.wikipedia.org/wiki/Logic_gate&lt;br /&gt;
&lt;br /&gt;
Notation: #:always 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) 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.&lt;br /&gt;
&lt;br /&gt;
Gates will always be capitalized in the way they are within the entry, I.E. And, Or, AndOr, XNOr, etc&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
There are three principle 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 principle reason for this is pathfinding always prefers the shortest path to ground, 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, more than a single on or off signal. For simplicity and streamlining the systems I have designed only use binary outputs, but theoretically they could be made to compute natively in decimal; however, this is a bit more complicated than a week of study allows.&lt;br /&gt;
&lt;br /&gt;
==SIMPLE GATES==&lt;br /&gt;
&lt;br /&gt;
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 &amp;quot;wake up&amp;quot; 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 it's enclosure, this allows the gate to respond faster 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 I find them to be better in general use.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
And&lt;br /&gt;
This simple gate is made by confining the animal into a straight coridor; the ground path will have two or more doors which are connected to the input, while the second longer path remains clear. the gate can be configured as an NAnd gate by simply moving the pressure plate. if the plate is by the ground path it functions as an And gate returning TRUE if the ground path is open, and if the plate is by the purge path it will return FALSE when the inputs are TRUE&lt;br /&gt;
 #########&lt;br /&gt;
  ABCD^ D&lt;br /&gt;
 #########&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Multi And&lt;br /&gt;
 ############&lt;br /&gt;
  ANYNUMD^ D&lt;br /&gt;
 ############&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
NAnd&lt;br /&gt;
Reconfigured And gate, see And.&lt;br /&gt;
 #########&lt;br /&gt;
  ABCD ^D&lt;br /&gt;
 #########&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Or&lt;br /&gt;
Basic gate&lt;br /&gt;
 #####&lt;br /&gt;
 AD^ D&lt;br /&gt;
 B####&lt;br /&gt;
 #####&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Multi Or&lt;br /&gt;
 #######&lt;br /&gt;
 A #####&lt;br /&gt;
 N #####&lt;br /&gt;
 Y D^ D&lt;br /&gt;
 N #####&lt;br /&gt;
 M #####&lt;br /&gt;
 #######&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
NOr&lt;br /&gt;
Basically a reconfigured Or gate&lt;br /&gt;
 #####&lt;br /&gt;
 AD ^D&lt;br /&gt;
 B####&lt;br /&gt;
 #####&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Not&lt;br /&gt;
The simplest gate, It only takes a single imput.&lt;br /&gt;
 #######&lt;br /&gt;
  AD^ D&lt;br /&gt;
 #######&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Compound Gates==&lt;br /&gt;
&lt;br /&gt;
Basically two or more gates arranged with different path costs to ground. These gates can be configured in a number of different ways, these being the simplest. It may be possible to make these gates as single gates but that would require inverting some of the input. Simple compund gates use two simple gates and handle two inputs, complex compund gates have more then two simple gates and need more than two inputs. a Complex compund gate might be used to convert decimal numbers into binary using And gates&lt;br /&gt;
&lt;br /&gt;
XOr&lt;br /&gt;
Compound of And and Or, when ONLY ONE is TRUE returns TRUE&lt;br /&gt;
If A and B are false the animal moves to the FALSE position by Purge, if A or B is true, the animal moves to the TRUE position at the Or gate, if both A and B are true the animal moves to the FALSE postion by the And gate.&lt;br /&gt;
&lt;br /&gt;
 #g########&lt;br /&gt;
 # ABD  D #&lt;br /&gt;
 # ####^# #&lt;br /&gt;
 # ####D# #&lt;br /&gt;
 # ###BA# #&lt;br /&gt;
 #        #&lt;br /&gt;
 ##########&lt;br /&gt;
And path cost: 4&lt;br /&gt;
Or path cost: 10&lt;br /&gt;
Purge path cost: 14&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
XNor&lt;br /&gt;
Inverse of XOr: Return TRUE if BOTH are TRUE OR FALSE&lt;br /&gt;
If A and B are false the animal move to the TRUE position by Purge, if A or B is true, the animal moves to the FALSE position at the Or gate, if both A and B are true the animal moves to the TRUE postion by the And gate.&lt;br /&gt;
&lt;br /&gt;
 #g#########&lt;br /&gt;
 #         #&lt;br /&gt;
 ##B###### #&lt;br /&gt;
 ###A## DA # &lt;br /&gt;
 ####D^##B #&lt;br /&gt;
 #####D### #&lt;br /&gt;
 ######    #&lt;br /&gt;
 ###########&lt;br /&gt;
And path cost: 4&lt;br /&gt;
Or path cost: 10&lt;br /&gt;
Purge path cost: 15&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Complex Compound gate, Octal display ALU&lt;br /&gt;
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)&lt;br /&gt;
&lt;br /&gt;
 #################&lt;br /&gt;
                 #&lt;br /&gt;
 # # # # # # #1# #&lt;br /&gt;
 # # #1# #1#2#2# #&lt;br /&gt;
 #1#2#2#4#4#4#4# #&lt;br /&gt;
 #D#D#D#D#D#D#D#D#&lt;br /&gt;
 #               #&lt;br /&gt;
 #################&lt;br /&gt;
&lt;br /&gt;
 # ######&lt;br /&gt;
 # 1  D #&lt;br /&gt;
 # #### #&lt;br /&gt;
 # 2  D #&lt;br /&gt;
 # #### #&lt;br /&gt;
 # 12 D #&lt;br /&gt;
 # #### #&lt;br /&gt;
 # 4  D #&lt;br /&gt;
 # #### #&lt;br /&gt;
 # 14 D #&lt;br /&gt;
 # #### #&lt;br /&gt;
 # 24 D #&lt;br /&gt;
 # #### #&lt;br /&gt;
 # 124D #&lt;br /&gt;
 # #### #&lt;br /&gt;
 #    D #&lt;br /&gt;
 ########&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Fusion gates==&lt;br /&gt;
&lt;br /&gt;
These are gates which are constructed by physically combining the two gates to get a specific output.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
AndOr&lt;br /&gt;
This gate will evaluate if either of x And statements are TRUE. This gate is built as a straight line similar to the And gate&lt;br /&gt;
 ######&lt;br /&gt;
 #C####&lt;br /&gt;
 ABD^ D&lt;br /&gt;
 C#####&lt;br /&gt;
 ######&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
NAndOr&lt;br /&gt;
Reconfigured AndOr gate, see AndOr&lt;br /&gt;
 ######&lt;br /&gt;
 #C####&lt;br /&gt;
 ABD ^D&lt;br /&gt;
 C#####&lt;br /&gt;
 ######&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
OrandOr&lt;br /&gt;
This gate returns true if either A or B and either C or D is true.&lt;br /&gt;
&lt;br /&gt;
 ######&lt;br /&gt;
 AC####&lt;br /&gt;
 BED^ D&lt;br /&gt;
 ######&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
OrandAnd&lt;br /&gt;
This gate returns true if either A or B is true, and E and C are true.&lt;br /&gt;
&lt;br /&gt;
 #######&lt;br /&gt;
 A######&lt;br /&gt;
 BCED^ D&lt;br /&gt;
 #######&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Complex Gates==&lt;br /&gt;
&lt;br /&gt;
==Adders==&lt;br /&gt;
A Full adder can be made as a Compound Fusion gate, by combining, And, AndOr, and Or gates&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Binary Adder&lt;br /&gt;
The first binary adder I attempted was structured like an electronic adder using an array of simple gates. It contained five animals and used grates to control the logic, based off of bidok's logic gates. This adder functioned correctly but it was very inefficient with space, and highly unreliable often taking ten plus minutes to properly align. I refined this design by lining the gates up into a linear arrangement, but this failed to solve the efficiency problems.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
I then realized that simply limiting my Adder to using Electronic gates was silly realizing the key point of animal logic I designed a single stage gate, which had four output states: 0,1,C,1&amp;amp;C. this allowed me to compress the Adder into a single circuit. Modifying the design further the use of doors allows the new design to function at approximately 4-6 times the speed of the prototype adder.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The Binary Adder function by adding three values, A,B, and Carry. Carry is only involved if the previous adder had a result of 2, or 3. the adder works by detecting if (A Or B Or C = True)Sum=1, Or (A And B, Or, A And C, Or B And C = True)Sum=2, Or (A And B And C = True)Sum=3, Or (A And B And C = False)Sum=0. With this basic logic one simply needs to configure the output for 1 if the answer is 1, C if the answer is 2, and 1 and C if the answer is 3. the gates must also be arranged so the Highest Sum has the shortest path to ground as otherwise the gate would return nonsense.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Stand alone Adders (they don't carry into another adder) require 22 mechanisms, and 14 doors.&lt;br /&gt;
Start Adders (They feed into the next Adder and include a carry) require 32 mechanisms, and 14 doors.&lt;br /&gt;
Chain Adders (The receive Carry, and pass a Carry bit up) require 32 mechanisms, and 14 doors&lt;br /&gt;
While Materials intensive the gates only take up 13x9 urists, ideal for chaining along mining tunnels.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Reference pictures&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery&amp;gt;&lt;br /&gt;
Image:Xnor,Xor,Nand,Or prototype adder STATE 1.PNG|Prototype digital adder&lt;br /&gt;
Image:And,Or,AndOr, Prototype adder STATE 3.PNG|sum 11&lt;br /&gt;
Image:And,Or,AndOr, Prototype adder STATE 2.PNG|sum 10&lt;br /&gt;
Image:And,Or,AndOr, Prototype adder STATE 1.PNG|sum 01&lt;br /&gt;
Image:And,Or,AndOr, Prototype adder STATE 0.PNG|sum 00&lt;br /&gt;
Image:9bit adder prototype interface pannel.PNG|9bit adder interface&lt;br /&gt;
Image:9bit adder prototype.PNG|9bit adder&lt;br /&gt;
Image:9bit adder prototype 10100010notes.PNG|9bit adder, notes show the decimal value of each adder's bit&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
By chaining these gates you can perform most binary math, the easiest of which is addition. In my old fort I built and tested my initial 9 Bit Addition computer. the design failed in two circumstances, the AndOr gate of bit 32 had a lower path cost than the And gate when the animal was at Sum 2, and the Or gate in bit 4 had a lower path cost than ground if the lower door was open.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The gates in the Super Snail adder can be reset to the correct positions by forbidding the doors which fault. I'm working on a more reliable compact adder. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Decimal Adder&lt;br /&gt;
While it can be done, It's massively more complex than simply making a set of decimal converters working with numbers over 10,&lt;br /&gt;
&lt;br /&gt;
hexadecimal adder&lt;br /&gt;
The hex adder makes use of 32 sum gates per side of a single adder, making it geometrically more complex than the binary adder, however it does make animal management more streamlined. more information to come.&lt;br /&gt;
&lt;br /&gt;
Status&lt;br /&gt;
Sum gates 0-31           done&lt;br /&gt;
layout                   pending&lt;br /&gt;
working prototype        pending&lt;br /&gt;
finished dorfputer       pending&lt;br /&gt;
&lt;br /&gt;
Subtractors&lt;br /&gt;
inverse adder, simple but not yet tested.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Animals==&lt;br /&gt;
&lt;br /&gt;
Choosing the animal which works as the logic core for an animal logic systems is somewhat important, depending on your needs and the available animals. however pretty much anything will do as long as you can remember which animal fits into which gate (to avoid designating the same animal for more than one pit).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Kittens'''&lt;br /&gt;
&lt;br /&gt;
Put those worthless cats to work, load them into your fortress's logic core and make them work for their keep. while kittens are the most reliable cores for logic gates with their 3 pathing goals they're also problematic as they grow into cats which only have two, and may cause catsplosions inside your logical cores. Ideally kittens should be replaced yearly or biyearly as their growth defines.&lt;br /&gt;
Kittens path to the activity zone, their parents, and vermin.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Puppies'''&lt;br /&gt;
&lt;br /&gt;
Why should your fortresses working animals only work once they grow up? throw the puppies into the logic core and have them work from the day of their birth. Puppies are quite reliable with their two pathing goals, but retain the problem of maturation.&lt;br /&gt;
Puppies path to the activity zone, and their parents.&lt;br /&gt;
&lt;br /&gt;
'''Animal Children'''&lt;br /&gt;
&lt;br /&gt;
Using the non matured animals for something useful before butchering may be quite effective, however they still must be flushed when they mature.&lt;br /&gt;
Animal children path to the activity zone, and their parents.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Cats'''&lt;br /&gt;
&lt;br /&gt;
Aggravating animals, throw them into the computer and get some worth out of them. Otherwise useless cats become useful when used for logic, with two pathing goals they're responsive, and multiply quickly. watch out for catsplosions while using these critters&lt;br /&gt;
Cats path to the activity zone, and Vermin.&lt;br /&gt;
&lt;br /&gt;
'''&lt;br /&gt;
Dogs'''&lt;br /&gt;
&lt;br /&gt;
The workhorse of your fortress, because horses can't do anything useful. I'd recommend not using dogs as they're put to better use as wardogs to protect your dorfs.&lt;br /&gt;
Dogs path to the activity zone.&lt;br /&gt;
&lt;br /&gt;
'''&lt;br /&gt;
Cattle'''&lt;br /&gt;
&lt;br /&gt;
Large lumbering bovines, the advantage of Cattle is you can tell the sexes apart, they also make the pressure plates continue to work if you forget to reassign the trigger weight.&lt;br /&gt;
Cattle path to the activity zone.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Other animals'''&lt;br /&gt;
&lt;br /&gt;
Any animals work, but the above are probably your best choice, excluding any modded animals. however if you have a GCS handy a GCS powered computer would be awesome, so take this as you will.&lt;br /&gt;
Other animals have different pathing goals, but most only path to the activity zone.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Goblins'''&lt;br /&gt;
&lt;br /&gt;
I'm working on an incremental goblin powered system, results pending.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Putting it all together==&lt;br /&gt;
&lt;br /&gt;
When it comes time to automate your systems the first thing you need to know is what needs to automated and what should remain manual. an obsidian farm with completely autonomous control of the casting process is all well and good, until it drowns all your legendary miners when it prematurely triggers. all systems should have manual controls and failsafes to help avoid FUN! (but because we all love FUN sometimes you forget to fully connect that emergency drain, or that failsafe system you built somehow failed.)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
once you know the steps you need in your system it comes time to select the parts you need to automate, whether it be basic logic gates or more sophisticated multiple trigger systems.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This is mainly pure logic and I can't really help with that, but post a requirement in the talk page and if I see it I'll work on it. Consult the computing page on this wiki, and look up digital logic on Wikipedia. past that it's pretty fundamental and I don't really think I can adequately describe it.&lt;/div&gt;</summary>
		<author><name>LordOOTFD</name></author>
	</entry>
	<entry>
		<id>http://dwarffortresswiki.org/index.php?title=User:LordOOTFD&amp;diff=61939</id>
		<title>User:LordOOTFD</title>
		<link rel="alternate" type="text/html" href="http://dwarffortresswiki.org/index.php?title=User:LordOOTFD&amp;diff=61939"/>
		<updated>2010-01-29T05:53:09Z</updated>

		<summary type="html">&lt;p&gt;LordOOTFD: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Animal logic works as a function of the path finding algorithm in dwarf fortress, as all animals seek to find the lowest cost path to their desired objects (activity zone, parents, dwarfs, valuable objects, etc) this can be used to create very very complex logic gates. Animal logic has three principle advantages, speed, compactness, and simplified functions; however, animal logic is slower than mechanical logic, less reliable than either, and logic is often inverted.&lt;br /&gt;
&lt;br /&gt;
Throughout this document I will be using a number of terms which may not be immediately obvious so I'll list them here: &lt;br /&gt;
&lt;br /&gt;
Ground: for simplicity the thing the animal is pathing to is refereed to as ground as that is the ground state which it wishes to reach. Ground is always the left unless otherwise noted.&lt;br /&gt;
&lt;br /&gt;
Purge: Path to ground with no inputs&lt;br /&gt;
&lt;br /&gt;
Path cost: The number of steps the animal must make to reach ground&lt;br /&gt;
&lt;br /&gt;
Fusion Gate: Simply one or more logic gates built into the same system (this is more than simply stringing gates)&lt;br /&gt;
&lt;br /&gt;
Compund Gate: Gate which uses two or more gates set to different path costs.&lt;br /&gt;
&lt;br /&gt;
And Gate: And takes x inputs and output TRUE if ALL are TRUE.&lt;br /&gt;
&lt;br /&gt;
NAnd Gate: NAnd takes x inputs and returns TRUE if ALL are FALSE. &lt;br /&gt;
&lt;br /&gt;
AndOr Gate: AndOr takes x inputs and returns TRUE if X-Y are TRUE. (this gate is exclusive to animal logic, and is a single step fusion of And, and Or)&lt;br /&gt;
&lt;br /&gt;
Or Gate: Or takes x input and output TRUE if ANY are true.&lt;br /&gt;
&lt;br /&gt;
Not Gate: Not takes a single input and inverts it to the oposite state TRUE if FALSE. &lt;br /&gt;
&lt;br /&gt;
XOr Gate: XOr takes 2 or more inputs and output TRUE if ONLY ONE is TRUE but NOT ALL are TRUE. &lt;br /&gt;
&lt;br /&gt;
NOr Gate: NOr takes x input and returns TRUE if ALL inputs are FALSE. &lt;br /&gt;
&lt;br /&gt;
XNOr Gate: XNOr takes 2 or more inputs and returns TRUE if ALL are TRUE, OR FALSE.&lt;br /&gt;
&lt;br /&gt;
For a better explanation of gates see:http://en.wikipedia.org/wiki/Logic_gate&lt;br /&gt;
&lt;br /&gt;
Notation: #:always 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) 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.&lt;br /&gt;
&lt;br /&gt;
Gates will always be capitalized in the way they are within the entry, I.E. And, Or, AndOr, XNOr, etc&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
There are three principle 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 principle reason for this is pathfinding always prefers the shortest path to ground, 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, more than a single on or off signal. For simplicity and streamlining the systems I have designed only use binary outputs, but theoretically they could be made to compute natively in decimal; however, this is a bit more complicated than a week of study allows.&lt;br /&gt;
&lt;br /&gt;
==SIMPLE GATES==&lt;br /&gt;
&lt;br /&gt;
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 &amp;quot;wake up&amp;quot; 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 it's enclosure, this allows the gate to respond faster 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 I find them to be better in general use.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
And&lt;br /&gt;
This simple gate is made by confining the animal into a straight coridor; the ground path will have two or more doors which are connected to the input, while the second longer path remains clear. the gate can be configured as an NAnd gate by simply moving the pressure plate. if the plate is by the ground path it functions as an And gate returning TRUE if the ground path is open, and if the plate is by the purge path it will return FALSE when the inputs are TRUE&lt;br /&gt;
 #########&lt;br /&gt;
  ABCD^ D&lt;br /&gt;
 #########&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Multi And&lt;br /&gt;
 ############&lt;br /&gt;
  ANYNUMD^ D&lt;br /&gt;
 ############&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
NAnd&lt;br /&gt;
Reconfigured And gate, see And.&lt;br /&gt;
 #########&lt;br /&gt;
  ABCD ^D&lt;br /&gt;
 #########&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Or&lt;br /&gt;
Basic gate&lt;br /&gt;
 #####&lt;br /&gt;
 AD^ D&lt;br /&gt;
 B####&lt;br /&gt;
 #####&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Multi Or&lt;br /&gt;
 #######&lt;br /&gt;
 A #####&lt;br /&gt;
 N #####&lt;br /&gt;
 Y D^ D&lt;br /&gt;
 N #####&lt;br /&gt;
 M #####&lt;br /&gt;
 #######&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
NOr&lt;br /&gt;
Basically a reconfigured Or gate&lt;br /&gt;
 #####&lt;br /&gt;
 AD ^D&lt;br /&gt;
 B####&lt;br /&gt;
 #####&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Not&lt;br /&gt;
The simplest gate, It only takes a single imput.&lt;br /&gt;
 #######&lt;br /&gt;
  AD^ D&lt;br /&gt;
 #######&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Compound Gates==&lt;br /&gt;
&lt;br /&gt;
Basically two or more gates arranged with different path costs to ground. These gates can be configured in a number of different ways, these being the simplest. It may be possible to make these gates as single gates but that would require inverting some of the input. Simple compund gates use two simple gates and handle two inputs, complex compund gates have more then two simple gates and need more than two inputs. a Complex compund gate might be used to convert decimal numbers into binary using And gates&lt;br /&gt;
&lt;br /&gt;
XOr&lt;br /&gt;
Compound of And and Or, when ONLY ONE is TRUE returns TRUE&lt;br /&gt;
If A and B are false the animal moves to the FALSE position by Purge, if A or B is true, the animal moves to the TRUE position at the Or gate, if both A and B are true the animal moves to the FALSE postion by the And gate.&lt;br /&gt;
&lt;br /&gt;
 #g########&lt;br /&gt;
 # ABD  D #&lt;br /&gt;
 # ####^# #&lt;br /&gt;
 # ####D# #&lt;br /&gt;
 # ###BA# #&lt;br /&gt;
 #        #&lt;br /&gt;
 ##########&lt;br /&gt;
And path cost: 4&lt;br /&gt;
Or path cost: 10&lt;br /&gt;
Purge path cost: 14&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
XNor&lt;br /&gt;
Inverse of XOr: Return TRUE if BOTH are TRUE OR FALSE&lt;br /&gt;
If A and B are false the animal move to the TRUE position by Purge, if A or B is true, the animal moves to the FALSE position at the Or gate, if both A and B are true the animal moves to the TRUE postion by the And gate.&lt;br /&gt;
&lt;br /&gt;
 #g#########&lt;br /&gt;
 #         #&lt;br /&gt;
 ##B###### #&lt;br /&gt;
 ###A## DA # &lt;br /&gt;
 ####D^##B #&lt;br /&gt;
 #####D### #&lt;br /&gt;
 ######    #&lt;br /&gt;
 ###########&lt;br /&gt;
And path cost: 4&lt;br /&gt;
Or path cost: 10&lt;br /&gt;
Purge path cost: 15&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Complex Compound gate, Octal display ALU&lt;br /&gt;
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)&lt;br /&gt;
&lt;br /&gt;
 #################&lt;br /&gt;
                 #&lt;br /&gt;
 # # # # # # #1# #&lt;br /&gt;
 # # #1# #1#2#2# #&lt;br /&gt;
 #1#2#2#4#4#4#4# #&lt;br /&gt;
 #D#D#D#D#D#D#D#D#&lt;br /&gt;
 #               #&lt;br /&gt;
 #################&lt;br /&gt;
&lt;br /&gt;
 # ######&lt;br /&gt;
 # 1  D #&lt;br /&gt;
 # #### #&lt;br /&gt;
 # 2  D #&lt;br /&gt;
 # #### #&lt;br /&gt;
 # 12 D #&lt;br /&gt;
 # #### #&lt;br /&gt;
 # 4  D #&lt;br /&gt;
 # #### #&lt;br /&gt;
 # 14 D #&lt;br /&gt;
 # #### #&lt;br /&gt;
 # 24 D #&lt;br /&gt;
 # #### #&lt;br /&gt;
 # 124D #&lt;br /&gt;
 # #### #&lt;br /&gt;
 #    D #&lt;br /&gt;
 ########&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Fusion gates==&lt;br /&gt;
&lt;br /&gt;
These are gates which are constructed by physically combining the two gates to get a specific output.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
AndOr&lt;br /&gt;
This gate will evaluate if either of x And statements are TRUE. This gate is built as a straight line similar to the And gate&lt;br /&gt;
 ######&lt;br /&gt;
 #C####&lt;br /&gt;
 ABD^ D&lt;br /&gt;
 C#####&lt;br /&gt;
 ######&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
NAndOr&lt;br /&gt;
Reconfigured AndOr gate, see AndOr&lt;br /&gt;
 ######&lt;br /&gt;
 #C####&lt;br /&gt;
 ABD ^D&lt;br /&gt;
 C#####&lt;br /&gt;
 ######&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
OrandOr&lt;br /&gt;
This gate returns true if either A or B and either C or D is true.&lt;br /&gt;
&lt;br /&gt;
 ######&lt;br /&gt;
 AC####&lt;br /&gt;
 BED^ D&lt;br /&gt;
 ######&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
OrandAnd&lt;br /&gt;
This gate returns true if either A or B is true, and E and C are true.&lt;br /&gt;
&lt;br /&gt;
 #######&lt;br /&gt;
 A######&lt;br /&gt;
 BCED^ D&lt;br /&gt;
 #######&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Complex Gates==&lt;br /&gt;
&lt;br /&gt;
==Adders==&lt;br /&gt;
A Full adder can be made as a Compound Fusion gate, by combining, And, AndOr, and Or gates&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Binary Adder&lt;br /&gt;
The first binary adder I attempted was structured like an electronic adder using an array of simple gates. It contained five animals and used grates to control the logic, based off of bidok's logic gates. This adder functioned correctly but it was very inefficient with space, and highly unreliable often taking ten plus minutes to properly align. I refined this design by lining the gates up into a linear arrangement, but this failed to solve the efficiency problems.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
I then realized that simply limiting my Adder to using Electronic gates was silly realizing the key point of animal logic I designed a single stage gate, which had four output states: 0,1,C,1&amp;amp;C. this allowed me to compress the Adder into a single circuit. Modifying the design further the use of doors allows the new design to function at approximately 4-6 times the speed of the prototype adder.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The Binary Adder function by adding three values, A,B, and Carry. Carry is only involved if the previous adder had a result of 2, or 3. the adder works by detecting if (A Or B Or C = True)Sum=1, Or (A And B, Or, A And C, Or B And C = True)Sum=2, Or (A And B And C = True)Sum=3, Or (A And B And C = False)Sum=0. With this basic logic one simply needs to configure the output for 1 if the answer is 1, C if the answer is 2, and 1 and C if the answer is 3. the gates must also be arranged so the Highest Sum has the shortest path to ground as otherwise the gate would return nonsense.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Stand alone Adders (they don't carry into another adder) require 22 mechanisms, and 14 doors.&lt;br /&gt;
Start Adders (They feed into the next Adder and include a carry) require 32 mechanisms, and 14 doors.&lt;br /&gt;
Chain Adders (The receive Carry, and pass a Carry bit up) require 32 mechanisms, and 14 doors&lt;br /&gt;
While Materials intensive the gates only take up 13x9 urists, ideal for chaining along mining tunnels.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Reference pictures&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery&amp;gt;&lt;br /&gt;
Image:Xnor,Xor,Nand,Or prototype adder STATE 1.PNG|Prototype digital adder&lt;br /&gt;
Image:And,Or,AndOr, Prototype adder STATE 3.PNG|sum 11&lt;br /&gt;
Image:And,Or,AndOr, Prototype adder STATE 2.PNG|sum 10&lt;br /&gt;
Image:And,Or,AndOr, Prototype adder STATE 1.PNG|sum 01&lt;br /&gt;
Image:And,Or,AndOr, Prototype adder STATE 0.PNG|sum 00&lt;br /&gt;
Image:9bit adder prototype interface pannel.PNG|9bit adder interface&lt;br /&gt;
Image:9bit adder prototype.PNG|9bit adder&lt;br /&gt;
Image:9bit adder prototype 10100010notes.PNG|9bit adder, notes show the decimal value of each adder's bit&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
By chaining these gates you can perform most binary math, the easiest of which is addition. In my old fort I built and tested my initial 9 Bit Addition computer. the design failed in two circumstances, the AndOr gate of bit 32 had a lower path cost than the And gate when the animal was at Sum 2, and the Or gate in bit 4 had a lower path cost than ground if the lower door was open.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The gates in the Super Snail adder can be reset to the correct positions by forbidding the doors which fault. I'm working on a more reliable compact adder. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Decimal Adder&lt;br /&gt;
While it can be done, It's massively more complex than simply making a set of decimal converters working with numbers over 10,&lt;br /&gt;
&lt;br /&gt;
hexadecimal adder&lt;br /&gt;
The hex adder makes use of 32 sum gates per side of a single adder, making it geometrically more complex than the binary adder, however it does make animal management more streamlined. more information to come.&lt;br /&gt;
&lt;br /&gt;
Status&lt;br /&gt;
Sum gates 0-31           done&lt;br /&gt;
layout                   pending&lt;br /&gt;
working prototype        pending&lt;br /&gt;
finished dorfputer       pending&lt;br /&gt;
&lt;br /&gt;
Subtractors&lt;br /&gt;
inverse adder, simple but not yet tested.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Animals==&lt;br /&gt;
&lt;br /&gt;
Choosing the animal which works as the logic core for an animal logic systems is somewhat important, depending on your needs and the available animals. however pretty much anything will do as long as you can remember which animal fits into which gate (to avoid designating the same animal for more than one pit).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Kittens&lt;br /&gt;
Put those worthless cats to work, load them into your fortress's logic core and make them work for their keep. while kittens are the most reliable cores for logic gates with their 3 pathing goals they're also problematic as they grow into cats which only have two, and may cause catsplosions inside your logical cores. Ideally kittens should be replaced yearly or biyearly as their growth defines.&lt;br /&gt;
Kittens path to the activity zone, their parents, and vermin.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Puppies&lt;br /&gt;
Why should your fortresses working animals only work once they grow up? throw the puppies into the logic core and have them work from the day of their birth. Puppies are quite reliable with their two pathing goals, but retain the problem of maturation.&lt;br /&gt;
Puppies path to the activity zone, and their parents.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Animal Children&lt;br /&gt;
Using the non matured animals for something useful before butchering may be quite effective, however they still must be flushed when they mature.&lt;br /&gt;
Animal children path to the activity zone, and their parents.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Cats&lt;br /&gt;
Aggravating animals, throw them into the computer and get some worth out of them. Otherwise useless cats become useful when used for logic, with two pathing goals they're responsive, and multiply quickly. watch out for catsplosions while using these critters&lt;br /&gt;
Cats path to the activity zone, and Vermin.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Dogs&lt;br /&gt;
The workhorse of your fortress, because horses can't do anything useful. I'd recommend not using dogs as they're put to better use as wardogs to protect your dorfs.&lt;br /&gt;
Dogs path to the activity zone.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Cattle&lt;br /&gt;
Large lumbering bovines, the advantage of Cattle is you can tell the sexes apart, they also make the pressure plates continue to work if you forget to reassign the trigger weight.&lt;br /&gt;
Cattle path to the activity zone.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Other animals&lt;br /&gt;
Any animals work, but the above are probably your best choice, excluding any modded animals. however if you have a GCS handy a GCS powered computer would be awesome, so take this as you will.&lt;br /&gt;
Other animals have different pathing goals, but most only path to the activity zone.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Goblins&lt;br /&gt;
I'm working on an incremental goblin powered system, results pending.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Putting it all together==&lt;br /&gt;
&lt;br /&gt;
When it comes time to automate your systems the first thing you need to know is what needs to automated and what should remain manual. an obsidian farm with completely autonomous control of the casting process is all well and good, until it drowns all your legendary miners when it prematurely triggers. all systems should have manual controls and failsafes to help avoid FUN! (but because we all love FUN sometimes you forget to fully connect that emergency drain, or that failsafe system you built somehow failed.)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
once you know the steps you need in your system it comes time to select the parts you need to automate, whether it be basic logic gates or more sophisticated multiple trigger systems.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This is mainly pure logic and I can't really help with that, but post a requirement in the talk page and if I see it I'll work on it. Consult the computing page on this wiki, and look up digital logic on Wikipedia. past that it's pretty fundamental and I don't really think I can adequately describe it.&lt;/div&gt;</summary>
		<author><name>LordOOTFD</name></author>
	</entry>
	<entry>
		<id>http://dwarffortresswiki.org/index.php?title=User:LordOOTFD&amp;diff=61938</id>
		<title>User:LordOOTFD</title>
		<link rel="alternate" type="text/html" href="http://dwarffortresswiki.org/index.php?title=User:LordOOTFD&amp;diff=61938"/>
		<updated>2010-01-29T05:29:20Z</updated>

		<summary type="html">&lt;p&gt;LordOOTFD: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Animal logic works as a function of the path finding algorithm in dwarf fortress, as all animals seek to find the lowest cost path to their desired objects (activity zone, parents, dwarfs, valuable objects, etc) this can be used to create very very complex logic gates. Animal logic has three principle advantages, speed, compactness, and simplified functions; however, animal logic is slower than mechanical logic, less reliable than either, and logic is often inverted.&lt;br /&gt;
&lt;br /&gt;
Throughout this document I will be using a number of terms which may not be immediately obvious so I'll list them here: &lt;br /&gt;
&lt;br /&gt;
Ground: for simplicity the thing the animal is pathing to is refereed to as ground as that is the ground state which it wishes to reach. Ground is always the left unless otherwise noted.&lt;br /&gt;
&lt;br /&gt;
Purge: Path to ground with no inputs&lt;br /&gt;
&lt;br /&gt;
Path cost: The number of steps the animal must make to reach ground&lt;br /&gt;
&lt;br /&gt;
Fusion Gate: Simply one or more logic gates built into the same system (this is more than simply stringing gates)&lt;br /&gt;
&lt;br /&gt;
Compund Gate: Gate which uses two or more gates set to different path costs.&lt;br /&gt;
&lt;br /&gt;
And Gate: And takes x inputs and output TRUE if ALL are TRUE.&lt;br /&gt;
&lt;br /&gt;
NAnd Gate: NAnd takes x inputs and returns TRUE if ALL are FALSE. &lt;br /&gt;
&lt;br /&gt;
AndOr Gate: AndOr takes x inputs and returns TRUE if X-Y are TRUE. (this gate is exclusive to animal logic, and is a single step fusion of And, and Or)&lt;br /&gt;
&lt;br /&gt;
Or Gate: Or takes x input and output TRUE if ANY are true.&lt;br /&gt;
&lt;br /&gt;
Not Gate: Not takes a single input and inverts it to the oposite state TRUE if FALSE. &lt;br /&gt;
&lt;br /&gt;
XOr Gate: XOr takes 2 or more inputs and output TRUE if ONLY ONE is TRUE but NOT ALL are TRUE. &lt;br /&gt;
&lt;br /&gt;
NOr Gate: NOr takes x input and returns TRUE if ALL inputs are FALSE. &lt;br /&gt;
&lt;br /&gt;
XNOr Gate: XNOr takes 2 or more inputs and returns TRUE if ALL are TRUE, OR FALSE.&lt;br /&gt;
&lt;br /&gt;
For a better explanation of gates see:http://en.wikipedia.org/wiki/Logic_gate&lt;br /&gt;
&lt;br /&gt;
Notation: #:always 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) 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.&lt;br /&gt;
&lt;br /&gt;
Gates will always be capitalized in the way they are within the entry, I.E. And, Or, AndOr, XNOr, etc&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
There are three principle 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 principle reason for this is pathfinding always prefers the shortest path to ground, 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, more than a single on or off signal. For simplicity and streamlining the systems I have designed only use binary outputs, but theoretically they could be made to compute natively in decimal; however, this is a bit more complicated than a week of study allows.&lt;br /&gt;
&lt;br /&gt;
==SIMPLE GATES==&lt;br /&gt;
&lt;br /&gt;
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 &amp;quot;wake up&amp;quot; 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 it's enclosure, this allows the gate to respond faster 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 I find them to be better in general use.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
And&lt;br /&gt;
This simple gate is made by confining the animal into a straight coridor; the ground path will have two or more doors which are connected to the input, while the second longer path remains clear. the gate can be configured as an NAnd gate by simply moving the pressure plate. if the plate is by the ground path it functions as an And gate returning TRUE if the ground path is open, and if the plate is by the purge path it will return FALSE when the inputs are TRUE&lt;br /&gt;
 #########&lt;br /&gt;
  ABCD^ D&lt;br /&gt;
 #########&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Multi And&lt;br /&gt;
 ############&lt;br /&gt;
  ANYNUMD^ D&lt;br /&gt;
 ############&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
NAnd&lt;br /&gt;
Reconfigured And gate, see And.&lt;br /&gt;
 #########&lt;br /&gt;
  ABCD ^D&lt;br /&gt;
 #########&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Or&lt;br /&gt;
Basic gate&lt;br /&gt;
 #####&lt;br /&gt;
 AD^ D&lt;br /&gt;
 B####&lt;br /&gt;
 #####&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Multi Or&lt;br /&gt;
 #######&lt;br /&gt;
 A #####&lt;br /&gt;
 N #####&lt;br /&gt;
 Y D^ D&lt;br /&gt;
 N #####&lt;br /&gt;
 M #####&lt;br /&gt;
 #######&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
NOr&lt;br /&gt;
Basically a reconfigured Or gate&lt;br /&gt;
 #####&lt;br /&gt;
 AD ^D&lt;br /&gt;
 B####&lt;br /&gt;
 #####&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Not&lt;br /&gt;
The simplest gate, It only takes a single imput.&lt;br /&gt;
 #######&lt;br /&gt;
  AD^ D&lt;br /&gt;
 #######&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Compound Gates==&lt;br /&gt;
&lt;br /&gt;
Basically two or more gates arranged with different path costs to ground. These gates can be configured in a number of different ways, these being the simplest. It may be possible to make these gates as single gates but that would require inverting some of the input. Simple compund gates use two simple gates and handle two inputs, complex compund gates have more then two simple gates and need more than two inputs. a Complex compund gate might be used to convert decimal numbers into binary using And gates&lt;br /&gt;
&lt;br /&gt;
XOr&lt;br /&gt;
Compound of And and Or, when ONLY ONE is TRUE returns TRUE&lt;br /&gt;
If A and B are false the animal moves to the FALSE position by Purge, if A or B is true, the animal moves to the TRUE position at the Or gate, if both A and B are true the animal moves to the FALSE postion by the And gate.&lt;br /&gt;
&lt;br /&gt;
 #g########&lt;br /&gt;
 # ABD  D #&lt;br /&gt;
 # ####^# #&lt;br /&gt;
 # ####D# #&lt;br /&gt;
 # ###BA# #&lt;br /&gt;
 #        #&lt;br /&gt;
 ##########&lt;br /&gt;
And path cost: 4&lt;br /&gt;
Or path cost: 10&lt;br /&gt;
Purge path cost: 14&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
XNor&lt;br /&gt;
Inverse of XOr: Return TRUE if BOTH are TRUE OR FALSE&lt;br /&gt;
If A and B are false the animal move to the TRUE position by Purge, if A or B is true, the animal moves to the FALSE position at the Or gate, if both A and B are true the animal moves to the TRUE postion by the And gate.&lt;br /&gt;
&lt;br /&gt;
 #g#########&lt;br /&gt;
 #         #&lt;br /&gt;
 ##B###### #&lt;br /&gt;
 ###A## DA # &lt;br /&gt;
 ####D^##B #&lt;br /&gt;
 #####D### #&lt;br /&gt;
 ######    #&lt;br /&gt;
 ###########&lt;br /&gt;
And path cost: 4&lt;br /&gt;
Or path cost: 10&lt;br /&gt;
Purge path cost: 15&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Complex Compound gate, Octal display ALU&lt;br /&gt;
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)&lt;br /&gt;
&lt;br /&gt;
 #################&lt;br /&gt;
                 #&lt;br /&gt;
 # # # # # # #1# #&lt;br /&gt;
 # # #1# #1#2#2# #&lt;br /&gt;
 #1#2#2#4#4#4#4# #&lt;br /&gt;
 #D#D#D#D#D#D#D#D#&lt;br /&gt;
 #               #&lt;br /&gt;
 #################&lt;br /&gt;
&lt;br /&gt;
 # ######&lt;br /&gt;
 # 1  D #&lt;br /&gt;
 # #### #&lt;br /&gt;
 # 2  D #&lt;br /&gt;
 # #### #&lt;br /&gt;
 # 12 D #&lt;br /&gt;
 # #### #&lt;br /&gt;
 # 4  D #&lt;br /&gt;
 # #### #&lt;br /&gt;
 # 14 D #&lt;br /&gt;
 # #### #&lt;br /&gt;
 # 24 D #&lt;br /&gt;
 # #### #&lt;br /&gt;
 # 124D #&lt;br /&gt;
 # #### #&lt;br /&gt;
 #    D #&lt;br /&gt;
 ########&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Fusion gates==&lt;br /&gt;
&lt;br /&gt;
These are gates which are constructed by physically combining the two gates to get a specific output.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
AndOr&lt;br /&gt;
This gate will evaluate if either of x And statements are TRUE. This gate is built as a straight line similar to the And gate&lt;br /&gt;
 ######&lt;br /&gt;
 #C####&lt;br /&gt;
 ABD^ D&lt;br /&gt;
 C#####&lt;br /&gt;
 ######&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
NAndOr&lt;br /&gt;
Reconfigured AndOr gate, see AndOr&lt;br /&gt;
 ######&lt;br /&gt;
 #C####&lt;br /&gt;
 ABD ^D&lt;br /&gt;
 C#####&lt;br /&gt;
 ######&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
OrandOr&lt;br /&gt;
This gate returns true if either A or B and either C or D is true.&lt;br /&gt;
&lt;br /&gt;
 ######&lt;br /&gt;
 AC####&lt;br /&gt;
 BED^ D&lt;br /&gt;
 ######&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
OrandAnd&lt;br /&gt;
This gate returns true if either A or B is true, and E and C are true.&lt;br /&gt;
&lt;br /&gt;
 #######&lt;br /&gt;
 A######&lt;br /&gt;
 BCED^ D&lt;br /&gt;
 #######&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Complex Gates==&lt;br /&gt;
&lt;br /&gt;
==Adders==&lt;br /&gt;
A Full adder can be made as a Compound Fusion gate, by combining, And, AndOr, and Or gates&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Binary Adder&lt;br /&gt;
The first binary adder I attempted was structured like an electronic adder using an array of simple gates. It contained five animals and used grates to control the logic, based off of bidok's logic gates. This adder functioned correctly but it was very inefficient with space, and highly unreliable often taking ten plus minutes to properly align. I refined this design by lining the gates up into a linear arrangement, but this failed to solve the efficiency problems.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
I then realized that simply limiting my Adder to using Electronic gates was silly realizing the key point of animal logic I designed a single stage gate, which had four output states: 0,1,C,1&amp;amp;C. this allowed me to compress the Adder into a single circuit. Modifying the design further the use of doors allows the new design to function at approximately 4-6 times the speed of the prototype adder.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The Binary Adder function by adding three values, A,B, and Carry. Carry is only involved if the previous adder had a result of 2, or 3. the adder works by detecting if (A Or B Or C = True)Sum=1, Or (A And B, Or, A And C, Or B And C = True)Sum=2, Or (A And B And C = True)Sum=3, Or (A And B And C = False)Sum=0. With this basic logic one simply needs to configure the output for 1 if the answer is 1, C if the answer is 2, and 1 and C if the answer is 3. the gates must also be arranged so the Highest Sum has the shortest path to ground as otherwise the gate would return nonsense.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Stand alone Adders (they don't carry into another adder) require 22 mechanisms, and 14 doors.&lt;br /&gt;
Start Adders (They feed into the next Adder and include a carry) require 32 mechanisms, and 14 doors.&lt;br /&gt;
Chain Adders (The receive Carry, and pass a Carry bit up) require 32 mechanisms, and 14 doors&lt;br /&gt;
While Materials intensive the gates only take up 13x9 urists, ideal for chaining along mining tunnels.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Reference pictures&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery&amp;gt;&lt;br /&gt;
Image:Xnor,Xor,Nand,Or prototype adder STATE 1.PNG|frame|Prototype digital adder&lt;br /&gt;
Image:And,Or,AndOr, Prototype adder STATE 3.PNG|frame|sum 11&lt;br /&gt;
Image:And,Or,AndOr, Prototype adder STATE 2.PNG|frame|sum 10&lt;br /&gt;
Image:And,Or,AndOr, Prototype adder STATE 1.PNG|frame|sum 01&lt;br /&gt;
Image:And,Or,AndOr, Prototype adder STATE 0.PNG|frame|sum 00&lt;br /&gt;
Image:9bit adder prototype interface pannel.PNG|frame|9bit adder interface&lt;br /&gt;
Image:9bit adder prototype.PNG|frame|9bit adder&lt;br /&gt;
Image:9bit adder prototype 10100010notes.PNG|frame|9bit adder, notes show the decimal value of each adder's bit&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
By chaining these gates you can perform most binary math, the easiest of which is addition. In my old fort I built and tested my initial 9 Bit Addition computer. the design failed in two circumstances, the AndOr gate of bit 32 had a lower path cost than the And gate when the animal was at Sum 2, and the Or gate in bit 4 had a lower path cost than ground if the lower door was open.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The gates in the Super Snail adder can be reset to the correct positions by forbidding the doors which fault. I'm working on a more reliable compact adder. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Decimal Adder&lt;br /&gt;
While it can be done, It's massively more complex than simply making a set of decimal converters working with numbers over 10,&lt;br /&gt;
&lt;br /&gt;
hexadecimal adder&lt;br /&gt;
The hex adder makes use of 32 sum gates per side of a single adder, making it geometrically more complex than the binary adder, however it does make animal management more streamlined. more information to come.&lt;br /&gt;
&lt;br /&gt;
Status&lt;br /&gt;
Sum gates 0-31           done&lt;br /&gt;
layout                   pending&lt;br /&gt;
working prototype        pending&lt;br /&gt;
finished dorfputer       pending&lt;br /&gt;
&lt;br /&gt;
Subtractors&lt;br /&gt;
inverse adder, simple but not yet tested.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Animals==&lt;br /&gt;
&lt;br /&gt;
Choosing the animal which works as the logic core for an animal logic systems is somewhat important, depending on your needs and the available animals. however pretty much anything will do as long as you can remember which animal fits into which gate (to avoid designating the same animal for more than one pit).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Kittens&lt;br /&gt;
Put those worthless cats to work, load them into your fortress's logic core and make them work for their keep. while kittens are the most reliable cores for logic gates with their 3 pathing goals they're also problematic as they grow into cats which only have two, and may cause catsplosions inside your logical cores. Ideally kittens should be replaced yearly or biyearly as their growth defines.&lt;br /&gt;
Kittens path to the activity zone, their parents, and vermin.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Puppies&lt;br /&gt;
Why should your fortresses working animals only work once they grow up? throw the puppies into the logic core and have them work from the day of their birth. Puppies are quite reliable with their two pathing goals, but retain the problem of maturation.&lt;br /&gt;
Puppies path to the activity zone, and their parents.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Animal Children&lt;br /&gt;
Using the non matured animals for something useful before butchering may be quite effective, however they still must be flushed when they mature.&lt;br /&gt;
Animal children path to the activity zone, and their parents.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Cats&lt;br /&gt;
Aggravating animals, throw them into the computer and get some worth out of them. Otherwise useless cats become useful when used for logic, with two pathing goals they're responsive, and multiply quickly. watch out for catsplosions while using these critters&lt;br /&gt;
Cats path to the activity zone, and Vermin.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Dogs&lt;br /&gt;
The workhorse of your fortress, because horses can't do anything useful. I'd recommend not using dogs as they're put to better use as wardogs to protect your dorfs.&lt;br /&gt;
Dogs path to the activity zone.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Cattle&lt;br /&gt;
Large lumbering bovines, the advantage of Cattle is you can tell the sexes apart, they also make the pressure plates continue to work if you forget to reassign the trigger weight.&lt;br /&gt;
Cattle path to the activity zone.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Other animals&lt;br /&gt;
Any animals work, but the above are probably your best choice, excluding any modded animals. however if you have a GCS handy a GCS powered computer would be awesome, so take this as you will.&lt;br /&gt;
Other animals have different pathing goals, but most only path to the activity zone.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Goblins&lt;br /&gt;
I'm working on an incremental goblin powered system, results pending.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Putting it all together==&lt;br /&gt;
&lt;br /&gt;
When it comes time to automate your systems the first thing you need to know is what needs to automated and what should remain manual. an obsidian farm with completely autonomous control of the casting process is all well and good, until it drowns all your legendary miners when it prematurely triggers. all systems should have manual controls and failsafes to help avoid FUN! (but because we all love FUN sometimes you forget to fully connect that emergency drain, or that failsafe system you built somehow failed.)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
once you know the steps you need in your system it comes time to select the parts you need to automate, whether it be basic logic gates or more sophisticated multiple trigger systems.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This is mainly pure logic and I can't really help with that, but post a requirement in the talk page and if I see it I'll work on it. Consult the computing page on this wiki, and look up digital logic on Wikipedia. past that it's pretty fundamental and I don't really think I can adequately describe it.&lt;/div&gt;</summary>
		<author><name>LordOOTFD</name></author>
	</entry>
	<entry>
		<id>http://dwarffortresswiki.org/index.php?title=User:LordOOTFD&amp;diff=61937</id>
		<title>User:LordOOTFD</title>
		<link rel="alternate" type="text/html" href="http://dwarffortresswiki.org/index.php?title=User:LordOOTFD&amp;diff=61937"/>
		<updated>2010-01-29T05:28:36Z</updated>

		<summary type="html">&lt;p&gt;LordOOTFD: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Animal logic works as a function of the path finding algorithm in dwarf fortress, as all animals seek to find the lowest cost path to their desired objects (activity zone, parents, dwarfs, valuable objects, etc) this can be used to create very very complex logic gates. Animal logic has three principle advantages, speed, compactness, and simplified functions; however, animal logic is slower than mechanical logic, less reliable than either, and logic is often inverted.&lt;br /&gt;
&lt;br /&gt;
Throughout this document I will be using a number of terms which may not be immediately obvious so I'll list them here: &lt;br /&gt;
&lt;br /&gt;
Ground: for simplicity the thing the animal is pathing to is refereed to as ground as that is the ground state which it wishes to reach. Ground is always the left unless otherwise noted.&lt;br /&gt;
&lt;br /&gt;
Purge: Path to ground with no inputs&lt;br /&gt;
&lt;br /&gt;
Path cost: The number of steps the animal must make to reach ground&lt;br /&gt;
&lt;br /&gt;
Fusion Gate: Simply one or more logic gates built into the same system (this is more than simply stringing gates)&lt;br /&gt;
&lt;br /&gt;
Compund Gate: Gate which uses two or more gates set to different path costs.&lt;br /&gt;
&lt;br /&gt;
And Gate: And takes x inputs and output TRUE if ALL are TRUE.&lt;br /&gt;
&lt;br /&gt;
NAnd Gate: NAnd takes x inputs and returns TRUE if ALL are FALSE. &lt;br /&gt;
&lt;br /&gt;
AndOr Gate: AndOr takes x inputs and returns TRUE if X-Y are TRUE. (this gate is exclusive to animal logic, and is a single step fusion of And, and Or)&lt;br /&gt;
&lt;br /&gt;
Or Gate: Or takes x input and output TRUE if ANY are true.&lt;br /&gt;
&lt;br /&gt;
Not Gate: Not takes a single input and inverts it to the oposite state TRUE if FALSE. &lt;br /&gt;
&lt;br /&gt;
XOr Gate: XOr takes 2 or more inputs and output TRUE if ONLY ONE is TRUE but NOT ALL are TRUE. &lt;br /&gt;
&lt;br /&gt;
NOr Gate: NOr takes x input and returns TRUE if ALL inputs are FALSE. &lt;br /&gt;
&lt;br /&gt;
XNOr Gate: XNOr takes 2 or more inputs and returns TRUE if ALL are TRUE, OR FALSE.&lt;br /&gt;
&lt;br /&gt;
For a better explanation of gates see:http://en.wikipedia.org/wiki/Logic_gate&lt;br /&gt;
&lt;br /&gt;
Notation: #:always 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) 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.&lt;br /&gt;
&lt;br /&gt;
Gates will always be capitalized in the way they are within the entry, I.E. And, Or, AndOr, XNOr, etc&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
There are three principle 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 principle reason for this is pathfinding always prefers the shortest path to ground, 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, more than a single on or off signal. For simplicity and streamlining the systems I have designed only use binary outputs, but theoretically they could be made to compute natively in decimal; however, this is a bit more complicated than a week of study allows.&lt;br /&gt;
&lt;br /&gt;
==SIMPLE GATES==&lt;br /&gt;
&lt;br /&gt;
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 &amp;quot;wake up&amp;quot; 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 it's enclosure, this allows the gate to respond faster 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 I find them to be better in general use.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
And&lt;br /&gt;
This simple gate is made by confining the animal into a straight coridor; the ground path will have two or more doors which are connected to the input, while the second longer path remains clear. the gate can be configured as an NAnd gate by simply moving the pressure plate. if the plate is by the ground path it functions as an And gate returning TRUE if the ground path is open, and if the plate is by the purge path it will return FALSE when the inputs are TRUE&lt;br /&gt;
 #########&lt;br /&gt;
  ABCD^ D&lt;br /&gt;
 #########&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Multi And&lt;br /&gt;
 ############&lt;br /&gt;
  ANYNUMD^ D&lt;br /&gt;
 ############&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
NAnd&lt;br /&gt;
Reconfigured And gate, see And.&lt;br /&gt;
 #########&lt;br /&gt;
  ABCD ^D&lt;br /&gt;
 #########&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Or&lt;br /&gt;
Basic gate&lt;br /&gt;
 #####&lt;br /&gt;
 AD^ D&lt;br /&gt;
 B####&lt;br /&gt;
 #####&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Multi Or&lt;br /&gt;
 #######&lt;br /&gt;
 A #####&lt;br /&gt;
 N #####&lt;br /&gt;
 Y D^ D&lt;br /&gt;
 N #####&lt;br /&gt;
 M #####&lt;br /&gt;
 #######&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
NOr&lt;br /&gt;
Basically a reconfigured Or gate&lt;br /&gt;
 #####&lt;br /&gt;
 AD ^D&lt;br /&gt;
 B####&lt;br /&gt;
 #####&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Not&lt;br /&gt;
The simplest gate, It only takes a single imput.&lt;br /&gt;
 #######&lt;br /&gt;
  AD^ D&lt;br /&gt;
 #######&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Compound Gates==&lt;br /&gt;
&lt;br /&gt;
Basically two or more gates arranged with different path costs to ground. These gates can be configured in a number of different ways, these being the simplest. It may be possible to make these gates as single gates but that would require inverting some of the input. Simple compund gates use two simple gates and handle two inputs, complex compund gates have more then two simple gates and need more than two inputs. a Complex compund gate might be used to convert decimal numbers into binary using And gates&lt;br /&gt;
&lt;br /&gt;
XOr&lt;br /&gt;
Compound of And and Or, when ONLY ONE is TRUE returns TRUE&lt;br /&gt;
If A and B are false the animal moves to the FALSE position by Purge, if A or B is true, the animal moves to the TRUE position at the Or gate, if both A and B are true the animal moves to the FALSE postion by the And gate.&lt;br /&gt;
&lt;br /&gt;
 #g########&lt;br /&gt;
 # ABD  D #&lt;br /&gt;
 # ####^# #&lt;br /&gt;
 # ####D# #&lt;br /&gt;
 # ###BA# #&lt;br /&gt;
 #        #&lt;br /&gt;
 ##########&lt;br /&gt;
And path cost: 4&lt;br /&gt;
Or path cost: 10&lt;br /&gt;
Purge path cost: 14&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
XNor&lt;br /&gt;
Inverse of XOr: Return TRUE if BOTH are TRUE OR FALSE&lt;br /&gt;
If A and B are false the animal move to the TRUE position by Purge, if A or B is true, the animal moves to the FALSE position at the Or gate, if both A and B are true the animal moves to the TRUE postion by the And gate.&lt;br /&gt;
&lt;br /&gt;
 #g#########&lt;br /&gt;
 #         #&lt;br /&gt;
 ##B###### #&lt;br /&gt;
 ###A## DA # &lt;br /&gt;
 ####D^##B #&lt;br /&gt;
 #####D### #&lt;br /&gt;
 ######    #&lt;br /&gt;
 ###########&lt;br /&gt;
And path cost: 4&lt;br /&gt;
Or path cost: 10&lt;br /&gt;
Purge path cost: 15&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Complex Compound gate, Octal display ALU&lt;br /&gt;
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)&lt;br /&gt;
&lt;br /&gt;
 #################&lt;br /&gt;
                 #&lt;br /&gt;
 # # # # # # #1# #&lt;br /&gt;
 # # #1# #1#2#2# #&lt;br /&gt;
 #1#2#2#4#4#4#4# #&lt;br /&gt;
 #D#D#D#D#D#D#D#D#&lt;br /&gt;
 #               #&lt;br /&gt;
 #################&lt;br /&gt;
&lt;br /&gt;
 # ######&lt;br /&gt;
 # 1  D #&lt;br /&gt;
 # #### #&lt;br /&gt;
 # 2  D #&lt;br /&gt;
 # #### #&lt;br /&gt;
 # 12 D #&lt;br /&gt;
 # #### #&lt;br /&gt;
 # 4  D #&lt;br /&gt;
 # #### #&lt;br /&gt;
 # 14 D #&lt;br /&gt;
 # #### #&lt;br /&gt;
 # 24 D #&lt;br /&gt;
 # #### #&lt;br /&gt;
 # 124D #&lt;br /&gt;
 # #### #&lt;br /&gt;
 #    D #&lt;br /&gt;
 ########&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Fusion gates==&lt;br /&gt;
&lt;br /&gt;
These are gates which are constructed by physically combining the two gates to get a specific output.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
AndOr&lt;br /&gt;
This gate will evaluate if either of x And statements are TRUE. This gate is built as a straight line similar to the And gate&lt;br /&gt;
 ######&lt;br /&gt;
 #C####&lt;br /&gt;
 ABD^ D&lt;br /&gt;
 C#####&lt;br /&gt;
 ######&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
NAndOr&lt;br /&gt;
Reconfigured AndOr gate, see AndOr&lt;br /&gt;
 ######&lt;br /&gt;
 #C####&lt;br /&gt;
 ABD ^D&lt;br /&gt;
 C#####&lt;br /&gt;
 ######&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
OrandOr&lt;br /&gt;
This gate returns true if either A or B and either C or D is true.&lt;br /&gt;
&lt;br /&gt;
 ######&lt;br /&gt;
 AC####&lt;br /&gt;
 BED^ D&lt;br /&gt;
 ######&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
OrandAnd&lt;br /&gt;
This gate returns true if either A or B is true, and E and C are true.&lt;br /&gt;
&lt;br /&gt;
 #######&lt;br /&gt;
 A######&lt;br /&gt;
 BCED^ D&lt;br /&gt;
 #######&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Complex Gates==&lt;br /&gt;
&lt;br /&gt;
==Adders==&lt;br /&gt;
A Full adder can be made as a Compound Fusion gate, by combining, And, AndOr, and Or gates&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Binary Adder&lt;br /&gt;
The first binary adder I attempted was structured like an electronic adder using an array of simple gates. It contained five animals and used grates to control the logic, based off of bidok's logic gates. This adder functioned correctly but it was very inefficient with space, and highly unreliable often taking ten plus minutes to properly align. I refined this design by lining the gates up into a linear arrangement, but this failed to solve the efficiency problems.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
I then realized that simply limiting my Adder to using Electronic gates was silly realizing the key point of animal logic I designed a single stage gate, which had four output states: 0,1,C,1&amp;amp;C. this allowed me to compress the Adder into a single circuit. Modifying the design further the use of doors allows the new design to function at approximately 4-6 times the speed of the prototype adder.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The Binary Adder function by adding three values, A,B, and Carry. Carry is only involved if the previous adder had a result of 2, or 3. the adder works by detecting if (A Or B Or C = True)Sum=1, Or (A And B, Or, A And C, Or B And C = True)Sum=2, Or (A And B And C = True)Sum=3, Or (A And B And C = False)Sum=0. With this basic logic one simply needs to configure the output for 1 if the answer is 1, C if the answer is 2, and 1 and C if the answer is 3. the gates must also be arranged so the Highest Sum has the shortest path to ground as otherwise the gate would return nonsense.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Stand alone Adders (they don't carry into another adder) require 22 mechanisms, and 14 doors.&lt;br /&gt;
Start Adders (They feed into the next Adder and include a carry) require 32 mechanisms, and 14 doors.&lt;br /&gt;
Chain Adders (The receive Carry, and pass a Carry bit up) require 32 mechanisms, and 14 doors&lt;br /&gt;
While Materials intensive the gates only take up 13x9 urists, ideal for chaining along mining tunnels.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Reference pictures&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery&amp;gt;&lt;br /&gt;
[[Image:Xnor,Xor,Nand,Or prototype adder STATE 1.PNG|frame|Prototype digital adder]]&lt;br /&gt;
[[Image:And,Or,AndOr, Prototype adder STATE 3.PNG|frame|sum 11]]&lt;br /&gt;
[[Image:And,Or,AndOr, Prototype adder STATE 2.PNG|frame|sum 10]]&lt;br /&gt;
[[Image:And,Or,AndOr, Prototype adder STATE 1.PNG|frame|sum 01]]&lt;br /&gt;
[[Image:And,Or,AndOr, Prototype adder STATE 0.PNG|frame|sum 00]]&lt;br /&gt;
[[Image:9bit adder prototype interface pannel.PNG|frame|9bit adder interface]]&lt;br /&gt;
[[Image:9bit adder prototype.PNG|frame|9bit adder]]&lt;br /&gt;
[[Image:9bit adder prototype 10100010notes.PNG|frame|9bit adder, notes show the decimal value of each adder's bit]]&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
By chaining these gates you can perform most binary math, the easiest of which is addition. In my old fort I built and tested my initial 9 Bit Addition computer. the design failed in two circumstances, the AndOr gate of bit 32 had a lower path cost than the And gate when the animal was at Sum 2, and the Or gate in bit 4 had a lower path cost than ground if the lower door was open.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The gates in the Super Snail adder can be reset to the correct positions by forbidding the doors which fault. I'm working on a more reliable compact adder. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Decimal Adder&lt;br /&gt;
While it can be done, It's massively more complex than simply making a set of decimal converters working with numbers over 10,&lt;br /&gt;
&lt;br /&gt;
hexadecimal adder&lt;br /&gt;
The hex adder makes use of 32 sum gates per side of a single adder, making it geometrically more complex than the binary adder, however it does make animal management more streamlined. more information to come.&lt;br /&gt;
&lt;br /&gt;
Status&lt;br /&gt;
Sum gates 0-31           done&lt;br /&gt;
layout                   pending&lt;br /&gt;
working prototype        pending&lt;br /&gt;
finished dorfputer       pending&lt;br /&gt;
&lt;br /&gt;
Subtractors&lt;br /&gt;
inverse adder, simple but not yet tested.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Animals==&lt;br /&gt;
&lt;br /&gt;
Choosing the animal which works as the logic core for an animal logic systems is somewhat important, depending on your needs and the available animals. however pretty much anything will do as long as you can remember which animal fits into which gate (to avoid designating the same animal for more than one pit).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Kittens&lt;br /&gt;
Put those worthless cats to work, load them into your fortress's logic core and make them work for their keep. while kittens are the most reliable cores for logic gates with their 3 pathing goals they're also problematic as they grow into cats which only have two, and may cause catsplosions inside your logical cores. Ideally kittens should be replaced yearly or biyearly as their growth defines.&lt;br /&gt;
Kittens path to the activity zone, their parents, and vermin.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Puppies&lt;br /&gt;
Why should your fortresses working animals only work once they grow up? throw the puppies into the logic core and have them work from the day of their birth. Puppies are quite reliable with their two pathing goals, but retain the problem of maturation.&lt;br /&gt;
Puppies path to the activity zone, and their parents.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Animal Children&lt;br /&gt;
Using the non matured animals for something useful before butchering may be quite effective, however they still must be flushed when they mature.&lt;br /&gt;
Animal children path to the activity zone, and their parents.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Cats&lt;br /&gt;
Aggravating animals, throw them into the computer and get some worth out of them. Otherwise useless cats become useful when used for logic, with two pathing goals they're responsive, and multiply quickly. watch out for catsplosions while using these critters&lt;br /&gt;
Cats path to the activity zone, and Vermin.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Dogs&lt;br /&gt;
The workhorse of your fortress, because horses can't do anything useful. I'd recommend not using dogs as they're put to better use as wardogs to protect your dorfs.&lt;br /&gt;
Dogs path to the activity zone.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Cattle&lt;br /&gt;
Large lumbering bovines, the advantage of Cattle is you can tell the sexes apart, they also make the pressure plates continue to work if you forget to reassign the trigger weight.&lt;br /&gt;
Cattle path to the activity zone.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Other animals&lt;br /&gt;
Any animals work, but the above are probably your best choice, excluding any modded animals. however if you have a GCS handy a GCS powered computer would be awesome, so take this as you will.&lt;br /&gt;
Other animals have different pathing goals, but most only path to the activity zone.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Goblins&lt;br /&gt;
I'm working on an incremental goblin powered system, results pending.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Putting it all together==&lt;br /&gt;
&lt;br /&gt;
When it comes time to automate your systems the first thing you need to know is what needs to automated and what should remain manual. an obsidian farm with completely autonomous control of the casting process is all well and good, until it drowns all your legendary miners when it prematurely triggers. all systems should have manual controls and failsafes to help avoid FUN! (but because we all love FUN sometimes you forget to fully connect that emergency drain, or that failsafe system you built somehow failed.)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
once you know the steps you need in your system it comes time to select the parts you need to automate, whether it be basic logic gates or more sophisticated multiple trigger systems.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This is mainly pure logic and I can't really help with that, but post a requirement in the talk page and if I see it I'll work on it. Consult the computing page on this wiki, and look up digital logic on Wikipedia. past that it's pretty fundamental and I don't really think I can adequately describe it.&lt;/div&gt;</summary>
		<author><name>LordOOTFD</name></author>
	</entry>
	<entry>
		<id>http://dwarffortresswiki.org/index.php?title=User:LordOOTFD&amp;diff=61936</id>
		<title>User:LordOOTFD</title>
		<link rel="alternate" type="text/html" href="http://dwarffortresswiki.org/index.php?title=User:LordOOTFD&amp;diff=61936"/>
		<updated>2010-01-29T05:27:56Z</updated>

		<summary type="html">&lt;p&gt;LordOOTFD: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Animal logic works as a function of the path finding algorithm in dwarf fortress, as all animals seek to find the lowest cost path to their desired objects (activity zone, parents, dwarfs, valuable objects, etc) this can be used to create very very complex logic gates. Animal logic has three principle advantages, speed, compactness, and simplified functions; however, animal logic is slower than mechanical logic, less reliable than either, and logic is often inverted.&lt;br /&gt;
&lt;br /&gt;
Throughout this document I will be using a number of terms which may not be immediately obvious so I'll list them here: &lt;br /&gt;
&lt;br /&gt;
Ground: for simplicity the thing the animal is pathing to is refereed to as ground as that is the ground state which it wishes to reach. Ground is always the left unless otherwise noted.&lt;br /&gt;
&lt;br /&gt;
Purge: Path to ground with no inputs&lt;br /&gt;
&lt;br /&gt;
Path cost: The number of steps the animal must make to reach ground&lt;br /&gt;
&lt;br /&gt;
Fusion Gate: Simply one or more logic gates built into the same system (this is more than simply stringing gates)&lt;br /&gt;
&lt;br /&gt;
Compund Gate: Gate which uses two or more gates set to different path costs.&lt;br /&gt;
&lt;br /&gt;
And Gate: And takes x inputs and output TRUE if ALL are TRUE.&lt;br /&gt;
&lt;br /&gt;
NAnd Gate: NAnd takes x inputs and returns TRUE if ALL are FALSE. &lt;br /&gt;
&lt;br /&gt;
AndOr Gate: AndOr takes x inputs and returns TRUE if X-Y are TRUE. (this gate is exclusive to animal logic, and is a single step fusion of And, and Or)&lt;br /&gt;
&lt;br /&gt;
Or Gate: Or takes x input and output TRUE if ANY are true.&lt;br /&gt;
&lt;br /&gt;
Not Gate: Not takes a single input and inverts it to the oposite state TRUE if FALSE. &lt;br /&gt;
&lt;br /&gt;
XOr Gate: XOr takes 2 or more inputs and output TRUE if ONLY ONE is TRUE but NOT ALL are TRUE. &lt;br /&gt;
&lt;br /&gt;
NOr Gate: NOr takes x input and returns TRUE if ALL inputs are FALSE. &lt;br /&gt;
&lt;br /&gt;
XNOr Gate: XNOr takes 2 or more inputs and returns TRUE if ALL are TRUE, OR FALSE.&lt;br /&gt;
&lt;br /&gt;
For a better explanation of gates see:http://en.wikipedia.org/wiki/Logic_gate&lt;br /&gt;
&lt;br /&gt;
Notation: #:always 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) 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.&lt;br /&gt;
&lt;br /&gt;
Gates will always be capitalized in the way they are within the entry, I.E. And, Or, AndOr, XNOr, etc&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
There are three principle 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 principle reason for this is pathfinding always prefers the shortest path to ground, 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, more than a single on or off signal. For simplicity and streamlining the systems I have designed only use binary outputs, but theoretically they could be made to compute natively in decimal; however, this is a bit more complicated than a week of study allows.&lt;br /&gt;
&lt;br /&gt;
==SIMPLE GATES==&lt;br /&gt;
&lt;br /&gt;
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 &amp;quot;wake up&amp;quot; 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 it's enclosure, this allows the gate to respond faster 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 I find them to be better in general use.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
And&lt;br /&gt;
This simple gate is made by confining the animal into a straight coridor; the ground path will have two or more doors which are connected to the input, while the second longer path remains clear. the gate can be configured as an NAnd gate by simply moving the pressure plate. if the plate is by the ground path it functions as an And gate returning TRUE if the ground path is open, and if the plate is by the purge path it will return FALSE when the inputs are TRUE&lt;br /&gt;
 #########&lt;br /&gt;
  ABCD^ D&lt;br /&gt;
 #########&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Multi And&lt;br /&gt;
 ############&lt;br /&gt;
  ANYNUMD^ D&lt;br /&gt;
 ############&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
NAnd&lt;br /&gt;
Reconfigured And gate, see And.&lt;br /&gt;
 #########&lt;br /&gt;
  ABCD ^D&lt;br /&gt;
 #########&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Or&lt;br /&gt;
Basic gate&lt;br /&gt;
 #####&lt;br /&gt;
 AD^ D&lt;br /&gt;
 B####&lt;br /&gt;
 #####&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Multi Or&lt;br /&gt;
 #######&lt;br /&gt;
 A #####&lt;br /&gt;
 N #####&lt;br /&gt;
 Y D^ D&lt;br /&gt;
 N #####&lt;br /&gt;
 M #####&lt;br /&gt;
 #######&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
NOr&lt;br /&gt;
Basically a reconfigured Or gate&lt;br /&gt;
 #####&lt;br /&gt;
 AD ^D&lt;br /&gt;
 B####&lt;br /&gt;
 #####&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Not&lt;br /&gt;
The simplest gate, It only takes a single imput.&lt;br /&gt;
 #######&lt;br /&gt;
  AD^ D&lt;br /&gt;
 #######&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Compound Gates==&lt;br /&gt;
&lt;br /&gt;
Basically two or more gates arranged with different path costs to ground. These gates can be configured in a number of different ways, these being the simplest. It may be possible to make these gates as single gates but that would require inverting some of the input. Simple compund gates use two simple gates and handle two inputs, complex compund gates have more then two simple gates and need more than two inputs. a Complex compund gate might be used to convert decimal numbers into binary using And gates&lt;br /&gt;
&lt;br /&gt;
XOr&lt;br /&gt;
Compound of And and Or, when ONLY ONE is TRUE returns TRUE&lt;br /&gt;
If A and B are false the animal moves to the FALSE position by Purge, if A or B is true, the animal moves to the TRUE position at the Or gate, if both A and B are true the animal moves to the FALSE postion by the And gate.&lt;br /&gt;
&lt;br /&gt;
 #g########&lt;br /&gt;
 # ABD  D #&lt;br /&gt;
 # ####^# #&lt;br /&gt;
 # ####D# #&lt;br /&gt;
 # ###BA# #&lt;br /&gt;
 #        #&lt;br /&gt;
 ##########&lt;br /&gt;
And path cost: 4&lt;br /&gt;
Or path cost: 10&lt;br /&gt;
Purge path cost: 14&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
XNor&lt;br /&gt;
Inverse of XOr: Return TRUE if BOTH are TRUE OR FALSE&lt;br /&gt;
If A and B are false the animal move to the TRUE position by Purge, if A or B is true, the animal moves to the FALSE position at the Or gate, if both A and B are true the animal moves to the TRUE postion by the And gate.&lt;br /&gt;
&lt;br /&gt;
 #g#########&lt;br /&gt;
 #         #&lt;br /&gt;
 ##B###### #&lt;br /&gt;
 ###A## DA # &lt;br /&gt;
 ####D^##B #&lt;br /&gt;
 #####D### #&lt;br /&gt;
 ######    #&lt;br /&gt;
 ###########&lt;br /&gt;
And path cost: 4&lt;br /&gt;
Or path cost: 10&lt;br /&gt;
Purge path cost: 15&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Complex Compound gate, Octal display ALU&lt;br /&gt;
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)&lt;br /&gt;
&lt;br /&gt;
 #################&lt;br /&gt;
                 #&lt;br /&gt;
 # # # # # # #1# #&lt;br /&gt;
 # # #1# #1#2#2# #&lt;br /&gt;
 #1#2#2#4#4#4#4# #&lt;br /&gt;
 #D#D#D#D#D#D#D#D#&lt;br /&gt;
 #               #&lt;br /&gt;
 #################&lt;br /&gt;
&lt;br /&gt;
 # ######&lt;br /&gt;
 # 1  D #&lt;br /&gt;
 # #### #&lt;br /&gt;
 # 2  D #&lt;br /&gt;
 # #### #&lt;br /&gt;
 # 12 D #&lt;br /&gt;
 # #### #&lt;br /&gt;
 # 4  D #&lt;br /&gt;
 # #### #&lt;br /&gt;
 # 14 D #&lt;br /&gt;
 # #### #&lt;br /&gt;
 # 24 D #&lt;br /&gt;
 # #### #&lt;br /&gt;
 # 124D #&lt;br /&gt;
 # #### #&lt;br /&gt;
 #    D #&lt;br /&gt;
 ########&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Fusion gates==&lt;br /&gt;
&lt;br /&gt;
These are gates which are constructed by physically combining the two gates to get a specific output.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
AndOr&lt;br /&gt;
This gate will evaluate if either of x And statements are TRUE. This gate is built as a straight line similar to the And gate&lt;br /&gt;
 ######&lt;br /&gt;
 #C####&lt;br /&gt;
 ABD^ D&lt;br /&gt;
 C#####&lt;br /&gt;
 ######&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
NAndOr&lt;br /&gt;
Reconfigured AndOr gate, see AndOr&lt;br /&gt;
 ######&lt;br /&gt;
 #C####&lt;br /&gt;
 ABD ^D&lt;br /&gt;
 C#####&lt;br /&gt;
 ######&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
OrandOr&lt;br /&gt;
This gate returns true if either A or B and either C or D is true.&lt;br /&gt;
&lt;br /&gt;
 ######&lt;br /&gt;
 AC####&lt;br /&gt;
 BED^ D&lt;br /&gt;
 ######&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
OrandAnd&lt;br /&gt;
This gate returns true if either A or B is true, and E and C are true.&lt;br /&gt;
&lt;br /&gt;
 #######&lt;br /&gt;
 A######&lt;br /&gt;
 BCED^ D&lt;br /&gt;
 #######&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Complex Gates==&lt;br /&gt;
&lt;br /&gt;
==Adders==&lt;br /&gt;
A Full adder can be made as a Compound Fusion gate, by combining, And, AndOr, and Or gates&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Binary Adder&lt;br /&gt;
The first binary adder I attempted was structured like an electronic adder using an array of simple gates. It contained five animals and used grates to control the logic, based off of bidok's logic gates. This adder functioned correctly but it was very inefficient with space, and highly unreliable often taking ten plus minutes to properly align. I refined this design by lining the gates up into a linear arrangement, but this failed to solve the efficiency problems.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
I then realized that simply limiting my Adder to using Electronic gates was silly realizing the key point of animal logic I designed a single stage gate, which had four output states: 0,1,C,1&amp;amp;C. this allowed me to compress the Adder into a single circuit. Modifying the design further the use of doors allows the new design to function at approximately 4-6 times the speed of the prototype adder.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The Binary Adder function by adding three values, A,B, and Carry. Carry is only involved if the previous adder had a result of 2, or 3. the adder works by detecting if (A Or B Or C = True)Sum=1, Or (A And B, Or, A And C, Or B And C = True)Sum=2, Or (A And B And C = True)Sum=3, Or (A And B And C = False)Sum=0. With this basic logic one simply needs to configure the output for 1 if the answer is 1, C if the answer is 2, and 1 and C if the answer is 3. the gates must also be arranged so the Highest Sum has the shortest path to ground as otherwise the gate would return nonsense.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Stand alone Adders (they don't carry into another adder) require 22 mechanisms, and 14 doors.&lt;br /&gt;
Start Adders (They feed into the next Adder and include a carry) require 32 mechanisms, and 14 doors.&lt;br /&gt;
Chain Adders (The receive Carry, and pass a Carry bit up) require 32 mechanisms, and 14 doors&lt;br /&gt;
While Materials intensive the gates only take up 13x9 urists, ideal for chaining along mining tunnels.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Reference pictures&lt;br /&gt;
[[Image:Xnor,Xor,Nand,Or prototype adder STATE 1.PNG|frame|Prototype digital adder]]&lt;br /&gt;
[[Image:And,Or,AndOr, Prototype adder STATE 3.PNG|frame|sum 11]]&lt;br /&gt;
[[Image:And,Or,AndOr, Prototype adder STATE 2.PNG|frame|sum 10]]&lt;br /&gt;
[[Image:And,Or,AndOr, Prototype adder STATE 1.PNG|frame|sum 01]]&lt;br /&gt;
[[Image:And,Or,AndOr, Prototype adder STATE 0.PNG|frame|sum 00]]&lt;br /&gt;
[[Image:9bit adder prototype interface pannel.PNG|frame|9bit adder interface]]&lt;br /&gt;
[[Image:9bit adder prototype.PNG|frame|9bit adder]]&lt;br /&gt;
[[Image:9bit adder prototype 10100010notes.PNG|frame|9bit adder, notes show the decimal value of each adder's bit]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
By chaining these gates you can perform most binary math, the easiest of which is addition. In my old fort I built and tested my initial 9 Bit Addition computer. the design failed in two circumstances, the AndOr gate of bit 32 had a lower path cost than the And gate when the animal was at Sum 2, and the Or gate in bit 4 had a lower path cost than ground if the lower door was open.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The gates in the Super Snail adder can be reset to the correct positions by forbidding the doors which fault. I'm working on a more reliable compact adder. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Decimal Adder&lt;br /&gt;
While it can be done, It's massively more complex than simply making a set of decimal converters working with numbers over 10,&lt;br /&gt;
&lt;br /&gt;
hexadecimal adder&lt;br /&gt;
The hex adder makes use of 32 sum gates per side of a single adder, making it geometrically more complex than the binary adder, however it does make animal management more streamlined. more information to come.&lt;br /&gt;
&lt;br /&gt;
Status&lt;br /&gt;
Sum gates 0-31           done&lt;br /&gt;
layout                   pending&lt;br /&gt;
working prototype        pending&lt;br /&gt;
finished dorfputer       pending&lt;br /&gt;
&lt;br /&gt;
Subtractors&lt;br /&gt;
inverse adder, simple but not yet tested.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Animals==&lt;br /&gt;
&lt;br /&gt;
Choosing the animal which works as the logic core for an animal logic systems is somewhat important, depending on your needs and the available animals. however pretty much anything will do as long as you can remember which animal fits into which gate (to avoid designating the same animal for more than one pit).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Kittens&lt;br /&gt;
Put those worthless cats to work, load them into your fortress's logic core and make them work for their keep. while kittens are the most reliable cores for logic gates with their 3 pathing goals they're also problematic as they grow into cats which only have two, and may cause catsplosions inside your logical cores. Ideally kittens should be replaced yearly or biyearly as their growth defines.&lt;br /&gt;
Kittens path to the activity zone, their parents, and vermin.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Puppies&lt;br /&gt;
Why should your fortresses working animals only work once they grow up? throw the puppies into the logic core and have them work from the day of their birth. Puppies are quite reliable with their two pathing goals, but retain the problem of maturation.&lt;br /&gt;
Puppies path to the activity zone, and their parents.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Animal Children&lt;br /&gt;
Using the non matured animals for something useful before butchering may be quite effective, however they still must be flushed when they mature.&lt;br /&gt;
Animal children path to the activity zone, and their parents.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Cats&lt;br /&gt;
Aggravating animals, throw them into the computer and get some worth out of them. Otherwise useless cats become useful when used for logic, with two pathing goals they're responsive, and multiply quickly. watch out for catsplosions while using these critters&lt;br /&gt;
Cats path to the activity zone, and Vermin.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Dogs&lt;br /&gt;
The workhorse of your fortress, because horses can't do anything useful. I'd recommend not using dogs as they're put to better use as wardogs to protect your dorfs.&lt;br /&gt;
Dogs path to the activity zone.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Cattle&lt;br /&gt;
Large lumbering bovines, the advantage of Cattle is you can tell the sexes apart, they also make the pressure plates continue to work if you forget to reassign the trigger weight.&lt;br /&gt;
Cattle path to the activity zone.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Other animals&lt;br /&gt;
Any animals work, but the above are probably your best choice, excluding any modded animals. however if you have a GCS handy a GCS powered computer would be awesome, so take this as you will.&lt;br /&gt;
Other animals have different pathing goals, but most only path to the activity zone.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Goblins&lt;br /&gt;
I'm working on an incremental goblin powered system, results pending.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Putting it all together==&lt;br /&gt;
&lt;br /&gt;
When it comes time to automate your systems the first thing you need to know is what needs to automated and what should remain manual. an obsidian farm with completely autonomous control of the casting process is all well and good, until it drowns all your legendary miners when it prematurely triggers. all systems should have manual controls and failsafes to help avoid FUN! (but because we all love FUN sometimes you forget to fully connect that emergency drain, or that failsafe system you built somehow failed.)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
once you know the steps you need in your system it comes time to select the parts you need to automate, whether it be basic logic gates or more sophisticated multiple trigger systems.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This is mainly pure logic and I can't really help with that, but post a requirement in the talk page and if I see it I'll work on it. Consult the computing page on this wiki, and look up digital logic on Wikipedia. past that it's pretty fundamental and I don't really think I can adequately describe it.&lt;/div&gt;</summary>
		<author><name>LordOOTFD</name></author>
	</entry>
	<entry>
		<id>http://dwarffortresswiki.org/index.php?title=File:9bit_adder_prototype_10100010notes.PNG&amp;diff=61935</id>
		<title>File:9bit adder prototype 10100010notes.PNG</title>
		<link rel="alternate" type="text/html" href="http://dwarffortresswiki.org/index.php?title=File:9bit_adder_prototype_10100010notes.PNG&amp;diff=61935"/>
		<updated>2010-01-29T05:27:08Z</updated>

		<summary type="html">&lt;p&gt;LordOOTFD: 9bit adder showing bit values&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;9bit adder showing bit values&lt;/div&gt;</summary>
		<author><name>LordOOTFD</name></author>
	</entry>
	<entry>
		<id>http://dwarffortresswiki.org/index.php?title=User:LordOOTFD&amp;diff=61934</id>
		<title>User:LordOOTFD</title>
		<link rel="alternate" type="text/html" href="http://dwarffortresswiki.org/index.php?title=User:LordOOTFD&amp;diff=61934"/>
		<updated>2010-01-29T05:22:47Z</updated>

		<summary type="html">&lt;p&gt;LordOOTFD: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Animal logic works as a function of the path finding algorithm in dwarf fortress, as all animals seek to find the lowest cost path to their desired objects (activity zone, parents, dwarfs, valuable objects, etc) this can be used to create very very complex logic gates. Animal logic has three principle advantages, speed, compactness, and simplified functions; however, animal logic is slower than mechanical logic, less reliable than either, and logic is often inverted.&lt;br /&gt;
&lt;br /&gt;
Throughout this document I will be using a number of terms which may not be immediately obvious so I'll list them here: &lt;br /&gt;
&lt;br /&gt;
Ground: for simplicity the thing the animal is pathing to is refereed to as ground as that is the ground state which it wishes to reach. Ground is always the left unless otherwise noted.&lt;br /&gt;
&lt;br /&gt;
Purge: Path to ground with no inputs&lt;br /&gt;
&lt;br /&gt;
Path cost: The number of steps the animal must make to reach ground&lt;br /&gt;
&lt;br /&gt;
Fusion Gate: Simply one or more logic gates built into the same system (this is more than simply stringing gates)&lt;br /&gt;
&lt;br /&gt;
Compund Gate: Gate which uses two or more gates set to different path costs.&lt;br /&gt;
&lt;br /&gt;
And Gate: And takes x inputs and output TRUE if ALL are TRUE.&lt;br /&gt;
&lt;br /&gt;
NAnd Gate: NAnd takes x inputs and returns TRUE if ALL are FALSE. &lt;br /&gt;
&lt;br /&gt;
AndOr Gate: AndOr takes x inputs and returns TRUE if X-Y are TRUE. (this gate is exclusive to animal logic, and is a single step fusion of And, and Or)&lt;br /&gt;
&lt;br /&gt;
Or Gate: Or takes x input and output TRUE if ANY are true.&lt;br /&gt;
&lt;br /&gt;
Not Gate: Not takes a single input and inverts it to the oposite state TRUE if FALSE. &lt;br /&gt;
&lt;br /&gt;
XOr Gate: XOr takes 2 or more inputs and output TRUE if ONLY ONE is TRUE but NOT ALL are TRUE. &lt;br /&gt;
&lt;br /&gt;
NOr Gate: NOr takes x input and returns TRUE if ALL inputs are FALSE. &lt;br /&gt;
&lt;br /&gt;
XNOr Gate: XNOr takes 2 or more inputs and returns TRUE if ALL are TRUE, OR FALSE.&lt;br /&gt;
&lt;br /&gt;
For a better explanation of gates see:http://en.wikipedia.org/wiki/Logic_gate&lt;br /&gt;
&lt;br /&gt;
Notation: #:always 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) 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.&lt;br /&gt;
&lt;br /&gt;
Gates will always be capitalized in the way they are within the entry, I.E. And, Or, AndOr, XNOr, etc&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
There are three principle 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 principle reason for this is pathfinding always prefers the shortest path to ground, 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, more than a single on or off signal. For simplicity and streamlining the systems I have designed only use binary outputs, but theoretically they could be made to compute natively in decimal; however, this is a bit more complicated than a week of study allows.&lt;br /&gt;
&lt;br /&gt;
==SIMPLE GATES==&lt;br /&gt;
&lt;br /&gt;
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 &amp;quot;wake up&amp;quot; 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 it's enclosure, this allows the gate to respond faster 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 I find them to be better in general use.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
And&lt;br /&gt;
This simple gate is made by confining the animal into a straight coridor; the ground path will have two or more doors which are connected to the input, while the second longer path remains clear. the gate can be configured as an NAnd gate by simply moving the pressure plate. if the plate is by the ground path it functions as an And gate returning TRUE if the ground path is open, and if the plate is by the purge path it will return FALSE when the inputs are TRUE&lt;br /&gt;
 #########&lt;br /&gt;
  ABCD^ D&lt;br /&gt;
 #########&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Multi And&lt;br /&gt;
 ############&lt;br /&gt;
  ANYNUMD^ D&lt;br /&gt;
 ############&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
NAnd&lt;br /&gt;
Reconfigured And gate, see And.&lt;br /&gt;
 #########&lt;br /&gt;
  ABCD ^D&lt;br /&gt;
 #########&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Or&lt;br /&gt;
Basic gate&lt;br /&gt;
 #####&lt;br /&gt;
 AD^ D&lt;br /&gt;
 B####&lt;br /&gt;
 #####&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Multi Or&lt;br /&gt;
 #######&lt;br /&gt;
 A #####&lt;br /&gt;
 N #####&lt;br /&gt;
 Y D^ D&lt;br /&gt;
 N #####&lt;br /&gt;
 M #####&lt;br /&gt;
 #######&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
NOr&lt;br /&gt;
Basically a reconfigured Or gate&lt;br /&gt;
 #####&lt;br /&gt;
 AD ^D&lt;br /&gt;
 B####&lt;br /&gt;
 #####&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Not&lt;br /&gt;
The simplest gate, It only takes a single imput.&lt;br /&gt;
 #######&lt;br /&gt;
  AD^ D&lt;br /&gt;
 #######&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Compound Gates==&lt;br /&gt;
&lt;br /&gt;
Basically two or more gates arranged with different path costs to ground. These gates can be configured in a number of different ways, these being the simplest. It may be possible to make these gates as single gates but that would require inverting some of the input. Simple compund gates use two simple gates and handle two inputs, complex compund gates have more then two simple gates and need more than two inputs. a Complex compund gate might be used to convert decimal numbers into binary using And gates&lt;br /&gt;
&lt;br /&gt;
XOr&lt;br /&gt;
Compound of And and Or, when ONLY ONE is TRUE returns TRUE&lt;br /&gt;
If A and B are false the animal moves to the FALSE position by Purge, if A or B is true, the animal moves to the TRUE position at the Or gate, if both A and B are true the animal moves to the FALSE postion by the And gate.&lt;br /&gt;
&lt;br /&gt;
 #g########&lt;br /&gt;
 # ABD  D #&lt;br /&gt;
 # ####^# #&lt;br /&gt;
 # ####D# #&lt;br /&gt;
 # ###BA# #&lt;br /&gt;
 #        #&lt;br /&gt;
 ##########&lt;br /&gt;
And path cost: 4&lt;br /&gt;
Or path cost: 10&lt;br /&gt;
Purge path cost: 14&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
XNor&lt;br /&gt;
Inverse of XOr: Return TRUE if BOTH are TRUE OR FALSE&lt;br /&gt;
If A and B are false the animal move to the TRUE position by Purge, if A or B is true, the animal moves to the FALSE position at the Or gate, if both A and B are true the animal moves to the TRUE postion by the And gate.&lt;br /&gt;
&lt;br /&gt;
 #g#########&lt;br /&gt;
 #         #&lt;br /&gt;
 ##B###### #&lt;br /&gt;
 ###A## DA # &lt;br /&gt;
 ####D^##B #&lt;br /&gt;
 #####D### #&lt;br /&gt;
 ######    #&lt;br /&gt;
 ###########&lt;br /&gt;
And path cost: 4&lt;br /&gt;
Or path cost: 10&lt;br /&gt;
Purge path cost: 15&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Complex Compound gate, Octal display ALU&lt;br /&gt;
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)&lt;br /&gt;
&lt;br /&gt;
 #################&lt;br /&gt;
                 #&lt;br /&gt;
 # # # # # # #1# #&lt;br /&gt;
 # # #1# #1#2#2# #&lt;br /&gt;
 #1#2#2#4#4#4#4# #&lt;br /&gt;
 #D#D#D#D#D#D#D#D#&lt;br /&gt;
 #               #&lt;br /&gt;
 #################&lt;br /&gt;
&lt;br /&gt;
 # ######&lt;br /&gt;
 # 1  D #&lt;br /&gt;
 # #### #&lt;br /&gt;
 # 2  D #&lt;br /&gt;
 # #### #&lt;br /&gt;
 # 12 D #&lt;br /&gt;
 # #### #&lt;br /&gt;
 # 4  D #&lt;br /&gt;
 # #### #&lt;br /&gt;
 # 14 D #&lt;br /&gt;
 # #### #&lt;br /&gt;
 # 24 D #&lt;br /&gt;
 # #### #&lt;br /&gt;
 # 124D #&lt;br /&gt;
 # #### #&lt;br /&gt;
 #    D #&lt;br /&gt;
 ########&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Fusion gates==&lt;br /&gt;
&lt;br /&gt;
These are gates which are constructed by physically combining the two gates to get a specific output.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
AndOr&lt;br /&gt;
This gate will evaluate if either of x And statements are TRUE. This gate is built as a straight line similar to the And gate&lt;br /&gt;
 ######&lt;br /&gt;
 #C####&lt;br /&gt;
 ABD^ D&lt;br /&gt;
 C#####&lt;br /&gt;
 ######&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
NAndOr&lt;br /&gt;
Reconfigured AndOr gate, see AndOr&lt;br /&gt;
 ######&lt;br /&gt;
 #C####&lt;br /&gt;
 ABD ^D&lt;br /&gt;
 C#####&lt;br /&gt;
 ######&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
OrandOr&lt;br /&gt;
This gate returns true if either A or B and either C or D is true.&lt;br /&gt;
&lt;br /&gt;
 ######&lt;br /&gt;
 AC####&lt;br /&gt;
 BED^ D&lt;br /&gt;
 ######&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
OrandAnd&lt;br /&gt;
This gate returns true if either A or B is true, and E and C are true.&lt;br /&gt;
&lt;br /&gt;
 #######&lt;br /&gt;
 A######&lt;br /&gt;
 BCED^ D&lt;br /&gt;
 #######&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Complex Gates==&lt;br /&gt;
&lt;br /&gt;
==Adders==&lt;br /&gt;
A Full adder can be made as a Compound Fusion gate, by combining, And, AndOr, and Or gates&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Binary Adder&lt;br /&gt;
The first binary adder I attempted was structured like an electronic adder using an array of simple gates. It contained five animals and used grates to control the logic, based off of bidok's logic gates. This adder functioned correctly but it was very inefficient with space, and highly unreliable often taking ten plus minutes to properly align. I refined this design by lining the gates up into a linear arrangement, but this failed to solve the efficiency problems.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
I then realized that simply limiting my Adder to using Electronic gates was silly realizing the key point of animal logic I designed a single stage gate, which had four output states: 0,1,C,1&amp;amp;C. this allowed me to compress the Adder into a single circuit. Modifying the design further the use of doors allows the new design to function at approximately 4-6 times the speed of the prototype adder.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The Binary Adder function by adding three values, A,B, and Carry. Carry is only involved if the previous adder had a result of 2, or 3. the adder works by detecting if (A Or B Or C = True)Sum=1, Or (A And B, Or, A And C, Or B And C = True)Sum=2, Or (A And B And C = True)Sum=3, Or (A And B And C = False)Sum=0. With this basic logic one simply needs to configure the output for 1 if the answer is 1, C if the answer is 2, and 1 and C if the answer is 3. the gates must also be arranged so the Highest Sum has the shortest path to ground as otherwise the gate would return nonsense.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Stand alone Adders (they don't carry into another adder) require 22 mechanisms, and 14 doors.&lt;br /&gt;
Start Adders (They feed into the next Adder and include a carry) require 32 mechanisms, and 14 doors.&lt;br /&gt;
Chain Adders (The receive Carry, and pass a Carry bit up) require 32 mechanisms, and 14 doors&lt;br /&gt;
While Materials intensive the gates only take up 13x9 urists, ideal for chaining along mining tunnels.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Reference pictures&lt;br /&gt;
[[Image:Xnor,Xor,Nand,Or prototype adder STATE 1.PNG|frame|Prototype digital adder]]&lt;br /&gt;
Add pictures of the states here&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
By chaining these gates you can perform most binary math, the easiest of which is addition. In my old fort I built and tested my initial 9 Bit Addition computer. the design failed in two circumstances, the AndOr gate of bit 32 had a lower path cost than the And gate when the animal was at Sum 2, and the Or gate in bit 4 had a lower path cost than ground if the lower door was open.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The gates in the Super Snail adder can be reset to the correct positions by forbidding the doors which fault. I'm working on a more reliable compact adder. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Decimal Adder&lt;br /&gt;
While it can be done, It's massively more complex than simply making a set of decimal converters working with numbers over 10,&lt;br /&gt;
&lt;br /&gt;
hexadecimal adder&lt;br /&gt;
The hex adder makes use of 32 sum gates per side of a single adder, making it geometrically more complex than the binary adder, however it does make animal management more streamlined. more information to come.&lt;br /&gt;
&lt;br /&gt;
Status&lt;br /&gt;
Sum gates 0-31           done&lt;br /&gt;
layout                   pending&lt;br /&gt;
working prototype        pending&lt;br /&gt;
finished dorfputer       pending&lt;br /&gt;
&lt;br /&gt;
Subtractors&lt;br /&gt;
inverse adder, simple but not yet tested.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Animals==&lt;br /&gt;
&lt;br /&gt;
Choosing the animal which works as the logic core for an animal logic systems is somewhat important, depending on your needs and the available animals. however pretty much anything will do as long as you can remember which animal fits into which gate (to avoid designating the same animal for more than one pit).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Kittens&lt;br /&gt;
Put those worthless cats to work, load them into your fortress's logic core and make them work for their keep. while kittens are the most reliable cores for logic gates with their 3 pathing goals they're also problematic as they grow into cats which only have two, and may cause catsplosions inside your logical cores. Ideally kittens should be replaced yearly or biyearly as their growth defines.&lt;br /&gt;
Kittens path to the activity zone, their parents, and vermin.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Puppies&lt;br /&gt;
Why should your fortresses working animals only work once they grow up? throw the puppies into the logic core and have them work from the day of their birth. Puppies are quite reliable with their two pathing goals, but retain the problem of maturation.&lt;br /&gt;
Puppies path to the activity zone, and their parents.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Animal Children&lt;br /&gt;
Using the non matured animals for something useful before butchering may be quite effective, however they still must be flushed when they mature.&lt;br /&gt;
Animal children path to the activity zone, and their parents.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Cats&lt;br /&gt;
Aggravating animals, throw them into the computer and get some worth out of them. Otherwise useless cats become useful when used for logic, with two pathing goals they're responsive, and multiply quickly. watch out for catsplosions while using these critters&lt;br /&gt;
Cats path to the activity zone, and Vermin.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Dogs&lt;br /&gt;
The workhorse of your fortress, because horses can't do anything useful. I'd recommend not using dogs as they're put to better use as wardogs to protect your dorfs.&lt;br /&gt;
Dogs path to the activity zone.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Cattle&lt;br /&gt;
Large lumbering bovines, the advantage of Cattle is you can tell the sexes apart, they also make the pressure plates continue to work if you forget to reassign the trigger weight.&lt;br /&gt;
Cattle path to the activity zone.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Other animals&lt;br /&gt;
Any animals work, but the above are probably your best choice, excluding any modded animals. however if you have a GCS handy a GCS powered computer would be awesome, so take this as you will.&lt;br /&gt;
Other animals have different pathing goals, but most only path to the activity zone.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Goblins&lt;br /&gt;
I'm working on an incremental goblin powered system, results pending.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Putting it all together==&lt;br /&gt;
&lt;br /&gt;
When it comes time to automate your systems the first thing you need to know is what needs to automated and what should remain manual. an obsidian farm with completely autonomous control of the casting process is all well and good, until it drowns all your legendary miners when it prematurely triggers. all systems should have manual controls and failsafes to help avoid FUN! (but because we all love FUN sometimes you forget to fully connect that emergency drain, or that failsafe system you built somehow failed.)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
once you know the steps you need in your system it comes time to select the parts you need to automate, whether it be basic logic gates or more sophisticated multiple trigger systems.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This is mainly pure logic and I can't really help with that, but post a requirement in the talk page and if I see it I'll work on it. Consult the computing page on this wiki, and look up digital logic on Wikipedia. past that it's pretty fundamental and I don't really think I can adequately describe it.&lt;/div&gt;</summary>
		<author><name>LordOOTFD</name></author>
	</entry>
	<entry>
		<id>http://dwarffortresswiki.org/index.php?title=User:LordOOTFD&amp;diff=61933</id>
		<title>User:LordOOTFD</title>
		<link rel="alternate" type="text/html" href="http://dwarffortresswiki.org/index.php?title=User:LordOOTFD&amp;diff=61933"/>
		<updated>2010-01-29T05:20:52Z</updated>

		<summary type="html">&lt;p&gt;LordOOTFD: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Animal logic works as a function of the path finding algorithm in dwarf fortress, as all animals seek to find the lowest cost path to their desired objects (activity zone, parents, dwarfs, valuable objects, etc) this can be used to create very very complex logic gates. Animal logic has three principle advantages, speed, compactness, and simplified functions; however, animal logic is slower than mechanical logic, less reliable than either, and logic is often inverted.&lt;br /&gt;
&lt;br /&gt;
Throughout this document I will be using a number of terms which may not be immediately obvious so I'll list them here: &lt;br /&gt;
&lt;br /&gt;
Ground: for simplicity the thing the animal is pathing to is refereed to as ground as that is the ground state which it wishes to reach. Ground is always the left unless otherwise noted.&lt;br /&gt;
&lt;br /&gt;
Purge: Path to ground with no inputs&lt;br /&gt;
&lt;br /&gt;
Path cost: The number of steps the animal must make to reach ground&lt;br /&gt;
&lt;br /&gt;
Fusion Gate: Simply one or more logic gates built into the same system (this is more than simply stringing gates)&lt;br /&gt;
&lt;br /&gt;
Compund Gate: Gate which uses two or more gates set to different path costs.&lt;br /&gt;
&lt;br /&gt;
And Gate: And takes x inputs and output TRUE if ALL are TRUE.&lt;br /&gt;
&lt;br /&gt;
NAnd Gate: NAnd takes x inputs and returns TRUE if ALL are FALSE. &lt;br /&gt;
&lt;br /&gt;
AndOr Gate: AndOr takes x inputs and returns TRUE if X-Y are TRUE. (this gate is exclusive to animal logic, and is a single step fusion of And, and Or)&lt;br /&gt;
&lt;br /&gt;
Or Gate: Or takes x input and output TRUE if ANY are true.&lt;br /&gt;
&lt;br /&gt;
Not Gate: Not takes a single input and inverts it to the oposite state TRUE if FALSE. &lt;br /&gt;
&lt;br /&gt;
XOr Gate: XOr takes 2 or more inputs and output TRUE if ONLY ONE is TRUE but NOT ALL are TRUE. &lt;br /&gt;
&lt;br /&gt;
NOr Gate: NOr takes x input and returns TRUE if ALL inputs are FALSE. &lt;br /&gt;
&lt;br /&gt;
XNOr Gate: XNOr takes 2 or more inputs and returns TRUE if ALL are TRUE, OR FALSE.&lt;br /&gt;
&lt;br /&gt;
For a better explanation of gates see:http://en.wikipedia.org/wiki/Logic_gate&lt;br /&gt;
&lt;br /&gt;
Notation: #:always 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) 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.&lt;br /&gt;
&lt;br /&gt;
Gates will always be capitalized in the way they are within the entry, I.E. And, Or, AndOr, XNOr, etc&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
There are three principle 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 principle reason for this is pathfinding always prefers the shortest path to ground, 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, more than a single on or off signal. For simplicity and streamlining the systems I have designed only use binary outputs, but theoretically they could be made to compute natively in decimal; however, this is a bit more complicated than a week of study allows.&lt;br /&gt;
&lt;br /&gt;
==SIMPLE GATES==&lt;br /&gt;
&lt;br /&gt;
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 &amp;quot;wake up&amp;quot; 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 it's enclosure, this allows the gate to respond faster 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 I find them to be better in general use.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
And&lt;br /&gt;
This simple gate is made by confining the animal into a straight coridor; the ground path will have two or more doors which are connected to the input, while the second longer path remains clear. the gate can be configured as an NAnd gate by simply moving the pressure plate. if the plate is by the ground path it functions as an And gate returning TRUE if the ground path is open, and if the plate is by the purge path it will return FALSE when the inputs are TRUE&lt;br /&gt;
 #########&lt;br /&gt;
  ABCD^ D&lt;br /&gt;
 #########&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Multi And&lt;br /&gt;
 ############&lt;br /&gt;
  ANYNUMD^ D&lt;br /&gt;
 ############&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
NAnd&lt;br /&gt;
Reconfigured And gate, see And.&lt;br /&gt;
 #########&lt;br /&gt;
  ABCD ^D&lt;br /&gt;
 #########&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Or&lt;br /&gt;
Basic gate&lt;br /&gt;
 #####&lt;br /&gt;
 AD^ D&lt;br /&gt;
 B####&lt;br /&gt;
 #####&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Multi Or&lt;br /&gt;
 #######&lt;br /&gt;
 A #####&lt;br /&gt;
 N #####&lt;br /&gt;
 Y D^ D&lt;br /&gt;
 N #####&lt;br /&gt;
 M #####&lt;br /&gt;
 #######&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
NOr&lt;br /&gt;
Basically a reconfigured Or gate&lt;br /&gt;
 #####&lt;br /&gt;
 AD ^D&lt;br /&gt;
 B####&lt;br /&gt;
 #####&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Not&lt;br /&gt;
The simplest gate, It only takes a single imput.&lt;br /&gt;
 #######&lt;br /&gt;
  AD^ D&lt;br /&gt;
 #######&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Compound Gates==&lt;br /&gt;
&lt;br /&gt;
Basically two or more gates arranged with different path costs to ground. These gates can be configured in a number of different ways, these being the simplest. It may be possible to make these gates as single gates but that would require inverting some of the input. Simple compund gates use two simple gates and handle two inputs, complex compund gates have more then two simple gates and need more than two inputs. a Complex compund gate might be used to convert decimal numbers into binary using And gates&lt;br /&gt;
&lt;br /&gt;
XOr&lt;br /&gt;
Compound of And and Or, when ONLY ONE is TRUE returns TRUE&lt;br /&gt;
If A and B are false the animal moves to the FALSE position by Purge, if A or B is true, the animal moves to the TRUE position at the Or gate, if both A and B are true the animal moves to the FALSE postion by the And gate.&lt;br /&gt;
&lt;br /&gt;
 #g########&lt;br /&gt;
 # ABD  D #&lt;br /&gt;
 # ####^# #&lt;br /&gt;
 # ####D# #&lt;br /&gt;
 # ###BA# #&lt;br /&gt;
 #        #&lt;br /&gt;
 ##########&lt;br /&gt;
And path cost: 4&lt;br /&gt;
Or path cost: 10&lt;br /&gt;
Purge path cost: 14&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
XNor&lt;br /&gt;
Inverse of XOr: Return TRUE if BOTH are TRUE OR FALSE&lt;br /&gt;
If A and B are false the animal move to the TRUE position by Purge, if A or B is true, the animal moves to the FALSE position at the Or gate, if both A and B are true the animal moves to the TRUE postion by the And gate.&lt;br /&gt;
&lt;br /&gt;
 #g#########&lt;br /&gt;
 #         #&lt;br /&gt;
 ##B###### #&lt;br /&gt;
 ###A## DA # &lt;br /&gt;
 ####D^##B #&lt;br /&gt;
 #####D### #&lt;br /&gt;
 ######    #&lt;br /&gt;
 ###########&lt;br /&gt;
And path cost: 4&lt;br /&gt;
Or path cost: 10&lt;br /&gt;
Purge path cost: 15&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Complex Compound gate, Octal display ALU&lt;br /&gt;
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)&lt;br /&gt;
&lt;br /&gt;
 #################&lt;br /&gt;
                 #&lt;br /&gt;
 # # # # # # #1# #&lt;br /&gt;
 # # #1# #1#2#2# #&lt;br /&gt;
 #1#2#2#4#4#4#4# #&lt;br /&gt;
 #D#D#D#D#D#D#D#D#&lt;br /&gt;
 #               #&lt;br /&gt;
 #################&lt;br /&gt;
&lt;br /&gt;
 # ######&lt;br /&gt;
 # 1  D #&lt;br /&gt;
 # #### #&lt;br /&gt;
 # 2  D #&lt;br /&gt;
 # #### #&lt;br /&gt;
 # 12 D #&lt;br /&gt;
 # #### #&lt;br /&gt;
 # 4  D #&lt;br /&gt;
 # #### #&lt;br /&gt;
 # 14 D #&lt;br /&gt;
 # #### #&lt;br /&gt;
 # 24 D #&lt;br /&gt;
 # #### #&lt;br /&gt;
 # 124D #&lt;br /&gt;
 # #### #&lt;br /&gt;
 #    D #&lt;br /&gt;
 ########&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Fusion gates==&lt;br /&gt;
&lt;br /&gt;
These are gates which are constructed by physically combining the two gates to get a specific output.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
AndOr&lt;br /&gt;
This gate will evaluate if either of x And statements are TRUE. This gate is built as a straight line similar to the And gate&lt;br /&gt;
 ######&lt;br /&gt;
 #C####&lt;br /&gt;
 ABD^ D&lt;br /&gt;
 C#####&lt;br /&gt;
 ######&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
NAndOr&lt;br /&gt;
Reconfigured AndOr gate, see AndOr&lt;br /&gt;
 ######&lt;br /&gt;
 #C####&lt;br /&gt;
 ABD ^D&lt;br /&gt;
 C#####&lt;br /&gt;
 ######&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
OrandOr&lt;br /&gt;
This gate returns true if either A or B and either C or D is true.&lt;br /&gt;
&lt;br /&gt;
 ######&lt;br /&gt;
 AC####&lt;br /&gt;
 BED^ D&lt;br /&gt;
 ######&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
OrandAnd&lt;br /&gt;
This gate returns true if either A or B is true, and E and C are true.&lt;br /&gt;
&lt;br /&gt;
 #######&lt;br /&gt;
 A######&lt;br /&gt;
 BCED^ D&lt;br /&gt;
 #######&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Complex Gates==&lt;br /&gt;
&lt;br /&gt;
==Adders==&lt;br /&gt;
A Full adder can be made as a Compound Fusion gate, by combining, And, AndOr, and Or gates&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Binary Adder&lt;br /&gt;
The first binary adder I attempted was structured like an electronic adder using an array of simple gates. It contained five animals and used grates to control the logic, based off of bidok's logic gates. This adder functioned correctly but it was very inefficient with space, and highly unreliable often taking ten plus minutes to properly align. I refined this design by lining the gates up into a linear arrangement, but this failed to solve the efficiency problems.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
I then realized that simply limiting my Adder to using Electronic gates was silly realizing the key point of animal logic I designed a single stage gate, which had four output states: 0,1,C,1&amp;amp;C. this allowed me to compress the Adder into a single circuit. Modifying the design further the use of doors allows the new design to function at approximately 4-6 times the speed of the prototype adder.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The Binary Adder function by adding three values, A,B, and Carry. Carry is only involved if the previous adder had a result of 2, or 3. the adder works by detecting if (A Or B Or C = True)Sum=1, Or (A And B, Or, A And C, Or B And C = True)Sum=2, Or (A And B And C = True)Sum=3, Or (A And B And C = False)Sum=0. With this basic logic one simply needs to configure the output for 1 if the answer is 1, C if the answer is 2, and 1 and C if the answer is 3. the gates must also be arranged so the Highest Sum has the shortest path to ground as otherwise the gate would return nonsense.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Stand alone Adders (they don't carry into another adder) require 22 mechanisms, and 14 doors.&lt;br /&gt;
Start Adders (They feed into the next Adder and include a carry) require 32 mechanisms, and 14 doors.&lt;br /&gt;
Chain Adders (The receive Carry, and pass a Carry bit up) require 32 mechanisms, and 14 doors&lt;br /&gt;
While Materials intensive the gates only take up 13x9 urists, ideal for chaining along mining tunnels.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Reference pictures&lt;br /&gt;
[[Image:Xnor,Xor,Nand,Or prototype adder STATE 1.PNG]]&lt;br /&gt;
Add pictures of the states here&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
By chaining these gates you can perform most binary math, the easiest of which is addition. In my old fort I built and tested my initial 9 Bit Addition computer. the design failed in two circumstances, the AndOr gate of bit 32 had a lower path cost than the And gate when the animal was at Sum 2, and the Or gate in bit 4 had a lower path cost than ground if the lower door was open.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The gates in the Super Snail adder can be reset to the correct positions by forbidding the doors which fault. I'm working on a more reliable compact adder. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Decimal Adder&lt;br /&gt;
While it can be done, It's massively more complex than simply making a set of decimal converters working with numbers over 10,&lt;br /&gt;
&lt;br /&gt;
hexadecimal adder&lt;br /&gt;
The hex adder makes use of 32 sum gates per side of a single adder, making it geometrically more complex than the binary adder, however it does make animal management more streamlined. more information to come.&lt;br /&gt;
&lt;br /&gt;
Status&lt;br /&gt;
Sum gates 0-31           done&lt;br /&gt;
layout                   pending&lt;br /&gt;
working prototype        pending&lt;br /&gt;
finished dorfputer       pending&lt;br /&gt;
&lt;br /&gt;
Subtractors&lt;br /&gt;
inverse adder, simple but not yet tested.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Animals==&lt;br /&gt;
&lt;br /&gt;
Choosing the animal which works as the logic core for an animal logic systems is somewhat important, depending on your needs and the available animals. however pretty much anything will do as long as you can remember which animal fits into which gate (to avoid designating the same animal for more than one pit).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Kittens&lt;br /&gt;
Put those worthless cats to work, load them into your fortress's logic core and make them work for their keep. while kittens are the most reliable cores for logic gates with their 3 pathing goals they're also problematic as they grow into cats which only have two, and may cause catsplosions inside your logical cores. Ideally kittens should be replaced yearly or biyearly as their growth defines.&lt;br /&gt;
Kittens path to the activity zone, their parents, and vermin.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Puppies&lt;br /&gt;
Why should your fortresses working animals only work once they grow up? throw the puppies into the logic core and have them work from the day of their birth. Puppies are quite reliable with their two pathing goals, but retain the problem of maturation.&lt;br /&gt;
Puppies path to the activity zone, and their parents.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Animal Children&lt;br /&gt;
Using the non matured animals for something useful before butchering may be quite effective, however they still must be flushed when they mature.&lt;br /&gt;
Animal children path to the activity zone, and their parents.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Cats&lt;br /&gt;
Aggravating animals, throw them into the computer and get some worth out of them. Otherwise useless cats become useful when used for logic, with two pathing goals they're responsive, and multiply quickly. watch out for catsplosions while using these critters&lt;br /&gt;
Cats path to the activity zone, and Vermin.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Dogs&lt;br /&gt;
The workhorse of your fortress, because horses can't do anything useful. I'd recommend not using dogs as they're put to better use as wardogs to protect your dorfs.&lt;br /&gt;
Dogs path to the activity zone.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Cattle&lt;br /&gt;
Large lumbering bovines, the advantage of Cattle is you can tell the sexes apart, they also make the pressure plates continue to work if you forget to reassign the trigger weight.&lt;br /&gt;
Cattle path to the activity zone.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Other animals&lt;br /&gt;
Any animals work, but the above are probably your best choice, excluding any modded animals. however if you have a GCS handy a GCS powered computer would be awesome, so take this as you will.&lt;br /&gt;
Other animals have different pathing goals, but most only path to the activity zone.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Goblins&lt;br /&gt;
I'm working on an incremental goblin powered system, results pending.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Putting it all together==&lt;br /&gt;
&lt;br /&gt;
When it comes time to automate your systems the first thing you need to know is what needs to automated and what should remain manual. an obsidian farm with completely autonomous control of the casting process is all well and good, until it drowns all your legendary miners when it prematurely triggers. all systems should have manual controls and failsafes to help avoid FUN! (but because we all love FUN sometimes you forget to fully connect that emergency drain, or that failsafe system you built somehow failed.)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
once you know the steps you need in your system it comes time to select the parts you need to automate, whether it be basic logic gates or more sophisticated multiple trigger systems.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This is mainly pure logic and I can't really help with that, but post a requirement in the talk page and if I see it I'll work on it. Consult the computing page on this wiki, and look up digital logic on Wikipedia. past that it's pretty fundamental and I don't really think I can adequately describe it.&lt;/div&gt;</summary>
		<author><name>LordOOTFD</name></author>
	</entry>
	<entry>
		<id>http://dwarffortresswiki.org/index.php?title=User:LordOOTFD&amp;diff=61932</id>
		<title>User:LordOOTFD</title>
		<link rel="alternate" type="text/html" href="http://dwarffortresswiki.org/index.php?title=User:LordOOTFD&amp;diff=61932"/>
		<updated>2010-01-29T05:14:17Z</updated>

		<summary type="html">&lt;p&gt;LordOOTFD: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Animal logic works as a function of the path finding algorithm in dwarf fortress, as all animals seek to find the lowest cost path to their desired objects (activity zone, parents, dwarfs, valuable objects, etc) this can be used to create very very complex logic gates. Animal logic has three principle advantages, speed, compactness, and simplified functions; however, animal logic is slower than mechanical logic, less reliable than either, and logic is often inverted.&lt;br /&gt;
&lt;br /&gt;
Throughout this document I will be using a number of terms which may not be immediately obvious so I'll list them here: &lt;br /&gt;
&lt;br /&gt;
Ground: for simplicity the thing the animal is pathing to is refereed to as ground as that is the ground state which it wishes to reach. Ground is always the left unless otherwise noted.&lt;br /&gt;
&lt;br /&gt;
Purge: Path to ground with no inputs&lt;br /&gt;
&lt;br /&gt;
Path cost: The number of steps the animal must make to reach ground&lt;br /&gt;
&lt;br /&gt;
Fusion Gate: Simply one or more logic gates built into the same system (this is more than simply stringing gates)&lt;br /&gt;
&lt;br /&gt;
Compund Gate: Gate which uses two or more gates set to different path costs.&lt;br /&gt;
&lt;br /&gt;
And Gate: And takes x inputs and output TRUE if ALL are TRUE.&lt;br /&gt;
&lt;br /&gt;
NAnd Gate: NAnd takes x inputs and returns TRUE if ALL are FALSE. &lt;br /&gt;
&lt;br /&gt;
AndOr Gate: AndOr takes x inputs and returns TRUE if X-Y are TRUE. (this gate is exclusive to animal logic, and is a single step fusion of And, and Or)&lt;br /&gt;
&lt;br /&gt;
Or Gate: Or takes x input and output TRUE if ANY are true.&lt;br /&gt;
&lt;br /&gt;
Not Gate: Not takes a single input and inverts it to the oposite state TRUE if FALSE. &lt;br /&gt;
&lt;br /&gt;
XOr Gate: XOr takes 2 or more inputs and output TRUE if ONLY ONE is TRUE but NOT ALL are TRUE. &lt;br /&gt;
&lt;br /&gt;
NOr Gate: NOr takes x input and returns TRUE if ALL inputs are FALSE. &lt;br /&gt;
&lt;br /&gt;
XNOr Gate: XNOr takes 2 or more inputs and returns TRUE if ALL are TRUE, OR FALSE.&lt;br /&gt;
&lt;br /&gt;
For a better explanation of gates see:http://en.wikipedia.org/wiki/Logic_gate&lt;br /&gt;
&lt;br /&gt;
Notation: #:always 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) 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.&lt;br /&gt;
&lt;br /&gt;
Gates will always be capitalized in the way they are within the entry, I.E. And, Or, AndOr, XNOr, etc&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
There are three principle 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 principle reason for this is pathfinding always prefers the shortest path to ground, 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, more than a single on or off signal. For simplicity and streamlining the systems I have designed only use binary outputs, but theoretically they could be made to compute natively in decimal; however, this is a bit more complicated than a week of study allows.&lt;br /&gt;
&lt;br /&gt;
==SIMPLE GATES==&lt;br /&gt;
&lt;br /&gt;
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 &amp;quot;wake up&amp;quot; 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 it's enclosure, this allows the gate to respond faster 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 I find them to be better in general use.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
And&lt;br /&gt;
This simple gate is made by confining the animal into a straight coridor; the ground path will have two or more doors which are connected to the input, while the second longer path remains clear. the gate can be configured as an NAnd gate by simply moving the pressure plate. if the plate is by the ground path it functions as an And gate returning TRUE if the ground path is open, and if the plate is by the purge path it will return FALSE when the inputs are TRUE&lt;br /&gt;
 #########&lt;br /&gt;
  ABCD^ D&lt;br /&gt;
 #########&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Multi And&lt;br /&gt;
 ############&lt;br /&gt;
  ANYNUMD^ D&lt;br /&gt;
 ############&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
NAnd&lt;br /&gt;
Reconfigured And gate, see And.&lt;br /&gt;
 #########&lt;br /&gt;
  ABCD ^D&lt;br /&gt;
 #########&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Or&lt;br /&gt;
Basic gate&lt;br /&gt;
 #####&lt;br /&gt;
 AD^ D&lt;br /&gt;
 B####&lt;br /&gt;
 #####&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Multi Or&lt;br /&gt;
 #######&lt;br /&gt;
 A #####&lt;br /&gt;
 N #####&lt;br /&gt;
 Y D^ D&lt;br /&gt;
 N #####&lt;br /&gt;
 M #####&lt;br /&gt;
 #######&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
NOr&lt;br /&gt;
Basically a reconfigured Or gate&lt;br /&gt;
 #####&lt;br /&gt;
 AD ^D&lt;br /&gt;
 B####&lt;br /&gt;
 #####&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Not&lt;br /&gt;
The simplest gate, It only takes a single imput.&lt;br /&gt;
 #######&lt;br /&gt;
  AD^ D&lt;br /&gt;
 #######&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Compound Gates==&lt;br /&gt;
&lt;br /&gt;
Basically two or more gates arranged with different path costs to ground. These gates can be configured in a number of different ways, these being the simplest. It may be possible to make these gates as single gates but that would require inverting some of the input. Simple compund gates use two simple gates and handle two inputs, complex compund gates have more then two simple gates and need more than two inputs. a Complex compund gate might be used to convert decimal numbers into binary using And gates&lt;br /&gt;
&lt;br /&gt;
XOr&lt;br /&gt;
Compound of And and Or, when ONLY ONE is TRUE returns TRUE&lt;br /&gt;
If A and B are false the animal moves to the FALSE position by Purge, if A or B is true, the animal moves to the TRUE position at the Or gate, if both A and B are true the animal moves to the FALSE postion by the And gate.&lt;br /&gt;
&lt;br /&gt;
 #g########&lt;br /&gt;
 # ABD  D #&lt;br /&gt;
 # ####^# #&lt;br /&gt;
 # ####D# #&lt;br /&gt;
 # ###BA# #&lt;br /&gt;
 #        #&lt;br /&gt;
 ##########&lt;br /&gt;
And path cost: 4&lt;br /&gt;
Or path cost: 10&lt;br /&gt;
Purge path cost: 14&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
XNor&lt;br /&gt;
Inverse of XOr: Return TRUE if BOTH are TRUE OR FALSE&lt;br /&gt;
If A and B are false the animal move to the TRUE position by Purge, if A or B is true, the animal moves to the FALSE position at the Or gate, if both A and B are true the animal moves to the TRUE postion by the And gate.&lt;br /&gt;
&lt;br /&gt;
 #g#########&lt;br /&gt;
 #         #&lt;br /&gt;
 ##B###### #&lt;br /&gt;
 ###A## DA # &lt;br /&gt;
 ####D^##B #&lt;br /&gt;
 #####D### #&lt;br /&gt;
 ######    #&lt;br /&gt;
 ###########&lt;br /&gt;
And path cost: 4&lt;br /&gt;
Or path cost: 10&lt;br /&gt;
Purge path cost: 15&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Complex Compound gate, Octal display ALU&lt;br /&gt;
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)&lt;br /&gt;
&lt;br /&gt;
 #################&lt;br /&gt;
                 #&lt;br /&gt;
 # # # # # # #1# #&lt;br /&gt;
 # # #1# #1#2#2# #&lt;br /&gt;
 #1#2#2#4#4#4#4# #&lt;br /&gt;
 #D#D#D#D#D#D#D#D#&lt;br /&gt;
 #               #&lt;br /&gt;
 #################&lt;br /&gt;
&lt;br /&gt;
 # ######&lt;br /&gt;
 # 1  D #&lt;br /&gt;
 # #### #&lt;br /&gt;
 # 2  D #&lt;br /&gt;
 # #### #&lt;br /&gt;
 # 12 D #&lt;br /&gt;
 # #### #&lt;br /&gt;
 # 4  D #&lt;br /&gt;
 # #### #&lt;br /&gt;
 # 14 D #&lt;br /&gt;
 # #### #&lt;br /&gt;
 # 24 D #&lt;br /&gt;
 # #### #&lt;br /&gt;
 # 124D #&lt;br /&gt;
 # #### #&lt;br /&gt;
 #    D #&lt;br /&gt;
 ########&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Fusion gates==&lt;br /&gt;
&lt;br /&gt;
These are gates which are constructed by physically combining the two gates to get a specific output.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
AndOr&lt;br /&gt;
This gate will evaluate if either of x And statements are TRUE. This gate is built as a straight line similar to the And gate&lt;br /&gt;
 ######&lt;br /&gt;
 #C####&lt;br /&gt;
 ABD^ D&lt;br /&gt;
 C#####&lt;br /&gt;
 ######&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
NAndOr&lt;br /&gt;
Reconfigured AndOr gate, see AndOr&lt;br /&gt;
 ######&lt;br /&gt;
 #C####&lt;br /&gt;
 ABD ^D&lt;br /&gt;
 C#####&lt;br /&gt;
 ######&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
OrandOr&lt;br /&gt;
This gate returns true if either A or B and either C or D is true.&lt;br /&gt;
&lt;br /&gt;
 ######&lt;br /&gt;
 AC####&lt;br /&gt;
 BED^ D&lt;br /&gt;
 ######&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
OrandAnd&lt;br /&gt;
This gate returns true if either A or B is true, and E and C are true.&lt;br /&gt;
&lt;br /&gt;
 #######&lt;br /&gt;
 A######&lt;br /&gt;
 BCED^ D&lt;br /&gt;
 #######&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Complex Gates==&lt;br /&gt;
&lt;br /&gt;
==Adders==&lt;br /&gt;
A Full adder can be made as a Compound Fusion gate, by combining, And, AndOr, and Or gates&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Binary Adder&lt;br /&gt;
The first binary adder I attempted was structured like an electronic adder using an array of simple gates. It contained five animals and used grates to control the logic, based off of bidok's logic gates. This adder functioned correctly but it was very inefficient with space, and highly unreliable often taking ten plus minutes to properly align. I refined this design by lining the gates up into a linear arrangement, but this failed to solve the efficiency problems.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
I then realized that simply limiting my Adder to using Electronic gates was silly realizing the key point of animal logic I designed a single stage gate, which had four output states: 0,1,C,1&amp;amp;C. this allowed me to compress the Adder into a single circuit. Modifying the design further the use of doors allows the new design to function at approximately 4-6 times the speed of the prototype adder.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The Binary Adder function by adding three values, A,B, and Carry. Carry is only involved if the previous adder had a result of 2, or 3. the adder works by detecting if (A Or B Or C = True)Sum=1, Or (A And B, Or, A And C, Or B And C = True)Sum=2, Or (A And B And C = True)Sum=3, Or (A And B And C = False)Sum=0. With this basic logic one simply needs to configure the output for 1 if the answer is 1, C if the answer is 2, and 1 and C if the answer is 3. the gates must also be arranged so the Highest Sum has the shortest path to ground as otherwise the gate would return nonsense.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Stand alone Adders (they don't carry into another adder) require 22 mechanisms, and 14 doors.&lt;br /&gt;
Start Adders (They feed into the next Adder and include a carry) require 32 mechanisms, and 14 doors.&lt;br /&gt;
Chain Adders (The receive Carry, and pass a Carry bit up) require 32 mechanisms, and 14 doors&lt;br /&gt;
While Materials intensive the gates only take up 13x9 urists, ideal for chaining along mining tunnels.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Reference pictures&lt;br /&gt;
[[Image:Xnor,Xor,Nand,Or_prototype_adder_STATE_1]]&lt;br /&gt;
Add pictures of the states here&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
By chaining these gates you can perform most binary math, the easiest of which is addition. In my old fort I built and tested my initial 9 Bit Addition computer. the design failed in two circumstances, the AndOr gate of bit 32 had a lower path cost than the And gate when the animal was at Sum 2, and the Or gate in bit 4 had a lower path cost than ground if the lower door was open.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The gates in the Super Snail adder can be reset to the correct positions by forbidding the doors which fault. I'm working on a more reliable compact adder. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Decimal Adder&lt;br /&gt;
While it can be done, It's massively more complex than simply making a set of decimal converters working with numbers over 10,&lt;br /&gt;
&lt;br /&gt;
hexadecimal adder&lt;br /&gt;
The hex adder makes use of 32 sum gates per side of a single adder, making it geometrically more complex than the binary adder, however it does make animal management more streamlined. more information to come.&lt;br /&gt;
&lt;br /&gt;
Status&lt;br /&gt;
Sum gates 0-31           done&lt;br /&gt;
layout                   pending&lt;br /&gt;
working prototype        pending&lt;br /&gt;
finished dorfputer       pending&lt;br /&gt;
&lt;br /&gt;
Subtractors&lt;br /&gt;
inverse adder, simple but not yet tested.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Animals==&lt;br /&gt;
&lt;br /&gt;
Choosing the animal which works as the logic core for an animal logic systems is somewhat important, depending on your needs and the available animals. however pretty much anything will do as long as you can remember which animal fits into which gate (to avoid designating the same animal for more than one pit).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Kittens&lt;br /&gt;
Put those worthless cats to work, load them into your fortress's logic core and make them work for their keep. while kittens are the most reliable cores for logic gates with their 3 pathing goals they're also problematic as they grow into cats which only have two, and may cause catsplosions inside your logical cores. Ideally kittens should be replaced yearly or biyearly as their growth defines.&lt;br /&gt;
Kittens path to the activity zone, their parents, and vermin.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Puppies&lt;br /&gt;
Why should your fortresses working animals only work once they grow up? throw the puppies into the logic core and have them work from the day of their birth. Puppies are quite reliable with their two pathing goals, but retain the problem of maturation.&lt;br /&gt;
Puppies path to the activity zone, and their parents.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Animal Children&lt;br /&gt;
Using the non matured animals for something useful before butchering may be quite effective, however they still must be flushed when they mature.&lt;br /&gt;
Animal children path to the activity zone, and their parents.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Cats&lt;br /&gt;
Aggravating animals, throw them into the computer and get some worth out of them. Otherwise useless cats become useful when used for logic, with two pathing goals they're responsive, and multiply quickly. watch out for catsplosions while using these critters&lt;br /&gt;
Cats path to the activity zone, and Vermin.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Dogs&lt;br /&gt;
The workhorse of your fortress, because horses can't do anything useful. I'd recommend not using dogs as they're put to better use as wardogs to protect your dorfs.&lt;br /&gt;
Dogs path to the activity zone.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Cattle&lt;br /&gt;
Large lumbering bovines, the advantage of Cattle is you can tell the sexes apart, they also make the pressure plates continue to work if you forget to reassign the trigger weight.&lt;br /&gt;
Cattle path to the activity zone.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Other animals&lt;br /&gt;
Any animals work, but the above are probably your best choice, excluding any modded animals. however if you have a GCS handy a GCS powered computer would be awesome, so take this as you will.&lt;br /&gt;
Other animals have different pathing goals, but most only path to the activity zone.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Goblins&lt;br /&gt;
I'm working on an incremental goblin powered system, results pending.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Putting it all together==&lt;br /&gt;
&lt;br /&gt;
When it comes time to automate your systems the first thing you need to know is what needs to automated and what should remain manual. an obsidian farm with completely autonomous control of the casting process is all well and good, until it drowns all your legendary miners when it prematurely triggers. all systems should have manual controls and failsafes to help avoid FUN! (but because we all love FUN sometimes you forget to fully connect that emergency drain, or that failsafe system you built somehow failed.)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
once you know the steps you need in your system it comes time to select the parts you need to automate, whether it be basic logic gates or more sophisticated multiple trigger systems.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This is mainly pure logic and I can't really help with that, but post a requirement in the talk page and if I see it I'll work on it. Consult the computing page on this wiki, and look up digital logic on Wikipedia. past that it's pretty fundamental and I don't really think I can adequately describe it.&lt;/div&gt;</summary>
		<author><name>LordOOTFD</name></author>
	</entry>
	<entry>
		<id>http://dwarffortresswiki.org/index.php?title=User:LordOOTFD&amp;diff=61931</id>
		<title>User:LordOOTFD</title>
		<link rel="alternate" type="text/html" href="http://dwarffortresswiki.org/index.php?title=User:LordOOTFD&amp;diff=61931"/>
		<updated>2010-01-29T05:12:23Z</updated>

		<summary type="html">&lt;p&gt;LordOOTFD: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Animal logic works as a function of the path finding algorithm in dwarf fortress, as all animals seek to find the lowest cost path to their desired objects (activity zone, parents, dwarfs, valuable objects, etc) this can be used to create very very complex logic gates. Animal logic has three principle advantages, speed, compactness, and simplified functions; however, animal logic is slower than mechanical logic, less reliable than either, and logic is often inverted.&lt;br /&gt;
&lt;br /&gt;
Throughout this document I will be using a number of terms which may not be immediately obvious so I'll list them here: &lt;br /&gt;
&lt;br /&gt;
Ground: for simplicity the thing the animal is pathing to is refereed to as ground as that is the ground state which it wishes to reach. Ground is always the left unless otherwise noted.&lt;br /&gt;
&lt;br /&gt;
Purge: Path to ground with no inputs&lt;br /&gt;
&lt;br /&gt;
Path cost: The number of steps the animal must make to reach ground&lt;br /&gt;
&lt;br /&gt;
Fusion Gate: Simply one or more logic gates built into the same system (this is more than simply stringing gates)&lt;br /&gt;
&lt;br /&gt;
Compund Gate: Gate which uses two or more gates set to different path costs.&lt;br /&gt;
&lt;br /&gt;
And Gate: And takes x inputs and output TRUE if ALL are TRUE.&lt;br /&gt;
&lt;br /&gt;
NAnd Gate: NAnd takes x inputs and returns TRUE if ALL are FALSE. &lt;br /&gt;
&lt;br /&gt;
AndOr Gate: AndOr takes x inputs and returns TRUE if X-Y are TRUE. (this gate is exclusive to animal logic, and is a single step fusion of And, and Or)&lt;br /&gt;
&lt;br /&gt;
Or Gate: Or takes x input and output TRUE if ANY are true.&lt;br /&gt;
&lt;br /&gt;
Not Gate: Not takes a single input and inverts it to the oposite state TRUE if FALSE. &lt;br /&gt;
&lt;br /&gt;
XOr Gate: XOr takes 2 or more inputs and output TRUE if ONLY ONE is TRUE but NOT ALL are TRUE. &lt;br /&gt;
&lt;br /&gt;
NOr Gate: NOr takes x input and returns TRUE if ALL inputs are FALSE. &lt;br /&gt;
&lt;br /&gt;
XNOr Gate: XNOr takes 2 or more inputs and returns TRUE if ALL are TRUE, OR FALSE.&lt;br /&gt;
&lt;br /&gt;
For a better explanation of gates see:http://en.wikipedia.org/wiki/Logic_gate&lt;br /&gt;
&lt;br /&gt;
Notation: #:always 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) 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.&lt;br /&gt;
&lt;br /&gt;
Gates will always be capitalized in the way they are within the entry, I.E. And, Or, AndOr, XNOr, etc&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
There are three principle 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 principle reason for this is pathfinding always prefers the shortest path to ground, 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, more than a single on or off signal. For simplicity and streamlining the systems I have designed only use binary outputs, but theoretically they could be made to compute natively in decimal; however, this is a bit more complicated than a week of study allows.&lt;br /&gt;
&lt;br /&gt;
==SIMPLE GATES==&lt;br /&gt;
&lt;br /&gt;
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 &amp;quot;wake up&amp;quot; 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 it's enclosure, this allows the gate to respond faster 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 I find them to be better in general use.&lt;br /&gt;
&lt;br /&gt;
And&lt;br /&gt;
This simple gate is made by confining the animal into a straight coridor; the ground path will have two or more doors which are connected to the input, while the second longer path remains clear. the gate can be configured as an NAnd gate by simply moving the pressure plate. if the plate is by the ground path it functions as an And gate returning TRUE if the ground path is open, and if the plate is by the purge path it will return FALSE when the inputs are TRUE&lt;br /&gt;
 #########&lt;br /&gt;
  ABCD^ D&lt;br /&gt;
 #########&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Multi And&lt;br /&gt;
 ############&lt;br /&gt;
  ANYNUMD^ D&lt;br /&gt;
 ############&lt;br /&gt;
&lt;br /&gt;
NAnd&lt;br /&gt;
Reconfigured And gate, see And.&lt;br /&gt;
 #########&lt;br /&gt;
  ABCD ^D&lt;br /&gt;
 #########&lt;br /&gt;
&lt;br /&gt;
Or&lt;br /&gt;
Basic gate&lt;br /&gt;
 #####&lt;br /&gt;
 AD^ D&lt;br /&gt;
 B####&lt;br /&gt;
 #####&lt;br /&gt;
&lt;br /&gt;
Multi Or&lt;br /&gt;
 #######&lt;br /&gt;
 A #####&lt;br /&gt;
 N #####&lt;br /&gt;
 Y D^ D&lt;br /&gt;
 N #####&lt;br /&gt;
 M #####&lt;br /&gt;
 #######&lt;br /&gt;
&lt;br /&gt;
NOr&lt;br /&gt;
Basically a reconfigured Or gate&lt;br /&gt;
 #####&lt;br /&gt;
 AD ^D&lt;br /&gt;
 B####&lt;br /&gt;
 #####&lt;br /&gt;
&lt;br /&gt;
Not&lt;br /&gt;
The simplest gate, It only takes a single imput.&lt;br /&gt;
 #######&lt;br /&gt;
  AD^ D&lt;br /&gt;
 #######&lt;br /&gt;
&lt;br /&gt;
==Compound Gates==&lt;br /&gt;
&lt;br /&gt;
Basically two or more gates arranged with different path costs to ground. These gates can be configured in a number of different ways, these being the simplest. It may be possible to make these gates as single gates but that would require inverting some of the input. Simple compund gates use two simple gates and handle two inputs, complex compund gates have more then two simple gates and need more than two inputs. a Complex compund gate might be used to convert decimal numbers into binary using And gates&lt;br /&gt;
&lt;br /&gt;
XOr&lt;br /&gt;
Compound of And and Or, when ONLY ONE is TRUE returns TRUE&lt;br /&gt;
If A and B are false the animal moves to the FALSE position by Purge, if A or B is true, the animal moves to the TRUE position at the Or gate, if both A and B are true the animal moves to the FALSE postion by the And gate.&lt;br /&gt;
&lt;br /&gt;
 #g########&lt;br /&gt;
 # ABD  D #&lt;br /&gt;
 # ####^# #&lt;br /&gt;
 # ####D# #&lt;br /&gt;
 # ###BA# #&lt;br /&gt;
 #        #&lt;br /&gt;
 ##########&lt;br /&gt;
And path cost: 4&lt;br /&gt;
Or path cost: 10&lt;br /&gt;
Purge path cost: 14&lt;br /&gt;
&lt;br /&gt;
XNor&lt;br /&gt;
Inverse of XOr: Return TRUE if BOTH are TRUE OR FALSE&lt;br /&gt;
If A and B are false the animal move to the TRUE position by Purge, if A or B is true, the animal moves to the FALSE position at the Or gate, if both A and B are true the animal moves to the TRUE postion by the And gate.&lt;br /&gt;
&lt;br /&gt;
 #g#########&lt;br /&gt;
 #         #&lt;br /&gt;
 ##B###### #&lt;br /&gt;
 ###A## DA # &lt;br /&gt;
 ####D^##B #&lt;br /&gt;
 #####D### #&lt;br /&gt;
 ######    #&lt;br /&gt;
 ###########&lt;br /&gt;
And path cost: 4&lt;br /&gt;
Or path cost: 10&lt;br /&gt;
Purge path cost: 15&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Complex Compond gate, Octal display ALU&lt;br /&gt;
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)&lt;br /&gt;
&lt;br /&gt;
 #################&lt;br /&gt;
                 #&lt;br /&gt;
 # # # # # # #1# #&lt;br /&gt;
 # # #1# #1#2#2# #&lt;br /&gt;
 #1#2#2#4#4#4#4# #&lt;br /&gt;
 #D#D#D#D#D#D#D#D#&lt;br /&gt;
 #               #&lt;br /&gt;
 #################&lt;br /&gt;
&lt;br /&gt;
 # ######&lt;br /&gt;
 # 1  D #&lt;br /&gt;
 # #### #&lt;br /&gt;
 # 2  D #&lt;br /&gt;
 # #### #&lt;br /&gt;
 # 12 D #&lt;br /&gt;
 # #### #&lt;br /&gt;
 # 4  D #&lt;br /&gt;
 # #### #&lt;br /&gt;
 # 14 D #&lt;br /&gt;
 # #### #&lt;br /&gt;
 # 24 D #&lt;br /&gt;
 # #### #&lt;br /&gt;
 # 124D #&lt;br /&gt;
 # #### #&lt;br /&gt;
 #    D #&lt;br /&gt;
 ########&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Fusion gates==&lt;br /&gt;
&lt;br /&gt;
These are gates which are constructed by physically combining the two gates to get a specific output.&lt;br /&gt;
&lt;br /&gt;
AndOr&lt;br /&gt;
This gate will evaluate if either of x And statements are TRUE. This gate is built as a straight line similar to the And gate&lt;br /&gt;
 ######&lt;br /&gt;
 #C####&lt;br /&gt;
 ABD^ D&lt;br /&gt;
 C#####&lt;br /&gt;
 ######&lt;br /&gt;
&lt;br /&gt;
NAndOr&lt;br /&gt;
Reconfigured AndOr gate, see AndOr&lt;br /&gt;
 ######&lt;br /&gt;
 #C####&lt;br /&gt;
 ABD ^D&lt;br /&gt;
 C#####&lt;br /&gt;
 ######&lt;br /&gt;
&lt;br /&gt;
OrandOr&lt;br /&gt;
This gate returns true if either A or B and either C or D is true.&lt;br /&gt;
&lt;br /&gt;
 ######&lt;br /&gt;
 AC####&lt;br /&gt;
 BED^ D&lt;br /&gt;
 ######&lt;br /&gt;
&lt;br /&gt;
OrandAnd&lt;br /&gt;
This gate returns true if either A or B is true, and E and C are true.&lt;br /&gt;
&lt;br /&gt;
 #######&lt;br /&gt;
 A######&lt;br /&gt;
 BCED^ D&lt;br /&gt;
 #######&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Complex Gates==&lt;br /&gt;
&lt;br /&gt;
==Adders==&lt;br /&gt;
A Full adder can be made as a Compound Fusion gate, by combining, And, AndOr, and Or gates&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Binary Adder&lt;br /&gt;
The first binary adder I attempted was structured like an electronic adder using an array of simple gates. It contained five animals and used grates to control the logic, based off of bidok's logic gates. This adder functioned correctly but it was very inefficient with space, and highly unreliable often taking ten plus minutes to properly align. I refined this design by lining the gates up into a linear arrangement, but this failed to solve the efficiency problems.&lt;br /&gt;
&lt;br /&gt;
I then realized that simply limiting my Adder to using Electronic gates was silly realizing the key point of animal logic I designed a single stage gate, which had four output states: 0,1,C,1&amp;amp;C. this allowed me to compress the Adder into a single circuit. Modifying the design further the use of doors allows the new design to function at approximately 4-6 times the speed of the prototype adder.&lt;br /&gt;
&lt;br /&gt;
The Binary Adder function by adding three values, A,B, and Carry. Carry is only involved if the previous adder had a result of 2, or 3. the adder works by detecting if (A Or B Or C = True)Sum=1, Or (A And B, Or, A And C, Or B And C = True)Sum=2, Or (A And B And C = True)Sum=3, Or (A And B And C = False)Sum=0. With this basic logic one simply needs to configure the output for 1 if the answer is 1, C if the answer is 2, and 1 and C if the answer is 3. the gates must also be arranged so the Highest Sum has the shortest path to ground as otherwise the gate would return nonsense.&lt;br /&gt;
&lt;br /&gt;
Stand alone Adders (they don't carry into another adder) require 22 mechanisms, and 14 doors.&lt;br /&gt;
Start Adders (They feed into the next Adder and include a carry) require 32 mechanisms, and 14 doors.&lt;br /&gt;
Chain Adders (The receive Carry, and pass a Carry bit up) require 32 mechanisms, and 14 doors&lt;br /&gt;
While Materials intensive the gates only take up 13x9 urists, ideal for chaining along mining tunnels.&lt;br /&gt;
&lt;br /&gt;
Reference pictures&lt;br /&gt;
[[Image:Xnor,Xor,Nand,Or_prototype_adder_STATE_1]]&lt;br /&gt;
Add pictures of the states here&lt;br /&gt;
&lt;br /&gt;
By chaining these gates you can perform most binary math, the easiest of which is addition. In my old fort I built and tested my initial 9 Bit Addition computer. the design failed in two circumstances, the AndOr gate of bit 32 had a lower path cost than the And gate when the animal was at Sum 2, and the Or gate in bit 4 had a lower path cost than ground if the lower door was open.&lt;br /&gt;
&lt;br /&gt;
The gates in the Super Snail adder can be reset to the correct positions by forbidding the doors which fault. I'm working on a more reliable compact adder. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Decimal Adder&lt;br /&gt;
While it can be done, It's massively more complex than simply making a set of decimal converters working with numbers over 10,&lt;br /&gt;
&lt;br /&gt;
hexadecimal adder&lt;br /&gt;
The hex adder makes use of 32 sum gates per side of a single adder, making it geometrically more complex than the binary adder, however it does make animal management more streamlined. more information to come.&lt;br /&gt;
&lt;br /&gt;
Status&lt;br /&gt;
Sum gates 0-31           done&lt;br /&gt;
layout                   pending&lt;br /&gt;
working prototype        pending&lt;br /&gt;
finished dorfputer       pending&lt;br /&gt;
&lt;br /&gt;
Subtractors&lt;br /&gt;
inverse adder, simple but not yet tested.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Animals==&lt;br /&gt;
&lt;br /&gt;
Choosing the animal which works as the logic core for an animal logic systems is somewhat important, depending on your needs and the available animals. however pretty much anything will do as long as you can remember which animal fits into which gate (to avoid designating the same animal for more than one pit).&lt;br /&gt;
&lt;br /&gt;
Kittens&lt;br /&gt;
Put those worthless cats to work, load them into your fortress's logic core and make them work for their keep. while kittens are the most reliable cores for logic gates with their 3 pathing goals they're also problematic as they grow into cats which only have two, and may cause catsplosions inside your logical cores. Ideally kittens should be replaced yearly or biyearly as their growth defines.&lt;br /&gt;
Kittens path to the activity zone, their parents, and vermin.&lt;br /&gt;
&lt;br /&gt;
Puppies&lt;br /&gt;
Why should your fortresses working animals only work once they grow up? throw the puppies into the logic core and have them work from the day of their birth. Puppies are quite reliable with their two pathing goals, but retain the problem of maturation.&lt;br /&gt;
Puppies path to the activity zone, and their parents.&lt;br /&gt;
&lt;br /&gt;
Animal Children&lt;br /&gt;
Using the non matured animals for something useful before butchering may be quite effective, however they still must be flushed when they mature.&lt;br /&gt;
Animal children path to the activity zone, and their parents.&lt;br /&gt;
&lt;br /&gt;
Cats&lt;br /&gt;
Aggravating animals, throw them into the computer and get some worth out of them. Otherwise useless cats become useful when used for logic, with two pathing goals they're responsive, and multiply quickly. watch out for catsplosions while using these critters&lt;br /&gt;
Cats path to the activity zone, and Vermin.&lt;br /&gt;
&lt;br /&gt;
Dogs&lt;br /&gt;
The workhorse of your fortress, because horses can't do anything useful. I'd recommend not using dogs as they're put to better use as wardogs to protect your dorfs.&lt;br /&gt;
Dogs path to the activity zone.&lt;br /&gt;
&lt;br /&gt;
Cattle&lt;br /&gt;
Large lumbering bovines, the advantage of Cattle is you can tell the sexes apart, they also make the pressure plates continue to work if you forget to reassign the trigger weight.&lt;br /&gt;
Cattle path to the activity zone.&lt;br /&gt;
&lt;br /&gt;
Other animals&lt;br /&gt;
Any animals work, but the above are probably your best choice, excluding any modded animals. however if you have a GCS handy a GCS powered computer would be awesome, so take this as you will.&lt;br /&gt;
Other animals have different pathing goals, but most only path to the activity zone.&lt;br /&gt;
&lt;br /&gt;
Goblins&lt;br /&gt;
I'm working on an incremental goblin powered system, results pending.&lt;br /&gt;
&lt;br /&gt;
==Putting it all together==&lt;br /&gt;
&lt;br /&gt;
When it comes time to automate your systems the first thing you need to know is what needs to automated and what should remain manual. an obsidian farm with completely autonomous control of the casting process is all well and good, until it drowns all your legendary miners when it prematurely triggers. all systems should have manual controls and failsafes to help avoid FUN! (but because we all love FUN sometimes you forget to fully connect that emergency drain, or that failsafe system you built somehow failed.)&lt;br /&gt;
&lt;br /&gt;
once you know the steps you need in your system it comes time to select the parts you need to automate, whether it be basic logic gates or more sophisticated multiple trigger systems.&lt;br /&gt;
&lt;br /&gt;
This is mainly pure logic and I can't really help with that, but post a requirement in the talk page and if I see it I'll work on it. Consult the computing page on this wiki, and look up digital logic on Wikipedia. past that it's pretty fundamental and I don't really think I can adequately describe it.&lt;/div&gt;</summary>
		<author><name>LordOOTFD</name></author>
	</entry>
	<entry>
		<id>http://dwarffortresswiki.org/index.php?title=User:LordOOTFD&amp;diff=61930</id>
		<title>User:LordOOTFD</title>
		<link rel="alternate" type="text/html" href="http://dwarffortresswiki.org/index.php?title=User:LordOOTFD&amp;diff=61930"/>
		<updated>2010-01-29T05:08:27Z</updated>

		<summary type="html">&lt;p&gt;LordOOTFD: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Animal logic works as a function of the path finding algorithm in dwarf fortress, as all animals seek to find the lowest cost path to their desired objects (activity zone, parents, dwarfs, valuable objects, etc) this can be used to create very very complex logic gates. Animal logic has three principle advantages, speed, compactness, and simplified functions; however, animal logic is slower than mechanical logic, less reliable than either, and logic is often inverted.&lt;br /&gt;
&lt;br /&gt;
Throughout this document I will be using a number of terms which may not be immediately obvious so I'll list them here: &lt;br /&gt;
&lt;br /&gt;
Ground: for simplicity the thing the animal is pathing to is refereed to as ground as that is the ground state which it wishes to reach. Ground is always the left unless otherwise noted.&lt;br /&gt;
&lt;br /&gt;
Purge: Path to ground with no inputs&lt;br /&gt;
&lt;br /&gt;
Path cost: The number of steps the animal must make to reach ground&lt;br /&gt;
&lt;br /&gt;
Fusion Gate: Simply one or more logic gates built into the same system (this is more than simply stringing gates)&lt;br /&gt;
&lt;br /&gt;
Compund Gate: Gate which uses two or more gates set to different path costs.&lt;br /&gt;
&lt;br /&gt;
And Gate: And takes x inputs and output TRUE if ALL are TRUE.&lt;br /&gt;
&lt;br /&gt;
NAnd Gate: NAnd takes x inputs and returns TRUE if ALL are FALSE. &lt;br /&gt;
&lt;br /&gt;
AndOr Gate: AndOr takes x inputs and returns TRUE if X-Y are TRUE. (this gate is exclusive to animal logic, and is a single step fusion of And, and Or)&lt;br /&gt;
&lt;br /&gt;
Or Gate: Or takes x input and output TRUE if ANY are true.&lt;br /&gt;
&lt;br /&gt;
Not Gate: Not takes a single input and inverts it to the oposite state TRUE if FALSE. &lt;br /&gt;
&lt;br /&gt;
XOr Gate: XOr takes 2 or more inputs and output TRUE if ONLY ONE is TRUE but NOT ALL are TRUE. &lt;br /&gt;
&lt;br /&gt;
NOr Gate: NOr takes x input and returns TRUE if ALL inputs are FALSE. &lt;br /&gt;
&lt;br /&gt;
XNOr Gate: XNOr takes 2 or more inputs and returns TRUE if ALL are TRUE, OR FALSE.&lt;br /&gt;
&lt;br /&gt;
For a better explanation of gates see:http://en.wikipedia.org/wiki/Logic_gate&lt;br /&gt;
&lt;br /&gt;
Notation: #:always 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) 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.&lt;br /&gt;
&lt;br /&gt;
Gates will always be capitalized in the way they are within the entry, I.E. And, Or, AndOr, XNOr, etc&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
There are three principle 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 principle reason for this is pathfinding always prefers the shortest path to ground, 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, more than a single on or off signal. For simplicity and streamlining the systems I have designed only use binary outputs, but theoretically they could be made to compute natively in decimal; however, this is a bit more complicated than a week of study allows.&lt;br /&gt;
&lt;br /&gt;
GATES&lt;br /&gt;
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 &amp;quot;wake up&amp;quot; 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 it's enclosure, this allows the gate to respond faster 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 I find them to be better in general use.&lt;br /&gt;
&lt;br /&gt;
And&lt;br /&gt;
This simple gate is made by confining the animal into a straight coridor; the ground path will have two or more doors which are connected to the input, while the second longer path remains clear. the gate can be configured as an NAnd gate by simply moving the pressure plate. if the plate is by the ground path it functions as an And gate returning TRUE if the ground path is open, and if the plate is by the purge path it will return FALSE when the inputs are TRUE&lt;br /&gt;
 #########&lt;br /&gt;
  ABCD^ D&lt;br /&gt;
 #########&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Multi And&lt;br /&gt;
 ############&lt;br /&gt;
  ANYNUMD^ D&lt;br /&gt;
 ############&lt;br /&gt;
&lt;br /&gt;
NAnd&lt;br /&gt;
Reconfigured And gate, see And.&lt;br /&gt;
 #########&lt;br /&gt;
  ABCD ^D&lt;br /&gt;
 #########&lt;br /&gt;
&lt;br /&gt;
Or&lt;br /&gt;
Basic gate&lt;br /&gt;
 #####&lt;br /&gt;
 AD^ D&lt;br /&gt;
 B####&lt;br /&gt;
 #####&lt;br /&gt;
&lt;br /&gt;
Multi Or&lt;br /&gt;
 #######&lt;br /&gt;
 A #####&lt;br /&gt;
 N #####&lt;br /&gt;
 Y D^ D&lt;br /&gt;
 N #####&lt;br /&gt;
 M #####&lt;br /&gt;
 #######&lt;br /&gt;
&lt;br /&gt;
NOr&lt;br /&gt;
Basically a reconfigured Or gate&lt;br /&gt;
 #####&lt;br /&gt;
 AD ^D&lt;br /&gt;
 B####&lt;br /&gt;
 #####&lt;br /&gt;
&lt;br /&gt;
Not&lt;br /&gt;
The simplest gate, It only takes a single imput.&lt;br /&gt;
 #######&lt;br /&gt;
  AD^ D&lt;br /&gt;
 #######&lt;br /&gt;
&lt;br /&gt;
Compound Gates&lt;br /&gt;
Basically two or more gates arranged with different path costs to ground. These gates can be configured in a number of different ways, these being the simplest. It may be possible to make these gates as single gates but that would require inverting some of the input. Simple compund gates use two simple gates and handle two inputs, complex compund gates have more then two simple gates and need more than two inputs. a Complex compund gate might be used to convert decimal numbers into binary using And gates&lt;br /&gt;
&lt;br /&gt;
XOr&lt;br /&gt;
Compound of And and Or, when ONLY ONE is TRUE returns TRUE&lt;br /&gt;
If A and B are false the animal moves to the FALSE position by Purge, if A or B is true, the animal moves to the TRUE position at the Or gate, if both A and B are true the animal moves to the FALSE postion by the And gate.&lt;br /&gt;
&lt;br /&gt;
 #g########&lt;br /&gt;
 # ABD  D #&lt;br /&gt;
 # ####^# #&lt;br /&gt;
 # ####D# #&lt;br /&gt;
 # ###BA# #&lt;br /&gt;
 #        #&lt;br /&gt;
 ##########&lt;br /&gt;
And path cost: 4&lt;br /&gt;
Or path cost: 10&lt;br /&gt;
Purge path cost: 14&lt;br /&gt;
&lt;br /&gt;
XNor&lt;br /&gt;
Inverse of XOr: Return TRUE if BOTH are TRUE OR FALSE&lt;br /&gt;
If A and B are false the animal move to the TRUE position by Purge, if A or B is true, the animal moves to the FALSE position at the Or gate, if both A and B are true the animal moves to the TRUE postion by the And gate.&lt;br /&gt;
&lt;br /&gt;
 #g#########&lt;br /&gt;
 #         #&lt;br /&gt;
 ##B###### #&lt;br /&gt;
 ###A## DA # &lt;br /&gt;
 ####D^##B #&lt;br /&gt;
 #####D### #&lt;br /&gt;
 ######    #&lt;br /&gt;
 ###########&lt;br /&gt;
And path cost: 4&lt;br /&gt;
Or path cost: 10&lt;br /&gt;
Purge path cost: 15&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Complex Compond gate, Octal display ALU&lt;br /&gt;
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)&lt;br /&gt;
&lt;br /&gt;
 #################&lt;br /&gt;
                 #&lt;br /&gt;
 # # # # # # #1# #&lt;br /&gt;
 # # #1# #1#2#2# #&lt;br /&gt;
 #1#2#2#4#4#4#4# #&lt;br /&gt;
 #D#D#D#D#D#D#D#D#&lt;br /&gt;
 #               #&lt;br /&gt;
 #################&lt;br /&gt;
&lt;br /&gt;
 # ######&lt;br /&gt;
 # 1  D #&lt;br /&gt;
 # #### #&lt;br /&gt;
 # 2  D #&lt;br /&gt;
 # #### #&lt;br /&gt;
 # 12 D #&lt;br /&gt;
 # #### #&lt;br /&gt;
 # 4  D #&lt;br /&gt;
 # #### #&lt;br /&gt;
 # 14 D #&lt;br /&gt;
 # #### #&lt;br /&gt;
 # 24 D #&lt;br /&gt;
 # #### #&lt;br /&gt;
 # 124D #&lt;br /&gt;
 # #### #&lt;br /&gt;
 #    D #&lt;br /&gt;
 ########&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Fusion gates&lt;br /&gt;
These are gates which are constructed by physically combining the two gates to get a specific output.&lt;br /&gt;
&lt;br /&gt;
AndOr&lt;br /&gt;
This gate will evaluate if either of x And statements are TRUE. This gate is built as a straight line similar to the And gate&lt;br /&gt;
 ######&lt;br /&gt;
 #C####&lt;br /&gt;
 ABD^ D&lt;br /&gt;
 C#####&lt;br /&gt;
 ######&lt;br /&gt;
&lt;br /&gt;
NAndOr&lt;br /&gt;
Reconfigured AndOr gate, see AndOr&lt;br /&gt;
 ######&lt;br /&gt;
 #C####&lt;br /&gt;
 ABD ^D&lt;br /&gt;
 C#####&lt;br /&gt;
 ######&lt;br /&gt;
&lt;br /&gt;
OrandOr&lt;br /&gt;
This gate returns true if either A or B and either C or D is true.&lt;br /&gt;
&lt;br /&gt;
 ######&lt;br /&gt;
 AC####&lt;br /&gt;
 BED^ D&lt;br /&gt;
 ######&lt;br /&gt;
&lt;br /&gt;
OrandAnd&lt;br /&gt;
This gate returns true if either A or B is true, and E and C are true.&lt;br /&gt;
&lt;br /&gt;
 #######&lt;br /&gt;
 A######&lt;br /&gt;
 BCED^ D&lt;br /&gt;
 #######&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Complex Gate&lt;br /&gt;
&lt;br /&gt;
Adders&lt;br /&gt;
A Full adder can be made as a Compound Fusion gate, by combining, And, AndOr, and Or gates&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Binary Adder&lt;br /&gt;
The first binary adder I attempted was structured like an electronic adder using an array of simple gates. It contained five animals and used grates to control the logic, based off of bidok's logic gates. This adder functioned correctly but it was very inefficient with space, and highly unreliable often taking ten plus minutes to properly align. I refined this design by lining the gates up into a linear arrangement, but this failed to solve the efficiency problems.&lt;br /&gt;
&lt;br /&gt;
I then realized that simply limiting my Adder to using Electronic gates was silly realizing the key point of animal logic I designed a single stage gate, which had four output states: 0,1,C,1&amp;amp;C. this allowed me to compress the Adder into a single circuit. Modifying the design further the use of doors allows the new design to function at approximately 4-6 times the speed of the prototype adder.&lt;br /&gt;
&lt;br /&gt;
The Binary Adder function by adding three values, A,B, and Carry. Carry is only involved if the previous adder had a result of 2, or 3. the adder works by detecting if (A Or B Or C = True)Sum=1, Or (A And B, Or, A And C, Or B And C = True)Sum=2, Or (A And B And C = True)Sum=3, Or (A And B And C = False)Sum=0. With this basic logic one simply needs to configure the output for 1 if the answer is 1, C if the answer is 2, and 1 and C if the answer is 3. the gates must also be arranged so the Highest Sum has the shortest path to ground as otherwise the gate would return nonsense.&lt;br /&gt;
&lt;br /&gt;
Stand alone Adders (they don't carry into another adder) require 22 mechanisms, and 14 doors.&lt;br /&gt;
Start Adders (They feed into the next Adder and include a carry) require 32 mechanisms, and 14 doors.&lt;br /&gt;
Chain Adders (The receive Carry, and pass a Carry bit up) require 32 mechanisms, and 14 doors&lt;br /&gt;
While Materials intensive the gates only take up 13x9 urists, ideal for chaining along mining tunnels.&lt;br /&gt;
&lt;br /&gt;
Reference pictures&lt;br /&gt;
[[Image:Xnor,Xor,Nand,Or_prototype_adder_STATE_1]]&lt;br /&gt;
Add pictures of the states here&lt;br /&gt;
&lt;br /&gt;
By chaining these gates you can perform most binary math, the easiest of which is addition. In my old fort I built and tested my initial 9 Bit Addition computer. the design failed in two circumstances, the AndOr gate of bit 32 had a lower path cost than the And gate when the animal was at Sum 2, and the Or gate in bit 4 had a lower path cost than ground if the lower door was open.&lt;br /&gt;
&lt;br /&gt;
The gates in the Super Snail adder can be reset to the correct positions by forbidding the doors which fault. I'm working on a more reliable compact adder. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Decimal Adder&lt;br /&gt;
While it can be done, It's massively more complex than simply making a set of decimal converters working with numbers over 10,&lt;br /&gt;
&lt;br /&gt;
hexadecimal adder&lt;br /&gt;
The hex adder makes use of 32 sum gates per side of a single adder, making it geometrically more complex than the binary adder, however it does make animal management more streamlined. more information to come.&lt;br /&gt;
&lt;br /&gt;
Status&lt;br /&gt;
Sum gates 0-31           done&lt;br /&gt;
layout                   pending&lt;br /&gt;
working prototype        pending&lt;br /&gt;
finished dorfputer       pending&lt;br /&gt;
&lt;br /&gt;
Subtractors&lt;br /&gt;
inverse adder, simple but not yet tested.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Animals&lt;br /&gt;
Choosing the animal which works as the logic core for an animal logic systems is somewhat important, depending on your needs and the available animals. however pretty much anything will do as long as you can remember which animal fits into which gate (to avoid designating the same animal for more than one pit).&lt;br /&gt;
&lt;br /&gt;
Kittens&lt;br /&gt;
Put those worthless cats to work, load them into your fortress's logic core and make them work for their keep. while kittens are the most reliable cores for logic gates with their 3 pathing goals they're also problematic as they grow into cats which only have two, and may cause catsplosions inside your logical cores. Ideally kittens should be replaced yearly or biyearly as their growth defines.&lt;br /&gt;
Kittens path to the activity zone, their parents, and vermin.&lt;br /&gt;
&lt;br /&gt;
Puppies&lt;br /&gt;
Why should your fortresses working animals only work once they grow up? throw the puppies into the logic core and have them work from the day of their birth. Puppies are quite reliable with their two pathing goals, but retain the problem of maturation.&lt;br /&gt;
Puppies path to the activity zone, and their parents.&lt;br /&gt;
&lt;br /&gt;
Animal Children&lt;br /&gt;
Using the non matured animals for something useful before butchering may be quite effective, however they still must be flushed when they mature.&lt;br /&gt;
Animal children path to the activity zone, and their parents.&lt;br /&gt;
&lt;br /&gt;
Cats&lt;br /&gt;
Aggravating animals, throw them into the computer and get some worth out of them. Otherwise useless cats become useful when used for logic, with two pathing goals they're responsive, and multiply quickly. watch out for catsplosions while using these critters&lt;br /&gt;
Cats path to the activity zone, and Vermin.&lt;br /&gt;
&lt;br /&gt;
Dogs&lt;br /&gt;
The workhorse of your fortress, because horses can't do anything useful. I'd recommend not using dogs as they're put to better use as wardogs to protect your dorfs.&lt;br /&gt;
Dogs path to the activity zone.&lt;br /&gt;
&lt;br /&gt;
Cattle&lt;br /&gt;
Large lumbering bovines, the advantage of Cattle is you can tell the sexes apart, they also make the pressure plates continue to work if you forget to reassign the trigger weight.&lt;br /&gt;
Cattle path to the activity zone.&lt;br /&gt;
&lt;br /&gt;
Other animals&lt;br /&gt;
Any animals work, but the above are probably your best choice, excluding any modded animals. however if you have a GCS handy a GCS powered computer would be awesome, so take this as you will.&lt;br /&gt;
Other animals have different pathing goals, but most only path to the activity zone.&lt;br /&gt;
&lt;br /&gt;
Goblins&lt;br /&gt;
I'm working on an incremental goblin powered system, results pending.&lt;br /&gt;
&lt;br /&gt;
Putting it all together&lt;br /&gt;
&lt;br /&gt;
When it comes time to automate your systems the first thing you need to know is what needs to automated and what should remain manual. an obsidian farm with completely autonomous control of the casting process is all well and good, until it drowns all your legendary miners when it prematurely triggers. all systems should have manual controls and failsafes to help avoid FUN! (but because we all love FUN sometimes you forget to fully connect that emergency drain, or that failsafe system you built somehow failed.)&lt;br /&gt;
&lt;br /&gt;
once you know the steps you need in your system it comes time to select the parts you need to automate, whether it be basic logic gates or more sophisticated multiple trigger systems.&lt;br /&gt;
&lt;br /&gt;
This is mainly pure logic and I can't really help with that, but post a requirement in the talk page and if I see it I'll work on it. Consult the computing page on this wiki, and look up digital logic on Wikipedia. past that it's pretty fundamental and I don't really think I can adequately describe it.&lt;/div&gt;</summary>
		<author><name>LordOOTFD</name></author>
	</entry>
	<entry>
		<id>http://dwarffortresswiki.org/index.php?title=User:LordOOTFD&amp;diff=61929</id>
		<title>User:LordOOTFD</title>
		<link rel="alternate" type="text/html" href="http://dwarffortresswiki.org/index.php?title=User:LordOOTFD&amp;diff=61929"/>
		<updated>2010-01-29T05:06:05Z</updated>

		<summary type="html">&lt;p&gt;LordOOTFD: Undo revision 61928 by LordOOTFD (Talk)&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Animal logic works as a function of the path finding algorithm in dwarf fortress, as all animals seek to find the lowest cost path to their desired objects (activity zone, parents, dwarfs, valuable objects, etc) this can be used to create very very complex logic gates. Animal logic has three principle advantages, speed, compactness, and simplified functions; however, animal logic is slower than mechanical logic, less reliable than either, and logic is often inverted.&lt;br /&gt;
&lt;br /&gt;
Throughout this document I will be using a number of terms which may not be immediately obvious so I'll list them here: &lt;br /&gt;
&lt;br /&gt;
Ground: for simplicity the thing the animal is pathing to is refereed to as ground as that is the ground state which it wishes to reach. Ground is always the left unless otherwise noted.&lt;br /&gt;
&lt;br /&gt;
Purge: Path to ground with no inputs&lt;br /&gt;
&lt;br /&gt;
Path cost: The number of steps the animal must make to reach ground&lt;br /&gt;
&lt;br /&gt;
Fusion Gate: Simply one or more logic gates built into the same system (this is more than simply stringing gates)&lt;br /&gt;
&lt;br /&gt;
Compund Gate: Gate which uses two or more gates set to different path costs.&lt;br /&gt;
&lt;br /&gt;
And Gate: And takes x inputs and output TRUE if ALL are TRUE.&lt;br /&gt;
&lt;br /&gt;
NAnd Gate: NAnd takes x inputs and returns TRUE if ALL are FALSE. &lt;br /&gt;
&lt;br /&gt;
AndOr Gate: AndOr takes x inputs and returns TRUE if X-Y are TRUE. (this gate is exclusive to animal logic, and is a single step fusion of And, and Or)&lt;br /&gt;
&lt;br /&gt;
Or Gate: Or takes x input and output TRUE if ANY are true.&lt;br /&gt;
&lt;br /&gt;
Not Gate: Not takes a single input and inverts it to the oposite state TRUE if FALSE. &lt;br /&gt;
&lt;br /&gt;
XOr Gate: XOr takes 2 or more inputs and output TRUE if ONLY ONE is TRUE but NOT ALL are TRUE. &lt;br /&gt;
&lt;br /&gt;
NOr Gate: NOr takes x input and returns TRUE if ALL inputs are FALSE. &lt;br /&gt;
&lt;br /&gt;
XNOr Gate: XNOr takes 2 or more inputs and returns TRUE if ALL are TRUE, OR FALSE.&lt;br /&gt;
&lt;br /&gt;
For a better explanation of gates see:http://en.wikipedia.org/wiki/Logic_gate&lt;br /&gt;
&lt;br /&gt;
Notation: #:always 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) 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.&lt;br /&gt;
&lt;br /&gt;
Gates will always be capitalized in the way they are within the entry, I.E. And, Or, AndOr, XNOr, etc&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
There are three principle 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 principle reason for this is pathfinding always prefers the shortest path to ground, 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, more than a single on or off signal. For simplicity and streamlining the systems I have designed only use binary outputs, but theoretically they could be made to compute natively in decimal; however, this is a bit more complicated than a week of study allows.&lt;br /&gt;
&lt;br /&gt;
GATES&lt;br /&gt;
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 &amp;quot;wake up&amp;quot; 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 it's enclosure, this allows the gate to respond faster 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 I find them to be better in general use.&lt;br /&gt;
&lt;br /&gt;
And&lt;br /&gt;
This simple gate is made by confining the animal into a straight coridor; the ground path will have two or more doors which are connected to the input, while the second longer path remains clear. the gate can be configured as an NAnd gate by simply moving the pressure plate. if the plate is by the ground path it functions as an And gate returning TRUE if the ground path is open, and if the plate is by the purge path it will return FALSE when the inputs are TRUE&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
#########&lt;br /&gt;
 ABCD^ D&lt;br /&gt;
#########&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Multi And&lt;br /&gt;
############&lt;br /&gt;
 ANYNUMD^ D&lt;br /&gt;
############&lt;br /&gt;
&lt;br /&gt;
NAnd&lt;br /&gt;
Reconfigured And gate, see And.&lt;br /&gt;
#########&lt;br /&gt;
 ABCD ^D&lt;br /&gt;
#########&lt;br /&gt;
&lt;br /&gt;
Or&lt;br /&gt;
Basic gate&lt;br /&gt;
#####&lt;br /&gt;
AD^ D&lt;br /&gt;
B####&lt;br /&gt;
#####&lt;br /&gt;
&lt;br /&gt;
Multi Or&lt;br /&gt;
#######&lt;br /&gt;
A #####&lt;br /&gt;
N #####&lt;br /&gt;
Y D^ D&lt;br /&gt;
N #####&lt;br /&gt;
M #####&lt;br /&gt;
#######&lt;br /&gt;
&lt;br /&gt;
NOr&lt;br /&gt;
Basically a reconfigured Or gate&lt;br /&gt;
#####&lt;br /&gt;
AD ^D&lt;br /&gt;
B####&lt;br /&gt;
#####&lt;br /&gt;
&lt;br /&gt;
Not&lt;br /&gt;
The simplest gate, It only takes a single imput.&lt;br /&gt;
#######&lt;br /&gt;
 AD^ D&lt;br /&gt;
#######&lt;br /&gt;
&lt;br /&gt;
Compound Gates&lt;br /&gt;
Basically two or more gates arranged with different path costs to ground. These gates can be configured in a number of different ways, these being the simplest. It may be possible to make these gates as single gates but that would require inverting some of the input. Simple compund gates use two simple gates and handle two inputs, complex compund gates have more then two simple gates and need more than two inputs. a Complex compund gate might be used to convert decimal numbers into binary using And gates&lt;br /&gt;
&lt;br /&gt;
XOr&lt;br /&gt;
Compound of And and Or, when ONLY ONE is TRUE returns TRUE&lt;br /&gt;
If A and B are false the animal moves to the FALSE position by Purge, if A or B is true, the animal moves to the TRUE position at the Or gate, if both A and B are true the animal moves to the FALSE postion by the And gate.&lt;br /&gt;
&lt;br /&gt;
#g########&lt;br /&gt;
# ABD  D #&lt;br /&gt;
# ####^# #&lt;br /&gt;
# ####D# #&lt;br /&gt;
# ###BA# #&lt;br /&gt;
#        #&lt;br /&gt;
##########&lt;br /&gt;
And path cost: 4&lt;br /&gt;
Or path cost: 10&lt;br /&gt;
Purge path cost: 14&lt;br /&gt;
&lt;br /&gt;
XNor&lt;br /&gt;
Inverse of XOr: Return TRUE if BOTH are TRUE OR FALSE&lt;br /&gt;
If A and B are false the animal move to the TRUE position by Purge, if A or B is true, the animal moves to the FALSE position at the Or gate, if both A and B are true the animal moves to the TRUE postion by the And gate.&lt;br /&gt;
&lt;br /&gt;
#g#########&lt;br /&gt;
#         #&lt;br /&gt;
##B###### #&lt;br /&gt;
###A## DA # &lt;br /&gt;
####D^##B #&lt;br /&gt;
#####D### #&lt;br /&gt;
######    #&lt;br /&gt;
###########&lt;br /&gt;
And path cost: 4&lt;br /&gt;
Or path cost: 10&lt;br /&gt;
Purge path cost: 15&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Complex Compond gate, Octal display ALU&lt;br /&gt;
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)&lt;br /&gt;
&lt;br /&gt;
#################&lt;br /&gt;
                #&lt;br /&gt;
# # # # # # #1# #&lt;br /&gt;
# # #1# #1#2#2# #&lt;br /&gt;
#1#2#2#4#4#4#4# #&lt;br /&gt;
#D#D#D#D#D#D#D#D#&lt;br /&gt;
#               #&lt;br /&gt;
#################&lt;br /&gt;
&lt;br /&gt;
# ######&lt;br /&gt;
# 1  D #&lt;br /&gt;
# #### #&lt;br /&gt;
# 2  D #&lt;br /&gt;
# #### #&lt;br /&gt;
# 12 D #&lt;br /&gt;
# #### #&lt;br /&gt;
# 4  D #&lt;br /&gt;
# #### #&lt;br /&gt;
# 14 D #&lt;br /&gt;
# #### #&lt;br /&gt;
# 24 D #&lt;br /&gt;
# #### #&lt;br /&gt;
# 124D #&lt;br /&gt;
# #### #&lt;br /&gt;
#    D #&lt;br /&gt;
########&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Fusion gates&lt;br /&gt;
These are gates which are constructed by physically combining the two gates to get a specific output.&lt;br /&gt;
&lt;br /&gt;
AndOr&lt;br /&gt;
This gate will evaluate if either of x And statements are TRUE. This gate is built as a straight line similar to the And gate&lt;br /&gt;
######&lt;br /&gt;
#C####&lt;br /&gt;
ABD^ D&lt;br /&gt;
C#####&lt;br /&gt;
######&lt;br /&gt;
&lt;br /&gt;
NAndOr&lt;br /&gt;
Reconfigured AndOr gate, see AndOr&lt;br /&gt;
######&lt;br /&gt;
#C####&lt;br /&gt;
ABD ^D&lt;br /&gt;
C#####&lt;br /&gt;
######&lt;br /&gt;
&lt;br /&gt;
OrandOr&lt;br /&gt;
This gate returns true if either A or B and either C or D is true.&lt;br /&gt;
&lt;br /&gt;
######&lt;br /&gt;
AC####&lt;br /&gt;
BED^ D&lt;br /&gt;
######&lt;br /&gt;
&lt;br /&gt;
OrandAnd&lt;br /&gt;
This gate returns true if either A or B is true, and E and C are true.&lt;br /&gt;
&lt;br /&gt;
#######&lt;br /&gt;
A######&lt;br /&gt;
BCED^ D&lt;br /&gt;
#######&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Complex Gate&lt;br /&gt;
&lt;br /&gt;
Adders&lt;br /&gt;
A Full adder can be made as a Compound Fusion gate, by combining, And, AndOr, and Or gates&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Binary Adder&lt;br /&gt;
The first binary adder I attempted was structured like an electronic adder using an array of simple gates. It contained five animals and used grates to control the logic, based off of bidok's logic gates. This adder functioned correctly but it was very inefficient with space, and highly unreliable often taking ten plus minutes to properly align. I refined this design by lining the gates up into a linear arrangement, but this failed to solve the efficiency problems.&lt;br /&gt;
&lt;br /&gt;
I then realized that simply limiting my Adder to using Electronic gates was silly realizing the key point of animal logic I designed a single stage gate, which had four output states: 0,1,C,1&amp;amp;C. this allowed me to compress the Adder into a single circuit. Modifying the design further the use of doors allows the new design to function at approximately 4-6 times the speed of the prototype adder.&lt;br /&gt;
&lt;br /&gt;
The Binary Adder function by adding three values, A,B, and Carry. Carry is only involved if the previous adder had a result of 2, or 3. the adder works by detecting if (A Or B Or C = True)Sum=1, Or (A And B, Or, A And C, Or B And C = True)Sum=2, Or (A And B And C = True)Sum=3, Or (A And B And C = False)Sum=0. With this basic logic one simply needs to configure the output for 1 if the answer is 1, C if the answer is 2, and 1 and C if the answer is 3. the gates must also be arranged so the Highest Sum has the shortest path to ground as otherwise the gate would return nonsense.&lt;br /&gt;
&lt;br /&gt;
Stand alone Adders (they don't carry into another adder) require 22 mechanisms, and 14 doors.&lt;br /&gt;
Start Adders (They feed into the next Adder and include a carry) require 32 mechanisms, and 14 doors.&lt;br /&gt;
Chain Adders (The receive Carry, and pass a Carry bit up) require 32 mechanisms, and 14 doors&lt;br /&gt;
While Materials intensive the gates only take up 13x9 urists, ideal for chaining along mining tunnels.&lt;br /&gt;
&lt;br /&gt;
Reference pictures&lt;br /&gt;
[[Image:Xnor,Xor,Nand,Or_prototype_adder_STATE_1]]&lt;br /&gt;
Add pictures of the states here&lt;br /&gt;
&lt;br /&gt;
By chaining these gates you can perform most binary math, the easiest of which is addition. In my old fort I built and tested my initial 9 Bit Addition computer. the design failed in two circumstances, the AndOr gate of bit 32 had a lower path cost than the And gate when the animal was at Sum 2, and the Or gate in bit 4 had a lower path cost than ground if the lower door was open.&lt;br /&gt;
&lt;br /&gt;
The gates in the Super Snail adder can be reset to the correct positions by forbidding the doors which fault. I'm working on a more reliable compact adder. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Decimal Adder&lt;br /&gt;
While it can be done, It's massively more complex than simply making a set of decimal converters working with numbers over 10,&lt;br /&gt;
&lt;br /&gt;
hexadecimal adder&lt;br /&gt;
The hex adder makes use of 32 sum gates per side of a single adder, making it geometrically more complex than the binary adder, however it does make animal management more streamlined. more information to come.&lt;br /&gt;
&lt;br /&gt;
Status&lt;br /&gt;
Sum gates 0-31           done&lt;br /&gt;
layout                   pending&lt;br /&gt;
working prototype        pending&lt;br /&gt;
finished dorfputer       pending&lt;br /&gt;
&lt;br /&gt;
Subtractors&lt;br /&gt;
inverse adder, simple but not yet tested.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Animals&lt;br /&gt;
Choosing the animal which works as the logic core for an animal logic systems is somewhat important, depending on your needs and the available animals. however pretty much anything will do as long as you can remember which animal fits into which gate (to avoid designating the same animal for more than one pit).&lt;br /&gt;
&lt;br /&gt;
Kittens&lt;br /&gt;
Put those worthless cats to work, load them into your fortress's logic core and make them work for their keep. while kittens are the most reliable cores for logic gates with their 3 pathing goals they're also problematic as they grow into cats which only have two, and may cause catsplosions inside your logical cores. Ideally kittens should be replaced yearly or biyearly as their growth defines.&lt;br /&gt;
Kittens path to the activity zone, their parents, and vermin.&lt;br /&gt;
&lt;br /&gt;
Puppies&lt;br /&gt;
Why should your fortresses working animals only work once they grow up? throw the puppies into the logic core and have them work from the day of their birth. Puppies are quite reliable with their two pathing goals, but retain the problem of maturation.&lt;br /&gt;
Puppies path to the activity zone, and their parents.&lt;br /&gt;
&lt;br /&gt;
Animal Children&lt;br /&gt;
Using the non matured animals for something useful before butchering may be quite effective, however they still must be flushed when they mature.&lt;br /&gt;
Animal children path to the activity zone, and their parents.&lt;br /&gt;
&lt;br /&gt;
Cats&lt;br /&gt;
Aggravating animals, throw them into the computer and get some worth out of them. Otherwise useless cats become useful when used for logic, with two pathing goals they're responsive, and multiply quickly. watch out for catsplosions while using these critters&lt;br /&gt;
Cats path to the activity zone, and Vermin.&lt;br /&gt;
&lt;br /&gt;
Dogs&lt;br /&gt;
The workhorse of your fortress, because horses can't do anything useful. I'd recommend not using dogs as they're put to better use as wardogs to protect your dorfs.&lt;br /&gt;
Dogs path to the activity zone.&lt;br /&gt;
&lt;br /&gt;
Cattle&lt;br /&gt;
Large lumbering bovines, the advantage of Cattle is you can tell the sexes apart, they also make the pressure plates continue to work if you forget to reassign the trigger weight.&lt;br /&gt;
Cattle path to the activity zone.&lt;br /&gt;
&lt;br /&gt;
Other animals&lt;br /&gt;
Any animals work, but the above are probably your best choice, excluding any modded animals. however if you have a GCS handy a GCS powered computer would be awesome, so take this as you will.&lt;br /&gt;
Other animals have different pathing goals, but most only path to the activity zone.&lt;br /&gt;
&lt;br /&gt;
Goblins&lt;br /&gt;
I'm working on an incremental goblin powered system, results pending.&lt;br /&gt;
&lt;br /&gt;
Putting it all together&lt;br /&gt;
&lt;br /&gt;
When it comes time to automate your systems the first thing you need to know is what needs to automated and what should remain manual. an obsidian farm with completely autonomous control of the casting process is all well and good, until it drowns all your legendary miners when it prematurely triggers. all systems should have manual controls and failsafes to help avoid FUN! (but because we all love FUN sometimes you forget to fully connect that emergency drain, or that failsafe system you built somehow failed.)&lt;br /&gt;
&lt;br /&gt;
once you know the steps you need in your system it comes time to select the parts you need to automate, whether it be basic logic gates or more sophisticated multiple trigger systems.&lt;br /&gt;
&lt;br /&gt;
This is mainly pure logic and I can't really help with that, but post a requirement in the talk page and if I see it I'll work on it. Consult the computing page on this wiki, and look up digital logic on Wikipedia. past that it's pretty fundamental and I don't really think I can adequately describe it.&lt;/div&gt;</summary>
		<author><name>LordOOTFD</name></author>
	</entry>
	<entry>
		<id>http://dwarffortresswiki.org/index.php?title=User:LordOOTFD&amp;diff=61928</id>
		<title>User:LordOOTFD</title>
		<link rel="alternate" type="text/html" href="http://dwarffortresswiki.org/index.php?title=User:LordOOTFD&amp;diff=61928"/>
		<updated>2010-01-29T05:05:32Z</updated>

		<summary type="html">&lt;p&gt;LordOOTFD: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Animal logic works as a function of the path finding algorithm in dwarf fortress, as all animals seek to find the lowest cost path to their desired objects (activity zone, parents, dwarfs, valuable objects, etc) this can be used to create very very complex logic gates. Animal logic has three principle advantages, speed, compactness, and simplified functions; however, animal logic is slower than mechanical logic, less reliable than either, and logic is often inverted.&lt;br /&gt;
&lt;br /&gt;
Throughout this document I will be using a number of terms which may not be immediately obvious so I'll list them here: &lt;br /&gt;
&lt;br /&gt;
Ground: for simplicity the thing the animal is pathing to is refereed to as ground as that is the ground state which it wishes to reach. Ground is always the left unless otherwise noted.&lt;br /&gt;
&lt;br /&gt;
Purge: Path to ground with no inputs&lt;br /&gt;
&lt;br /&gt;
Path cost: The number of steps the animal must make to reach ground&lt;br /&gt;
&lt;br /&gt;
Fusion Gate: Simply one or more logic gates built into the same system (this is more than simply stringing gates)&lt;br /&gt;
&lt;br /&gt;
Compund Gate: Gate which uses two or more gates set to different path costs.&lt;br /&gt;
&lt;br /&gt;
And Gate: And takes x inputs and output TRUE if ALL are TRUE.&lt;br /&gt;
&lt;br /&gt;
NAnd Gate: NAnd takes x inputs and returns TRUE if ALL are FALSE. &lt;br /&gt;
&lt;br /&gt;
AndOr Gate: AndOr takes x inputs and returns TRUE if X-Y are TRUE. (this gate is exclusive to animal logic, and is a single step fusion of And, and Or)&lt;br /&gt;
&lt;br /&gt;
Or Gate: Or takes x input and output TRUE if ANY are true.&lt;br /&gt;
&lt;br /&gt;
Not Gate: Not takes a single input and inverts it to the oposite state TRUE if FALSE. &lt;br /&gt;
&lt;br /&gt;
XOr Gate: XOr takes 2 or more inputs and output TRUE if ONLY ONE is TRUE but NOT ALL are TRUE. &lt;br /&gt;
&lt;br /&gt;
NOr Gate: NOr takes x input and returns TRUE if ALL inputs are FALSE. &lt;br /&gt;
&lt;br /&gt;
XNOr Gate: XNOr takes 2 or more inputs and returns TRUE if ALL are TRUE, OR FALSE.&lt;br /&gt;
&lt;br /&gt;
For a better explanation of gates see:http://en.wikipedia.org/wiki/Logic_gate&lt;br /&gt;
&lt;br /&gt;
Notation: #:always 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) 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.&lt;br /&gt;
&lt;br /&gt;
Gates will always be capitalized in the way they are within the entry, I.E. And, Or, AndOr, XNOr, etc&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
There are three principle 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 principle reason for this is pathfinding always prefers the shortest path to ground, 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, more than a single on or off signal. For simplicity and streamlining the systems I have designed only use binary outputs, but theoretically they could be made to compute natively in decimal; however, this is a bit more complicated than a week of study allows.&lt;br /&gt;
&lt;br /&gt;
GATES&lt;br /&gt;
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 &amp;quot;wake up&amp;quot; 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 it's enclosure, this allows the gate to respond faster 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 I find them to be better in general use.&lt;br /&gt;
&lt;br /&gt;
And&lt;br /&gt;
This simple gate is made by confining the animal into a straight coridor; the ground path will have two or more doors which are connected to the input, while the second longer path remains clear. the gate can be configured as an NAnd gate by simply moving the pressure plate. if the plate is by the ground path it functions as an And gate returning TRUE if the ground path is open, and if the plate is by the purge path it will return FALSE when the inputs are TRUE&lt;br /&gt;
====And===&lt;br /&gt;
#########&lt;br /&gt;
 ABCD^ D&lt;br /&gt;
#########&lt;br /&gt;
test&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Complex Gate&lt;br /&gt;
&lt;br /&gt;
Adders&lt;br /&gt;
A Full adder can be made as a Compound Fusion gate, by combining, And, AndOr, and Or gates&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Binary Adder&lt;br /&gt;
The first binary adder I attempted was structured like an electronic adder using an array of simple gates. It contained five animals and used grates to control the logic, based off of bidok's logic gates. This adder functioned correctly but it was very inefficient with space, and highly unreliable often taking ten plus minutes to properly align. I refined this design by lining the gates up into a linear arrangement, but this failed to solve the efficiency problems.&lt;br /&gt;
&lt;br /&gt;
I then realized that simply limiting my Adder to using Electronic gates was silly realizing the key point of animal logic I designed a single stage gate, which had four output states: 0,1,C,1&amp;amp;C. this allowed me to compress the Adder into a single circuit. Modifying the design further the use of doors allows the new design to function at approximately 4-6 times the speed of the prototype adder.&lt;br /&gt;
&lt;br /&gt;
The Binary Adder function by adding three values, A,B, and Carry. Carry is only involved if the previous adder had a result of 2, or 3. the adder works by detecting if (A Or B Or C = True)Sum=1, Or (A And B, Or, A And C, Or B And C = True)Sum=2, Or (A And B And C = True)Sum=3, Or (A And B And C = False)Sum=0. With this basic logic one simply needs to configure the output for 1 if the answer is 1, C if the answer is 2, and 1 and C if the answer is 3. the gates must also be arranged so the Highest Sum has the shortest path to ground as otherwise the gate would return nonsense.&lt;br /&gt;
&lt;br /&gt;
Stand alone Adders (they don't carry into another adder) require 22 mechanisms, and 14 doors.&lt;br /&gt;
Start Adders (They feed into the next Adder and include a carry) require 32 mechanisms, and 14 doors.&lt;br /&gt;
Chain Adders (The receive Carry, and pass a Carry bit up) require 32 mechanisms, and 14 doors&lt;br /&gt;
While Materials intensive the gates only take up 13x9 urists, ideal for chaining along mining tunnels.&lt;br /&gt;
&lt;br /&gt;
Reference pictures&lt;br /&gt;
[[Image:Xnor,Xor,Nand,Or_prototype_adder_STATE_1]]&lt;br /&gt;
Add pictures of the states here&lt;br /&gt;
&lt;br /&gt;
By chaining these gates you can perform most binary math, the easiest of which is addition. In my old fort I built and tested my initial 9 Bit Addition computer. the design failed in two circumstances, the AndOr gate of bit 32 had a lower path cost than the And gate when the animal was at Sum 2, and the Or gate in bit 4 had a lower path cost than ground if the lower door was open.&lt;br /&gt;
&lt;br /&gt;
The gates in the Super Snail adder can be reset to the correct positions by forbidding the doors which fault. I'm working on a more reliable compact adder. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Decimal Adder&lt;br /&gt;
While it can be done, It's massively more complex than simply making a set of decimal converters working with numbers over 10,&lt;br /&gt;
&lt;br /&gt;
hexadecimal adder&lt;br /&gt;
The hex adder makes use of 32 sum gates per side of a single adder, making it geometrically more complex than the binary adder, however it does make animal management more streamlined. more information to come.&lt;br /&gt;
&lt;br /&gt;
Status&lt;br /&gt;
Sum gates 0-31           done&lt;br /&gt;
layout                   pending&lt;br /&gt;
working prototype        pending&lt;br /&gt;
finished dorfputer       pending&lt;br /&gt;
&lt;br /&gt;
Subtractors&lt;br /&gt;
inverse adder, simple but not yet tested.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Animals&lt;br /&gt;
Choosing the animal which works as the logic core for an animal logic systems is somewhat important, depending on your needs and the available animals. however pretty much anything will do as long as you can remember which animal fits into which gate (to avoid designating the same animal for more than one pit).&lt;br /&gt;
&lt;br /&gt;
Kittens&lt;br /&gt;
Put those worthless cats to work, load them into your fortress's logic core and make them work for their keep. while kittens are the most reliable cores for logic gates with their 3 pathing goals they're also problematic as they grow into cats which only have two, and may cause catsplosions inside your logical cores. Ideally kittens should be replaced yearly or biyearly as their growth defines.&lt;br /&gt;
Kittens path to the activity zone, their parents, and vermin.&lt;br /&gt;
&lt;br /&gt;
Puppies&lt;br /&gt;
Why should your fortresses working animals only work once they grow up? throw the puppies into the logic core and have them work from the day of their birth. Puppies are quite reliable with their two pathing goals, but retain the problem of maturation.&lt;br /&gt;
Puppies path to the activity zone, and their parents.&lt;br /&gt;
&lt;br /&gt;
Animal Children&lt;br /&gt;
Using the non matured animals for something useful before butchering may be quite effective, however they still must be flushed when they mature.&lt;br /&gt;
Animal children path to the activity zone, and their parents.&lt;br /&gt;
&lt;br /&gt;
Cats&lt;br /&gt;
Aggravating animals, throw them into the computer and get some worth out of them. Otherwise useless cats become useful when used for logic, with two pathing goals they're responsive, and multiply quickly. watch out for catsplosions while using these critters&lt;br /&gt;
Cats path to the activity zone, and Vermin.&lt;br /&gt;
&lt;br /&gt;
Dogs&lt;br /&gt;
The workhorse of your fortress, because horses can't do anything useful. I'd recommend not using dogs as they're put to better use as wardogs to protect your dorfs.&lt;br /&gt;
Dogs path to the activity zone.&lt;br /&gt;
&lt;br /&gt;
Cattle&lt;br /&gt;
Large lumbering bovines, the advantage of Cattle is you can tell the sexes apart, they also make the pressure plates continue to work if you forget to reassign the trigger weight.&lt;br /&gt;
Cattle path to the activity zone.&lt;br /&gt;
&lt;br /&gt;
Other animals&lt;br /&gt;
Any animals work, but the above are probably your best choice, excluding any modded animals. however if you have a GCS handy a GCS powered computer would be awesome, so take this as you will.&lt;br /&gt;
Other animals have different pathing goals, but most only path to the activity zone.&lt;br /&gt;
&lt;br /&gt;
Goblins&lt;br /&gt;
I'm working on an incremental goblin powered system, results pending.&lt;br /&gt;
&lt;br /&gt;
Putting it all together&lt;br /&gt;
&lt;br /&gt;
When it comes time to automate your systems the first thing you need to know is what needs to automated and what should remain manual. an obsidian farm with completely autonomous control of the casting process is all well and good, until it drowns all your legendary miners when it prematurely triggers. all systems should have manual controls and failsafes to help avoid FUN! (but because we all love FUN sometimes you forget to fully connect that emergency drain, or that failsafe system you built somehow failed.)&lt;br /&gt;
&lt;br /&gt;
once you know the steps you need in your system it comes time to select the parts you need to automate, whether it be basic logic gates or more sophisticated multiple trigger systems.&lt;br /&gt;
&lt;br /&gt;
This is mainly pure logic and I can't really help with that, but post a requirement in the talk page and if I see it I'll work on it. Consult the computing page on this wiki, and look up digital logic on Wikipedia. past that it's pretty fundamental and I don't really think I can adequately describe it.&lt;/div&gt;</summary>
		<author><name>LordOOTFD</name></author>
	</entry>
	<entry>
		<id>http://dwarffortresswiki.org/index.php?title=User:LordOOTFD&amp;diff=61927</id>
		<title>User:LordOOTFD</title>
		<link rel="alternate" type="text/html" href="http://dwarffortresswiki.org/index.php?title=User:LordOOTFD&amp;diff=61927"/>
		<updated>2010-01-29T05:03:33Z</updated>

		<summary type="html">&lt;p&gt;LordOOTFD: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Animal logic works as a function of the path finding algorithm in dwarf fortress, as all animals seek to find the lowest cost path to their desired objects (activity zone, parents, dwarfs, valuable objects, etc) this can be used to create very very complex logic gates. Animal logic has three principle advantages, speed, compactness, and simplified functions; however, animal logic is slower than mechanical logic, less reliable than either, and logic is often inverted.&lt;br /&gt;
&lt;br /&gt;
Throughout this document I will be using a number of terms which may not be immediately obvious so I'll list them here: &lt;br /&gt;
&lt;br /&gt;
Ground: for simplicity the thing the animal is pathing to is refereed to as ground as that is the ground state which it wishes to reach. Ground is always the left unless otherwise noted.&lt;br /&gt;
&lt;br /&gt;
Purge: Path to ground with no inputs&lt;br /&gt;
&lt;br /&gt;
Path cost: The number of steps the animal must make to reach ground&lt;br /&gt;
&lt;br /&gt;
Fusion Gate: Simply one or more logic gates built into the same system (this is more than simply stringing gates)&lt;br /&gt;
&lt;br /&gt;
Compund Gate: Gate which uses two or more gates set to different path costs.&lt;br /&gt;
&lt;br /&gt;
And Gate: And takes x inputs and output TRUE if ALL are TRUE.&lt;br /&gt;
&lt;br /&gt;
NAnd Gate: NAnd takes x inputs and returns TRUE if ALL are FALSE. &lt;br /&gt;
&lt;br /&gt;
AndOr Gate: AndOr takes x inputs and returns TRUE if X-Y are TRUE. (this gate is exclusive to animal logic, and is a single step fusion of And, and Or)&lt;br /&gt;
&lt;br /&gt;
Or Gate: Or takes x input and output TRUE if ANY are true.&lt;br /&gt;
&lt;br /&gt;
Not Gate: Not takes a single input and inverts it to the oposite state TRUE if FALSE. &lt;br /&gt;
&lt;br /&gt;
XOr Gate: XOr takes 2 or more inputs and output TRUE if ONLY ONE is TRUE but NOT ALL are TRUE. &lt;br /&gt;
&lt;br /&gt;
NOr Gate: NOr takes x input and returns TRUE if ALL inputs are FALSE. &lt;br /&gt;
&lt;br /&gt;
XNOr Gate: XNOr takes 2 or more inputs and returns TRUE if ALL are TRUE, OR FALSE.&lt;br /&gt;
&lt;br /&gt;
For a better explanation of gates see:http://en.wikipedia.org/wiki/Logic_gate&lt;br /&gt;
&lt;br /&gt;
Notation: #:always 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) 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.&lt;br /&gt;
&lt;br /&gt;
Gates will always be capitalized in the way they are within the entry, I.E. And, Or, AndOr, XNOr, etc&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
There are three principle 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 principle reason for this is pathfinding always prefers the shortest path to ground, 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, more than a single on or off signal. For simplicity and streamlining the systems I have designed only use binary outputs, but theoretically they could be made to compute natively in decimal; however, this is a bit more complicated than a week of study allows.&lt;br /&gt;
&lt;br /&gt;
GATES&lt;br /&gt;
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 &amp;quot;wake up&amp;quot; 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 it's enclosure, this allows the gate to respond faster 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 I find them to be better in general use.&lt;br /&gt;
&lt;br /&gt;
And&lt;br /&gt;
This simple gate is made by confining the animal into a straight coridor; the ground path will have two or more doors which are connected to the input, while the second longer path remains clear. the gate can be configured as an NAnd gate by simply moving the pressure plate. if the plate is by the ground path it functions as an And gate returning TRUE if the ground path is open, and if the plate is by the purge path it will return FALSE when the inputs are TRUE&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
#########&lt;br /&gt;
 ABCD^ D&lt;br /&gt;
#########&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Multi And&lt;br /&gt;
############&lt;br /&gt;
 ANYNUMD^ D&lt;br /&gt;
############&lt;br /&gt;
&lt;br /&gt;
NAnd&lt;br /&gt;
Reconfigured And gate, see And.&lt;br /&gt;
#########&lt;br /&gt;
 ABCD ^D&lt;br /&gt;
#########&lt;br /&gt;
&lt;br /&gt;
Or&lt;br /&gt;
Basic gate&lt;br /&gt;
#####&lt;br /&gt;
AD^ D&lt;br /&gt;
B####&lt;br /&gt;
#####&lt;br /&gt;
&lt;br /&gt;
Multi Or&lt;br /&gt;
#######&lt;br /&gt;
A #####&lt;br /&gt;
N #####&lt;br /&gt;
Y D^ D&lt;br /&gt;
N #####&lt;br /&gt;
M #####&lt;br /&gt;
#######&lt;br /&gt;
&lt;br /&gt;
NOr&lt;br /&gt;
Basically a reconfigured Or gate&lt;br /&gt;
#####&lt;br /&gt;
AD ^D&lt;br /&gt;
B####&lt;br /&gt;
#####&lt;br /&gt;
&lt;br /&gt;
Not&lt;br /&gt;
The simplest gate, It only takes a single imput.&lt;br /&gt;
#######&lt;br /&gt;
 AD^ D&lt;br /&gt;
#######&lt;br /&gt;
&lt;br /&gt;
Compound Gates&lt;br /&gt;
Basically two or more gates arranged with different path costs to ground. These gates can be configured in a number of different ways, these being the simplest. It may be possible to make these gates as single gates but that would require inverting some of the input. Simple compund gates use two simple gates and handle two inputs, complex compund gates have more then two simple gates and need more than two inputs. a Complex compund gate might be used to convert decimal numbers into binary using And gates&lt;br /&gt;
&lt;br /&gt;
XOr&lt;br /&gt;
Compound of And and Or, when ONLY ONE is TRUE returns TRUE&lt;br /&gt;
If A and B are false the animal moves to the FALSE position by Purge, if A or B is true, the animal moves to the TRUE position at the Or gate, if both A and B are true the animal moves to the FALSE postion by the And gate.&lt;br /&gt;
&lt;br /&gt;
#g########&lt;br /&gt;
# ABD  D #&lt;br /&gt;
# ####^# #&lt;br /&gt;
# ####D# #&lt;br /&gt;
# ###BA# #&lt;br /&gt;
#        #&lt;br /&gt;
##########&lt;br /&gt;
And path cost: 4&lt;br /&gt;
Or path cost: 10&lt;br /&gt;
Purge path cost: 14&lt;br /&gt;
&lt;br /&gt;
XNor&lt;br /&gt;
Inverse of XOr: Return TRUE if BOTH are TRUE OR FALSE&lt;br /&gt;
If A and B are false the animal move to the TRUE position by Purge, if A or B is true, the animal moves to the FALSE position at the Or gate, if both A and B are true the animal moves to the TRUE postion by the And gate.&lt;br /&gt;
&lt;br /&gt;
#g#########&lt;br /&gt;
#         #&lt;br /&gt;
##B###### #&lt;br /&gt;
###A## DA # &lt;br /&gt;
####D^##B #&lt;br /&gt;
#####D### #&lt;br /&gt;
######    #&lt;br /&gt;
###########&lt;br /&gt;
And path cost: 4&lt;br /&gt;
Or path cost: 10&lt;br /&gt;
Purge path cost: 15&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Complex Compond gate, Octal display ALU&lt;br /&gt;
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)&lt;br /&gt;
&lt;br /&gt;
#################&lt;br /&gt;
                #&lt;br /&gt;
# # # # # # #1# #&lt;br /&gt;
# # #1# #1#2#2# #&lt;br /&gt;
#1#2#2#4#4#4#4# #&lt;br /&gt;
#D#D#D#D#D#D#D#D#&lt;br /&gt;
#               #&lt;br /&gt;
#################&lt;br /&gt;
&lt;br /&gt;
# ######&lt;br /&gt;
# 1  D #&lt;br /&gt;
# #### #&lt;br /&gt;
# 2  D #&lt;br /&gt;
# #### #&lt;br /&gt;
# 12 D #&lt;br /&gt;
# #### #&lt;br /&gt;
# 4  D #&lt;br /&gt;
# #### #&lt;br /&gt;
# 14 D #&lt;br /&gt;
# #### #&lt;br /&gt;
# 24 D #&lt;br /&gt;
# #### #&lt;br /&gt;
# 124D #&lt;br /&gt;
# #### #&lt;br /&gt;
#    D #&lt;br /&gt;
########&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Fusion gates&lt;br /&gt;
These are gates which are constructed by physically combining the two gates to get a specific output.&lt;br /&gt;
&lt;br /&gt;
AndOr&lt;br /&gt;
This gate will evaluate if either of x And statements are TRUE. This gate is built as a straight line similar to the And gate&lt;br /&gt;
######&lt;br /&gt;
#C####&lt;br /&gt;
ABD^ D&lt;br /&gt;
C#####&lt;br /&gt;
######&lt;br /&gt;
&lt;br /&gt;
NAndOr&lt;br /&gt;
Reconfigured AndOr gate, see AndOr&lt;br /&gt;
######&lt;br /&gt;
#C####&lt;br /&gt;
ABD ^D&lt;br /&gt;
C#####&lt;br /&gt;
######&lt;br /&gt;
&lt;br /&gt;
OrandOr&lt;br /&gt;
This gate returns true if either A or B and either C or D is true.&lt;br /&gt;
&lt;br /&gt;
######&lt;br /&gt;
AC####&lt;br /&gt;
BED^ D&lt;br /&gt;
######&lt;br /&gt;
&lt;br /&gt;
OrandAnd&lt;br /&gt;
This gate returns true if either A or B is true, and E and C are true.&lt;br /&gt;
&lt;br /&gt;
#######&lt;br /&gt;
A######&lt;br /&gt;
BCED^ D&lt;br /&gt;
#######&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Complex Gate&lt;br /&gt;
&lt;br /&gt;
Adders&lt;br /&gt;
A Full adder can be made as a Compound Fusion gate, by combining, And, AndOr, and Or gates&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Binary Adder&lt;br /&gt;
The first binary adder I attempted was structured like an electronic adder using an array of simple gates. It contained five animals and used grates to control the logic, based off of bidok's logic gates. This adder functioned correctly but it was very inefficient with space, and highly unreliable often taking ten plus minutes to properly align. I refined this design by lining the gates up into a linear arrangement, but this failed to solve the efficiency problems.&lt;br /&gt;
&lt;br /&gt;
I then realized that simply limiting my Adder to using Electronic gates was silly realizing the key point of animal logic I designed a single stage gate, which had four output states: 0,1,C,1&amp;amp;C. this allowed me to compress the Adder into a single circuit. Modifying the design further the use of doors allows the new design to function at approximately 4-6 times the speed of the prototype adder.&lt;br /&gt;
&lt;br /&gt;
The Binary Adder function by adding three values, A,B, and Carry. Carry is only involved if the previous adder had a result of 2, or 3. the adder works by detecting if (A Or B Or C = True)Sum=1, Or (A And B, Or, A And C, Or B And C = True)Sum=2, Or (A And B And C = True)Sum=3, Or (A And B And C = False)Sum=0. With this basic logic one simply needs to configure the output for 1 if the answer is 1, C if the answer is 2, and 1 and C if the answer is 3. the gates must also be arranged so the Highest Sum has the shortest path to ground as otherwise the gate would return nonsense.&lt;br /&gt;
&lt;br /&gt;
Stand alone Adders (they don't carry into another adder) require 22 mechanisms, and 14 doors.&lt;br /&gt;
Start Adders (They feed into the next Adder and include a carry) require 32 mechanisms, and 14 doors.&lt;br /&gt;
Chain Adders (The receive Carry, and pass a Carry bit up) require 32 mechanisms, and 14 doors&lt;br /&gt;
While Materials intensive the gates only take up 13x9 urists, ideal for chaining along mining tunnels.&lt;br /&gt;
&lt;br /&gt;
Reference pictures&lt;br /&gt;
[[Image:Xnor,Xor,Nand,Or_prototype_adder_STATE_1]]&lt;br /&gt;
Add pictures of the states here&lt;br /&gt;
&lt;br /&gt;
By chaining these gates you can perform most binary math, the easiest of which is addition. In my old fort I built and tested my initial 9 Bit Addition computer. the design failed in two circumstances, the AndOr gate of bit 32 had a lower path cost than the And gate when the animal was at Sum 2, and the Or gate in bit 4 had a lower path cost than ground if the lower door was open.&lt;br /&gt;
&lt;br /&gt;
The gates in the Super Snail adder can be reset to the correct positions by forbidding the doors which fault. I'm working on a more reliable compact adder. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Decimal Adder&lt;br /&gt;
While it can be done, It's massively more complex than simply making a set of decimal converters working with numbers over 10,&lt;br /&gt;
&lt;br /&gt;
hexadecimal adder&lt;br /&gt;
The hex adder makes use of 32 sum gates per side of a single adder, making it geometrically more complex than the binary adder, however it does make animal management more streamlined. more information to come.&lt;br /&gt;
&lt;br /&gt;
Status&lt;br /&gt;
Sum gates 0-31           done&lt;br /&gt;
layout                   pending&lt;br /&gt;
working prototype        pending&lt;br /&gt;
finished dorfputer       pending&lt;br /&gt;
&lt;br /&gt;
Subtractors&lt;br /&gt;
inverse adder, simple but not yet tested.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Animals&lt;br /&gt;
Choosing the animal which works as the logic core for an animal logic systems is somewhat important, depending on your needs and the available animals. however pretty much anything will do as long as you can remember which animal fits into which gate (to avoid designating the same animal for more than one pit).&lt;br /&gt;
&lt;br /&gt;
Kittens&lt;br /&gt;
Put those worthless cats to work, load them into your fortress's logic core and make them work for their keep. while kittens are the most reliable cores for logic gates with their 3 pathing goals they're also problematic as they grow into cats which only have two, and may cause catsplosions inside your logical cores. Ideally kittens should be replaced yearly or biyearly as their growth defines.&lt;br /&gt;
Kittens path to the activity zone, their parents, and vermin.&lt;br /&gt;
&lt;br /&gt;
Puppies&lt;br /&gt;
Why should your fortresses working animals only work once they grow up? throw the puppies into the logic core and have them work from the day of their birth. Puppies are quite reliable with their two pathing goals, but retain the problem of maturation.&lt;br /&gt;
Puppies path to the activity zone, and their parents.&lt;br /&gt;
&lt;br /&gt;
Animal Children&lt;br /&gt;
Using the non matured animals for something useful before butchering may be quite effective, however they still must be flushed when they mature.&lt;br /&gt;
Animal children path to the activity zone, and their parents.&lt;br /&gt;
&lt;br /&gt;
Cats&lt;br /&gt;
Aggravating animals, throw them into the computer and get some worth out of them. Otherwise useless cats become useful when used for logic, with two pathing goals they're responsive, and multiply quickly. watch out for catsplosions while using these critters&lt;br /&gt;
Cats path to the activity zone, and Vermin.&lt;br /&gt;
&lt;br /&gt;
Dogs&lt;br /&gt;
The workhorse of your fortress, because horses can't do anything useful. I'd recommend not using dogs as they're put to better use as wardogs to protect your dorfs.&lt;br /&gt;
Dogs path to the activity zone.&lt;br /&gt;
&lt;br /&gt;
Cattle&lt;br /&gt;
Large lumbering bovines, the advantage of Cattle is you can tell the sexes apart, they also make the pressure plates continue to work if you forget to reassign the trigger weight.&lt;br /&gt;
Cattle path to the activity zone.&lt;br /&gt;
&lt;br /&gt;
Other animals&lt;br /&gt;
Any animals work, but the above are probably your best choice, excluding any modded animals. however if you have a GCS handy a GCS powered computer would be awesome, so take this as you will.&lt;br /&gt;
Other animals have different pathing goals, but most only path to the activity zone.&lt;br /&gt;
&lt;br /&gt;
Goblins&lt;br /&gt;
I'm working on an incremental goblin powered system, results pending.&lt;br /&gt;
&lt;br /&gt;
Putting it all together&lt;br /&gt;
&lt;br /&gt;
When it comes time to automate your systems the first thing you need to know is what needs to automated and what should remain manual. an obsidian farm with completely autonomous control of the casting process is all well and good, until it drowns all your legendary miners when it prematurely triggers. all systems should have manual controls and failsafes to help avoid FUN! (but because we all love FUN sometimes you forget to fully connect that emergency drain, or that failsafe system you built somehow failed.)&lt;br /&gt;
&lt;br /&gt;
once you know the steps you need in your system it comes time to select the parts you need to automate, whether it be basic logic gates or more sophisticated multiple trigger systems.&lt;br /&gt;
&lt;br /&gt;
This is mainly pure logic and I can't really help with that, but post a requirement in the talk page and if I see it I'll work on it. Consult the computing page on this wiki, and look up digital logic on Wikipedia. past that it's pretty fundamental and I don't really think I can adequately describe it.&lt;/div&gt;</summary>
		<author><name>LordOOTFD</name></author>
	</entry>
	<entry>
		<id>http://dwarffortresswiki.org/index.php?title=User:LordOOTFD&amp;diff=61926</id>
		<title>User:LordOOTFD</title>
		<link rel="alternate" type="text/html" href="http://dwarffortresswiki.org/index.php?title=User:LordOOTFD&amp;diff=61926"/>
		<updated>2010-01-29T04:58:44Z</updated>

		<summary type="html">&lt;p&gt;LordOOTFD: Created page with 'Animal logic works as a function of the path finding algorithm in dwarf fortress, as all animals seek to find the lowest cost path to their desired objects (activity zone, parent…'&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Animal logic works as a function of the path finding algorithm in dwarf fortress, as all animals seek to find the lowest cost path to their desired objects (activity zone, parents, dwarfs, valuable objects, etc) this can be used to create very very complex logic gates. Animal logic has three principle advantages, speed, compactness, and simplified functions; however, animal logic is slower than mechanical logic, less reliable than either, and logic is often inverted.&lt;br /&gt;
&lt;br /&gt;
Throughout this document I will be using a number of terms which may not be immediately obvious so I'll list them here: &lt;br /&gt;
&lt;br /&gt;
Ground: for simplicity the thing the animal is pathing to is refereed to as ground as that is the ground state which it wishes to reach. Ground is always the left unless otherwise noted.&lt;br /&gt;
Purge: Path to ground with no inputs&lt;br /&gt;
Path cost: The number of steps the animal must make to reach ground&lt;br /&gt;
Fusion Gate: Simply one or more logic gates built into the same system (this is more than simply stringing gates)&lt;br /&gt;
Compund Gate: Gate which uses two or more gates set to different path costs.&lt;br /&gt;
And Gate: And takes x inputs and output TRUE if ALL are TRUE.&lt;br /&gt;
NAnd Gate: NAnd takes x inputs and returns TRUE if ALL are FALSE. &lt;br /&gt;
AndOr Gate: AndOr takes x inputs and returns TRUE if X-Y are TRUE. (this gate is exclusive to animal logic, and is a single step fusion of And, and Or)&lt;br /&gt;
Or Gate: Or takes x input and output TRUE if ANY are true.&lt;br /&gt;
Not Gate: Not takes a single input and inverts it to the oposite state TRUE if FALSE. &lt;br /&gt;
XOr Gate: XOr takes 2 or more inputs and output TRUE if ONLY ONE is TRUE but NOT ALL are TRUE. &lt;br /&gt;
NOr Gate: NOr takes x input and returns TRUE if ALL inputs are FALSE. &lt;br /&gt;
XNOr Gate: XNOr takes 2 or more inputs and returns TRUE if ALL are TRUE, OR FALSE.&lt;br /&gt;
For a better explanation of gates see:http://en.wikipedia.org/wiki/Logic_gate&lt;br /&gt;
Notation: #:always 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) 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.&lt;br /&gt;
Gates will always be capitalized in the way they are within the entry, I.E. And, Or, AndOr, XNOr, etc&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
There are three principle 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 principle reason for this is pathfinding always prefers the shortest path to ground, 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, more than a single on or off signal. For simplicity and streamlining the systems I have designed only use binary outputs, but theoretically they could be made to compute natively in decimal; however, this is a bit more complicated than a week of study allows.&lt;br /&gt;
&lt;br /&gt;
GATES&lt;br /&gt;
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 &amp;quot;wake up&amp;quot; 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 it's enclosure, this allows the gate to respond faster 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 I find them to be better in general use.&lt;br /&gt;
&lt;br /&gt;
And&lt;br /&gt;
This simple gate is made by confining the animal into a straight coridor; the ground path will have two or more doors which are connected to the input, while the second longer path remains clear. the gate can be configured as an NAnd gate by simply moving the pressure plate. if the plate is by the ground path it functions as an And gate returning TRUE if the ground path is open, and if the plate is by the purge path it will return FALSE when the inputs are TRUE&lt;br /&gt;
#########&lt;br /&gt;
 ABCD^ D&lt;br /&gt;
#########&lt;br /&gt;
&lt;br /&gt;
Multi And&lt;br /&gt;
############&lt;br /&gt;
 ANYNUMD^ D&lt;br /&gt;
############&lt;br /&gt;
&lt;br /&gt;
NAnd&lt;br /&gt;
Reconfigured And gate, see And.&lt;br /&gt;
#########&lt;br /&gt;
 ABCD ^D&lt;br /&gt;
#########&lt;br /&gt;
&lt;br /&gt;
Or&lt;br /&gt;
Basic gate&lt;br /&gt;
#####&lt;br /&gt;
AD^ D&lt;br /&gt;
B####&lt;br /&gt;
#####&lt;br /&gt;
&lt;br /&gt;
Multi Or&lt;br /&gt;
#######&lt;br /&gt;
A #####&lt;br /&gt;
N #####&lt;br /&gt;
Y D^ D&lt;br /&gt;
N #####&lt;br /&gt;
M #####&lt;br /&gt;
#######&lt;br /&gt;
&lt;br /&gt;
NOr&lt;br /&gt;
Basically a reconfigured Or gate&lt;br /&gt;
#####&lt;br /&gt;
AD ^D&lt;br /&gt;
B####&lt;br /&gt;
#####&lt;br /&gt;
&lt;br /&gt;
Not&lt;br /&gt;
The simplest gate, It only takes a single imput.&lt;br /&gt;
#######&lt;br /&gt;
 AD^ D&lt;br /&gt;
#######&lt;br /&gt;
&lt;br /&gt;
Compound Gates&lt;br /&gt;
Basically two or more gates arranged with different path costs to ground. These gates can be configured in a number of different ways, these being the simplest. It may be possible to make these gates as single gates but that would require inverting some of the input. Simple compund gates use two simple gates and handle two inputs, complex compund gates have more then two simple gates and need more than two inputs. a Complex compund gate might be used to convert decimal numbers into binary using And gates&lt;br /&gt;
&lt;br /&gt;
XOr&lt;br /&gt;
Compound of And and Or, when ONLY ONE is TRUE returns TRUE&lt;br /&gt;
If A and B are false the animal moves to the FALSE position by Purge, if A or B is true, the animal moves to the TRUE position at the Or gate, if both A and B are true the animal moves to the FALSE postion by the And gate.&lt;br /&gt;
&lt;br /&gt;
#g########&lt;br /&gt;
# ABD  D #&lt;br /&gt;
# ####^# #&lt;br /&gt;
# ####D# #&lt;br /&gt;
# ###BA# #&lt;br /&gt;
#        #&lt;br /&gt;
##########&lt;br /&gt;
And path cost: 4&lt;br /&gt;
Or path cost: 10&lt;br /&gt;
Purge path cost: 14&lt;br /&gt;
&lt;br /&gt;
XNor&lt;br /&gt;
Inverse of XOr: Return TRUE if BOTH are TRUE OR FALSE&lt;br /&gt;
If A and B are false the animal move to the TRUE position by Purge, if A or B is true, the animal moves to the FALSE position at the Or gate, if both A and B are true the animal moves to the TRUE postion by the And gate.&lt;br /&gt;
&lt;br /&gt;
#g#########&lt;br /&gt;
#         #&lt;br /&gt;
##B###### #&lt;br /&gt;
###A## DA # &lt;br /&gt;
####D^##B #&lt;br /&gt;
#####D### #&lt;br /&gt;
######    #&lt;br /&gt;
###########&lt;br /&gt;
And path cost: 4&lt;br /&gt;
Or path cost: 10&lt;br /&gt;
Purge path cost: 15&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Complex Compond gate, Octal display ALU&lt;br /&gt;
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)&lt;br /&gt;
&lt;br /&gt;
#################&lt;br /&gt;
                #&lt;br /&gt;
# # # # # # #1# #&lt;br /&gt;
# # #1# #1#2#2# #&lt;br /&gt;
#1#2#2#4#4#4#4# #&lt;br /&gt;
#D#D#D#D#D#D#D#D#&lt;br /&gt;
#               #&lt;br /&gt;
#################&lt;br /&gt;
&lt;br /&gt;
# ######&lt;br /&gt;
# 1  D #&lt;br /&gt;
# #### #&lt;br /&gt;
# 2  D #&lt;br /&gt;
# #### #&lt;br /&gt;
# 12 D #&lt;br /&gt;
# #### #&lt;br /&gt;
# 4  D #&lt;br /&gt;
# #### #&lt;br /&gt;
# 14 D #&lt;br /&gt;
# #### #&lt;br /&gt;
# 24 D #&lt;br /&gt;
# #### #&lt;br /&gt;
# 124D #&lt;br /&gt;
# #### #&lt;br /&gt;
#    D #&lt;br /&gt;
########&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Fusion gates&lt;br /&gt;
These are gates which are constructed by physically combining the two gates to get a specific output.&lt;br /&gt;
&lt;br /&gt;
AndOr&lt;br /&gt;
This gate will evaluate if either of x And statements are TRUE. This gate is built as a straight line similar to the And gate&lt;br /&gt;
######&lt;br /&gt;
#C####&lt;br /&gt;
ABD^ D&lt;br /&gt;
C#####&lt;br /&gt;
######&lt;br /&gt;
&lt;br /&gt;
NAndOr&lt;br /&gt;
Reconfigured AndOr gate, see AndOr&lt;br /&gt;
######&lt;br /&gt;
#C####&lt;br /&gt;
ABD ^D&lt;br /&gt;
C#####&lt;br /&gt;
######&lt;br /&gt;
&lt;br /&gt;
OrandOr&lt;br /&gt;
This gate returns true if either A or B and either C or D is true.&lt;br /&gt;
&lt;br /&gt;
######&lt;br /&gt;
AC####&lt;br /&gt;
BED^ D&lt;br /&gt;
######&lt;br /&gt;
&lt;br /&gt;
OrandAnd&lt;br /&gt;
This gate returns true if either A or B is true, and E and C are true.&lt;br /&gt;
&lt;br /&gt;
#######&lt;br /&gt;
A######&lt;br /&gt;
BCED^ D&lt;br /&gt;
#######&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Complex Gate&lt;br /&gt;
&lt;br /&gt;
Adders&lt;br /&gt;
A Full adder can be made as a Compound Fusion gate, by combining, And, AndOr, and Or gates&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Binary Adder&lt;br /&gt;
The first binary adder I attempted was structured like an electronic adder using an array of simple gates. It contained five animals and used grates to control the logic, based off of bidok's logic gates. This adder functioned correctly but it was very inefficient with space, and highly unreliable often taking ten plus minutes to properly align. I refined this design by lining the gates up into a linear arrangement, but this failed to solve the efficiency problems.&lt;br /&gt;
&lt;br /&gt;
I then realized that simply limiting my Adder to using Electronic gates was silly realizing the key point of animal logic I designed a single stage gate, which had four output states: 0,1,C,1&amp;amp;C. this allowed me to compress the Adder into a single circuit. Modifying the design further the use of doors allows the new design to function at approximately 4-6 times the speed of the prototype adder.&lt;br /&gt;
&lt;br /&gt;
The Binary Adder function by adding three values, A,B, and Carry. Carry is only involved if the previous adder had a result of 2, or 3. the adder works by detecting if (A Or B Or C = True)Sum=1, Or (A And B, Or, A And C, Or B And C = True)Sum=2, Or (A And B And C = True)Sum=3, Or (A And B And C = False)Sum=0. With this basic logic one simply needs to configure the output for 1 if the answer is 1, C if the answer is 2, and 1 and C if the answer is 3. the gates must also be arranged so the Highest Sum has the shortest path to ground as otherwise the gate would return nonsense.&lt;br /&gt;
&lt;br /&gt;
Stand alone Adders (they don't carry into another adder) require 22 mechanisms, and 14 doors.&lt;br /&gt;
Start Adders (They feed into the next Adder and include a carry) require 32 mechanisms, and 14 doors.&lt;br /&gt;
Chain Adders (The receive Carry, and pass a Carry bit up) require 32 mechanisms, and 14 doors&lt;br /&gt;
While Materials intensive the gates only take up 13x9 urists, ideal for chaining along mining tunnels.&lt;br /&gt;
&lt;br /&gt;
Reference pictures&lt;br /&gt;
[[Image:Xnor,Xor,Nand,Or_prototype_adder_STATE_1]]&lt;br /&gt;
Add pictures of the states here&lt;br /&gt;
&lt;br /&gt;
By chaining these gates you can perform most binary math, the easiest of which is addition. In my old fort I built and tested my initial 9 Bit Addition computer. the design failed in two circumstances, the AndOr gate of bit 32 had a lower path cost than the And gate when the animal was at Sum 2, and the Or gate in bit 4 had a lower path cost than ground if the lower door was open.&lt;br /&gt;
&lt;br /&gt;
The gates in the Super Snail adder can be reset to the correct positions by forbidding the doors which fault. I'm working on a more reliable compact adder. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Decimal Adder&lt;br /&gt;
While it can be done, It's massively more complex than simply making a set of decimal converters working with numbers over 10,&lt;br /&gt;
&lt;br /&gt;
hexadecimal adder&lt;br /&gt;
The hex adder makes use of 32 sum gates per side of a single adder, making it geometrically more complex than the binary adder, however it does make animal management more streamlined. more information to come.&lt;br /&gt;
&lt;br /&gt;
Status&lt;br /&gt;
Sum gates 0-31           done&lt;br /&gt;
layout                   pending&lt;br /&gt;
working prototype        pending&lt;br /&gt;
finished dorfputer       pending&lt;br /&gt;
&lt;br /&gt;
Subtractors&lt;br /&gt;
inverse adder, simple but not yet tested.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Animals&lt;br /&gt;
Choosing the animal which works as the logic core for an animal logic systems is somewhat important, depending on your needs and the available animals. however pretty much anything will do as long as you can remember which animal fits into which gate (to avoid designating the same animal for more than one pit).&lt;br /&gt;
&lt;br /&gt;
Kittens&lt;br /&gt;
Put those worthless cats to work, load them into your fortress's logic core and make them work for their keep. while kittens are the most reliable cores for logic gates with their 3 pathing goals they're also problematic as they grow into cats which only have two, and may cause catsplosions inside your logical cores. Ideally kittens should be replaced yearly or biyearly as their growth defines.&lt;br /&gt;
Kittens path to the activity zone, their parents, and vermin.&lt;br /&gt;
&lt;br /&gt;
Puppies&lt;br /&gt;
Why should your fortresses working animals only work once they grow up? throw the puppies into the logic core and have them work from the day of their birth. Puppies are quite reliable with their two pathing goals, but retain the problem of maturation.&lt;br /&gt;
Puppies path to the activity zone, and their parents.&lt;br /&gt;
&lt;br /&gt;
Animal Children&lt;br /&gt;
Using the non matured animals for something useful before butchering may be quite effective, however they still must be flushed when they mature.&lt;br /&gt;
Animal children path to the activity zone, and their parents.&lt;br /&gt;
&lt;br /&gt;
Cats&lt;br /&gt;
Aggravating animals, throw them into the computer and get some worth out of them. Otherwise useless cats become useful when used for logic, with two pathing goals they're responsive, and multiply quickly. watch out for catsplosions while using these critters&lt;br /&gt;
Cats path to the activity zone, and Vermin.&lt;br /&gt;
&lt;br /&gt;
Dogs&lt;br /&gt;
The workhorse of your fortress, because horses can't do anything useful. I'd recommend not using dogs as they're put to better use as wardogs to protect your dorfs.&lt;br /&gt;
Dogs path to the activity zone.&lt;br /&gt;
&lt;br /&gt;
Cattle&lt;br /&gt;
Large lumbering bovines, the advantage of Cattle is you can tell the sexes apart, they also make the pressure plates continue to work if you forget to reassign the trigger weight.&lt;br /&gt;
Cattle path to the activity zone.&lt;br /&gt;
&lt;br /&gt;
Other animals&lt;br /&gt;
Any animals work, but the above are probably your best choice, excluding any modded animals. however if you have a GCS handy a GCS powered computer would be awesome, so take this as you will.&lt;br /&gt;
Other animals have different pathing goals, but most only path to the activity zone.&lt;br /&gt;
&lt;br /&gt;
Goblins&lt;br /&gt;
I'm working on an incremental goblin powered system, results pending.&lt;br /&gt;
&lt;br /&gt;
Putting it all together&lt;br /&gt;
&lt;br /&gt;
When it comes time to automate your systems the first thing you need to know is what needs to automated and what should remain manual. an obsidian farm with completely autonomous control of the casting process is all well and good, until it drowns all your legendary miners when it prematurely triggers. all systems should have manual controls and failsafes to help avoid FUN! (but because we all love FUN sometimes you forget to fully connect that emergency drain, or that failsafe system you built somehow failed.)&lt;br /&gt;
&lt;br /&gt;
once you know the steps you need in your system it comes time to select the parts you need to automate, whether it be basic logic gates or more sophisticated multiple trigger systems.&lt;br /&gt;
&lt;br /&gt;
This is mainly pure logic and I can't really help with that, but post a requirement in the talk page and if I see it I'll work on it. Consult the computing page on this wiki, and look up digital logic on Wikipedia. past that it's pretty fundamental and I don't really think I can adequately describe it.&lt;/div&gt;</summary>
		<author><name>LordOOTFD</name></author>
	</entry>
	<entry>
		<id>http://dwarffortresswiki.org/index.php?title=File:Xnor,Xor,Nand,Or_prototype_adder_STATE_1.PNG&amp;diff=61925</id>
		<title>File:Xnor,Xor,Nand,Or prototype adder STATE 1.PNG</title>
		<link rel="alternate" type="text/html" href="http://dwarffortresswiki.org/index.php?title=File:Xnor,Xor,Nand,Or_prototype_adder_STATE_1.PNG&amp;diff=61925"/>
		<updated>2010-01-29T04:33:00Z</updated>

		<summary type="html">&lt;p&gt;LordOOTFD: Prototype adder using pure logic&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Prototype adder using pure logic&lt;/div&gt;</summary>
		<author><name>LordOOTFD</name></author>
	</entry>
	<entry>
		<id>http://dwarffortresswiki.org/index.php?title=File:And,Or,AndOr,_Prototype_adder_STATE_3.PNG&amp;diff=61924</id>
		<title>File:And,Or,AndOr, Prototype adder STATE 3.PNG</title>
		<link rel="alternate" type="text/html" href="http://dwarffortresswiki.org/index.php?title=File:And,Or,AndOr,_Prototype_adder_STATE_3.PNG&amp;diff=61924"/>
		<updated>2010-01-29T04:32:03Z</updated>

		<summary type="html">&lt;p&gt;LordOOTFD: a=1,b=1,c=1 Sum=11&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;a=1,b=1,c=1 Sum=11&lt;/div&gt;</summary>
		<author><name>LordOOTFD</name></author>
	</entry>
	<entry>
		<id>http://dwarffortresswiki.org/index.php?title=File:And,Or,AndOr,_Prototype_adder_STATE_2.PNG&amp;diff=61923</id>
		<title>File:And,Or,AndOr, Prototype adder STATE 2.PNG</title>
		<link rel="alternate" type="text/html" href="http://dwarffortresswiki.org/index.php?title=File:And,Or,AndOr,_Prototype_adder_STATE_2.PNG&amp;diff=61923"/>
		<updated>2010-01-29T04:31:43Z</updated>

		<summary type="html">&lt;p&gt;LordOOTFD: a=1,b=1,c=0 Sum=10&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;a=1,b=1,c=0 Sum=10&lt;/div&gt;</summary>
		<author><name>LordOOTFD</name></author>
	</entry>
	<entry>
		<id>http://dwarffortresswiki.org/index.php?title=File:And,Or,AndOr,_Prototype_adder_STATE_1.PNG&amp;diff=61922</id>
		<title>File:And,Or,AndOr, Prototype adder STATE 1.PNG</title>
		<link rel="alternate" type="text/html" href="http://dwarffortresswiki.org/index.php?title=File:And,Or,AndOr,_Prototype_adder_STATE_1.PNG&amp;diff=61922"/>
		<updated>2010-01-29T04:31:14Z</updated>

		<summary type="html">&lt;p&gt;LordOOTFD: a=1,b=0,c=0 Sum=0&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;a=1,b=0,c=0 Sum=0&lt;/div&gt;</summary>
		<author><name>LordOOTFD</name></author>
	</entry>
	<entry>
		<id>http://dwarffortresswiki.org/index.php?title=File:And,Or,AndOr,_Prototype_adder_STATE_0.PNG&amp;diff=61921</id>
		<title>File:And,Or,AndOr, Prototype adder STATE 0.PNG</title>
		<link rel="alternate" type="text/html" href="http://dwarffortresswiki.org/index.php?title=File:And,Or,AndOr,_Prototype_adder_STATE_0.PNG&amp;diff=61921"/>
		<updated>2010-01-29T04:30:46Z</updated>

		<summary type="html">&lt;p&gt;LordOOTFD: a=0,b=0,c=0 sum=0&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;a=0,b=0,c=0 sum=0&lt;/div&gt;</summary>
		<author><name>LordOOTFD</name></author>
	</entry>
	<entry>
		<id>http://dwarffortresswiki.org/index.php?title=File:9bit_adder_prototype_interface_pannel.PNG&amp;diff=61920</id>
		<title>File:9bit adder prototype interface pannel.PNG</title>
		<link rel="alternate" type="text/html" href="http://dwarffortresswiki.org/index.php?title=File:9bit_adder_prototype_interface_pannel.PNG&amp;diff=61920"/>
		<updated>2010-01-29T04:21:17Z</updated>

		<summary type="html">&lt;p&gt;LordOOTFD: Interface pannel for 9bit adder, showing the current computation.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Interface pannel for 9bit adder, showing the current computation.&lt;/div&gt;</summary>
		<author><name>LordOOTFD</name></author>
	</entry>
	<entry>
		<id>http://dwarffortresswiki.org/index.php?title=File:9bit_adder_prototype.PNG&amp;diff=61919</id>
		<title>File:9bit adder prototype.PNG</title>
		<link rel="alternate" type="text/html" href="http://dwarffortresswiki.org/index.php?title=File:9bit_adder_prototype.PNG&amp;diff=61919"/>
		<updated>2010-01-29T04:18:22Z</updated>

		<summary type="html">&lt;p&gt;LordOOTFD: State is 10100010&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;State is 10100010&lt;/div&gt;</summary>
		<author><name>LordOOTFD</name></author>
	</entry>
</feed>