http://dwarffortresswiki.org/api.php?action=feedcontributions&user=SL&feedformat=atomDwarf Fortress Wiki - User contributions [en]2024-03-29T08:17:08ZUser contributionsMediaWiki 1.35.11http://dwarffortresswiki.org/index.php?title=v0.31_Talk:Mechanical_logic&diff=102379v0.31 Talk:Mechanical logic2010-05-02T21:49:20Z<p>SL: </p>
<hr />
<div>The designs on the 40d mechanical logic gates page were incomprehensible, so I designed some new ones and put them here. I haven't put up a "rotation sensor" design yet, since (a) the description is self-explanatory, and (b) I'm designing flowless water logic gates at the moment and am wondering if it's possible to make a flowless version. --[[User:SL|SL]] 02:27, 10 April 2010 (UTC)<br />
:[[User:Kami/Logic_gates#Power_to_signal_converter]] --[[User:Kami|Kami]] 17:22, 14 April 2010 (UTC)<br />
::Nice. Even better than what I was doing, since I needed two pumps to take it from one space to another and back, and annoyingly complicated logic too.--[[User:SL|SL]] 21:06, 2 May 2010 (UTC)</div>SLhttp://dwarffortresswiki.org/index.php?title=v0.31:Mechanical_logic&diff=102378v0.31:Mechanical logic2010-05-02T21:48:35Z<p>SL: </p>
<hr />
<div><!-- <br />
***************************<br />
* WORKING IN PROGRESS !!! *<br />
***************************<br />
--><br />
{{av}}<br />
{{human}}<br />
Mechanical logic is one discipline of {{l|computing|computing}} using mechanical {{l|power|power}} to perform logical operations. In this case powered or unpowered {{l|machine component|machine components}} represent the binary information.<br />
<br />
The principles of mechanical logic are simple. {{l|Gear assembly|Gear assemblies}} linked to {{l|trigger|triggers}} will be toggled between disengaged and engaged when they receive an on/off signal. In this manner, you can conditionally attach power supply from {{l|windmill|windmills}} or {{l|waterwheel|waterwheels}} to specially arranged gears to build logic gates. You can also connect additional gears or other machine components as load - consuming power - to a linked gear in various configurations.<br />
<br />
An alternative to using the gates listed here that require an extra load of gears is to use [[Pre-Toggled Mechanical Logic]]. This logic discipline has the benefit of being far easier to power, since it does not rely on extra gears to force a gear to disable in certain circumstances. At present, it does not work with pressure plates, however, but probably only needs a bit of redesigning.<br />
<br />
== Pros and cons ==<br />
<br />
* needs a substantial amount of wood to construct power supply<br />
* needs a substantial amount of {{l|mechanism|mechanism}} and therefore {{l|mechanics|mechanics}} especially when you base your gates on load<br />
* needs {{l|water|fluid}} to build converter to trigger something else than machine components<br />
<br />
* is very fast because gears don't have a reaction delay of 100 steps<br />
* is very flexible because gears can be toggled and therefore inverting input signals is very easy<br />
* is easy to reconfigure because you don't have to deal with fluid or {{l|creature|creatures}} as you have to when you stick to other computing disciplines<br />
<br />
<!-- ToDo --><br />
<!--<br />
== General concepts ==<br />
=== Load based ===<br />
=== Toggle based ===<br />
--><br />
<br />
== Power to signal converter ==<br />
When you are dealing with mechanical logic, you'll finally want or have to trigger something else than machine components like doors or bridges. Currently, there doesn't exist any {{l|trigger|trigger}} in dwarf fortress that reacts on the working state of machine components, thus power on/off. So, you'll have to convert power via pressure plates, screw pumps and fluid into an on/off signal.<br />
<div style="width:1px; white-space:nowrap;"><br />
'''Z 0'''<br />
{| cellpadding="0" cellspacing="0" style="border-spacing:0; border-style:solid; border-width:thin; border-color:#000000;"<br />
|<br />
{| cellpadding="0" cellspacing="0" style="border-spacing:0; padding:0; margin:0; vertical-align:middle;"<br />
|-<br />
|{{RTL|#DDD}}<br />
|{{RTL|#DDD}}<br />
|{{RTL|#DDD}}<br />
|{{RTL|#222}}<br />
|{{RTL|#222}}<br />
|{{RTL|#222}}<br />
|-<br />
|{{RTL|#DDD}}<br />
|{{RTL|#222|·|#BBB}}<br />
|{{RTL|#444|÷|#DDD}}<br />
|{{RTL|#444|÷|#DDD|►|#00A|center|►|#00A|center}}<br />
|{{RTL|#222|·|#BBB}}<br />
|{{RTL|#222}}<br />
|-<br />
|{{RTL|#DDD}}<br />
|{{RTL|#DDD}}<br />
|{{RTL|#DDD}}<br />
|{{RTL|#222}}<br />
|{{RTL|#222}}<br />
|{{RTL|#222}}<br />
|}<br />
|}<br />
</div><br />
<div style="width:1px; white-space:nowrap;"><br />
'''Z-1'''<br />
{| cellpadding="0" cellspacing="0" style="border-spacing:0; border-style:solid; border-width:thin; border-color:#000000;"<br />
|<br />
{| cellpadding="0" cellspacing="0" style="border-spacing:0; padding:0; margin:0; vertical-align:middle;"<br />
|-<br />
|{{RTL|#222}}<br />
|{{RTL|#222}}<br />
|{{RTL|#222}}<br />
|{{RTL|#222}}<br />
|{{RTL|#222}}<br />
|{{RTL|#222}}<br />
|-<br />
|{{RTL|#222}}<br />
|{{RTL|#00A|^|#DDD||||7|#88F|left}}<br />
|{{RTL|#DDD||||||7|#88F|left}}<br />
|{{RTL|#DDD||||||7|#88F|left}}<br />
|{{RTL|#DDD||||||7|#88F|left}}<br />
|{{RTL|#222}}<br />
|-<br />
|{{RTL|#222}}<br />
|{{RTL|#222}}<br />
|{{RTL|#222}}<br />
|{{RTL|#222}}<br />
|{{RTL|#222}}<br />
|{{RTL|#222}}<br />
|-<br />
|}<br />
|}<br />
</div><br />
<br /><br />
When the pump is connected to power, it will suck water from the pressure plate and pump it to the right. The water level on the pressure plate will fall to 0. The plate can be constructed to react on 0&hellip;3 water. You can invert it to get an off signal instead setting it to 4&hellip;7. In both cases the ''off signal'' will have a delay of 100 steps.{{Verify}} This gate is fluid conserving.<br />
<br />
==Mechanical signal-input power-output gates==<br />
* These gates can be used either by adding a power -> link signal converter (also known as a "rotation sensor"), or directly used to control pumps, such as in other logic gates (the unsourced fluid logic gates use these, for instance). The conventional "rotation sensor" consists of a pump powered by the gate's OUTPUT gear, pumping an infinite supply of water onto a water-sensing pressure plate with an infinite drain.<br />
* There are certain things important to all the gates:<br />
* Each gate has an OUTPUT gear, which will be placed next to a pump which the gate will control.<br />
* In diagrams, the OUTPUT gear is below the 'O' gear, connected to it by gears or vertical axles. The P indicates where you should hook power up, and L indicates where load (gears or pumps that don't have a water source) should be connected, and ¦ and - are horizontal axles. The Is are gears linked to INPUTs (some gates have one input, but most have two).<br />
* Gates which incorporate a NOT will have the power network branch off from the 'O' gear, and have a train of power-draining stuff connected to the input gears, whereas gates which do not incorporate a NOT will have the power connected to the input gears instead. The principle behind normal gates is that when the INPUTs are ON, power is connected. The principle behind the NOT gates is that power is always connected, but when the INPUTs are ON, a large enough power requirement is connected to send the power requirements above the power supply, shutting down the system.<br />
* If your windmills produce no power, you'll have to come up with some way to use water wheels for power instead.<br />
* You should build only enough windmills (or water wheels) to power the system, and should not connect the network for one gate to another gate's network, since that would both gates up.<br />
* The gates' instructions will explain how much load and power you need to have at each P and L in the more complicated gates.<br />
<br />
===Legend===<br />
{| class="wikitable" border="1"<br />
|-<br />
! Symbol<br />
! Meaning<br />
|-<br />
| {{diagram|[#ff0]O}}<br />
| A gear which connects to your OUTPUT gear, which outputs power when the gate is producing an ON output.<br />
|-<br />
| {{diagram|[#aaf]I}}<br />
| A gear connected to an INPUT. In most gates you will have two Is, with each one connected to a different input.<br />
|-<br />
| {{diagram|-}} and {{diagram|¦}}<br />
| Horizontal axles<br />
|-<br />
| {{diagram|[#0f0]P}}<br />
| Power goes here<br />
|-<br />
| {{diagram|[#aaf]i}}<br />
| Two more gears, each connected to the two different inputs.<br />
|-<br />
| {{diagram|[#f00]L}}<br />
| a chain of gears or pumps which serve to add load to the system, generally shutting it off when connected.<br />
|-<br />
| {{diagram|*}}<br />
| A gear which isn't linked to any inputs or outputs and just serves to connect the power or whatever.<br />
|}<br />
<br />
===Mechanical identity gate ===<br />
{{diagram|<br />
[#ff0]O[#aaf]I--[#0f0]P}}<br />
<br />
* This takes an linked input signal and converts it to power without changing it.<br />
* Connected to the input gear, such that they will only be connected to the system if the input gear is receiving an ON signal, are gears with windmills on top of them. Build only enough windmills to power the devices that the gate's OUTPUT gear are connected to (and the gears/axles).<br />
* When the INPUT is ON, the INPUT gear will be active, and the network will provide power to the OUTPUT. When the INPUT is OFF, it will not provide power to the OUTPUT.<br />
<br />
===Mechanical NOT gate===<br />
{{diagram|<br />
[#ff0]O[#aaf]I[#f00]L<br />
¦<br />
¦<br />
[#0f0]P}}<br />
<br />
* When the INPUT is ON, the INPUT gear will be active, and the network should need more power than is available. The devices connected to OUTPUT should shut down. When INPUT is OFF, the devices should have power since the INPUT gear will be disconnected.<br />
<br />
===Mechanical NAND gate===<br />
{{diagram|<br />
[#ff0]O[#aaf]I[#aaf]I[#f00]L<br />
¦<br />
¦<br />
[#0f0]P}}<br />
<br />
* This works just like the NOT gate, except that there are two inputs and both have to be active to shut down the system instead of one. Make sure you have enough power to run the system when one of the input gears is active.<br />
<br />
===Mechanical AND gate===<br />
{{diagram|<br />
[#ff0]O[#aaf]I[#aaf]I[#0f0]P}}<br />
<br />
* This works like the identity gate, except that there are two inputs and both have to be active for the system to get power.<br />
<br />
===Mechanical OR gate===<br />
{{diagram|<br />
[#ff0]O[#aaf]I<br />
[#aaf]I*[#0f0]P}}<br />
<br />
* This works like the identity gate, except that there are two inputs, and if either is active, the system receives power. Note that the entire power network is connected to both inputs, such that if either input is active the entire power network is powering the system.<br />
<br />
===Mechanical NOR gate===<br />
{{diagram|<br />
[#aaf]I*[#f00]L<br />
[#ff0]O[#aaf]I<br />
¦<br />
¦<br />
[#0f0]P}}<br />
<br />
* This works like the NOT gate, except that there are two inputs, and if either is active, the gear train or pump stack signified by the 'L' will be connected to the system. You need to have enough load to push power requirements above the amount of power produced by the power supply, shutting the system down.<br />
<br />
===Mechanical XOR gate===<br />
{{diagram|<br />
[#ff0]O[#aaf]I<br />
[#aaf]I*--*[#0f0]P<br />
[#000].[#aaf]i[#000].[#000].[#aaf]i<br />
[#000].[#f00]L[#000].[#000].[#f00]L}}<br />
<br />
<br />
* Except for the 'i's and 'L's, this gate is identical to the OR gate. The additional components add the 'exclusive' part of the 'XOR' to the gate.<br />
* This gate may be a bit difficult to construct. First, the 'i's are additional gears connected to each of your inputs, and the Ls are additional load, however, neither load by itself should be enough to shut down the system. However, you need to make the two sets of load large enough that if both inputs are active at the same time, their power requirements become large enough to shut down the system, without making them large enough to shut it down when only one of them is active. It'll just require a little math on your part.<br />
<br />
===Mechanical XNOR gate===<br />
{{diagram|<br />
[#000].[#000].[#aaf]I*[#f00]L<br />
[#000].[#000].[#ff0]O[#aaf]I<br />
[#000].[#000].¦<br />
[#0f0]P[#aaf]-*[#aaf]i-[#0f0]P<br />
[#000].[#000].[#aaf]i<br />
[#000].[#000].¦<br />
[#000].[#000].[#0f0]P}}<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! A<br />
! B<br />
! Drain<br />
! Power<br />
! Extra Power<br />
! Result<br />
|-<br />
| 0<br />
| 0<br />
| No<br />
| Yes<br />
| No<br />
| 1<br />
|-<br />
| 0<br />
| 1<br />
| Yes<br />
| Yes<br />
| Half<br />
| 0<br />
|-<br />
| 1<br />
| 0<br />
| Yes<br />
| Yes<br />
| Half<br />
| 0<br />
|-<br />
| 1<br />
| 1<br />
| Yes<br />
| Yes<br />
| Full<br />
| 1<br />
|} <br />
<br />
* The XNOR gate is an equality gate: The output is ON when both inputs are equal, and OFF when they are not equal.<br />
* This gate may be '''even more complicated''' to build than the XOR gate!<br />
* First, your 'i's are again gears connected to your two inputs. The two extra Ps to the right and below them are additional power sources, ideally only one windmill each.<br />
* Here's where it gets complicated. The load has to be sufficient to shut down the system even when ONE of the inputs' additional power supplies are connected. However, when BOTH inputs are on, there needs to be enough power from both additional Ps to bring the system back online.<br />
* Thus our gate does what it is supposed to: Produce enough power to have the OUTPUT gear be ON when both A and B are either 0 or 1, but not when they are not equal.</div>SLhttp://dwarffortresswiki.org/index.php?title=v0.31:Mechanical_logic&diff=102377v0.31:Mechanical logic2010-05-02T21:48:21Z<p>SL: </p>
<hr />
<div><!-- <br />
***************************<br />
* WORKING IN PROGRESS !!! *<br />
***************************<br />
--><br />
{{av}}<br />
{{human}}<br />
Mechanical logic is one discipline of {{l|computing|computing}} using mechanical {{l|power|power}} to perform logical operations. In this case powered or unpowered {{l|machine component|machine components}} represent the binary information.<br />
<br />
The principles of mechanical logic are simple. {{l|Gear assembly|Gear assemblies}} linked to {{l|trigger|triggers}} will be toggled between disengaged and engaged when they receive an on/off signal. In this manner, you can conditionally attach power supply from {{l|windmill|windmills}} or {{l|waterwheel|waterwheels}} to specially arranged gears to build logic gates. You can also connect additional gears or other machine components as load - consuming power - to a linked gear in various configurations.<br />
<br />
An alternative to using the gates listed here that require an extra load of gears is to use [[Pre-Toggled Mechanical Logic]]. This logic discipline has the benefit of being far easier to power, since it does not rely on extra gears to force a gear to disable in certain circumstances. At present, it does not work with pressure plates, however, but probably only needs a bit of redesigning.<br />
<br />
Source: http://df.magmawiki.com/index.php?title=DF2010%3AMechanical_logic&diff=102362&oldid=102330#ixzz0moM2hsov<br />
== Pros and cons ==<br />
<br />
* needs a substantial amount of wood to construct power supply<br />
* needs a substantial amount of {{l|mechanism|mechanism}} and therefore {{l|mechanics|mechanics}} especially when you base your gates on load<br />
* needs {{l|water|fluid}} to build converter to trigger something else than machine components<br />
<br />
* is very fast because gears don't have a reaction delay of 100 steps<br />
* is very flexible because gears can be toggled and therefore inverting input signals is very easy<br />
* is easy to reconfigure because you don't have to deal with fluid or {{l|creature|creatures}} as you have to when you stick to other computing disciplines<br />
<br />
<!-- ToDo --><br />
<!--<br />
== General concepts ==<br />
=== Load based ===<br />
=== Toggle based ===<br />
--><br />
<br />
== Power to signal converter ==<br />
When you are dealing with mechanical logic, you'll finally want or have to trigger something else than machine components like doors or bridges. Currently, there doesn't exist any {{l|trigger|trigger}} in dwarf fortress that reacts on the working state of machine components, thus power on/off. So, you'll have to convert power via pressure plates, screw pumps and fluid into an on/off signal.<br />
<div style="width:1px; white-space:nowrap;"><br />
'''Z 0'''<br />
{| cellpadding="0" cellspacing="0" style="border-spacing:0; border-style:solid; border-width:thin; border-color:#000000;"<br />
|<br />
{| cellpadding="0" cellspacing="0" style="border-spacing:0; padding:0; margin:0; vertical-align:middle;"<br />
|-<br />
|{{RTL|#DDD}}<br />
|{{RTL|#DDD}}<br />
|{{RTL|#DDD}}<br />
|{{RTL|#222}}<br />
|{{RTL|#222}}<br />
|{{RTL|#222}}<br />
|-<br />
|{{RTL|#DDD}}<br />
|{{RTL|#222|·|#BBB}}<br />
|{{RTL|#444|÷|#DDD}}<br />
|{{RTL|#444|÷|#DDD|►|#00A|center|►|#00A|center}}<br />
|{{RTL|#222|·|#BBB}}<br />
|{{RTL|#222}}<br />
|-<br />
|{{RTL|#DDD}}<br />
|{{RTL|#DDD}}<br />
|{{RTL|#DDD}}<br />
|{{RTL|#222}}<br />
|{{RTL|#222}}<br />
|{{RTL|#222}}<br />
|}<br />
|}<br />
</div><br />
<div style="width:1px; white-space:nowrap;"><br />
'''Z-1'''<br />
{| cellpadding="0" cellspacing="0" style="border-spacing:0; border-style:solid; border-width:thin; border-color:#000000;"<br />
|<br />
{| cellpadding="0" cellspacing="0" style="border-spacing:0; padding:0; margin:0; vertical-align:middle;"<br />
|-<br />
|{{RTL|#222}}<br />
|{{RTL|#222}}<br />
|{{RTL|#222}}<br />
|{{RTL|#222}}<br />
|{{RTL|#222}}<br />
|{{RTL|#222}}<br />
|-<br />
|{{RTL|#222}}<br />
|{{RTL|#00A|^|#DDD||||7|#88F|left}}<br />
|{{RTL|#DDD||||||7|#88F|left}}<br />
|{{RTL|#DDD||||||7|#88F|left}}<br />
|{{RTL|#DDD||||||7|#88F|left}}<br />
|{{RTL|#222}}<br />
|-<br />
|{{RTL|#222}}<br />
|{{RTL|#222}}<br />
|{{RTL|#222}}<br />
|{{RTL|#222}}<br />
|{{RTL|#222}}<br />
|{{RTL|#222}}<br />
|-<br />
|}<br />
|}<br />
</div><br />
<br /><br />
When the pump is connected to power, it will suck water from the pressure plate and pump it to the right. The water level on the pressure plate will fall to 0. The plate can be constructed to react on 0&hellip;3 water. You can invert it to get an off signal instead setting it to 4&hellip;7. In both cases the ''off signal'' will have a delay of 100 steps.{{Verify}} This gate is fluid conserving.<br />
<br />
==Mechanical signal-input power-output gates==<br />
* These gates can be used either by adding a power -> link signal converter (also known as a "rotation sensor"), or directly used to control pumps, such as in other logic gates (the unsourced fluid logic gates use these, for instance). The conventional "rotation sensor" consists of a pump powered by the gate's OUTPUT gear, pumping an infinite supply of water onto a water-sensing pressure plate with an infinite drain.<br />
* There are certain things important to all the gates:<br />
* Each gate has an OUTPUT gear, which will be placed next to a pump which the gate will control.<br />
* In diagrams, the OUTPUT gear is below the 'O' gear, connected to it by gears or vertical axles. The P indicates where you should hook power up, and L indicates where load (gears or pumps that don't have a water source) should be connected, and ¦ and - are horizontal axles. The Is are gears linked to INPUTs (some gates have one input, but most have two).<br />
* Gates which incorporate a NOT will have the power network branch off from the 'O' gear, and have a train of power-draining stuff connected to the input gears, whereas gates which do not incorporate a NOT will have the power connected to the input gears instead. The principle behind normal gates is that when the INPUTs are ON, power is connected. The principle behind the NOT gates is that power is always connected, but when the INPUTs are ON, a large enough power requirement is connected to send the power requirements above the power supply, shutting down the system.<br />
* If your windmills produce no power, you'll have to come up with some way to use water wheels for power instead.<br />
* You should build only enough windmills (or water wheels) to power the system, and should not connect the network for one gate to another gate's network, since that would both gates up.<br />
* The gates' instructions will explain how much load and power you need to have at each P and L in the more complicated gates.<br />
<br />
===Legend===<br />
{| class="wikitable" border="1"<br />
|-<br />
! Symbol<br />
! Meaning<br />
|-<br />
| {{diagram|[#ff0]O}}<br />
| A gear which connects to your OUTPUT gear, which outputs power when the gate is producing an ON output.<br />
|-<br />
| {{diagram|[#aaf]I}}<br />
| A gear connected to an INPUT. In most gates you will have two Is, with each one connected to a different input.<br />
|-<br />
| {{diagram|-}} and {{diagram|¦}}<br />
| Horizontal axles<br />
|-<br />
| {{diagram|[#0f0]P}}<br />
| Power goes here<br />
|-<br />
| {{diagram|[#aaf]i}}<br />
| Two more gears, each connected to the two different inputs.<br />
|-<br />
| {{diagram|[#f00]L}}<br />
| a chain of gears or pumps which serve to add load to the system, generally shutting it off when connected.<br />
|-<br />
| {{diagram|*}}<br />
| A gear which isn't linked to any inputs or outputs and just serves to connect the power or whatever.<br />
|}<br />
<br />
===Mechanical identity gate ===<br />
{{diagram|<br />
[#ff0]O[#aaf]I--[#0f0]P}}<br />
<br />
* This takes an linked input signal and converts it to power without changing it.<br />
* Connected to the input gear, such that they will only be connected to the system if the input gear is receiving an ON signal, are gears with windmills on top of them. Build only enough windmills to power the devices that the gate's OUTPUT gear are connected to (and the gears/axles).<br />
* When the INPUT is ON, the INPUT gear will be active, and the network will provide power to the OUTPUT. When the INPUT is OFF, it will not provide power to the OUTPUT.<br />
<br />
===Mechanical NOT gate===<br />
{{diagram|<br />
[#ff0]O[#aaf]I[#f00]L<br />
¦<br />
¦<br />
[#0f0]P}}<br />
<br />
* When the INPUT is ON, the INPUT gear will be active, and the network should need more power than is available. The devices connected to OUTPUT should shut down. When INPUT is OFF, the devices should have power since the INPUT gear will be disconnected.<br />
<br />
===Mechanical NAND gate===<br />
{{diagram|<br />
[#ff0]O[#aaf]I[#aaf]I[#f00]L<br />
¦<br />
¦<br />
[#0f0]P}}<br />
<br />
* This works just like the NOT gate, except that there are two inputs and both have to be active to shut down the system instead of one. Make sure you have enough power to run the system when one of the input gears is active.<br />
<br />
===Mechanical AND gate===<br />
{{diagram|<br />
[#ff0]O[#aaf]I[#aaf]I[#0f0]P}}<br />
<br />
* This works like the identity gate, except that there are two inputs and both have to be active for the system to get power.<br />
<br />
===Mechanical OR gate===<br />
{{diagram|<br />
[#ff0]O[#aaf]I<br />
[#aaf]I*[#0f0]P}}<br />
<br />
* This works like the identity gate, except that there are two inputs, and if either is active, the system receives power. Note that the entire power network is connected to both inputs, such that if either input is active the entire power network is powering the system.<br />
<br />
===Mechanical NOR gate===<br />
{{diagram|<br />
[#aaf]I*[#f00]L<br />
[#ff0]O[#aaf]I<br />
¦<br />
¦<br />
[#0f0]P}}<br />
<br />
* This works like the NOT gate, except that there are two inputs, and if either is active, the gear train or pump stack signified by the 'L' will be connected to the system. You need to have enough load to push power requirements above the amount of power produced by the power supply, shutting the system down.<br />
<br />
===Mechanical XOR gate===<br />
{{diagram|<br />
[#ff0]O[#aaf]I<br />
[#aaf]I*--*[#0f0]P<br />
[#000].[#aaf]i[#000].[#000].[#aaf]i<br />
[#000].[#f00]L[#000].[#000].[#f00]L}}<br />
<br />
<br />
* Except for the 'i's and 'L's, this gate is identical to the OR gate. The additional components add the 'exclusive' part of the 'XOR' to the gate.<br />
* This gate may be a bit difficult to construct. First, the 'i's are additional gears connected to each of your inputs, and the Ls are additional load, however, neither load by itself should be enough to shut down the system. However, you need to make the two sets of load large enough that if both inputs are active at the same time, their power requirements become large enough to shut down the system, without making them large enough to shut it down when only one of them is active. It'll just require a little math on your part.<br />
<br />
===Mechanical XNOR gate===<br />
{{diagram|<br />
[#000].[#000].[#aaf]I*[#f00]L<br />
[#000].[#000].[#ff0]O[#aaf]I<br />
[#000].[#000].¦<br />
[#0f0]P[#aaf]-*[#aaf]i-[#0f0]P<br />
[#000].[#000].[#aaf]i<br />
[#000].[#000].¦<br />
[#000].[#000].[#0f0]P}}<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! A<br />
! B<br />
! Drain<br />
! Power<br />
! Extra Power<br />
! Result<br />
|-<br />
| 0<br />
| 0<br />
| No<br />
| Yes<br />
| No<br />
| 1<br />
|-<br />
| 0<br />
| 1<br />
| Yes<br />
| Yes<br />
| Half<br />
| 0<br />
|-<br />
| 1<br />
| 0<br />
| Yes<br />
| Yes<br />
| Half<br />
| 0<br />
|-<br />
| 1<br />
| 1<br />
| Yes<br />
| Yes<br />
| Full<br />
| 1<br />
|} <br />
<br />
* The XNOR gate is an equality gate: The output is ON when both inputs are equal, and OFF when they are not equal.<br />
* This gate may be '''even more complicated''' to build than the XOR gate!<br />
* First, your 'i's are again gears connected to your two inputs. The two extra Ps to the right and below them are additional power sources, ideally only one windmill each.<br />
* Here's where it gets complicated. The load has to be sufficient to shut down the system even when ONE of the inputs' additional power supplies are connected. However, when BOTH inputs are on, there needs to be enough power from both additional Ps to bring the system back online.<br />
* Thus our gate does what it is supposed to: Produce enough power to have the OUTPUT gear be ON when both A and B are either 0 or 1, but not when they are not equal.</div>SLhttp://dwarffortresswiki.org/index.php?title=v0.31:Mechanical_logic&diff=102376v0.31:Mechanical logic2010-05-02T21:47:03Z<p>SL: So I was wrong :P</p>
<hr />
<div><!-- <br />
***************************<br />
* WORKING IN PROGRESS !!! *<br />
***************************<br />
--><br />
{{av}}<br />
{{human}}<br />
Mechanical logic is one discipline of {{l|computing|computing}} using mechanical {{l|power|power}} to perform logical operations. In this case powered or unpowered {{l|machine component|machine components}} represent the binary information.<br />
<br />
The principles of mechanical logic are simple. {{l|Gear assembly|Gear assemblies}} linked to {{l|trigger|triggers}} will be toggled between disengaged and engaged when they receive an on/off signal. In this manner, you can conditionally attach power supply from {{l|windmill|windmills}} or {{l|waterwheel|waterwheels}} to specially arranged gears to build logic gates. You can also connect additional gears or other machine components as load - consuming power - to a linked gear in various configurations.<br />
<br />
== Pros and cons ==<br />
<br />
* needs a substantial amount of wood to construct power supply<br />
* needs a substantial amount of {{l|mechanism|mechanisms}} and therefore {{l|mechanics|mechanics}}, especially when you base your gates on load<br />
* needs {{l|water|fluid}} to build converter<br />
<br />
* is very fast because gears don't have a reaction delay of 100 steps<br />
* is very flexible because gears can be toggled and therefore inverting input signals is very easy<br />
* is easy to reconfigure because you don't have to deal with fluid or {{l|creature|creatures}} as you have to when you stick to other computing disciplines<br />
<br />
<!-- ToDo --><br />
<!--<br />
== General concepts ==<br />
=== Load based ===<br />
=== Toggle based ===<br />
--><br />
<br />
== Power to signal converter ==<br />
When you are dealing with mechanical logic, you'll finally want or have to trigger something else than machine components like doors or bridges. Currently, there doesn't exist any {{l|trigger|trigger}} in dwarf fortress that reacts on the working state of machine components, thus power on/off. So, you'll have to convert power via pressure plates, screw pumps and fluid into an on/off signal.<br />
<div style="width:1px; white-space:nowrap;"><br />
'''Z 0'''<br />
{| cellpadding="0" cellspacing="0" style="border-spacing:0; border-style:solid; border-width:thin; border-color:#000000;"<br />
|<br />
{| cellpadding="0" cellspacing="0" style="border-spacing:0; padding:0; margin:0; vertical-align:middle;"<br />
|-<br />
|{{RTL|#DDD}}<br />
|{{RTL|#DDD}}<br />
|{{RTL|#DDD}}<br />
|{{RTL|#222}}<br />
|{{RTL|#222}}<br />
|{{RTL|#222}}<br />
|-<br />
|{{RTL|#DDD}}<br />
|{{RTL|#222|·|#BBB}}<br />
|{{RTL|#444|÷|#DDD}}<br />
|{{RTL|#444|÷|#DDD|►|#00A|center|►|#00A|center}}<br />
|{{RTL|#222|·|#BBB}}<br />
|{{RTL|#222}}<br />
|-<br />
|{{RTL|#DDD}}<br />
|{{RTL|#DDD}}<br />
|{{RTL|#DDD}}<br />
|{{RTL|#222}}<br />
|{{RTL|#222}}<br />
|{{RTL|#222}}<br />
|}<br />
|}<br />
</div><br />
<div style="width:1px; white-space:nowrap;"><br />
'''Z-1'''<br />
{| cellpadding="0" cellspacing="0" style="border-spacing:0; border-style:solid; border-width:thin; border-color:#000000;"<br />
|<br />
{| cellpadding="0" cellspacing="0" style="border-spacing:0; padding:0; margin:0; vertical-align:middle;"<br />
|-<br />
|{{RTL|#222}}<br />
|{{RTL|#222}}<br />
|{{RTL|#222}}<br />
|{{RTL|#222}}<br />
|{{RTL|#222}}<br />
|{{RTL|#222}}<br />
|-<br />
|{{RTL|#222}}<br />
|{{RTL|#00A|^|#DDD||||7|#88F|left}}<br />
|{{RTL|#DDD||||||7|#88F|left}}<br />
|{{RTL|#DDD||||||7|#88F|left}}<br />
|{{RTL|#DDD||||||7|#88F|left}}<br />
|{{RTL|#222}}<br />
|-<br />
|{{RTL|#222}}<br />
|{{RTL|#222}}<br />
|{{RTL|#222}}<br />
|{{RTL|#222}}<br />
|{{RTL|#222}}<br />
|{{RTL|#222}}<br />
|-<br />
|}<br />
|}<br />
</div><br />
<br /><br />
When the pump is connected to power, it will suck water from the pressure plate and pump it to the right. The water level on the pressure plate will fall to 0. The plate can be constructed to react on 0&hellip;3 water. You can invert it to get an off signal instead setting it to 4&hellip;7. In both cases the ''off signal'' will have a delay of 100 steps.{{Verify}} This gate is fluid conserving.<br />
<br />
==Mechanical signal-input power-output gates==<br />
* These gates can be used either by adding a power -> link signal converter (also known as a "rotation sensor"), or directly used to control pumps, such as in other logic gates (the unsourced fluid logic gates use these, for instance). The conventional "rotation sensor" consists of a pump powered by the gate's OUTPUT gear, pumping an infinite supply of water onto a water-sensing pressure plate with an infinite drain.<br />
* There are certain things important to all the gates:<br />
* Each gate has an OUTPUT gear, which will be placed next to a pump which the gate will control.<br />
* In diagrams, the OUTPUT gear is below the 'O' gear, connected to it by gears or vertical axles. The P indicates where you should hook power up, and L indicates where load (gears or pumps that don't have a water source) should be connected, and ¦ and - are horizontal axles. The Is are gears linked to INPUTs (some gates have one input, but most have two).<br />
* Gates which incorporate a NOT will have the power network branch off from the 'O' gear, and have a train of power-draining stuff connected to the input gears, whereas gates which do not incorporate a NOT will have the power connected to the input gears instead. The principle behind normal gates is that when the INPUTs are ON, power is connected. The principle behind the NOT gates is that power is always connected, but when the INPUTs are ON, a large enough power requirement is connected to send the power requirements above the power supply, shutting down the system.<br />
* If your windmills produce no power, you'll have to come up with some way to use water wheels for power instead.<br />
* You should build only enough windmills (or water wheels) to power the system, and should not connect the network for one gate to another gate's network, since that would both gates up.<br />
* The gates' instructions will explain how much load and power you need to have at each P and L in the more complicated gates.<br />
<br />
===Legend===<br />
{| class="wikitable" border="1"<br />
|-<br />
! Symbol<br />
! Meaning<br />
|-<br />
| {{diagram|[#ff0]O}}<br />
| A gear which connects to your OUTPUT gear, which outputs power when the gate is producing an ON output.<br />
|-<br />
| {{diagram|[#aaf]I}}<br />
| A gear connected to an INPUT. In most gates you will have two Is, with each one connected to a different input.<br />
|-<br />
| {{diagram|-}} and {{diagram|¦}}<br />
| Horizontal axles<br />
|-<br />
| {{diagram|[#0f0]P}}<br />
| Power goes here<br />
|-<br />
| {{diagram|[#aaf]i}}<br />
| Two more gears, each connected to the two different inputs.<br />
|-<br />
| {{diagram|[#f00]L}}<br />
| a chain of gears or pumps which serve to add load to the system, generally shutting it off when connected.<br />
|-<br />
| {{diagram|*}}<br />
| A gear which isn't linked to any inputs or outputs and just serves to connect the power or whatever.<br />
|}<br />
<br />
===Mechanical identity gate ===<br />
{{diagram|<br />
[#ff0]O[#aaf]I--[#0f0]P}}<br />
<br />
* This takes an linked input signal and converts it to power without changing it.<br />
* Connected to the input gear, such that they will only be connected to the system if the input gear is receiving an ON signal, are gears with windmills on top of them. Build only enough windmills to power the devices that the gate's OUTPUT gear are connected to (and the gears/axles).<br />
* When the INPUT is ON, the INPUT gear will be active, and the network will provide power to the OUTPUT. When the INPUT is OFF, it will not provide power to the OUTPUT.<br />
<br />
===Mechanical NOT gate===<br />
{{diagram|<br />
[#ff0]O[#aaf]I[#f00]L<br />
¦<br />
¦<br />
[#0f0]P}}<br />
<br />
* When the INPUT is ON, the INPUT gear will be active, and the network should need more power than is available. The devices connected to OUTPUT should shut down. When INPUT is OFF, the devices should have power since the INPUT gear will be disconnected.<br />
<br />
===Mechanical NAND gate===<br />
{{diagram|<br />
[#ff0]O[#aaf]I[#aaf]I[#f00]L<br />
¦<br />
¦<br />
[#0f0]P}}<br />
<br />
* This works just like the NOT gate, except that there are two inputs and both have to be active to shut down the system instead of one. Make sure you have enough power to run the system when one of the input gears is active.<br />
<br />
===Mechanical AND gate===<br />
{{diagram|<br />
[#ff0]O[#aaf]I[#aaf]I[#0f0]P}}<br />
<br />
* This works like the identity gate, except that there are two inputs and both have to be active for the system to get power.<br />
<br />
===Mechanical OR gate===<br />
{{diagram|<br />
[#ff0]O[#aaf]I<br />
[#aaf]I*[#0f0]P}}<br />
<br />
* This works like the identity gate, except that there are two inputs, and if either is active, the system receives power. Note that the entire power network is connected to both inputs, such that if either input is active the entire power network is powering the system.<br />
<br />
===Mechanical NOR gate===<br />
{{diagram|<br />
[#aaf]I*[#f00]L<br />
[#ff0]O[#aaf]I<br />
¦<br />
¦<br />
[#0f0]P}}<br />
<br />
* This works like the NOT gate, except that there are two inputs, and if either is active, the gear train or pump stack signified by the 'L' will be connected to the system. You need to have enough load to push power requirements above the amount of power produced by the power supply, shutting the system down.<br />
<br />
===Mechanical XOR gate===<br />
{{diagram|<br />
[#ff0]O[#aaf]I<br />
[#aaf]I*--*[#0f0]P<br />
[#000].[#aaf]i[#000].[#000].[#aaf]i<br />
[#000].[#f00]L[#000].[#000].[#f00]L}}<br />
<br />
<br />
* Except for the 'i's and 'L's, this gate is identical to the OR gate. The additional components add the 'exclusive' part of the 'XOR' to the gate.<br />
* This gate may be a bit difficult to construct. First, the 'i's are additional gears connected to each of your inputs, and the Ls are additional load, however, neither load by itself should be enough to shut down the system. However, you need to make the two sets of load large enough that if both inputs are active at the same time, their power requirements become large enough to shut down the system, without making them large enough to shut it down when only one of them is active. It'll just require a little math on your part.<br />
<br />
===Mechanical XNOR gate===<br />
{{diagram|<br />
[#000].[#000].[#aaf]I*[#f00]L<br />
[#000].[#000].[#ff0]O[#aaf]I<br />
[#000].[#000].¦<br />
[#0f0]P[#aaf]-*[#aaf]i-[#0f0]P<br />
[#000].[#000].[#aaf]i<br />
[#000].[#000].¦<br />
[#000].[#000].[#0f0]P}}<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! A<br />
! B<br />
! Drain<br />
! Power<br />
! Extra Power<br />
! Result<br />
|-<br />
| 0<br />
| 0<br />
| No<br />
| Yes<br />
| No<br />
| 1<br />
|-<br />
| 0<br />
| 1<br />
| Yes<br />
| Yes<br />
| Half<br />
| 0<br />
|-<br />
| 1<br />
| 0<br />
| Yes<br />
| Yes<br />
| Half<br />
| 0<br />
|-<br />
| 1<br />
| 1<br />
| Yes<br />
| Yes<br />
| Full<br />
| 1<br />
|} <br />
<br />
* The XNOR gate is an equality gate: The output is ON when both inputs are equal, and OFF when they are not equal.<br />
* This gate may be '''even more complicated''' to build than the XOR gate!<br />
* First, your 'i's are again gears connected to your two inputs. The two extra Ps to the right and below them are additional power sources, ideally only one windmill each.<br />
* Here's where it gets complicated. The load has to be sufficient to shut down the system even when ONE of the inputs' additional power supplies are connected. However, when BOTH inputs are on, there needs to be enough power from both additional Ps to bring the system back online.<br />
* Thus our gate does what it is supposed to: Produce enough power to have the OUTPUT gear be ON when both A and B are either 0 or 1, but not when they are not equal.</div>SLhttp://dwarffortresswiki.org/index.php?title=v0.31_Talk:Pre-Toggled_Mechanical_Logic&diff=102374v0.31 Talk:Pre-Toggled Mechanical Logic2010-05-02T21:33:18Z<p>SL: </p>
<hr />
<div>Did you test any of this before writing this up and linking to it from the mechanical logic page? This doesn't work the way you seem to think. Once your inputs have toggled once, your pre-toggled gears will revert back to normal and you will, for instance, instead of a NAND gate, have an OR gate. When an object sends a state, it sends an OFF/ON signal corresponding to the input's state. It does not send a TOGGLE-STATE signal. Here, I built one of them and tested it: Your NAND gate is actually an OR gate, because pre-toggling doesn't do what you think it does. http://mkv25.net/dfma/movie-2151-pre-togglednandbecominganorgate --[[User:SL|SL]] 20:56, 2 May 2010 (UTC)<br />
:Actually, when you're dealing with gear assemblies, levers '''DO''' send a "toggle" signal. However, it's also apparent that you did the test wrong - the first design guideline states that "Levers and pressure plates should be linked to a gear assembly in the ''on'' state. For reference, a lever is ''off'' when built.", and your levers were linked while in the "off" state. --[[User:Quietust|Quietust]] 21:20, 2 May 2010 (UTC)<br />
::There's also the fact that the stuff in this article doesn't really work when dealing with pressure plates, since pressure plates can't easily be linked when "on". --[[User:Quietust|Quietust]] 21:22, 2 May 2010 (UTC)<br />
:::I realized a minute ago (and edited the text in my movie) that they were toggling, as the pre-toggling lever switched the gears to OFF and the input levers then switched them back to ON. It's just that the gate seems to be an OR gate instead of a NAND gate when linked up the way I did it (I did miss the part about toggling the levers to ON before linking them). Now why would you have to have your levers ON instead of OFF? It's not so useful if you can't use pressure plates with it. Surely the gates could be designed to accomodate default lever and pressure plate states, hell, switching the OR and NAND gate designs and dropping the levers-ON-before-linking requirement would likely make those work with pressure plates. --[[User:SL|SL]] 21:31, 2 May 2010 (UTC)</div>SLhttp://dwarffortresswiki.org/index.php?title=v0.31_Talk:Pre-Toggled_Mechanical_Logic&diff=102373v0.31 Talk:Pre-Toggled Mechanical Logic2010-05-02T21:32:23Z<p>SL: </p>
<hr />
<div>Did you test any of this before writing this up and linking to it from the mechanical logic page? This doesn't work the way you seem to think. Once your inputs have toggled once, your pre-toggled gears will revert back to normal and you will, for instance, instead of a NAND gate, have an OR gate. When an object sends a state, it sends an OFF/ON signal corresponding to the input's state. It does not send a TOGGLE-STATE signal. Here, I built one of them and tested it: Your NAND gate is actually an OR gate, because pre-toggling doesn't do what you think it does. http://mkv25.net/dfma/movie-2151-pre-togglednandbecominganorgate --[[User:SL|SL]] 20:56, 2 May 2010 (UTC)<br />
:Actually, when you're dealing with gear assemblies, levers '''DO''' send a "toggle" signal. However, it's also apparent that you did the test wrong - the first design guideline states that "Levers and pressure plates should be linked to a gear assembly in the ''on'' state. For reference, a lever is ''off'' when built.", and your levers were linked while in the "off" state. --[[User:Quietust|Quietust]] 21:20, 2 May 2010 (UTC)<br />
::There's also the fact that the stuff in this article doesn't really work when dealing with pressure plates, since pressure plates can't easily be linked when "on". --[[User:Quietust|Quietust]] 21:22, 2 May 2010 (UTC)<br />
:::I realized a minute ago (and edited the text in my movie) that they were toggling, as the pre-toggling lever switched the gears to OFF and the input levers then switched them back to ON. It's just that the gate seems to be an OR gate instead of a NAND gate when linked up the way I did it (I did miss the part about toggling the levers to ON before linking them). Now why would you have to have your levers ON instead of OFF? It's not so useful if you can't use pressure plates with it. Surely the gates could be designed to accomodate default lever and pressure plate states, hell, switching the OR and NAND gate designs would likely make those work with pressure plates. --[[User:SL|SL]] 21:31, 2 May 2010 (UTC)</div>SLhttp://dwarffortresswiki.org/index.php?title=v0.31_Talk:Pre-Toggled_Mechanical_Logic&diff=102372v0.31 Talk:Pre-Toggled Mechanical Logic2010-05-02T21:31:53Z<p>SL: </p>
<hr />
<div>Did you test any of this before writing this up and linking to it from the mechanical logic page? This doesn't work the way you seem to think. Once your inputs have toggled once, your pre-toggled gears will revert back to normal and you will, for instance, instead of a NAND gate, have an OR gate. When an object sends a state, it sends an OFF/ON signal corresponding to the input's state. It does not send a TOGGLE-STATE signal. Here, I built one of them and tested it: Your NAND gate is actually an OR gate, because pre-toggling doesn't do what you think it does. http://mkv25.net/dfma/movie-2151-pre-togglednandbecominganorgate --[[User:SL|SL]] 20:56, 2 May 2010 (UTC)<br />
:Actually, when you're dealing with gear assemblies, levers '''DO''' send a "toggle" signal. However, it's also apparent that you did the test wrong - the first design guideline states that "Levers and pressure plates should be linked to a gear assembly in the ''on'' state. For reference, a lever is ''off'' when built.", and your levers were linked while in the "off" state. --[[User:Quietust|Quietust]] 21:20, 2 May 2010 (UTC)<br />
::There's also the fact that the stuff in this article doesn't really work when dealing with pressure plates, since pressure plates can't easily be linked when "on". --[[User:Quietust|Quietust]] 21:22, 2 May 2010 (UTC)<br />
:::I realized a minute ago (and edited the text in my movie) that they were toggling, as the pre-toggling lever switched the gears to OFF and the input levers then switched them back to ON. It's just that the gate seems to be an OR gate instead of a NAND gate. Now why would you have to have your levers ON instead of OFF? It's not so useful if you can't use pressure plates with it. Surely the gates could be designed to accomodate default lever and pressure plate states, hell, switching the OR and NAND gate designs would likely make those work with pressure plates. --[[User:SL|SL]] 21:31, 2 May 2010 (UTC)</div>SLhttp://dwarffortresswiki.org/index.php?title=v0.31_Talk:Pre-Toggled_Mechanical_Logic&diff=102371v0.31 Talk:Pre-Toggled Mechanical Logic2010-05-02T21:31:41Z<p>SL: </p>
<hr />
<div>Did you test any of this before writing this up and linking to it from the mechanical logic page? This doesn't work the way you seem to think. Once your inputs have toggled once, your pre-toggled gears will revert back to normal and you will, for instance, instead of a NAND gate, have an OR gate. When an object sends a state, it sends an OFF/ON signal corresponding to the input's state. It does not send a TOGGLE-STATE signal. Here, I built one of them and tested it: Your NAND gate is actually an OR gate, because pre-toggling doesn't do what you think it does. http://mkv25.net/dfma/movie-2151-pre-togglednandbecominganorgate --[[User:SL|SL]] 20:56, 2 May 2010 (UTC)<br />
:Actually, when you're dealing with gear assemblies, levers '''DO''' send a "toggle" signal. However, it's also apparent that you did the test wrong - the first design guideline states that "Levers and pressure plates should be linked to a gear assembly in the ''on'' state. For reference, a lever is ''off'' when built.", and your levers were linked while in the "off" state. --[[User:Quietust|Quietust]] 21:20, 2 May 2010 (UTC)<br />
::There's also the fact that the stuff in this article doesn't really work when dealing with pressure plates, since pressure plates can't easily be linked when "on". --[[User:Quietust|Quietust]] 21:22, 2 May 2010 (UTC)<br />
::I realized a minute ago (and edited the text in my movie) that they were toggling, as the pre-toggling lever switched the gears to OFF and the input levers then switched them back to ON. It's just that the gate seems to be an OR gate instead of a NAND gate. Now why would you have to have your levers ON instead of OFF? It's not so useful if you can't use pressure plates with it. Surely the gates could be designed to accomodate default lever and pressure plate states, hell, switching the OR and NAND gate designs would likely make those work with pressure plates. --[[User:SL|SL]] 21:31, 2 May 2010 (UTC)</div>SLhttp://dwarffortresswiki.org/index.php?title=v0.31:Mechanical_logic&diff=102366v0.31:Mechanical logic2010-05-02T21:07:03Z<p>SL: "is very flexible because gears can be toggled and therefore inverting input signals is very easy" isn't even remotely true. Inputs don't send toggle signals, people!</p>
<hr />
<div><!-- <br />
***************************<br />
* WORKING IN PROGRESS !!! *<br />
***************************<br />
--><br />
{{av}}<br />
{{human}}<br />
Mechanical logic is one discipline of {{l|computing|computing}} using mechanical {{l|power|power}} to perform logical operations. In this case powered or unpowered {{l|machine component|machine components}} represent the binary information.<br />
<br />
The principles of mechanical logic are simple. {{l|Gear assembly|Gear assemblies}} linked to {{l|trigger|triggers}} will be toggled between disengaged and engaged when they receive an on/off signal. In this manner, you can conditionally attach power supply from {{l|windmill|windmills}} or {{l|waterwheel|waterwheels}} to specially arranged gears to build logic gates. You can also connect additional gears or other machine components as load - consuming power - to a linked gear in various configurations.<br />
<br />
== Pros and cons ==<br />
<br />
* needs a substantial amount of wood to construct power supply<br />
* needs a substantial amount of {{l|mechanism|mechanisms}} and therefore {{l|mechanics|mechanics}}, especially when you base your gates on load<br />
* needs {{l|water|fluid}} to build converter<br />
<br />
* is very fast because gears don't have a reaction delay of 100 steps<br />
* is easy to reconfigure because you don't have to deal with fluid or {{l|creature|creatures}} as you have to when you stick to other computing disciplines<br />
<br />
<!-- ToDo --><br />
<!--<br />
== General concepts ==<br />
=== Load based ===<br />
=== Toggle based ===<br />
--><br />
<br />
== Power to signal converter ==<br />
When you are dealing with mechanical logic, you'll finally want or have to trigger something else than machine components like doors or bridges. Currently, there doesn't exist any {{l|trigger|trigger}} in dwarf fortress that reacts on the working state of machine components, thus power on/off. So, you'll have to convert power via pressure plates, screw pumps and fluid into an on/off signal.<br />
<div style="width:1px; white-space:nowrap;"><br />
'''Z 0'''<br />
{| cellpadding="0" cellspacing="0" style="border-spacing:0; border-style:solid; border-width:thin; border-color:#000000;"<br />
|<br />
{| cellpadding="0" cellspacing="0" style="border-spacing:0; padding:0; margin:0; vertical-align:middle;"<br />
|-<br />
|{{RTL|#DDD}}<br />
|{{RTL|#DDD}}<br />
|{{RTL|#DDD}}<br />
|{{RTL|#222}}<br />
|{{RTL|#222}}<br />
|{{RTL|#222}}<br />
|-<br />
|{{RTL|#DDD}}<br />
|{{RTL|#222|·|#BBB}}<br />
|{{RTL|#444|÷|#DDD}}<br />
|{{RTL|#444|÷|#DDD|►|#00A|center|►|#00A|center}}<br />
|{{RTL|#222|·|#BBB}}<br />
|{{RTL|#222}}<br />
|-<br />
|{{RTL|#DDD}}<br />
|{{RTL|#DDD}}<br />
|{{RTL|#DDD}}<br />
|{{RTL|#222}}<br />
|{{RTL|#222}}<br />
|{{RTL|#222}}<br />
|}<br />
|}<br />
</div><br />
<div style="width:1px; white-space:nowrap;"><br />
'''Z-1'''<br />
{| cellpadding="0" cellspacing="0" style="border-spacing:0; border-style:solid; border-width:thin; border-color:#000000;"<br />
|<br />
{| cellpadding="0" cellspacing="0" style="border-spacing:0; padding:0; margin:0; vertical-align:middle;"<br />
|-<br />
|{{RTL|#222}}<br />
|{{RTL|#222}}<br />
|{{RTL|#222}}<br />
|{{RTL|#222}}<br />
|{{RTL|#222}}<br />
|{{RTL|#222}}<br />
|-<br />
|{{RTL|#222}}<br />
|{{RTL|#00A|^|#DDD||||7|#88F|left}}<br />
|{{RTL|#DDD||||||7|#88F|left}}<br />
|{{RTL|#DDD||||||7|#88F|left}}<br />
|{{RTL|#DDD||||||7|#88F|left}}<br />
|{{RTL|#222}}<br />
|-<br />
|{{RTL|#222}}<br />
|{{RTL|#222}}<br />
|{{RTL|#222}}<br />
|{{RTL|#222}}<br />
|{{RTL|#222}}<br />
|{{RTL|#222}}<br />
|-<br />
|}<br />
|}<br />
</div><br />
<br /><br />
When the pump is connected to power, it will suck water from the pressure plate and pump it to the right. The water level on the pressure plate will fall to 0. The plate can be constructed to react on 0&hellip;3 water. You can invert it to get an off signal instead setting it to 4&hellip;7. In both cases the ''off signal'' will have a delay of 100 steps.{{Verify}} This gate is fluid conserving.<br />
<br />
==Mechanical signal-input power-output gates==<br />
* These gates can be used either by adding a power -> link signal converter (also known as a "rotation sensor"), or directly used to control pumps, such as in other logic gates (the unsourced fluid logic gates use these, for instance). The conventional "rotation sensor" consists of a pump powered by the gate's OUTPUT gear, pumping an infinite supply of water onto a water-sensing pressure plate with an infinite drain.<br />
* There are certain things important to all the gates:<br />
* Each gate has an OUTPUT gear, which will be placed next to a pump which the gate will control.<br />
* In diagrams, the OUTPUT gear is below the 'O' gear, connected to it by gears or vertical axles. The P indicates where you should hook power up, and L indicates where load (gears or pumps that don't have a water source) should be connected, and ¦ and - are horizontal axles. The Is are gears linked to INPUTs (some gates have one input, but most have two).<br />
* Gates which incorporate a NOT will have the power network branch off from the 'O' gear, and have a train of power-draining stuff connected to the input gears, whereas gates which do not incorporate a NOT will have the power connected to the input gears instead. The principle behind normal gates is that when the INPUTs are ON, power is connected. The principle behind the NOT gates is that power is always connected, but when the INPUTs are ON, a large enough power requirement is connected to send the power requirements above the power supply, shutting down the system.<br />
* If your windmills produce no power, you'll have to come up with some way to use water wheels for power instead.<br />
* You should build only enough windmills (or water wheels) to power the system, and should not connect the network for one gate to another gate's network, since that would both gates up.<br />
* The gates' instructions will explain how much load and power you need to have at each P and L in the more complicated gates.<br />
<br />
===Legend===<br />
{| class="wikitable" border="1"<br />
|-<br />
! Symbol<br />
! Meaning<br />
|-<br />
| {{diagram|[#ff0]O}}<br />
| A gear which connects to your OUTPUT gear, which outputs power when the gate is producing an ON output.<br />
|-<br />
| {{diagram|[#aaf]I}}<br />
| A gear connected to an INPUT. In most gates you will have two Is, with each one connected to a different input.<br />
|-<br />
| {{diagram|-}} and {{diagram|¦}}<br />
| Horizontal axles<br />
|-<br />
| {{diagram|[#0f0]P}}<br />
| Power goes here<br />
|-<br />
| {{diagram|[#aaf]i}}<br />
| Two more gears, each connected to the two different inputs.<br />
|-<br />
| {{diagram|[#f00]L}}<br />
| a chain of gears or pumps which serve to add load to the system, generally shutting it off when connected.<br />
|-<br />
| {{diagram|*}}<br />
| A gear which isn't linked to any inputs or outputs and just serves to connect the power or whatever.<br />
|}<br />
<br />
===Mechanical identity gate ===<br />
{{diagram|<br />
[#ff0]O[#aaf]I--[#0f0]P}}<br />
<br />
* This takes an linked input signal and converts it to power without changing it.<br />
* Connected to the input gear, such that they will only be connected to the system if the input gear is receiving an ON signal, are gears with windmills on top of them. Build only enough windmills to power the devices that the gate's OUTPUT gear are connected to (and the gears/axles).<br />
* When the INPUT is ON, the INPUT gear will be active, and the network will provide power to the OUTPUT. When the INPUT is OFF, it will not provide power to the OUTPUT.<br />
<br />
===Mechanical NOT gate===<br />
{{diagram|<br />
[#ff0]O[#aaf]I[#f00]L<br />
¦<br />
¦<br />
[#0f0]P}}<br />
<br />
* When the INPUT is ON, the INPUT gear will be active, and the network should need more power than is available. The devices connected to OUTPUT should shut down. When INPUT is OFF, the devices should have power since the INPUT gear will be disconnected.<br />
<br />
===Mechanical NAND gate===<br />
{{diagram|<br />
[#ff0]O[#aaf]I[#aaf]I[#f00]L<br />
¦<br />
¦<br />
[#0f0]P}}<br />
<br />
* This works just like the NOT gate, except that there are two inputs and both have to be active to shut down the system instead of one. Make sure you have enough power to run the system when one of the input gears is active.<br />
<br />
===Mechanical AND gate===<br />
{{diagram|<br />
[#ff0]O[#aaf]I[#aaf]I[#0f0]P}}<br />
<br />
* This works like the identity gate, except that there are two inputs and both have to be active for the system to get power.<br />
<br />
===Mechanical OR gate===<br />
{{diagram|<br />
[#ff0]O[#aaf]I<br />
[#aaf]I*[#0f0]P}}<br />
<br />
* This works like the identity gate, except that there are two inputs, and if either is active, the system receives power. Note that the entire power network is connected to both inputs, such that if either input is active the entire power network is powering the system.<br />
<br />
===Mechanical NOR gate===<br />
{{diagram|<br />
[#aaf]I*[#f00]L<br />
[#ff0]O[#aaf]I<br />
¦<br />
¦<br />
[#0f0]P}}<br />
<br />
* This works like the NOT gate, except that there are two inputs, and if either is active, the gear train or pump stack signified by the 'L' will be connected to the system. You need to have enough load to push power requirements above the amount of power produced by the power supply, shutting the system down.<br />
<br />
===Mechanical XOR gate===<br />
{{diagram|<br />
[#ff0]O[#aaf]I<br />
[#aaf]I*--*[#0f0]P<br />
[#000].[#aaf]i[#000].[#000].[#aaf]i<br />
[#000].[#f00]L[#000].[#000].[#f00]L}}<br />
<br />
<br />
* Except for the 'i's and 'L's, this gate is identical to the OR gate. The additional components add the 'exclusive' part of the 'XOR' to the gate.<br />
* This gate may be a bit difficult to construct. First, the 'i's are additional gears connected to each of your inputs, and the Ls are additional load, however, neither load by itself should be enough to shut down the system. However, you need to make the two sets of load large enough that if both inputs are active at the same time, their power requirements become large enough to shut down the system, without making them large enough to shut it down when only one of them is active. It'll just require a little math on your part.<br />
<br />
===Mechanical XNOR gate===<br />
{{diagram|<br />
[#000].[#000].[#aaf]I*[#f00]L<br />
[#000].[#000].[#ff0]O[#aaf]I<br />
[#000].[#000].¦<br />
[#0f0]P[#aaf]-*[#aaf]i-[#0f0]P<br />
[#000].[#000].[#aaf]i<br />
[#000].[#000].¦<br />
[#000].[#000].[#0f0]P}}<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! A<br />
! B<br />
! Drain<br />
! Power<br />
! Extra Power<br />
! Result<br />
|-<br />
| 0<br />
| 0<br />
| No<br />
| Yes<br />
| No<br />
| 1<br />
|-<br />
| 0<br />
| 1<br />
| Yes<br />
| Yes<br />
| Half<br />
| 0<br />
|-<br />
| 1<br />
| 0<br />
| Yes<br />
| Yes<br />
| Half<br />
| 0<br />
|-<br />
| 1<br />
| 1<br />
| Yes<br />
| Yes<br />
| Full<br />
| 1<br />
|} <br />
<br />
* The XNOR gate is an equality gate: The output is ON when both inputs are equal, and OFF when they are not equal.<br />
* This gate may be '''even more complicated''' to build than the XOR gate!<br />
* First, your 'i's are again gears connected to your two inputs. The two extra Ps to the right and below them are additional power sources, ideally only one windmill each.<br />
* Here's where it gets complicated. The load has to be sufficient to shut down the system even when ONE of the inputs' additional power supplies are connected. However, when BOTH inputs are on, there needs to be enough power from both additional Ps to bring the system back online.<br />
* Thus our gate does what it is supposed to: Produce enough power to have the OUTPUT gear be ON when both A and B are either 0 or 1, but not when they are not equal.</div>SLhttp://dwarffortresswiki.org/index.php?title=v0.31_Talk:Mechanical_logic&diff=102364v0.31 Talk:Mechanical logic2010-05-02T21:06:15Z<p>SL: </p>
<hr />
<div>The designs on the 40d mechanical logic gates page were incomprehensible, so I designed some new ones and put them here. I haven't put up a "rotation sensor" design yet, since (a) the description is self-explanatory, and (b) I'm designing flowless water logic gates at the moment and am wondering if it's possible to make a flowless version. --[[User:SL|SL]] 02:27, 10 April 2010 (UTC)<br />
:[[User:Kami/Logic_gates#Power_to_signal_converter]] --[[User:Kami|Kami]] 17:22, 14 April 2010 (UTC)<br />
::Nice. Even better than what I was doing, since I needed two pumps to take it from one space to another and back, and annoyingly complicated logic too.--[[User:SL|SL]] 21:06, 2 May 2010 (UTC)<br />
<br />
I don't think the "is very flexible because gears can be toggled and therefore inverting input signals is very easy" (... surely now, haven't we dispelled the myth that inputs send toggle signals instead of ON/OFF yet?) or "is easy to reconfigure because you don't have to deal with fluid or creatures as you have to when you stick to other computing disciplines" are very accurate, based on my experience with both mechanical and fluid logic. if you want to invert something with fluid logic, you change the pressure plate. If you want to invert a mechanical logic gate, you redesign the whole thing. Or invert the pressure plate on your signal converter, heh. --[[User:SL|SL]] 21:06, 2 May 2010 (UTC)</div>SLhttp://dwarffortresswiki.org/index.php?title=v0.31:Mechanical_logic&diff=102363v0.31:Mechanical logic2010-05-02T21:00:02Z<p>SL: /* Pros and cons */</p>
<hr />
<div><!-- <br />
***************************<br />
* WORKING IN PROGRESS !!! *<br />
***************************<br />
--><br />
{{av}}<br />
{{human}}<br />
Mechanical logic is one discipline of {{l|computing|computing}} using mechanical {{l|power|power}} to perform logical operations. In this case powered or unpowered {{l|machine component|machine components}} represent the binary information.<br />
<br />
The principles of mechanical logic are simple. {{l|Gear assembly|Gear assemblies}} linked to {{l|trigger|triggers}} will be toggled between disengaged and engaged when they receive an on/off signal. In this manner, you can conditionally attach power supply from {{l|windmill|windmills}} or {{l|waterwheel|waterwheels}} to specially arranged gears to build logic gates. You can also connect additional gears or other machine components as load - consuming power - to a linked gear in various configurations.<br />
<br />
== Pros and cons ==<br />
<br />
* needs a substantial amount of wood to construct power supply<br />
* needs a substantial amount of {{l|mechanism|mechanisms}} and therefore {{l|mechanics|mechanics}}, especially when you base your gates on load<br />
* needs {{l|water|fluid}} to build converter<br />
<br />
* is very fast because gears don't have a reaction delay of 100 steps<br />
* is very flexible because gears can be toggled and therefore inverting input signals is very easy<br />
* is easy to reconfigure because you don't have to deal with fluid or {{l|creature|creatures}} as you have to when you stick to other computing disciplines<br />
<br />
<!-- ToDo --><br />
<!--<br />
== General concepts ==<br />
=== Load based ===<br />
=== Toggle based ===<br />
--><br />
<br />
== Power to signal converter ==<br />
When you are dealing with mechanical logic, you'll finally want or have to trigger something else than machine components like doors or bridges. Currently, there doesn't exist any {{l|trigger|trigger}} in dwarf fortress that reacts on the working state of machine components, thus power on/off. So, you'll have to convert power via pressure plates, screw pumps and fluid into an on/off signal.<br />
<div style="width:1px; white-space:nowrap;"><br />
'''Z 0'''<br />
{| cellpadding="0" cellspacing="0" style="border-spacing:0; border-style:solid; border-width:thin; border-color:#000000;"<br />
|<br />
{| cellpadding="0" cellspacing="0" style="border-spacing:0; padding:0; margin:0; vertical-align:middle;"<br />
|-<br />
|{{RTL|#DDD}}<br />
|{{RTL|#DDD}}<br />
|{{RTL|#DDD}}<br />
|{{RTL|#222}}<br />
|{{RTL|#222}}<br />
|{{RTL|#222}}<br />
|-<br />
|{{RTL|#DDD}}<br />
|{{RTL|#222|·|#BBB}}<br />
|{{RTL|#444|÷|#DDD}}<br />
|{{RTL|#444|÷|#DDD|►|#00A|center|►|#00A|center}}<br />
|{{RTL|#222|·|#BBB}}<br />
|{{RTL|#222}}<br />
|-<br />
|{{RTL|#DDD}}<br />
|{{RTL|#DDD}}<br />
|{{RTL|#DDD}}<br />
|{{RTL|#222}}<br />
|{{RTL|#222}}<br />
|{{RTL|#222}}<br />
|}<br />
|}<br />
</div><br />
<div style="width:1px; white-space:nowrap;"><br />
'''Z-1'''<br />
{| cellpadding="0" cellspacing="0" style="border-spacing:0; border-style:solid; border-width:thin; border-color:#000000;"<br />
|<br />
{| cellpadding="0" cellspacing="0" style="border-spacing:0; padding:0; margin:0; vertical-align:middle;"<br />
|-<br />
|{{RTL|#222}}<br />
|{{RTL|#222}}<br />
|{{RTL|#222}}<br />
|{{RTL|#222}}<br />
|{{RTL|#222}}<br />
|{{RTL|#222}}<br />
|-<br />
|{{RTL|#222}}<br />
|{{RTL|#00A|^|#DDD||||7|#88F|left}}<br />
|{{RTL|#DDD||||||7|#88F|left}}<br />
|{{RTL|#DDD||||||7|#88F|left}}<br />
|{{RTL|#DDD||||||7|#88F|left}}<br />
|{{RTL|#222}}<br />
|-<br />
|{{RTL|#222}}<br />
|{{RTL|#222}}<br />
|{{RTL|#222}}<br />
|{{RTL|#222}}<br />
|{{RTL|#222}}<br />
|{{RTL|#222}}<br />
|-<br />
|}<br />
|}<br />
</div><br />
<br /><br />
When the pump is connected to power, it will suck water from the pressure plate and pump it to the right. The water level on the pressure plate will fall to 0. The plate can be constructed to react on 0&hellip;3 water. You can invert it to get an off signal instead setting it to 4&hellip;7. In both cases the ''off signal'' will have a delay of 100 steps.{{Verify}} This gate is fluid conserving.<br />
<br />
==Mechanical signal-input power-output gates==<br />
* These gates can be used either by adding a power -> link signal converter (also known as a "rotation sensor"), or directly used to control pumps, such as in other logic gates (the unsourced fluid logic gates use these, for instance). The conventional "rotation sensor" consists of a pump powered by the gate's OUTPUT gear, pumping an infinite supply of water onto a water-sensing pressure plate with an infinite drain.<br />
* There are certain things important to all the gates:<br />
* Each gate has an OUTPUT gear, which will be placed next to a pump which the gate will control.<br />
* In diagrams, the OUTPUT gear is below the 'O' gear, connected to it by gears or vertical axles. The P indicates where you should hook power up, and L indicates where load (gears or pumps that don't have a water source) should be connected, and ¦ and - are horizontal axles. The Is are gears linked to INPUTs (some gates have one input, but most have two).<br />
* Gates which incorporate a NOT will have the power network branch off from the 'O' gear, and have a train of power-draining stuff connected to the input gears, whereas gates which do not incorporate a NOT will have the power connected to the input gears instead. The principle behind normal gates is that when the INPUTs are ON, power is connected. The principle behind the NOT gates is that power is always connected, but when the INPUTs are ON, a large enough power requirement is connected to send the power requirements above the power supply, shutting down the system.<br />
* If your windmills produce no power, you'll have to come up with some way to use water wheels for power instead.<br />
* You should build only enough windmills (or water wheels) to power the system, and should not connect the network for one gate to another gate's network, since that would both gates up.<br />
* The gates' instructions will explain how much load and power you need to have at each P and L in the more complicated gates.<br />
<br />
===Legend===<br />
{| class="wikitable" border="1"<br />
|-<br />
! Symbol<br />
! Meaning<br />
|-<br />
| {{diagram|[#ff0]O}}<br />
| A gear which connects to your OUTPUT gear, which outputs power when the gate is producing an ON output.<br />
|-<br />
| {{diagram|[#aaf]I}}<br />
| A gear connected to an INPUT. In most gates you will have two Is, with each one connected to a different input.<br />
|-<br />
| {{diagram|-}} and {{diagram|¦}}<br />
| Horizontal axles<br />
|-<br />
| {{diagram|[#0f0]P}}<br />
| Power goes here<br />
|-<br />
| {{diagram|[#aaf]i}}<br />
| Two more gears, each connected to the two different inputs.<br />
|-<br />
| {{diagram|[#f00]L}}<br />
| a chain of gears or pumps which serve to add load to the system, generally shutting it off when connected.<br />
|-<br />
| {{diagram|*}}<br />
| A gear which isn't linked to any inputs or outputs and just serves to connect the power or whatever.<br />
|}<br />
<br />
===Mechanical identity gate ===<br />
{{diagram|<br />
[#ff0]O[#aaf]I--[#0f0]P}}<br />
<br />
* This takes an linked input signal and converts it to power without changing it.<br />
* Connected to the input gear, such that they will only be connected to the system if the input gear is receiving an ON signal, are gears with windmills on top of them. Build only enough windmills to power the devices that the gate's OUTPUT gear are connected to (and the gears/axles).<br />
* When the INPUT is ON, the INPUT gear will be active, and the network will provide power to the OUTPUT. When the INPUT is OFF, it will not provide power to the OUTPUT.<br />
<br />
===Mechanical NOT gate===<br />
{{diagram|<br />
[#ff0]O[#aaf]I[#f00]L<br />
¦<br />
¦<br />
[#0f0]P}}<br />
<br />
* When the INPUT is ON, the INPUT gear will be active, and the network should need more power than is available. The devices connected to OUTPUT should shut down. When INPUT is OFF, the devices should have power since the INPUT gear will be disconnected.<br />
<br />
===Mechanical NAND gate===<br />
{{diagram|<br />
[#ff0]O[#aaf]I[#aaf]I[#f00]L<br />
¦<br />
¦<br />
[#0f0]P}}<br />
<br />
* This works just like the NOT gate, except that there are two inputs and both have to be active to shut down the system instead of one. Make sure you have enough power to run the system when one of the input gears is active.<br />
<br />
===Mechanical AND gate===<br />
{{diagram|<br />
[#ff0]O[#aaf]I[#aaf]I[#0f0]P}}<br />
<br />
* This works like the identity gate, except that there are two inputs and both have to be active for the system to get power.<br />
<br />
===Mechanical OR gate===<br />
{{diagram|<br />
[#ff0]O[#aaf]I<br />
[#aaf]I*[#0f0]P}}<br />
<br />
* This works like the identity gate, except that there are two inputs, and if either is active, the system receives power. Note that the entire power network is connected to both inputs, such that if either input is active the entire power network is powering the system.<br />
<br />
===Mechanical NOR gate===<br />
{{diagram|<br />
[#aaf]I*[#f00]L<br />
[#ff0]O[#aaf]I<br />
¦<br />
¦<br />
[#0f0]P}}<br />
<br />
* This works like the NOT gate, except that there are two inputs, and if either is active, the gear train or pump stack signified by the 'L' will be connected to the system. You need to have enough load to push power requirements above the amount of power produced by the power supply, shutting the system down.<br />
<br />
===Mechanical XOR gate===<br />
{{diagram|<br />
[#ff0]O[#aaf]I<br />
[#aaf]I*--*[#0f0]P<br />
[#000].[#aaf]i[#000].[#000].[#aaf]i<br />
[#000].[#f00]L[#000].[#000].[#f00]L}}<br />
<br />
<br />
* Except for the 'i's and 'L's, this gate is identical to the OR gate. The additional components add the 'exclusive' part of the 'XOR' to the gate.<br />
* This gate may be a bit difficult to construct. First, the 'i's are additional gears connected to each of your inputs, and the Ls are additional load, however, neither load by itself should be enough to shut down the system. However, you need to make the two sets of load large enough that if both inputs are active at the same time, their power requirements become large enough to shut down the system, without making them large enough to shut it down when only one of them is active. It'll just require a little math on your part.<br />
<br />
===Mechanical XNOR gate===<br />
{{diagram|<br />
[#000].[#000].[#aaf]I*[#f00]L<br />
[#000].[#000].[#ff0]O[#aaf]I<br />
[#000].[#000].¦<br />
[#0f0]P[#aaf]-*[#aaf]i-[#0f0]P<br />
[#000].[#000].[#aaf]i<br />
[#000].[#000].¦<br />
[#000].[#000].[#0f0]P}}<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! A<br />
! B<br />
! Drain<br />
! Power<br />
! Extra Power<br />
! Result<br />
|-<br />
| 0<br />
| 0<br />
| No<br />
| Yes<br />
| No<br />
| 1<br />
|-<br />
| 0<br />
| 1<br />
| Yes<br />
| Yes<br />
| Half<br />
| 0<br />
|-<br />
| 1<br />
| 0<br />
| Yes<br />
| Yes<br />
| Half<br />
| 0<br />
|-<br />
| 1<br />
| 1<br />
| Yes<br />
| Yes<br />
| Full<br />
| 1<br />
|} <br />
<br />
* The XNOR gate is an equality gate: The output is ON when both inputs are equal, and OFF when they are not equal.<br />
* This gate may be '''even more complicated''' to build than the XOR gate!<br />
* First, your 'i's are again gears connected to your two inputs. The two extra Ps to the right and below them are additional power sources, ideally only one windmill each.<br />
* Here's where it gets complicated. The load has to be sufficient to shut down the system even when ONE of the inputs' additional power supplies are connected. However, when BOTH inputs are on, there needs to be enough power from both additional Ps to bring the system back online.<br />
* Thus our gate does what it is supposed to: Produce enough power to have the OUTPUT gear be ON when both A and B are either 0 or 1, but not when they are not equal.</div>SLhttp://dwarffortresswiki.org/index.php?title=v0.31:Mechanical_logic&diff=102362v0.31:Mechanical logic2010-05-02T20:58:55Z<p>SL: Pre-toggled logic does not actually work, according to the on/off way signal sending works and the test I ran to be sure, so I deleted the paragraph recommending it.</p>
<hr />
<div><!-- <br />
***************************<br />
* WORKING IN PROGRESS !!! *<br />
***************************<br />
--><br />
{{av}}<br />
{{human}}<br />
Mechanical logic is one discipline of {{l|computing|computing}} using mechanical {{l|power|power}} to perform logical operations. In this case powered or unpowered {{l|machine component|machine components}} represent the binary information.<br />
<br />
The principles of mechanical logic are simple. {{l|Gear assembly|Gear assemblies}} linked to {{l|trigger|triggers}} will be toggled between disengaged and engaged when they receive an on/off signal. In this manner, you can conditionally attach power supply from {{l|windmill|windmills}} or {{l|waterwheel|waterwheels}} to specially arranged gears to build logic gates. You can also connect additional gears or other machine components as load - consuming power - to a linked gear in various configurations.<br />
<br />
== Pros and cons ==<br />
<br />
* needs a substantial amount of wood to construct power supply<br />
* needs a substantial amount of {{l|mechanism|mechanism}} and therefore {{l|mechanics|mechanics}} especially when you base your gates on load<br />
* needs {{l|water|fluid}} to build converter to trigger something else than machine components<br />
<br />
* is very fast because gears don't have a reaction delay of 100 steps<br />
* is very flexible because gears can be toggled and therefore inverting input signals is very easy<br />
* is easy to reconfigure because you don't have to deal with fluid or {{l|creature|creatures}} as you have to when you stick to other computing disciplines<br />
<br />
<!-- ToDo --><br />
<!--<br />
== General concepts ==<br />
=== Load based ===<br />
=== Toggle based ===<br />
--><br />
<br />
== Power to signal converter ==<br />
When you are dealing with mechanical logic, you'll finally want or have to trigger something else than machine components like doors or bridges. Currently, there doesn't exist any {{l|trigger|trigger}} in dwarf fortress that reacts on the working state of machine components, thus power on/off. So, you'll have to convert power via pressure plates, screw pumps and fluid into an on/off signal.<br />
<div style="width:1px; white-space:nowrap;"><br />
'''Z 0'''<br />
{| cellpadding="0" cellspacing="0" style="border-spacing:0; border-style:solid; border-width:thin; border-color:#000000;"<br />
|<br />
{| cellpadding="0" cellspacing="0" style="border-spacing:0; padding:0; margin:0; vertical-align:middle;"<br />
|-<br />
|{{RTL|#DDD}}<br />
|{{RTL|#DDD}}<br />
|{{RTL|#DDD}}<br />
|{{RTL|#222}}<br />
|{{RTL|#222}}<br />
|{{RTL|#222}}<br />
|-<br />
|{{RTL|#DDD}}<br />
|{{RTL|#222|·|#BBB}}<br />
|{{RTL|#444|÷|#DDD}}<br />
|{{RTL|#444|÷|#DDD|►|#00A|center|►|#00A|center}}<br />
|{{RTL|#222|·|#BBB}}<br />
|{{RTL|#222}}<br />
|-<br />
|{{RTL|#DDD}}<br />
|{{RTL|#DDD}}<br />
|{{RTL|#DDD}}<br />
|{{RTL|#222}}<br />
|{{RTL|#222}}<br />
|{{RTL|#222}}<br />
|}<br />
|}<br />
</div><br />
<div style="width:1px; white-space:nowrap;"><br />
'''Z-1'''<br />
{| cellpadding="0" cellspacing="0" style="border-spacing:0; border-style:solid; border-width:thin; border-color:#000000;"<br />
|<br />
{| cellpadding="0" cellspacing="0" style="border-spacing:0; padding:0; margin:0; vertical-align:middle;"<br />
|-<br />
|{{RTL|#222}}<br />
|{{RTL|#222}}<br />
|{{RTL|#222}}<br />
|{{RTL|#222}}<br />
|{{RTL|#222}}<br />
|{{RTL|#222}}<br />
|-<br />
|{{RTL|#222}}<br />
|{{RTL|#00A|^|#DDD||||7|#88F|left}}<br />
|{{RTL|#DDD||||||7|#88F|left}}<br />
|{{RTL|#DDD||||||7|#88F|left}}<br />
|{{RTL|#DDD||||||7|#88F|left}}<br />
|{{RTL|#222}}<br />
|-<br />
|{{RTL|#222}}<br />
|{{RTL|#222}}<br />
|{{RTL|#222}}<br />
|{{RTL|#222}}<br />
|{{RTL|#222}}<br />
|{{RTL|#222}}<br />
|-<br />
|}<br />
|}<br />
</div><br />
<br /><br />
When the pump is connected to power, it will suck water from the pressure plate and pump it to the right. The water level on the pressure plate will fall to 0. The plate can be constructed to react on 0&hellip;3 water. You can invert it to get an off signal instead setting it to 4&hellip;7. In both cases the ''off signal'' will have a delay of 100 steps.{{Verify}} This gate is fluid conserving.<br />
<br />
==Mechanical signal-input power-output gates==<br />
* These gates can be used either by adding a power -> link signal converter (also known as a "rotation sensor"), or directly used to control pumps, such as in other logic gates (the unsourced fluid logic gates use these, for instance). The conventional "rotation sensor" consists of a pump powered by the gate's OUTPUT gear, pumping an infinite supply of water onto a water-sensing pressure plate with an infinite drain.<br />
* There are certain things important to all the gates:<br />
* Each gate has an OUTPUT gear, which will be placed next to a pump which the gate will control.<br />
* In diagrams, the OUTPUT gear is below the 'O' gear, connected to it by gears or vertical axles. The P indicates where you should hook power up, and L indicates where load (gears or pumps that don't have a water source) should be connected, and ¦ and - are horizontal axles. The Is are gears linked to INPUTs (some gates have one input, but most have two).<br />
* Gates which incorporate a NOT will have the power network branch off from the 'O' gear, and have a train of power-draining stuff connected to the input gears, whereas gates which do not incorporate a NOT will have the power connected to the input gears instead. The principle behind normal gates is that when the INPUTs are ON, power is connected. The principle behind the NOT gates is that power is always connected, but when the INPUTs are ON, a large enough power requirement is connected to send the power requirements above the power supply, shutting down the system.<br />
* If your windmills produce no power, you'll have to come up with some way to use water wheels for power instead.<br />
* You should build only enough windmills (or water wheels) to power the system, and should not connect the network for one gate to another gate's network, since that would both gates up.<br />
* The gates' instructions will explain how much load and power you need to have at each P and L in the more complicated gates.<br />
<br />
===Legend===<br />
{| class="wikitable" border="1"<br />
|-<br />
! Symbol<br />
! Meaning<br />
|-<br />
| {{diagram|[#ff0]O}}<br />
| A gear which connects to your OUTPUT gear, which outputs power when the gate is producing an ON output.<br />
|-<br />
| {{diagram|[#aaf]I}}<br />
| A gear connected to an INPUT. In most gates you will have two Is, with each one connected to a different input.<br />
|-<br />
| {{diagram|-}} and {{diagram|¦}}<br />
| Horizontal axles<br />
|-<br />
| {{diagram|[#0f0]P}}<br />
| Power goes here<br />
|-<br />
| {{diagram|[#aaf]i}}<br />
| Two more gears, each connected to the two different inputs.<br />
|-<br />
| {{diagram|[#f00]L}}<br />
| a chain of gears or pumps which serve to add load to the system, generally shutting it off when connected.<br />
|-<br />
| {{diagram|*}}<br />
| A gear which isn't linked to any inputs or outputs and just serves to connect the power or whatever.<br />
|}<br />
<br />
===Mechanical identity gate ===<br />
{{diagram|<br />
[#ff0]O[#aaf]I--[#0f0]P}}<br />
<br />
* This takes an linked input signal and converts it to power without changing it.<br />
* Connected to the input gear, such that they will only be connected to the system if the input gear is receiving an ON signal, are gears with windmills on top of them. Build only enough windmills to power the devices that the gate's OUTPUT gear are connected to (and the gears/axles).<br />
* When the INPUT is ON, the INPUT gear will be active, and the network will provide power to the OUTPUT. When the INPUT is OFF, it will not provide power to the OUTPUT.<br />
<br />
===Mechanical NOT gate===<br />
{{diagram|<br />
[#ff0]O[#aaf]I[#f00]L<br />
¦<br />
¦<br />
[#0f0]P}}<br />
<br />
* When the INPUT is ON, the INPUT gear will be active, and the network should need more power than is available. The devices connected to OUTPUT should shut down. When INPUT is OFF, the devices should have power since the INPUT gear will be disconnected.<br />
<br />
===Mechanical NAND gate===<br />
{{diagram|<br />
[#ff0]O[#aaf]I[#aaf]I[#f00]L<br />
¦<br />
¦<br />
[#0f0]P}}<br />
<br />
* This works just like the NOT gate, except that there are two inputs and both have to be active to shut down the system instead of one. Make sure you have enough power to run the system when one of the input gears is active.<br />
<br />
===Mechanical AND gate===<br />
{{diagram|<br />
[#ff0]O[#aaf]I[#aaf]I[#0f0]P}}<br />
<br />
* This works like the identity gate, except that there are two inputs and both have to be active for the system to get power.<br />
<br />
===Mechanical OR gate===<br />
{{diagram|<br />
[#ff0]O[#aaf]I<br />
[#aaf]I*[#0f0]P}}<br />
<br />
* This works like the identity gate, except that there are two inputs, and if either is active, the system receives power. Note that the entire power network is connected to both inputs, such that if either input is active the entire power network is powering the system.<br />
<br />
===Mechanical NOR gate===<br />
{{diagram|<br />
[#aaf]I*[#f00]L<br />
[#ff0]O[#aaf]I<br />
¦<br />
¦<br />
[#0f0]P}}<br />
<br />
* This works like the NOT gate, except that there are two inputs, and if either is active, the gear train or pump stack signified by the 'L' will be connected to the system. You need to have enough load to push power requirements above the amount of power produced by the power supply, shutting the system down.<br />
<br />
===Mechanical XOR gate===<br />
{{diagram|<br />
[#ff0]O[#aaf]I<br />
[#aaf]I*--*[#0f0]P<br />
[#000].[#aaf]i[#000].[#000].[#aaf]i<br />
[#000].[#f00]L[#000].[#000].[#f00]L}}<br />
<br />
<br />
* Except for the 'i's and 'L's, this gate is identical to the OR gate. The additional components add the 'exclusive' part of the 'XOR' to the gate.<br />
* This gate may be a bit difficult to construct. First, the 'i's are additional gears connected to each of your inputs, and the Ls are additional load, however, neither load by itself should be enough to shut down the system. However, you need to make the two sets of load large enough that if both inputs are active at the same time, their power requirements become large enough to shut down the system, without making them large enough to shut it down when only one of them is active. It'll just require a little math on your part.<br />
<br />
===Mechanical XNOR gate===<br />
{{diagram|<br />
[#000].[#000].[#aaf]I*[#f00]L<br />
[#000].[#000].[#ff0]O[#aaf]I<br />
[#000].[#000].¦<br />
[#0f0]P[#aaf]-*[#aaf]i-[#0f0]P<br />
[#000].[#000].[#aaf]i<br />
[#000].[#000].¦<br />
[#000].[#000].[#0f0]P}}<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! A<br />
! B<br />
! Drain<br />
! Power<br />
! Extra Power<br />
! Result<br />
|-<br />
| 0<br />
| 0<br />
| No<br />
| Yes<br />
| No<br />
| 1<br />
|-<br />
| 0<br />
| 1<br />
| Yes<br />
| Yes<br />
| Half<br />
| 0<br />
|-<br />
| 1<br />
| 0<br />
| Yes<br />
| Yes<br />
| Half<br />
| 0<br />
|-<br />
| 1<br />
| 1<br />
| Yes<br />
| Yes<br />
| Full<br />
| 1<br />
|} <br />
<br />
* The XNOR gate is an equality gate: The output is ON when both inputs are equal, and OFF when they are not equal.<br />
* This gate may be '''even more complicated''' to build than the XOR gate!<br />
* First, your 'i's are again gears connected to your two inputs. The two extra Ps to the right and below them are additional power sources, ideally only one windmill each.<br />
* Here's where it gets complicated. The load has to be sufficient to shut down the system even when ONE of the inputs' additional power supplies are connected. However, when BOTH inputs are on, there needs to be enough power from both additional Ps to bring the system back online.<br />
* Thus our gate does what it is supposed to: Produce enough power to have the OUTPUT gear be ON when both A and B are either 0 or 1, but not when they are not equal.</div>SLhttp://dwarffortresswiki.org/index.php?title=v0.31_Talk:Pre-Toggled_Mechanical_Logic&diff=102361v0.31 Talk:Pre-Toggled Mechanical Logic2010-05-02T20:56:44Z<p>SL: Created page with 'Did you test any of this before writing this up and linking to it from the mechanical logic page? This doesn't work the way you seem to think. Once your inputs have toggled once,…'</p>
<hr />
<div>Did you test any of this before writing this up and linking to it from the mechanical logic page? This doesn't work the way you seem to think. Once your inputs have toggled once, your pre-toggled gears will revert back to normal and you will, for instance, instead of a NAND gate, have an OR gate. When an object sends a state, it sends an OFF/ON signal corresponding to the input's state. It does not send a TOGGLE-STATE signal. Here, I built one of them and tested it: Your NAND gate is actually an OR gate, because pre-toggling doesn't do what you think it does. http://mkv25.net/dfma/movie-2151-pre-togglednandbecominganorgate --[[User:SL|SL]] 20:56, 2 May 2010 (UTC)</div>SLhttp://dwarffortresswiki.org/index.php?title=v0.31:Mechanical_logic&diff=102330v0.31:Mechanical logic2010-05-02T19:06:15Z<p>SL: /* Power to signal converter */</p>
<hr />
<div><!-- <br />
***************************<br />
* WORKING IN PROGRESS !!! *<br />
***************************<br />
--><br />
{{av}}<br />
{{elven}}<br />
Mechanical logic is one discipline of {{l|computing|computing}} using mechanical {{l|power|power}} to perform logical operations. In this case powered or unpowered {{l|machine component|machine components}} represent the binary information.<br />
<br />
The principles of mechanical logic are simple. {{l|Gear assembly|Gear assemblies}} linked to {{l|trigger|triggers}} will be toggled between disengaged and engaged when they receive an on/off signal. In this manner, you can conditionally attach power supply from {{l|windmill|windmills}} or {{l|waterwheel|waterwheels}} to specially arranged gears to build logic gates. You can also connect additional gears or other machine components as load - consuming power - to a linked gear in various configurations.<br />
<br />
An alternative to using the gates listed here that require an extra load of gears is to use [[Pre-Toggled Mechanical Logic]]. This logic discipline has the benefit of being far easier to power, since it does not rely on extra gears to force a gear to disable in certain circumstances.<br />
<br />
== Pros and cons ==<br />
<br />
* needs a substantial amount of wood to construct power supply<br />
* needs a substantial amount of {{l|mechanism|mechanism}} and therefore {{l|mechanics|mechanics}} especially when you base your gates on load<br />
* needs {{l|water|fluid}} to build converter to trigger something else than machine components<br />
<br />
* is very fast because gears don't have a reaction delay of 100 steps<br />
* is very flexible because gears can be toggled and therefore inverting input signals is very easy<br />
* is easy to reconfigure because you don't have to deal with fluid or {{l|creature|creatures}} as you have to when you stick to other computing disciplines<br />
<br />
<!-- ToDo --><br />
<!--<br />
== General concepts ==<br />
=== Load based ===<br />
=== Toggle based ===<br />
--><br />
<br />
== Power to signal converter ==<br />
When you are dealing with mechanical logic, you'll finally want or have to trigger something else than machine components like doors or bridges. Currently, there doesn't exist any {{l|trigger|trigger}} in dwarf fortress that reacts on the working state of machine components, thus power on/off. So, you'll have to convert power via pressure plates, screw pumps and fluid into an on/off signal.<br />
<div style="width:1px; white-space:nowrap;"><br />
'''Z 0'''<br />
{| cellpadding="0" cellspacing="0" style="border-spacing:0; border-style:solid; border-width:thin; border-color:#000000;"<br />
|<br />
{| cellpadding="0" cellspacing="0" style="border-spacing:0; padding:0; margin:0; vertical-align:middle;"<br />
|-<br />
|{{RTL|#DDD}}<br />
|{{RTL|#DDD}}<br />
|{{RTL|#DDD}}<br />
|{{RTL|#222}}<br />
|{{RTL|#222}}<br />
|{{RTL|#222}}<br />
|-<br />
|{{RTL|#DDD}}<br />
|{{RTL|#222|·|#BBB}}<br />
|{{RTL|#444|÷|#DDD}}<br />
|{{RTL|#444|÷|#DDD|►|#00A|center|►|#00A|center}}<br />
|{{RTL|#222|·|#BBB}}<br />
|{{RTL|#222}}<br />
|-<br />
|{{RTL|#DDD}}<br />
|{{RTL|#DDD}}<br />
|{{RTL|#DDD}}<br />
|{{RTL|#222}}<br />
|{{RTL|#222}}<br />
|{{RTL|#222}}<br />
|}<br />
|}<br />
</div><br />
<div style="width:1px; white-space:nowrap;"><br />
'''Z-1'''<br />
{| cellpadding="0" cellspacing="0" style="border-spacing:0; border-style:solid; border-width:thin; border-color:#000000;"<br />
|<br />
{| cellpadding="0" cellspacing="0" style="border-spacing:0; padding:0; margin:0; vertical-align:middle;"<br />
|-<br />
|{{RTL|#222}}<br />
|{{RTL|#222}}<br />
|{{RTL|#222}}<br />
|{{RTL|#222}}<br />
|{{RTL|#222}}<br />
|{{RTL|#222}}<br />
|-<br />
|{{RTL|#222}}<br />
|{{RTL|#00A|^|#DDD||||7|#88F|left}}<br />
|{{RTL|#DDD||||||7|#88F|left}}<br />
|{{RTL|#DDD||||||7|#88F|left}}<br />
|{{RTL|#DDD||||||7|#88F|left}}<br />
|{{RTL|#222}}<br />
|-<br />
|{{RTL|#222}}<br />
|{{RTL|#222}}<br />
|{{RTL|#222}}<br />
|{{RTL|#222}}<br />
|{{RTL|#222}}<br />
|{{RTL|#222}}<br />
|-<br />
|}<br />
|}<br />
</div><br />
<br /><br />
When the pump is connected to power, it will suck water from the pressure plate and pump it to the right. The water level on the pressure plate will fall to 0. The plate can be constructed to react on 0&hellip;3 water. You can invert it to get an off signal instead setting it to 4&hellip;7. In both cases the ''off signal'' will have a delay of 100 steps.{{Verify}} This gate is fluid conserving.<br />
<br />
==Mechanical signal-input power-output gates==<br />
* These gates can be used either by adding a power -> link signal converter (also known as a "rotation sensor"), or directly used to control pumps, such as in other logic gates (the unsourced fluid logic gates use these, for instance). The conventional "rotation sensor" consists of a pump powered by the gate's OUTPUT gear, pumping an infinite supply of water onto a water-sensing pressure plate with an infinite drain.<br />
* There are certain things important to all the gates:<br />
* Each gate has an OUTPUT gear, which will be placed next to a pump which the gate will control.<br />
* In diagrams, the OUTPUT gear is below the 'O' gear, connected to it by gears or vertical axles. The P indicates where you should hook power up, and L indicates where load (gears or pumps that don't have a water source) should be connected, and ¦ and - are horizontal axles. The Is are gears linked to INPUTs (some gates have one input, but most have two).<br />
* Gates which incorporate a NOT will have the power network branch off from the 'O' gear, and have a train of power-draining stuff connected to the input gears, whereas gates which do not incorporate a NOT will have the power connected to the input gears instead. The principle behind normal gates is that when the INPUTs are ON, power is connected. The principle behind the NOT gates is that power is always connected, but when the INPUTs are ON, a large enough power requirement is connected to send the power requirements above the power supply, shutting down the system.<br />
* If your windmills produce no power, you'll have to come up with some way to use water wheels for power instead.<br />
* You should build only enough windmills (or water wheels) to power the system, and should not connect the network for one gate to another gate's network, since that would both gates up.<br />
* The gates' instructions will explain how much load and power you need to have at each P and L in the more complicated gates.<br />
<br />
===Legend===<br />
{| class="wikitable" border="1"<br />
|-<br />
! Symbol<br />
! Meaning<br />
|-<br />
| {{diagram|[#ff0]O}}<br />
| A gear which connects to your OUTPUT gear, which outputs power when the gate is producing an ON output.<br />
|-<br />
| {{diagram|[#aaf]I}}<br />
| A gear connected to an INPUT. In most gates you will have two Is, with each one connected to a different input.<br />
|-<br />
| {{diagram|-}} and {{diagram|¦}}<br />
| Horizontal axles<br />
|-<br />
| {{diagram|[#0f0]P}}<br />
| Power goes here<br />
|-<br />
| {{diagram|[#aaf]i}}<br />
| Two more gears, each connected to the two different inputs.<br />
|-<br />
| {{diagram|[#f00]L}}<br />
| a chain of gears or pumps which serve to add load to the system, generally shutting it off when connected.<br />
|-<br />
| {{diagram|*}}<br />
| A gear which isn't linked to any inputs or outputs and just serves to connect the power or whatever.<br />
|}<br />
<br />
===Mechanical identity gate ===<br />
{{diagram|<br />
[#ff0]O[#aaf]I--[#0f0]P}}<br />
<br />
* This takes an linked input signal and converts it to power without changing it.<br />
* Connected to the input gear, such that they will only be connected to the system if the input gear is receiving an ON signal, are gears with windmills on top of them. Build only enough windmills to power the devices that the gate's OUTPUT gear are connected to (and the gears/axles).<br />
* When the INPUT is ON, the INPUT gear will be active, and the network will provide power to the OUTPUT. When the INPUT is OFF, it will not provide power to the OUTPUT.<br />
<br />
===Mechanical NOT gate===<br />
{{diagram|<br />
[#ff0]O[#aaf]I[#f00]L<br />
¦<br />
¦<br />
[#0f0]P}}<br />
<br />
* When the INPUT is ON, the INPUT gear will be active, and the network should need more power than is available. The devices connected to OUTPUT should shut down. When INPUT is OFF, the devices should have power since the INPUT gear will be disconnected.<br />
<br />
===Mechanical NAND gate===<br />
{{diagram|<br />
[#ff0]O[#aaf]I[#aaf]I[#f00]L<br />
¦<br />
¦<br />
[#0f0]P}}<br />
<br />
* This works just like the NOT gate, except that there are two inputs and both have to be active to shut down the system instead of one. Make sure you have enough power to run the system when one of the input gears is active.<br />
<br />
===Mechanical AND gate===<br />
{{diagram|<br />
[#ff0]O[#aaf]I[#aaf]I[#0f0]P}}<br />
<br />
* This works like the identity gate, except that there are two inputs and both have to be active for the system to get power.<br />
<br />
===Mechanical OR gate===<br />
{{diagram|<br />
[#ff0]O[#aaf]I<br />
[#aaf]I*[#0f0]P}}<br />
<br />
* This works like the identity gate, except that there are two inputs, and if either is active, the system receives power. Note that the entire power network is connected to both inputs, such that if either input is active the entire power network is powering the system.<br />
<br />
===Mechanical NOR gate===<br />
{{diagram|<br />
[#aaf]I*[#f00]L<br />
[#ff0]O[#aaf]I<br />
¦<br />
¦<br />
[#0f0]P}}<br />
<br />
* This works like the NOT gate, except that there are two inputs, and if either is active, the gear train or pump stack signified by the 'L' will be connected to the system. You need to have enough load to push power requirements above the amount of power produced by the power supply, shutting the system down.<br />
<br />
===Mechanical XOR gate===<br />
{{diagram|<br />
[#ff0]O[#aaf]I<br />
[#aaf]I*--*[#0f0]P<br />
[#000].[#aaf]i[#000].[#000].[#aaf]i<br />
[#000].[#f00]L[#000].[#000].[#f00]L}}<br />
<br />
<br />
* Except for the 'i's and 'L's, this gate is identical to the OR gate. The additional components add the 'exclusive' part of the 'XOR' to the gate.<br />
* This gate may be a bit difficult to construct. First, the 'i's are additional gears connected to each of your inputs, and the Ls are additional load, however, neither load by itself should be enough to shut down the system. However, you need to make the two sets of load large enough that if both inputs are active at the same time, their power requirements become large enough to shut down the system, without making them large enough to shut it down when only one of them is active. It'll just require a little math on your part.<br />
<br />
===Mechanical XNOR gate===<br />
{{diagram|<br />
[#000].[#000].[#aaf]I*[#f00]L<br />
[#000].[#000].[#ff0]O[#aaf]I<br />
[#000].[#000].¦<br />
[#0f0]P[#aaf]-*[#aaf]i-[#0f0]P<br />
[#000].[#000].[#aaf]i<br />
[#000].[#000].¦<br />
[#000].[#000].[#0f0]P}}<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! A<br />
! B<br />
! Drain<br />
! Power<br />
! Extra Power<br />
! Result<br />
|-<br />
| 0<br />
| 0<br />
| No<br />
| Yes<br />
| No<br />
| 1<br />
|-<br />
| 0<br />
| 1<br />
| Yes<br />
| Yes<br />
| Half<br />
| 0<br />
|-<br />
| 1<br />
| 0<br />
| Yes<br />
| Yes<br />
| Half<br />
| 0<br />
|-<br />
| 1<br />
| 1<br />
| Yes<br />
| Yes<br />
| Full<br />
| 1<br />
|} <br />
<br />
* The XNOR gate is an equality gate: The output is ON when both inputs are equal, and OFF when they are not equal.<br />
* This gate may be '''even more complicated''' to build than the XOR gate!<br />
* First, your 'i's are again gears connected to your two inputs. The two extra Ps to the right and below them are additional power sources, ideally only one windmill each.<br />
* Here's where it gets complicated. The load has to be sufficient to shut down the system even when ONE of the inputs' additional power supplies are connected. However, when BOTH inputs are on, there needs to be enough power from both additional Ps to bring the system back online.<br />
* Thus our gate does what it is supposed to: Produce enough power to have the OUTPUT gear be ON when both A and B are either 0 or 1, but not when they are not equal.</div>SLhttp://dwarffortresswiki.org/index.php?title=v0.31:Mechanical_logic&diff=91994v0.31:Mechanical logic2010-04-13T05:47:32Z<p>SL: /* Mechanical XNOR gate */</p>
<hr />
<div>{{av}}<br />
{{human}}<br />
Mechanical logic is a discipline of {{l|Computing|Computing}} which uses axles, gears, {{l|power|power}}, and load to perform logical computations and turn power on and off. At present, to convert a power output into a link signal output such as most dwarven devices (bridge, door, hatch, cage, etc) can use, you would need to build a power -> signal converter (aka "rotation sensor") out of a pump and pressure plate with (currently, no other designs have been made) an unlimited water source and drain - one for each gate.<br />
<br />
The principles powering mechanical logic are simple: Gears linked to {{l|trigger|triggers}} will be disconnected when they receive an OFF signal. In this manner, you can conditionally attach either power supply (windmills or waterwheels) or load (additional gears or pumps) to a linked gear in various configurations in order to build logic gates.<br />
<br />
One of the weaknesses of mechanical logic is the substantial amount of materials it tends to require to construct the power and load devices, as well as the gears and axles making up the gates and connecting them to their outputs.<br />
<br />
==Mechanical signal-input power-output gates==<br />
* These gates can be used either by adding a power -> link signal converter (also known as a "rotation sensor"), or directly used to control pumps, such as in other logic gates (the unsourced fluid logic gates use these, for instance). The conventional "rotation sensor" consists of a pump powered by the gate's OUTPUT gear, pumping an infinite supply of water onto a water-sensing pressure plate with an infinite drain.<br />
* There are certain things important to all the gates:<br />
* Each gate has an OUTPUT gear, which will be placed next to a pump which the gate will control.<br />
* In diagrams, the OUTPUT gear is below the 'O' gear, connected to it by gears or vertical axles. The P indicates where you should hook power up, and L indicates where load (gears or pumps that don't have a water source) should be connected, and ¦ and - are horizontal axles. The Is are gears linked to INPUTs (some gates have one input, but most have two).<br />
* Gates which incorporate a NOT will have the power network branch off from the 'O' gear, and have a train of power-draining stuff connected to the input gears, whereas gates which do not incorporate a NOT will have the power connected to the input gears instead. The principle behind normal gates is that when the INPUTs are ON, power is connected. The principle behind the NOT gates is that power is always connected, but when the INPUTs are ON, a large enough power requirement is connected to send the power requirements above the power supply, shutting down the system.<br />
* If your windmills produce no power, you'll have to come up with some way to use water wheels for power instead.<br />
* You should build only enough windmills (or water wheels) to power the system, and should not connect the network for one gate to another gate's network, since that would both gates up.<br />
* The gates' instructions will explain how much load and power you need to have at each P and L in the more complicated gates.<br />
<br />
===Legend===<br />
{| class="wikitable" border="1"<br />
|-<br />
! Symbol<br />
! Meaning<br />
|-<br />
| {{diagram|[#ff0]O}}<br />
| A gear which connects to your OUTPUT gear, which outputs power when the gate is producing an ON output.<br />
|-<br />
| {{diagram|[#aaf]I}}<br />
| A gear connected to an INPUT. In most gates you will have two Is, with each one connected to a different input.<br />
|-<br />
| {{diagram|-}} and {{diagram|¦}}<br />
| Horizontal axles<br />
|-<br />
| {{diagram|[#0f0]P}}<br />
| Power goes here<br />
|-<br />
| {{diagram|[#aaf]i}}<br />
| Two more gears, each connected to the two different inputs.<br />
|-<br />
| {{diagram|[#f00]L}}<br />
| a chain of gears or pumps which serve to add load to the system, generally shutting it off when connected.<br />
|-<br />
| {{diagram|*}}<br />
| A gear which isn't linked to any inputs or outputs and just serves to connect the power or whatever.<br />
|}<br />
<br />
===Mechanical identity gate ===<br />
{{diagram|<br />
[#ff0]O[#aaf]I--[#0f0]P}}<br />
<br />
* This takes an linked input signal and converts it to power without changing it.<br />
* Connected to the input gear, such that they will only be connected to the system if the input gear is receiving an ON signal, are gears with windmills on top of them. Build only enough windmills to power the devices that the gate's OUTPUT gear are connected to (and the gears/axles).<br />
* When the INPUT is ON, the INPUT gear will be active, and the network will provide power to the OUTPUT. When the INPUT is OFF, it will not provide power to the OUTPUT.<br />
<br />
===Mechanical NOT gate===<br />
{{diagram|<br />
[#ff0]O[#aaf]I[#f00]L<br />
¦<br />
¦<br />
[#0f0]P}}<br />
<br />
* When the INPUT is ON, the INPUT gear will be active, and the network should need more power than is available. The devices connected to OUTPUT should shut down. When INPUT is OFF, the devices should have power since the INPUT gear will be disconnected.<br />
<br />
===Mechanical NAND gate===<br />
{{diagram|<br />
[#ff0]O[#aaf]I[#aaf]I[#f00]L<br />
¦<br />
¦<br />
[#0f0]P}}<br />
<br />
* This works just like the NOT gate, except that there are two inputs and both have to be active to shut down the system instead of one. Make sure you have enough power to run the system when one of the input gears is active.<br />
<br />
===Mechanical AND gate===<br />
{{diagram|<br />
[#ff0]O[#aaf]I[#aaf]I[#0f0]P}}<br />
<br />
* This works like the identity gate, except that there are two inputs and both have to be active for the system to get power.<br />
<br />
===Mechanical OR gate===<br />
{{diagram|<br />
[#ff0]O[#aaf]I<br />
[#aaf]I*[#0f0]P}}<br />
<br />
* This works like the identity gate, except that there are two inputs, and if either is active, the system receives power. Note that the entire power network is connected to both inputs, such that if either input is active the entire power network is powering the system.<br />
<br />
===Mechanical NOR gate===<br />
{{diagram|<br />
[#aaf]I*[#f00]L<br />
[#ff0]O[#aaf]I<br />
¦<br />
¦<br />
[#0f0]P}}<br />
<br />
* This works like the NOT gate, except that there are two inputs, and if either is active, the gear train or pump stack signified by the 'L' will be connected to the system. You need to have enough load to push power requirements above the amount of power produced by the power supply, shutting the system down.<br />
<br />
===Mechanical XOR gate===<br />
{{diagram|<br />
[#ff0]O[#aaf]I<br />
[#aaf]I*--*[#0f0]P<br />
[#000].[#aaf]i[#000].[#000].[#aaf]i<br />
[#000].[#f00]L[#000].[#000].[#f00]L}}<br />
<br />
<br />
* Except for the 'i's and 'L's, this gate is identical to the OR gate. The additional components add the 'exclusive' part of the 'XOR' to the gate.<br />
* This gate may be a bit difficult to construct. First, the 'i's are additional gears connected to each of your inputs, and the Ls are additional load, however, neither load by itself should be enough to shut down the system. However, you need to make the two sets of load large enough that if both inputs are active at the same time, their power requirements become large enough to shut down the system, without making them large enough to shut it down when only one of them is active. It'll just require a little math on your part.<br />
<br />
===Mechanical XNOR gate===<br />
{{diagram|<br />
[#000].[#000].[#aaf]I*[#f00]L<br />
[#000].[#000].[#ff0]O[#aaf]I<br />
[#000].[#000].¦<br />
[#0f0]P[#aaf]-*[#aaf]i-[#0f0]P<br />
[#000].[#000].[#aaf]i<br />
[#000].[#000].¦<br />
[#000].[#000].[#0f0]P}}<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! A<br />
! B<br />
! Drain<br />
! Power<br />
! Extra Power<br />
! Result<br />
|-<br />
| 0<br />
| 0<br />
| No<br />
| Yes<br />
| No<br />
| 1<br />
|-<br />
| 0<br />
| 1<br />
| Yes<br />
| Yes<br />
| Half<br />
| 0<br />
|-<br />
| 1<br />
| 0<br />
| Yes<br />
| Yes<br />
| Half<br />
| 0<br />
|-<br />
| 1<br />
| 1<br />
| Yes<br />
| Yes<br />
| Full<br />
| 1<br />
|} <br />
<br />
* The XNOR gate is an equality gate: The output is ON when both inputs are equal, and OFF when they are not equal.<br />
* This gate may be '''even more complicated''' to build than the XOR gate!<br />
* First, your 'i's are again gears connected to your two inputs. The two extra Ps to the right and below them are additional power sources, ideally only one windmill each.<br />
* Here's where it gets complicated. The load has to be sufficient to shut down the system even when ONE of the inputs' additional power supplies are connected. However, when BOTH inputs are on, there needs to be enough power from both additional Ps to bring the system back online.<br />
* Thus our gate does what it is supposed to: Produce enough power to have the OUTPUT gear be ON when both A and B are either 0 or 1, but not when they are not equal.</div>SLhttp://dwarffortresswiki.org/index.php?title=v0.31:Mechanical_logic&diff=91993v0.31:Mechanical logic2010-04-13T05:47:19Z<p>SL: /* Mechanical XNOR gate */</p>
<hr />
<div>{{av}}<br />
{{human}}<br />
Mechanical logic is a discipline of {{l|Computing|Computing}} which uses axles, gears, {{l|power|power}}, and load to perform logical computations and turn power on and off. At present, to convert a power output into a link signal output such as most dwarven devices (bridge, door, hatch, cage, etc) can use, you would need to build a power -> signal converter (aka "rotation sensor") out of a pump and pressure plate with (currently, no other designs have been made) an unlimited water source and drain - one for each gate.<br />
<br />
The principles powering mechanical logic are simple: Gears linked to {{l|trigger|triggers}} will be disconnected when they receive an OFF signal. In this manner, you can conditionally attach either power supply (windmills or waterwheels) or load (additional gears or pumps) to a linked gear in various configurations in order to build logic gates.<br />
<br />
One of the weaknesses of mechanical logic is the substantial amount of materials it tends to require to construct the power and load devices, as well as the gears and axles making up the gates and connecting them to their outputs.<br />
<br />
==Mechanical signal-input power-output gates==<br />
* These gates can be used either by adding a power -> link signal converter (also known as a "rotation sensor"), or directly used to control pumps, such as in other logic gates (the unsourced fluid logic gates use these, for instance). The conventional "rotation sensor" consists of a pump powered by the gate's OUTPUT gear, pumping an infinite supply of water onto a water-sensing pressure plate with an infinite drain.<br />
* There are certain things important to all the gates:<br />
* Each gate has an OUTPUT gear, which will be placed next to a pump which the gate will control.<br />
* In diagrams, the OUTPUT gear is below the 'O' gear, connected to it by gears or vertical axles. The P indicates where you should hook power up, and L indicates where load (gears or pumps that don't have a water source) should be connected, and ¦ and - are horizontal axles. The Is are gears linked to INPUTs (some gates have one input, but most have two).<br />
* Gates which incorporate a NOT will have the power network branch off from the 'O' gear, and have a train of power-draining stuff connected to the input gears, whereas gates which do not incorporate a NOT will have the power connected to the input gears instead. The principle behind normal gates is that when the INPUTs are ON, power is connected. The principle behind the NOT gates is that power is always connected, but when the INPUTs are ON, a large enough power requirement is connected to send the power requirements above the power supply, shutting down the system.<br />
* If your windmills produce no power, you'll have to come up with some way to use water wheels for power instead.<br />
* You should build only enough windmills (or water wheels) to power the system, and should not connect the network for one gate to another gate's network, since that would both gates up.<br />
* The gates' instructions will explain how much load and power you need to have at each P and L in the more complicated gates.<br />
<br />
===Legend===<br />
{| class="wikitable" border="1"<br />
|-<br />
! Symbol<br />
! Meaning<br />
|-<br />
| {{diagram|[#ff0]O}}<br />
| A gear which connects to your OUTPUT gear, which outputs power when the gate is producing an ON output.<br />
|-<br />
| {{diagram|[#aaf]I}}<br />
| A gear connected to an INPUT. In most gates you will have two Is, with each one connected to a different input.<br />
|-<br />
| {{diagram|-}} and {{diagram|¦}}<br />
| Horizontal axles<br />
|-<br />
| {{diagram|[#0f0]P}}<br />
| Power goes here<br />
|-<br />
| {{diagram|[#aaf]i}}<br />
| Two more gears, each connected to the two different inputs.<br />
|-<br />
| {{diagram|[#f00]L}}<br />
| a chain of gears or pumps which serve to add load to the system, generally shutting it off when connected.<br />
|-<br />
| {{diagram|*}}<br />
| A gear which isn't linked to any inputs or outputs and just serves to connect the power or whatever.<br />
|}<br />
<br />
===Mechanical identity gate ===<br />
{{diagram|<br />
[#ff0]O[#aaf]I--[#0f0]P}}<br />
<br />
* This takes an linked input signal and converts it to power without changing it.<br />
* Connected to the input gear, such that they will only be connected to the system if the input gear is receiving an ON signal, are gears with windmills on top of them. Build only enough windmills to power the devices that the gate's OUTPUT gear are connected to (and the gears/axles).<br />
* When the INPUT is ON, the INPUT gear will be active, and the network will provide power to the OUTPUT. When the INPUT is OFF, it will not provide power to the OUTPUT.<br />
<br />
===Mechanical NOT gate===<br />
{{diagram|<br />
[#ff0]O[#aaf]I[#f00]L<br />
¦<br />
¦<br />
[#0f0]P}}<br />
<br />
* When the INPUT is ON, the INPUT gear will be active, and the network should need more power than is available. The devices connected to OUTPUT should shut down. When INPUT is OFF, the devices should have power since the INPUT gear will be disconnected.<br />
<br />
===Mechanical NAND gate===<br />
{{diagram|<br />
[#ff0]O[#aaf]I[#aaf]I[#f00]L<br />
¦<br />
¦<br />
[#0f0]P}}<br />
<br />
* This works just like the NOT gate, except that there are two inputs and both have to be active to shut down the system instead of one. Make sure you have enough power to run the system when one of the input gears is active.<br />
<br />
===Mechanical AND gate===<br />
{{diagram|<br />
[#ff0]O[#aaf]I[#aaf]I[#0f0]P}}<br />
<br />
* This works like the identity gate, except that there are two inputs and both have to be active for the system to get power.<br />
<br />
===Mechanical OR gate===<br />
{{diagram|<br />
[#ff0]O[#aaf]I<br />
[#aaf]I*[#0f0]P}}<br />
<br />
* This works like the identity gate, except that there are two inputs, and if either is active, the system receives power. Note that the entire power network is connected to both inputs, such that if either input is active the entire power network is powering the system.<br />
<br />
===Mechanical NOR gate===<br />
{{diagram|<br />
[#aaf]I*[#f00]L<br />
[#ff0]O[#aaf]I<br />
¦<br />
¦<br />
[#0f0]P}}<br />
<br />
* This works like the NOT gate, except that there are two inputs, and if either is active, the gear train or pump stack signified by the 'L' will be connected to the system. You need to have enough load to push power requirements above the amount of power produced by the power supply, shutting the system down.<br />
<br />
===Mechanical XOR gate===<br />
{{diagram|<br />
[#ff0]O[#aaf]I<br />
[#aaf]I*--*[#0f0]P<br />
[#000].[#aaf]i[#000].[#000].[#aaf]i<br />
[#000].[#f00]L[#000].[#000].[#f00]L}}<br />
<br />
<br />
* Except for the 'i's and 'L's, this gate is identical to the OR gate. The additional components add the 'exclusive' part of the 'XOR' to the gate.<br />
* This gate may be a bit difficult to construct. First, the 'i's are additional gears connected to each of your inputs, and the Ls are additional load, however, neither load by itself should be enough to shut down the system. However, you need to make the two sets of load large enough that if both inputs are active at the same time, their power requirements become large enough to shut down the system, without making them large enough to shut it down when only one of them is active. It'll just require a little math on your part.<br />
<br />
===Mechanical XNOR gate===<br />
{{diagram|<br />
[#000].[#000].[#aaf]I*[#f00]L<br />
[#000].[#000].[#ff0]O[#aaf]I<br />
[#000].[#000].¦<br />
[#0f0]P[#aaf]-*[#aaf]i-[#0f0]P<br />
[#000].[#000].[#aaf]i<br />
[#000].[#000].¦<br />
[#000].[#000].[#0f0]P}}<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! A<br />
! B<br />
! Drain<br />
! Power<br />
! Extra Power<br />
! Result<br />
|-<br />
| 0<br />
| 0<br />
| Yes<br />
| No<br />
| No<br />
| 1<br />
|-<br />
| 0<br />
| 1<br />
| Yes<br />
| Yes<br />
| Half<br />
| 0<br />
|-<br />
| 1<br />
| 0<br />
| Yes<br />
| Yes<br />
| Half<br />
| 0<br />
|-<br />
| 1<br />
| 1<br />
| Yes<br />
| Yes<br />
| Full<br />
| 1<br />
|} <br />
<br />
* The XNOR gate is an equality gate: The output is ON when both inputs are equal, and OFF when they are not equal.<br />
* This gate may be '''even more complicated''' to build than the XOR gate!<br />
* First, your 'i's are again gears connected to your two inputs. The two extra Ps to the right and below them are additional power sources, ideally only one windmill each.<br />
* Here's where it gets complicated. The load has to be sufficient to shut down the system even when ONE of the inputs' additional power supplies are connected. However, when BOTH inputs are on, there needs to be enough power from both additional Ps to bring the system back online.<br />
* Thus our gate does what it is supposed to: Produce enough power to have the OUTPUT gear be ON when both A and B are either 0 or 1, but not when they are not equal.</div>SLhttp://dwarffortresswiki.org/index.php?title=v0.31:Mechanical_logic&diff=91992v0.31:Mechanical logic2010-04-13T05:45:38Z<p>SL: /* Mechanical identity gate */</p>
<hr />
<div>{{av}}<br />
{{human}}<br />
Mechanical logic is a discipline of {{l|Computing|Computing}} which uses axles, gears, {{l|power|power}}, and load to perform logical computations and turn power on and off. At present, to convert a power output into a link signal output such as most dwarven devices (bridge, door, hatch, cage, etc) can use, you would need to build a power -> signal converter (aka "rotation sensor") out of a pump and pressure plate with (currently, no other designs have been made) an unlimited water source and drain - one for each gate.<br />
<br />
The principles powering mechanical logic are simple: Gears linked to {{l|trigger|triggers}} will be disconnected when they receive an OFF signal. In this manner, you can conditionally attach either power supply (windmills or waterwheels) or load (additional gears or pumps) to a linked gear in various configurations in order to build logic gates.<br />
<br />
One of the weaknesses of mechanical logic is the substantial amount of materials it tends to require to construct the power and load devices, as well as the gears and axles making up the gates and connecting them to their outputs.<br />
<br />
==Mechanical signal-input power-output gates==<br />
* These gates can be used either by adding a power -> link signal converter (also known as a "rotation sensor"), or directly used to control pumps, such as in other logic gates (the unsourced fluid logic gates use these, for instance). The conventional "rotation sensor" consists of a pump powered by the gate's OUTPUT gear, pumping an infinite supply of water onto a water-sensing pressure plate with an infinite drain.<br />
* There are certain things important to all the gates:<br />
* Each gate has an OUTPUT gear, which will be placed next to a pump which the gate will control.<br />
* In diagrams, the OUTPUT gear is below the 'O' gear, connected to it by gears or vertical axles. The P indicates where you should hook power up, and L indicates where load (gears or pumps that don't have a water source) should be connected, and ¦ and - are horizontal axles. The Is are gears linked to INPUTs (some gates have one input, but most have two).<br />
* Gates which incorporate a NOT will have the power network branch off from the 'O' gear, and have a train of power-draining stuff connected to the input gears, whereas gates which do not incorporate a NOT will have the power connected to the input gears instead. The principle behind normal gates is that when the INPUTs are ON, power is connected. The principle behind the NOT gates is that power is always connected, but when the INPUTs are ON, a large enough power requirement is connected to send the power requirements above the power supply, shutting down the system.<br />
* If your windmills produce no power, you'll have to come up with some way to use water wheels for power instead.<br />
* You should build only enough windmills (or water wheels) to power the system, and should not connect the network for one gate to another gate's network, since that would both gates up.<br />
* The gates' instructions will explain how much load and power you need to have at each P and L in the more complicated gates.<br />
<br />
===Legend===<br />
{| class="wikitable" border="1"<br />
|-<br />
! Symbol<br />
! Meaning<br />
|-<br />
| {{diagram|[#ff0]O}}<br />
| A gear which connects to your OUTPUT gear, which outputs power when the gate is producing an ON output.<br />
|-<br />
| {{diagram|[#aaf]I}}<br />
| A gear connected to an INPUT. In most gates you will have two Is, with each one connected to a different input.<br />
|-<br />
| {{diagram|-}} and {{diagram|¦}}<br />
| Horizontal axles<br />
|-<br />
| {{diagram|[#0f0]P}}<br />
| Power goes here<br />
|-<br />
| {{diagram|[#aaf]i}}<br />
| Two more gears, each connected to the two different inputs.<br />
|-<br />
| {{diagram|[#f00]L}}<br />
| a chain of gears or pumps which serve to add load to the system, generally shutting it off when connected.<br />
|-<br />
| {{diagram|*}}<br />
| A gear which isn't linked to any inputs or outputs and just serves to connect the power or whatever.<br />
|}<br />
<br />
===Mechanical identity gate ===<br />
{{diagram|<br />
[#ff0]O[#aaf]I--[#0f0]P}}<br />
<br />
* This takes an linked input signal and converts it to power without changing it.<br />
* Connected to the input gear, such that they will only be connected to the system if the input gear is receiving an ON signal, are gears with windmills on top of them. Build only enough windmills to power the devices that the gate's OUTPUT gear are connected to (and the gears/axles).<br />
* When the INPUT is ON, the INPUT gear will be active, and the network will provide power to the OUTPUT. When the INPUT is OFF, it will not provide power to the OUTPUT.<br />
<br />
===Mechanical NOT gate===<br />
{{diagram|<br />
[#ff0]O[#aaf]I[#f00]L<br />
¦<br />
¦<br />
[#0f0]P}}<br />
<br />
* When the INPUT is ON, the INPUT gear will be active, and the network should need more power than is available. The devices connected to OUTPUT should shut down. When INPUT is OFF, the devices should have power since the INPUT gear will be disconnected.<br />
<br />
===Mechanical NAND gate===<br />
{{diagram|<br />
[#ff0]O[#aaf]I[#aaf]I[#f00]L<br />
¦<br />
¦<br />
[#0f0]P}}<br />
<br />
* This works just like the NOT gate, except that there are two inputs and both have to be active to shut down the system instead of one. Make sure you have enough power to run the system when one of the input gears is active.<br />
<br />
===Mechanical AND gate===<br />
{{diagram|<br />
[#ff0]O[#aaf]I[#aaf]I[#0f0]P}}<br />
<br />
* This works like the identity gate, except that there are two inputs and both have to be active for the system to get power.<br />
<br />
===Mechanical OR gate===<br />
{{diagram|<br />
[#ff0]O[#aaf]I<br />
[#aaf]I*[#0f0]P}}<br />
<br />
* This works like the identity gate, except that there are two inputs, and if either is active, the system receives power. Note that the entire power network is connected to both inputs, such that if either input is active the entire power network is powering the system.<br />
<br />
===Mechanical NOR gate===<br />
{{diagram|<br />
[#aaf]I*[#f00]L<br />
[#ff0]O[#aaf]I<br />
¦<br />
¦<br />
[#0f0]P}}<br />
<br />
* This works like the NOT gate, except that there are two inputs, and if either is active, the gear train or pump stack signified by the 'L' will be connected to the system. You need to have enough load to push power requirements above the amount of power produced by the power supply, shutting the system down.<br />
<br />
===Mechanical XOR gate===<br />
{{diagram|<br />
[#ff0]O[#aaf]I<br />
[#aaf]I*--*[#0f0]P<br />
[#000].[#aaf]i[#000].[#000].[#aaf]i<br />
[#000].[#f00]L[#000].[#000].[#f00]L}}<br />
<br />
<br />
* Except for the 'i's and 'L's, this gate is identical to the OR gate. The additional components add the 'exclusive' part of the 'XOR' to the gate.<br />
* This gate may be a bit difficult to construct. First, the 'i's are additional gears connected to each of your inputs, and the Ls are additional load, however, neither load by itself should be enough to shut down the system. However, you need to make the two sets of load large enough that if both inputs are active at the same time, their power requirements become large enough to shut down the system, without making them large enough to shut it down when only one of them is active. It'll just require a little math on your part.<br />
<br />
===Mechanical XNOR gate===<br />
{{diagram|<br />
[#000].[#000].[#aaf]I*[#f00]L<br />
[#000].[#000].[#ff0]O[#aaf]I<br />
[#000].[#000].¦<br />
[#0f0]P[#aaf]-*[#aaf]i-[#0f0]P<br />
[#000].[#000].[#aaf]i<br />
[#000].[#000].¦<br />
[#000].[#000].[#0f0]P}}<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! A<br />
! B<br />
! Drain<br />
! Power<br />
! Extra Power<br />
! Result<br />
|-<br />
| 0<br />
| 0<br />
| No<br />
| No<br />
| No<br />
| 1<br />
|-<br />
| 0<br />
| 1<br />
| Yes<br />
| Yes<br />
| Half<br />
| 0<br />
|-<br />
| 1<br />
| 0<br />
| Yes<br />
| Yes<br />
| Half<br />
| 0<br />
|-<br />
| 1<br />
| 1<br />
| Yes<br />
| Yes<br />
| Full<br />
| 1<br />
|} <br />
<br />
* The XNOR gate is an equality gate: The output is ON when both inputs are equal, and OFF when they are not equal.<br />
* This gate may be '''even more complicated''' to build than the XOR gate!<br />
* First, your 'i's are again gears connected to your two inputs. The two extra Ps to the right and below them are additional power sources, ideally only one windmill each.<br />
* Here's where it gets complicated. The load has to be sufficient to shut down the system even when ONE of the inputs' additional power supplies are connected. However, when BOTH inputs are on, there needs to be enough power from both additional Ps to bring the system back online.<br />
* Thus our gate does what it is supposed to: Produce enough power to have the OUTPUT gear be ON when both A and B are either 0 or 1, but not when they are not equal.</div>SLhttp://dwarffortresswiki.org/index.php?title=v0.31:Catsplosion&diff=90081v0.31:Catsplosion2010-04-12T01:19:11Z<p>SL: </p>
<hr />
<div>{{av}}<br />
{{Elven}}<br />
Cats reproduce at a exponential rate unchecked. Soon your computer will melt from calculating the pathing. <br />
<br />
In short.<br />
Cats will eat your computer. Kill them before they have the chance.</div>SLhttp://dwarffortresswiki.org/index.php?title=v0.31:Magma&diff=90069v0.31:Magma2010-04-12T00:59:26Z<p>SL: I do not think the {{elven}} tag is supposed to be at the bottom of the page. :3</p>
<hr />
<div>{{ArticleVersion}}<br />
{{elven}}<br />
<br />
==[[Magma sea|Magma lakes]]==<br />
Magma lakes are located at the bottom of every map, forming an almost impenetrable barrier. They also provide a great source of magma. {{l|Semi-molten rock|Semi-molten rock}} can also be found around the magma lakes, and cannot be dug through.<br />
<br />
==Magma pipes==<br />
Magma pipes are present in the new version of Dwarf Fortress as well. They can be found underground, however they rarely reach the upper z-levels (40+). Most end just a few z-levels above the magma lakes, though some span up to more than 100 z-levels.<br />
Magma pipes seem to be always connected to a magma lake, and the lake and pipe can occasionally reach up to the same level, making them hard to separate. However, magma pipes can be identified by the obsidian walls which surround them.<br />
Magma pipes will slowly refill themselves, giving the player an infinite source of magma.<br />
<br />
==Volcanos==<br />
Volcanos can be found which extend all the way to the surface, but on a standard map they are exceedingly rare, if you even have any at all on your map.<br />
<br />
==Properties of magma==<br />
Magma behaves the same way as water with the exception of not being affected by {{l|pressure}}, unless pressurized by a {{l|pump}}, and apparently not showing {{l|flow}}.<br />
<br />
==Dangers of magma==<br />
Magma is not immediately fatal when first touched. It is dangerous to stand in magma, but dwarves will generally only suffer minor burns when running from a flow. Most creatures can survive standing on even a completely filled magma tile for a single turn, but any more and they will likely die.<br />
<br />
[[Category:Physics]]</div>SLhttp://dwarffortresswiki.org/index.php?title=v0.31:Magma&diff=90068v0.31:Magma2010-04-12T00:58:38Z<p>SL: Mentioning that it doesn't show flow, since the flow article says that.</p>
<hr />
<div>{{ArticleVersion}}<br />
==[[Magma sea|Magma lakes]]==<br />
Magma lakes are located at the bottom of every map, forming an almost impenetrable barrier. They also provide a great source of magma. {{l|Semi-molten rock|Semi-molten rock}} can also be found around the magma lakes, and cannot be dug through.<br />
<br />
==Magma pipes==<br />
Magma pipes are present in the new version of Dwarf Fortress as well. They can be found underground, however they rarely reach the upper z-levels (40+). Most end just a few z-levels above the magma lakes, though some span up to more than 100 z-levels.<br />
Magma pipes seem to be always connected to a magma lake, and the lake and pipe can occasionally reach up to the same level, making them hard to separate. However, magma pipes can be identified by the obsidian walls which surround them.<br />
Magma pipes will slowly refill themselves, giving the player an infinite source of magma.<br />
<br />
==Volcanos==<br />
Volcanos can be found which extend all the way to the surface, but on a standard map they are exceedingly rare, if you even have any at all on your map.<br />
<br />
==Properties of magma==<br />
Magma behaves the same way as water with the exception of not being affected by {{l|pressure}}, unless pressurized by a {{l|pump}}, and apparently not showing {{l|flow}}.<br />
<br />
==Dangers of magma==<br />
Magma is not immediately fatal when first touched. It is dangerous to stand in magma, but dwarves will generally only suffer minor burns when running from a flow. Most creatures can survive standing on even a completely filled magma tile for a single turn, but any more and they will likely die.<br />
<br />
[[Category:Physics]]<br />
{{elven}}</div>SLhttp://dwarffortresswiki.org/index.php?title=v0.31:Magma&diff=90067v0.31:Magma2010-04-12T00:57:17Z<p>SL: Changed a link to {{l|}}, added a note about volcanos after finding one in one of my worlds</p>
<hr />
<div>{{ArticleVersion}}<br />
==[[Magma sea|Magma lakes]]==<br />
Magma lakes are located at the bottom of every map, forming an almost impenetrable barrier. They also provide a great source of magma. {{l|Semi-molten rock|Semi-molten rock}} can also be found around the magma lakes, and cannot be dug through.<br />
<br />
==Magma pipes==<br />
Magma pipes are present in the new version of Dwarf Fortress as well. They can be found underground, however they rarely reach the upper z-levels (40+). Most end just a few z-levels above the magma lakes, though some span up to more than 100 z-levels.<br />
Magma pipes seem to be always connected to a magma lake, and the lake and pipe can occasionally reach up to the same level, making them hard to separate. However, magma pipes can be identified by the obsidian walls which surround them.<br />
Magma pipes will slowly refill themselves, giving the player an infinite source of magma.<br />
<br />
==Volcanos==<br />
Volcanos can be found which extend all the way to the surface, but on a standard map they are exceedingly rare, if you even have any at all on your map.<br />
<br />
==Properties of magma==<br />
Magma behaves the same way as water with the exception of not being affected by {{l|pressure}}, unless pressurized by a {{l|pump}}.<br />
<br />
==Dangers of magma==<br />
Magma is not immediately fatal when first touched. It is dangerous to stand in magma, but dwarves will generally only suffer minor burns when running from a flow. Most creatures can survive standing on even a completely filled magma tile for a single turn, but any more and they will likely die.<br />
<br />
[[Category:Physics]]<br />
{{elven}}</div>SLhttp://dwarffortresswiki.org/index.php?title=v0.31:Flow&diff=90063v0.31:Flow2010-04-12T00:51:26Z<p>SL: /* Fluid Motion */</p>
<hr />
<div>{{av}}<br />
{{human}}<br />
'''Flow''' is a game mechanic used to simulate the motion of '''fluids'''. The two fluids that exist in dwarf fortress currently are '''{{l|water}}''' and '''{{l|magma}}'''. Flow can be identified by looking for a tile that is blinking between {{Tile|≈|#008|#999}} and {{Tile|~|#008|#999}} tiles. Fluids that are not blinking are not considered to be flowing. In order to power a '''{{l|waterwheel}}''' you must have flowing water at a depth of 4/7 or greater.<br />
*Note: In the current release flow does not seem to appear in magma. {{verify}}<br />
<br />
=Fluid Depth=<br />
Fluids can have a depth anywhere from 1 to 7. To see the depth of a tile of fluid you can look at it with {{k|k}} which will reveal the depth in the text at the right. Alternatively you can enable {{l|Technical_tricks#The_look_of_the_game|SHOW_FLOW_AMOUNTS}} which will replace the {{Tile|≈|#008|#999}} and {{Tile|~|#008|#999}} tiles with a numerical representation of the depth at all times. Turning on {{l|Technical_tricks#The_look_of_the_game|SHOW_FLOW_AMOUNTS}} does come with the drawback that you will no longer be able to see if a tile is flowing or not.<br />
<br />
=Fluid Motion=<br />
'''Water''' and '''{{l|magma}}''' both move in much the same way following a fairly simple set of rules. The only difference between the motion of {{l|magma}} and water is that magma behaves differently with regards to {{l|pressure}}.<br />
<br />
Fluids behave mostly as one might expect: Trying to move down and spreading out to the sides until they fill any available area. Fluids can also be under {{l|pressure}}, which allows them to be pushed back up by the weight of fluid in another area. Fluids can move in 10 directions, which are the 8 directions on the same z-level, and directly up or down. Fluids cannot move diagonally up or down. When fluids have a choice of where to move they select a destination randomly.<br />
<br />
Fluid motion follows a fairly simple set of rules. First fluids try to move down into the tile directly below them. If there is available open space below it will be filled very quickly. Fluids always try to move down before attempting to move in other directions.<br />
<br />
If there is a floor below or if all space below is already filled with fluid, than any fluid at a depth of 2/7 or greater will instead flow to one of the 8 adjacent side tiles. Fluid at a depth of 1/7 can only move down and will not attempt to move to the side. <br />
<br />
The last potential direction for a fluid to move is up, which can only occur if a fluid is under {{l|pressure}}. Any time fluids move they will generate flow. This flow is found in the tile they moved from (if any fluid remains) as well as the tile they move to. This flow will remain for a short time.<br />
<br />
*Fluids move down<br />
*Fluids move to the sides<br />
*Pressurized fluids may move up<br />
<br />
=Fluid Teleportation=<br />
This is an aspect of fluid motion that causes a great deal of confusion. Fluids do not just move to adjacent tiles, they also trace a path through other full tiles of fluid trying to move to more distant tiles. Fluid teleportation can occur at any of the three steps of fluid motion. When fluids move by teleportation flow is not created in the tiles that water skips past only in the actual source and destination tiles which can create a number of situations where flow does not appear contrary to expectations.<br />
<br />
=Obstructions=<br />
Water can be stopped by most solid tiles. These include {{l|wall|walls}} and {{l|building|buildings}} as well as closed {{l|floodgate|floodgates}}, {{l|door|doors}}, and {{l|hatch|hatches}}. Exceptions are {{l|grate|grates}}, {{l|bars|bars}} and {{l|fortification|fortifications}} which will allow fluids to pass freely. <br />
<br />
=Evaporation=<br />
Fluids that remain at a depth of 1/7 for long enough will evaporate. Evaporated fluids are simply removed from the game. In '''hot''' or '''scorching''' environments murky pools can evaporate at greater depths.<br />
<br />
[[Category:Physics]]</div>SLhttp://dwarffortresswiki.org/index.php?title=v0.31:Flow&diff=90061v0.31:Flow2010-04-12T00:49:52Z<p>SL: /* Fluid Motion */</p>
<hr />
<div>{{av}}<br />
{{human}}<br />
'''Flow''' is a game mechanic used to simulate the motion of '''fluids'''. The two fluids that exist in dwarf fortress currently are '''{{l|water}}''' and '''{{l|magma}}'''. Flow can be identified by looking for a tile that is blinking between {{Tile|≈|#008|#999}} and {{Tile|~|#008|#999}} tiles. Fluids that are not blinking are not considered to be flowing. In order to power a '''{{l|waterwheel}}''' you must have flowing water at a depth of 4/7 or greater.<br />
*Note: In the current release flow does not seem to appear in magma. {{verify}}<br />
<br />
=Fluid Depth=<br />
Fluids can have a depth anywhere from 1 to 7. To see the depth of a tile of fluid you can look at it with {{k|k}} which will reveal the depth in the text at the right. Alternatively you can enable {{l|Technical_tricks#The_look_of_the_game|SHOW_FLOW_AMOUNTS}} which will replace the {{Tile|≈|#008|#999}} and {{Tile|~|#008|#999}} tiles with a numerical representation of the depth at all times. Turning on {{l|Technical_tricks#The_look_of_the_game|SHOW_FLOW_AMOUNTS}} does come with the drawback that you will no longer be able to see if a tile is flowing or not.<br />
<br />
=Fluid Motion=<br />
'''Water''' and '''{{l|magma}}''' both move in much the same way following a fairly simple set of rules. The only difference between the motion of {{l|magma}} and water is that magma behaves differently with regards to {{l|pressure}}.<br />
<br />
Fluids behave mostly as one might expect trying to move down and spreading out to the sides until they fill any available area. Fluids can also be under {{l|pressure}} which allows them to be pushed back up by the weight of fluid in another area. Fluids can move in 10 directions, which is the 8 directions to the sides, and directly up or down. Fluids cannot move diagonally up or down. When fluids have a choice of where to move they select a destination randomly.<br />
<br />
Fluid motion follows a fairly simple set of rules. First fluids try to move down into the tile directly below them. If there is available open space below it will be filled very quickly. Fluids always try to move down before attempting to move in other directions.<br />
<br />
If there is a floor below or if all space below is already filled with fluid, than any fluid at a depth of 2/7 or greater will instead flow to one of the 8 adjacent side tiles. Fluid at a depth of 1/7 can only move down and will not attempt to move to the side. <br />
<br />
The last potential direction for a fluid to move is up, which can only occur if a fluid is under {{l|pressure}}. Any time fluids move they will generate flow. This flow is found in the tile they moved from (if any fluid remains) as well as the tile they move to. This flow will remain for a short time.<br />
<br />
*Fluids move down<br />
*Fluids move to the sides<br />
*Pressurized fluids may move up<br />
<br />
=Fluid Teleportation=<br />
This is an aspect of fluid motion that causes a great deal of confusion. Fluids do not just move to adjacent tiles, they also trace a path through other full tiles of fluid trying to move to more distant tiles. Fluid teleportation can occur at any of the three steps of fluid motion. When fluids move by teleportation flow is not created in the tiles that water skips past only in the actual source and destination tiles which can create a number of situations where flow does not appear contrary to expectations.<br />
<br />
=Obstructions=<br />
Water can be stopped by most solid tiles. These include {{l|wall|walls}} and {{l|building|buildings}} as well as closed {{l|floodgate|floodgates}}, {{l|door|doors}}, and {{l|hatch|hatches}}. Exceptions are {{l|grate|grates}}, {{l|bars|bars}} and {{l|fortification|fortifications}} which will allow fluids to pass freely. <br />
<br />
=Evaporation=<br />
Fluids that remain at a depth of 1/7 for long enough will evaporate. Evaporated fluids are simply removed from the game. In '''hot''' or '''scorching''' environments murky pools can evaporate at greater depths.<br />
<br />
[[Category:Physics]]</div>SLhttp://dwarffortresswiki.org/index.php?title=v0.31:Flow&diff=90060v0.31:Flow2010-04-12T00:49:32Z<p>SL: /* Fluid Motion */</p>
<hr />
<div>{{av}}<br />
{{human}}<br />
'''Flow''' is a game mechanic used to simulate the motion of '''fluids'''. The two fluids that exist in dwarf fortress currently are '''{{l|water}}''' and '''{{l|magma}}'''. Flow can be identified by looking for a tile that is blinking between {{Tile|≈|#008|#999}} and {{Tile|~|#008|#999}} tiles. Fluids that are not blinking are not considered to be flowing. In order to power a '''{{l|waterwheel}}''' you must have flowing water at a depth of 4/7 or greater.<br />
*Note: In the current release flow does not seem to appear in magma. {{verify}}<br />
<br />
=Fluid Depth=<br />
Fluids can have a depth anywhere from 1 to 7. To see the depth of a tile of fluid you can look at it with {{k|k}} which will reveal the depth in the text at the right. Alternatively you can enable {{l|Technical_tricks#The_look_of_the_game|SHOW_FLOW_AMOUNTS}} which will replace the {{Tile|≈|#008|#999}} and {{Tile|~|#008|#999}} tiles with a numerical representation of the depth at all times. Turning on {{l|Technical_tricks#The_look_of_the_game|SHOW_FLOW_AMOUNTS}} does come with the drawback that you will no longer be able to see if a tile is flowing or not.<br />
<br />
=Fluid Motion=<br />
'''Water''' and '''{{l|magma}}''' both move in much the same way following a fairly simple set of rules. The only difference between the motion {{l|magma}} and water is that magma behaves differently with regards to {{l|pressure}}.<br />
<br />
Fluids behave mostly as one might expect trying to move down and spreading out to the sides until they fill any available area. Fluids can also be under {{l|pressure}} which allows them to be pushed back up by the weight of fluid in another area. Fluids can move in 10 directions, which is the 8 directions to the sides, and directly up or down. Fluids cannot move diagonally up or down. When fluids have a choice of where to move they select a destination randomly.<br />
<br />
Fluid motion follows a fairly simple set of rules. First fluids try to move down into the tile directly below them. If there is available open space below it will be filled very quickly. Fluids always try to move down before attempting to move in other directions.<br />
<br />
If there is a floor below or if all space below is already filled with fluid, than any fluid at a depth of 2/7 or greater will instead flow to one of the 8 adjacent side tiles. Fluid at a depth of 1/7 can only move down and will not attempt to move to the side. <br />
<br />
The last potential direction for a fluid to move is up, which can only occur if a fluid is under {{l|pressure}}. Any time fluids move they will generate flow. This flow is found in the tile they moved from (if any fluid remains) as well as the tile they move to. This flow will remain for a short time.<br />
<br />
*Fluids move down<br />
*Fluids move to the sides<br />
*Pressurized fluids may move up<br />
<br />
=Fluid Teleportation=<br />
This is an aspect of fluid motion that causes a great deal of confusion. Fluids do not just move to adjacent tiles, they also trace a path through other full tiles of fluid trying to move to more distant tiles. Fluid teleportation can occur at any of the three steps of fluid motion. When fluids move by teleportation flow is not created in the tiles that water skips past only in the actual source and destination tiles which can create a number of situations where flow does not appear contrary to expectations.<br />
<br />
=Obstructions=<br />
Water can be stopped by most solid tiles. These include {{l|wall|walls}} and {{l|building|buildings}} as well as closed {{l|floodgate|floodgates}}, {{l|door|doors}}, and {{l|hatch|hatches}}. Exceptions are {{l|grate|grates}}, {{l|bars|bars}} and {{l|fortification|fortifications}} which will allow fluids to pass freely. <br />
<br />
=Evaporation=<br />
Fluids that remain at a depth of 1/7 for long enough will evaporate. Evaporated fluids are simply removed from the game. In '''hot''' or '''scorching''' environments murky pools can evaporate at greater depths.<br />
<br />
[[Category:Physics]]</div>SLhttp://dwarffortresswiki.org/index.php?title=v0.31:Computing&diff=89958v0.31:Computing2010-04-11T21:09:56Z<p>SL: </p>
<hr />
<div>{{av}}<br />
{{human}}<br />
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. 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.<br />
=== Binary information ===<br />
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:<br />
* on/off state or signal of a {{l|trigger|trigger}} (pressure plate, lever)<br />
* power or connection state of a {{l|machine component|machine component}}<br />
* open or closed state of a {{l|door|door}} or similar buildings<br />
* {{l|pressure plate|low/high}} or {{l|flow|flowing/standing}} {{l|water|fluid}}<br />
* present {{l|creature|creature}}s and {{l|dwarf|borgs}}<br />
<br />
Electronic devices and computers base on this elementary form of information, and if you want to go into computing, you’ll have to familiarize yourself with it. [http://en.wikipedia.org/wiki/Propositional_calculus propositional calculus]<br />
=== Input/Output ===<br />
Input can be any device which can be linked to another device with mechanisms, such as {{l|lever|levers}} or {{l|pressure plate|pressure plates}}. Pressure plates can measure water, magma, or creature weight, and can be set to react to your own dwarves if measuring creature weight. If measuring water or magma you specify the minimum and maximum levels at which it should output 'on', and at all other levels it will output an 'off' signal. Regardless of the actual amount of water, magma, or creature weight on your pressure plate, the plate can only output an 'on' or 'off' signal (1 or 0) to whatever devices it is linked to. So everything you build will have a binary base.<br />
<br />
====Input elements====<br />
* manual: {{l|lever|lever}} -> binary on/off signal<br />
* triggered: {{l|pressure plate|pressure plate}} -> binary on/off signal<br />
<br />
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. In some special configurations - when {{l|mechanical logic|mechanical logic}} is involved - output may not be a on/off signal but power, thus running or not running a machine component.<br />
<br />
Currently to convert from power to an on/off signal, the only way is to use a screw pump connected to that power source with an unlimited amount of water and drainage at the output, and a pressure plate to measure whether water is being pumped out by the pump.<br />
<br />
====Output elements====<br />
* signal: {{l|pressure plate|pressure plate}} -> binary on/off signal -> linkable Object(s)<br />
* power: {{l|gear assembly|gear assembly}} -> binary power on/power off -> machine<br />
<br />
=== Binary logic ===<br />
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'''.<br /><br />
* NOT - takes one input and returns the opposite of the input<br /><br /><br />
{| class="wikitable" border=1<br />
|-<br />
! input A <br />
! NOT<br />
|-<br />
| 0<br />
| 1<br />
|-<br />
| 1<br />
| 0<br />
|}<br /><br />
* AND - takes two inputs and returns true if both inputs are true<br />
* OR - takes two inputs and returns true if at least one input is true<br />
* XOR - takes two inputs and returns true if exactly one input is true<br />
* NAND - takes two inputs and returns true if either input is false<br />
* NOR - takes two inputs and returns true if both inputs are false<br />
* NXOR - takes two inputs and returns true if both inputs are identical<br /><br /><br />
{| class="wikitable" border=1<br />
|-<br />
! input A<br />
! input B<br />
! AND<br />
! OR<br />
! XOR<br />
! NAND<br />
! NOR<br />
! NXOR<br />
|-<br />
| 0<br />
| 0<br />
| 0<br />
| 0<br />
| 0<br />
| 1<br />
| 1<br />
| 1<br />
|-<br />
| 0<br />
| 1<br />
| 0<br />
| 1<br />
| 1<br />
| 1<br />
| 0<br />
| 0<br />
|-<br />
| 1<br />
| 0<br />
| 0<br />
| 1<br />
| 1<br />
| 1<br />
| 0<br />
| 0<br />
|-<br />
| 1<br />
| 1<br />
| 1<br />
| 1<br />
| 0<br />
| 0<br />
| 0<br />
| 1<br />
|}<br /><br />
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. Designing each individual gate that you will need (or using designs that had each individual gate designed) rather than building a gate out of multiple NAND gates or the like will generally result in your dorfputer reacting faster and using less resources (power, water, kittens, construction materials, what-have-you).<br />
<br />
=== Complex gates ===<br />
* {{l|Latch|Latch}} - storing and reading a single binary value<br />
* {{l|Repeater|Repeater}} - sending a repeating signal<br />
* {{l|Counter|Counter}}/{{l|Adder|Adder}} - binary calculation<br />
<br />
== Disciplines ==<br />
Historically, prior to DF2010 there have been 3 main disciplines of dwarfputing, depending on what would drive the dwarfputer. Each of them had its assets and drawbacks. So far, DF2010 at 0.31.01 appears to be essentially the same as far as power transmission goes, barring some differences with pump vertical power transmission (they don't without the floor between being channeled, apparently). Science! will determine what, if anything, differs as far as water flow, falling, and animal pathfinding.<br />
<br />
The three disciplines are:<br />
=== Fluid logic ===<br />
{{l|Infinite flow fluid logic|Infinite flow 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 {{l|evaporation|evaporation}} and [[DF2010:Water#Water_in_Fortress_Mode|destruction]].<br />
=== Mechanical logic ===<br />
{{l|Mechanical logic|Mechanical logic}} uses systems of axles and {{l|gear assemblies|gear assemblies}} to build logical gates. Mechanical logic reacts very fast and can be easily constructed, except for the need for a fluid-pump-based power->signal converter in every gate. Since every gear can itself be linked to a trigger (or multiple triggers), and automatically connect to adjacent gears for transferring either power or load, mechanical logic gates are very flexible and don't require anywhere near the number of different devices that tend to be used in fluid logic gates (except, again, for the requirement for a fluid-pump-based power->signal converter in every gate, unless you intend to use it to control a pump). On the other hand this discipline uses a LOT of mechanical power, and due to the lack of a power->signal converter, also referred to as a "rotation sensor" (a device to convert from power to on/off link signals), you need to build one using fluid logic components (the only design currently uses a pump, pressure plate, unlimited fluid, and unlimited drain) if you want to connect multiple mechanical logic gates together or connect a mechanical logic gate to any output other than a pump. So, in truth, current mechanical logic is more correctly termed mechanical-fluid hybrid logic, as you need an essentially unlimited source of water along with an unlimited drain to power the pump-based signal converters. (That said, an aquifer would work perfectly)<br />
<br />
=== Animal logic ===<br />
{{l|Animal logic|Animal logic}} places animals in an enclosed room, with a door blocking the path to where they desire to go, and a pressure plate below a hatch, with obstacles which are controlled by triggers. The animal thinks it can walk through the door, and if it has a path to the door will walk up to it and stand on the hatch. When the hatch is opened by a trigger, it falls onto the pressure plate. As long as the hatch is open, or other obstacles block its path to the door it remains on the pressure plate and the output is 'on'. Once it sees a path to the door it will leave the pressure plate. Generally this is made possibly by the fact that animals try to go to their parent while they're children, or to the meeting area. There are also be designs which use captured hostiles.<br />
<br />
There was a fourth, theoretical, discipline, Borg Logic, but there was never any reported success inventing any functioning and useful borg logic systems.<br />
<br />
===Examples of things you could do with logic gates===<br />
* Repeater: Repeatedly toggling hatches open and closed, or spikes up and down.<br />
* Latch: Making resettable one-use pressure plates which are reset by a lever.<br />
* NOT gate: Reversing the effect of a switch or creature-sensing pressure plate, generally linked to a latch device. You can, of course, mod the latch device to send the opposite signal instead of using a NOT gate.<br />
* AND gate: Requiring more than one condition to be true for something to occur. For instance, you could have a group of AND gates, with a system on/off switch, and and other triggers, with each trigger linked to a different AND gate with the system on/off switch linked to the the second input on all the AND gates, so that when the system on/off switch is OFF the output will be OFF on all the AND gates.<br />
* OR gate: You could link two 1-7 water sensors to an OR gate, and link that to a NOT gate, and link that to some floodgates or doors which act as emergency bulkheads, closing when water is detected in the area. Or, link the OR gate to bridges which raise instead (but you may crush things, and bridges are slower than doors).<br />
* XOR gate: You could use pressure plates hooked to latches at different points in your fort to detect enemy intrusion, and set them up to seal off the area with both an interior and exterior bulkhead when the intrusion occurs, but hook your latches up with an XOR gate and hook the output to the interior bulkhead to unseal that one if your pressure plates have detected that the enemy has gotten past it.<br />
* NOR gate: A NOR gate returns TRUE (ON) only if both inputs are FALSE. Instead of using the OR gate example with a NOT gate, you could use a NOR gate linked to two 1-7 water sensors, whose output goes to doors or floodgates. When the pressure plates are both waterless, the floodgates will be open. When one detects water, the floodgates close. (If you used 0-0 pressure plates with an OR, you would get an OFF signal if both plates detected water, or an ON signal otherwise (which is the same as 1-7 NAND 1-7))<br />
* NAND gate: A NAND gate returns TRUE (ON) whenever both inputs are not both TRUE (e.g. ON NAND ON is OFF, but every other combination is ON). Instead of the OR NOT or NOR example, you could link two 0-0 water sensors to a NAND gate, and link the NAND gate's output to raising bridges. 0-0 NAND 0-0 is the same as 1-7 OR 1-7. If there is no water on both pressure plates, the NAND gate will output an OFF signal. If, however, either has water, it will output an ON signal.<br />
<br />
* And here's a more complicated example, omitting the details of what gates to use: An automated swimming training room, where you pull a lever to close exit doors and open hatches to drop water into it, then pressure plates detect when there's enough water and close the hatches, and after a certain amount of time (using a very slow repeater, for instance), drains and exit doors open and the system resets until you pull the lever again. Or, the lever could be taken out entirely and the system could be made fully automatic (with dwarves set to train in the room, for instance) using the repeater.</div>SLhttp://dwarffortresswiki.org/index.php?title=v0.31:Mechanical_logic&diff=89955v0.31:Mechanical logic2010-04-11T21:04:31Z<p>SL: </p>
<hr />
<div>{{av}}<br />
{{human}}<br />
Mechanical logic is a discipline of {{l|Computing|Computing}} which uses axles, gears, {{l|power|power}}, and load to perform logical computations and turn power on and off. At present, to convert a power output into a link signal output such as most dwarven devices (bridge, door, hatch, cage, etc) can use, you would need to build a power -> signal converter (aka "rotation sensor") out of a pump and pressure plate with (currently, no other designs have been made) an unlimited water source and drain - one for each gate.<br />
<br />
The principles powering mechanical logic are simple: Gears linked to {{l|trigger|triggers}} will be disconnected when they receive an OFF signal. In this manner, you can conditionally attach either power supply (windmills or waterwheels) or load (additional gears or pumps) to a linked gear in various configurations in order to build logic gates.<br />
<br />
One of the weaknesses of mechanical logic is the substantial amount of materials it tends to require to construct the power and load devices, as well as the gears and axles making up the gates and connecting them to their outputs.<br />
<br />
==Mechanical signal-input power-output gates==<br />
* These gates can be used either by adding a power -> link signal converter (also known as a "rotation sensor"), or directly used to control pumps, such as in other logic gates (the unsourced fluid logic gates use these, for instance). The conventional "rotation sensor" consists of a pump powered by the gate's OUTPUT gear, pumping an infinite supply of water onto a water-sensing pressure plate with an infinite drain.<br />
* There are certain things important to all the gates:<br />
* Each gate has an OUTPUT gear, which will be placed next to a pump which the gate will control.<br />
* In diagrams, the OUTPUT gear is below the 'O' gear, connected to it by gears or vertical axles. The P indicates where you should hook power up, and L indicates where load (gears or pumps that don't have a water source) should be connected, and ¦ and - are horizontal axles. The Is are gears linked to INPUTs (some gates have one input, but most have two).<br />
* Gates which incorporate a NOT will have the power network branch off from the 'O' gear, and have a train of power-draining stuff connected to the input gears, whereas gates which do not incorporate a NOT will have the power connected to the input gears instead. The principle behind normal gates is that when the INPUTs are ON, power is connected. The principle behind the NOT gates is that power is always connected, but when the INPUTs are ON, a large enough power requirement is connected to send the power requirements above the power supply, shutting down the system.<br />
* If your windmills produce no power, you'll have to come up with some way to use water wheels for power instead.<br />
* You should build only enough windmills (or water wheels) to power the system, and should not connect the network for one gate to another gate's network, since that would both gates up.<br />
* The gates' instructions will explain how much load and power you need to have at each P and L in the more complicated gates.<br />
<br />
===Legend===<br />
{| class="wikitable" border="1"<br />
|-<br />
! Symbol<br />
! Meaning<br />
|-<br />
| {{diagram|[#ff0]O}}<br />
| A gear which connects to your OUTPUT gear, which outputs power when the gate is producing an ON output.<br />
|-<br />
| {{diagram|[#aaf]I}}<br />
| A gear connected to an INPUT. In most gates you will have two Is, with each one connected to a different input.<br />
|-<br />
| {{diagram|-}} and {{diagram|¦}}<br />
| Horizontal axles<br />
|-<br />
| {{diagram|[#0f0]P}}<br />
| Power goes here<br />
|-<br />
| {{diagram|[#aaf]i}}<br />
| Two more gears, each connected to the two different inputs.<br />
|-<br />
| {{diagram|[#f00]L}}<br />
| a chain of gears or pumps which serve to add load to the system, generally shutting it off when connected.<br />
|-<br />
| {{diagram|*}}<br />
| A gear which isn't linked to any inputs or outputs and just serves to connect the power or whatever.<br />
|}<br />
<br />
===Mechanical identity gate ===<br />
{{diagram|<br />
[#ff0]O[#aaf]I--[#0f0]P}}<br />
<br />
* This takes an linked input signal and converts it to power without changing it. The unsourced fluid transfer NOT gate uses this, for instance.<br />
* Connected to the input gear, such that they will only be connected to the system if the input gear is receiving an ON signal, are gears with windmills on top of them. Build only enough windmills to power the devices that the gate's OUTPUT gear are connected to (and the gears/axles).<br />
* When the INPUT is ON, the INPUT gear will be active, and the network will provide power to the OUTPUT. When the INPUT is OFF, it will not provide power to the OUTPUT.<br />
<br />
===Mechanical NOT gate===<br />
{{diagram|<br />
[#ff0]O[#aaf]I[#f00]L<br />
¦<br />
¦<br />
[#0f0]P}}<br />
<br />
* When the INPUT is ON, the INPUT gear will be active, and the network should need more power than is available. The devices connected to OUTPUT should shut down. When INPUT is OFF, the devices should have power since the INPUT gear will be disconnected.<br />
<br />
===Mechanical NAND gate===<br />
{{diagram|<br />
[#ff0]O[#aaf]I[#aaf]I[#f00]L<br />
¦<br />
¦<br />
[#0f0]P}}<br />
<br />
* This works just like the NOT gate, except that there are two inputs and both have to be active to shut down the system instead of one. Make sure you have enough power to run the system when one of the input gears is active.<br />
<br />
===Mechanical AND gate===<br />
{{diagram|<br />
[#ff0]O[#aaf]I[#aaf]I[#0f0]P}}<br />
<br />
* This works like the identity gate, except that there are two inputs and both have to be active for the system to get power.<br />
<br />
===Mechanical OR gate===<br />
{{diagram|<br />
[#ff0]O[#aaf]I<br />
[#aaf]I*[#0f0]P}}<br />
<br />
* This works like the identity gate, except that there are two inputs, and if either is active, the system receives power. Note that the entire power network is connected to both inputs, such that if either input is active the entire power network is powering the system.<br />
<br />
===Mechanical NOR gate===<br />
{{diagram|<br />
[#aaf]I*[#f00]L<br />
[#ff0]O[#aaf]I<br />
¦<br />
¦<br />
[#0f0]P}}<br />
<br />
* This works like the NOT gate, except that there are two inputs, and if either is active, the gear train or pump stack signified by the 'L' will be connected to the system. You need to have enough load to push power requirements above the amount of power produced by the power supply, shutting the system down.<br />
<br />
===Mechanical XOR gate===<br />
{{diagram|<br />
[#ff0]O[#aaf]I<br />
[#aaf]I*--*[#0f0]P<br />
[#000].[#aaf]i[#000].[#000].[#aaf]i<br />
[#000].[#f00]L[#000].[#000].[#f00]L}}<br />
<br />
<br />
* Except for the 'i's and 'L's, this gate is identical to the OR gate. The additional components add the 'exclusive' part of the 'XOR' to the gate.<br />
* This gate may be a bit difficult to construct. First, the 'i's are additional gears connected to each of your inputs, and the Ls are additional load, however, neither load by itself should be enough to shut down the system. However, you need to make the two sets of load large enough that if both inputs are active at the same time, their power requirements become large enough to shut down the system, without making them large enough to shut it down when only one of them is active. It'll just require a little math on your part.<br />
<br />
===Mechanical XNOR gate===<br />
{{diagram|<br />
[#000].[#000].[#aaf]I*[#f00]L<br />
[#000].[#000].[#ff0]O[#aaf]I<br />
[#000].[#000].¦<br />
[#0f0]P[#aaf]-*[#aaf]i-[#0f0]P<br />
[#000].[#000].[#aaf]i<br />
[#000].[#000].¦<br />
[#000].[#000].[#0f0]P}}<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! A<br />
! B<br />
! Drain<br />
! Power<br />
! Extra Power<br />
! Result<br />
|-<br />
| 0<br />
| 0<br />
| No<br />
| No<br />
| No<br />
| 1<br />
|-<br />
| 0<br />
| 1<br />
| Yes<br />
| Yes<br />
| Half<br />
| 0<br />
|-<br />
| 1<br />
| 0<br />
| Yes<br />
| Yes<br />
| Half<br />
| 0<br />
|-<br />
| 1<br />
| 1<br />
| Yes<br />
| Yes<br />
| Full<br />
| 1<br />
|} <br />
<br />
* The XNOR gate is an equality gate: The output is ON when both inputs are equal, and OFF when they are not equal.<br />
* This gate may be '''even more complicated''' to build than the XOR gate!<br />
* First, your 'i's are again gears connected to your two inputs. The two extra Ps to the right and below them are additional power sources, ideally only one windmill each.<br />
* Here's where it gets complicated. The load has to be sufficient to shut down the system even when ONE of the inputs' additional power supplies are connected. However, when BOTH inputs are on, there needs to be enough power from both additional Ps to bring the system back online.<br />
* Thus our gate does what it is supposed to: Produce enough power to have the OUTPUT gear be ON when both A and B are either 0 or 1, but not when they are not equal.</div>SLhttp://dwarffortresswiki.org/index.php?title=v0.31:Computing&diff=89954v0.31:Computing2010-04-11T21:04:17Z<p>SL: Undo revision 89953 by SL (Talk)</p>
<hr />
<div>{{av}}<br />
{{human}}<br />
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. 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.<br />
=== Binary information ===<br />
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:<br />
* on/off state or signal of a [[DF2010:trigger|trigger]] (pressure plate, lever)<br />
* power or connection state of a [[DF2010:machine component|machine component]]<br />
* open or closed state of a [[DF2010:door|door]] or similar buildings<br />
* [[DF2010:pressure plate|low/high]] or [[DF2010:flow|flowing/standing]] [[DF2010:water|fluid]]<br />
* present [[DF2010:creature|creature]]s and [[DF2010:dwarf|borgs]]<br />
<br />
Electronic devices and computers base on this elementary form of information, and if you want to go into computing, you’ll have to familiarize yourself with it. [http://en.wikipedia.org/wiki/Propositional_calculus propositional calculus]<br />
=== Input/Output ===<br />
Input can be any device which can be linked to another device with mechanisms, such as [[DF2010:lever|levers]] or [[DF2010:pressure plate|pressure plates]]. Pressure plates can measure water, magma, or creature weight, and can be set to react to your own dwarves if measuring creature weight. If measuring water or magma you specify the minimum and maximum levels at which it should output 'on', and at all other levels it will output an 'off' signal. Regardless of the actual amount of water, magma, or creature weight on your pressure plate, the plate can only output an 'on' or 'off' signal (1 or 0) to whatever devices it is linked to. So everything you build will have a binary base.<br />
<br />
====Input elements====<br />
* manual: [[DF2010:lever|lever]] -> binary on/off signal<br />
* triggered: [[DF2010:pressure plate|pressure plate]] -> binary on/off signal<br />
<br />
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. In some special configurations - when [[DF2010:mechanical logic|mechanical logic]] is involved - output may not be a on/off signal but power, thus running or not running a machine component.<br />
<br />
Currently to convert from power to an on/off signal, the only way is to use a screw pump connected to that power source with an unlimited amount of water and drainage at the output, and a pressure plate to measure whether water is being pumped out by the pump.<br />
<br />
====Output elements====<br />
* signal: [[DF2010:pressure plate|pressure plate]] -> binary on/off signal -> linkable Object(s)<br />
* power: [[DF2010:gear assembly|gear assembly]] -> binary power on/power off -> machine<br />
<br />
=== Binary logic ===<br />
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'''.<br /><br />
* NOT - takes one input and returns the opposite of the input<br /><br /><br />
{| class="wikitable" border=1<br />
|-<br />
! input A <br />
! NOT<br />
|-<br />
| 0<br />
| 1<br />
|-<br />
| 1<br />
| 0<br />
|}<br /><br />
* AND - takes two inputs and returns true if both inputs are true<br />
* OR - takes two inputs and returns true if at least one input is true<br />
* XOR - takes two inputs and returns true if exactly one input is true<br />
* NAND - takes two inputs and returns true if either input is false<br />
* NOR - takes two inputs and returns true if both inputs are false<br />
* NXOR - takes two inputs and returns true if both inputs are identical<br /><br /><br />
{| class="wikitable" border=1<br />
|-<br />
! input A<br />
! input B<br />
! AND<br />
! OR<br />
! XOR<br />
! NAND<br />
! NOR<br />
! NXOR<br />
|-<br />
| 0<br />
| 0<br />
| 0<br />
| 0<br />
| 0<br />
| 1<br />
| 1<br />
| 1<br />
|-<br />
| 0<br />
| 1<br />
| 0<br />
| 1<br />
| 1<br />
| 1<br />
| 0<br />
| 0<br />
|-<br />
| 1<br />
| 0<br />
| 0<br />
| 1<br />
| 1<br />
| 1<br />
| 0<br />
| 0<br />
|-<br />
| 1<br />
| 1<br />
| 1<br />
| 1<br />
| 0<br />
| 0<br />
| 0<br />
| 1<br />
|}<br /><br />
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. Designing each individual gate that you will need (or using designs that had each individual gate designed) rather than building a gate out of multiple NAND gates or the like will generally result in your dorfputer reacting faster and using less resources (power, water, kittens, construction materials, what-have-you).<br />
<br />
=== Complex gates ===<br />
* [[DF2010:Latch|Latch]] - storing and reading a single binary value<br />
* [[DF2010:Repeater|Repeater]] - sending a repeating signal<br />
* [[DF2010:Counter|Counter]]/[[DF2010:Adder|Adder]] - binary calculation<br />
<br />
== Disciplines ==<br />
Historically, prior to DF2010 there have been 3 main disciplines of dwarfputing, depending on what would drive the dwarfputer. Each of them had its assets and drawbacks. So far, DF2010 at 0.31.01 appears to be essentially the same as far as power transmission goes, barring some differences with pump vertical power transmission (they don't without the floor between being channeled, apparently). Science! will determine what, if anything, differs as far as water flow, falling, and animal pathfinding.<br />
<br />
The three disciplines are:<br />
=== Fluid logic ===<br />
[[DF2010:Infinite flow fluid logic|Infinite flow 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 [[DF2010:evaporation|evaporation]] and [[DF2010:Water#Water_in_Fortress_Mode|destruction]].<br />
=== Mechanical logic ===<br />
[[DF2010:Mechanical logic|Mechanical logic]] uses systems of axles and [[DF2010:gear assemblies|gear assemblies]] to build logical gates. Mechanical logic reacts very fast and can be easily constructed, except for the need for a fluid-pump-based power->signal converter in every gate. Since every gear can itself be linked to a trigger (or multiple triggers), and automatically connect to adjacent gears for transferring either power or load, mechanical logic gates are very flexible and don't require anywhere near the number of different devices that tend to be used in fluid logic gates (except, again, for the requirement for a fluid-pump-based power->signal converter in every gate, unless you intend to use it to control a pump). On the other hand this discipline uses a LOT of mechanical power, and due to the lack of a power->signal converter, also referred to as a "rotation sensor" (a device to convert from power to on/off link signals), you need to build one using fluid logic components (the only design currently uses a pump, pressure plate, unlimited fluid, and unlimited drain) if you want to connect multiple mechanical logic gates together or connect a mechanical logic gate to any output other than a pump. So, in truth, current mechanical logic is more correctly termed mechanical-fluid hybrid logic, as you need an essentially unlimited source of water along with an unlimited drain to power the pump-based signal converters. (That said, an aquifer would work perfectly)<br />
<br />
=== Animal logic ===<br />
[[DF2010:Animal logic|Animal logic]] places animals in an enclosed room, with a door blocking the path to where they desire to go, and a pressure plate below a hatch, with obstacles which are controlled by triggers. The animal thinks it can walk through the door, and if it has a path to the door will walk up to it and stand on the hatch. When the hatch is opened by a trigger, it falls onto the pressure plate. As long as the hatch is open, or other obstacles block its path to the door it remains on the pressure plate and the output is 'on'. Once it sees a path to the door it will leave the pressure plate. Generally this is made possibly by the fact that animals try to go to their parent while they're children, or to the meeting area. There are also be designs which use captured hostiles.<br />
<br />
There was a fourth, theoretical, discipline, Borg Logic, but there was never any reported success inventing any functioning and useful borg logic systems.<br />
<br />
===Examples of things you could do with logic gates===<br />
* Repeater: Repeatedly toggling hatches open and closed, or spikes up and down.<br />
* Latch: Making resettable one-use pressure plates which are reset by a lever.<br />
* NOT gate: Reversing the effect of a switch or creature-sensing pressure plate, generally linked to a latch device. You can, of course, mod the latch device to send the opposite signal instead of using a NOT gate.<br />
* AND gate: Requiring more than one condition to be true for something to occur. For instance, you could have a group of AND gates, with a system on/off switch, and and other triggers, with each trigger linked to a different AND gate with the system on/off switch linked to the the second input on all the AND gates, so that when the system on/off switch is OFF the output will be OFF on all the AND gates.<br />
* OR gate: You could link two 1-7 water sensors to an OR gate, and link that to a NOT gate, and link that to some floodgates or doors which act as emergency bulkheads, closing when water is detected in the area. Or, link the OR gate to bridges which raise instead (but you may crush things, and bridges are slower than doors).<br />
* XOR gate: You could use pressure plates hooked to latches at different points in your fort to detect enemy intrusion, and set them up to seal off the area with both an interior and exterior bulkhead when the intrusion occurs, but hook your latches up with an XOR gate and hook the output to the interior bulkhead to unseal that one if your pressure plates have detected that the enemy has gotten past it.<br />
* NOR gate: A NOR gate returns TRUE (ON) only if both inputs are FALSE. Instead of using the OR gate example with a NOT gate, you could use a NOR gate linked to two 1-7 water sensors, whose output goes to doors or floodgates. When the pressure plates are both waterless, the floodgates will be open. When one detects water, the floodgates close. (If you used 0-0 pressure plates with an OR, you would get an OFF signal if both plates detected water, or an ON signal otherwise (which is the same as 1-7 NAND 1-7))<br />
* NAND gate: A NAND gate returns TRUE (ON) whenever both inputs are not both TRUE (e.g. ON NAND ON is OFF, but every other combination is ON). Instead of the OR NOT or NOR example, you could link two 0-0 water sensors to a NAND gate, and link the NAND gate's output to raising bridges. 0-0 NAND 0-0 is the same as 1-7 OR 1-7. If there is no water on both pressure plates, the NAND gate will output an OFF signal. If, however, either has water, it will output an ON signal.<br />
<br />
* And here's a more complicated example, omitting the details of what gates to use: An automated swimming training room, where you pull a lever to close exit doors and open hatches to drop water into it, then pressure plates detect when there's enough water and close the hatches, and after a certain amount of time (using a very slow repeater, for instance), drains and exit doors open and the system resets until you pull the lever again. Or, the lever could be taken out entirely and the system could be made fully automatic (with dwarves set to train in the room, for instance) using the repeater.</div>SLhttp://dwarffortresswiki.org/index.php?title=v0.31:Computing&diff=89953v0.31:Computing2010-04-11T21:03:09Z<p>SL: </p>
<hr />
<div>{{av}}<br />
{{human}}<br />
Mechanical logic is a discipline of {{l|Computing|Computing}} which uses axles, gears, {{l|power|power}}, and load to perform logical computations and turn power on and off. At present, to convert a power output into a link signal output such as most dwarven devices (bridge, door, hatch, cage, etc) can use, you would need to build a power -> signal converter (aka "rotation sensor") out of a pump and pressure plate with (currently, no other designs have been made) an unlimited water source and drain - one for each gate.<br />
<br />
The principles powering mechanical logic are simple: Gears linked to {{l|trigger|triggers}} will be disconnected when they receive an OFF signal. In this manner, you can conditionally attach either power supply (windmills or waterwheels) or load (additional gears or pumps) to a linked gear in various configurations in order to build logic gates.<br />
<br />
One of the weaknesses of mechanical logic is the substantial amount of materials it tends to require to construct the power and load devices, as well as the gears and axles making up the gates and connecting them to their outputs.<br />
<br />
==Mechanical signal-input power-output gates==<br />
* These gates can be used either by adding a power -> link signal converter (also known as a "rotation sensor"), or directly used to control pumps, such as in other logic gates (the unsourced fluid logic gates use these, for instance). The conventional "rotation sensor" consists of a pump powered by the gate's OUTPUT gear, pumping an infinite supply of water onto a water-sensing pressure plate with an infinite drain.<br />
* There are certain things important to all the gates:<br />
* Each gate has an OUTPUT gear, which will be placed next to a pump which the gate will control.<br />
* In diagrams, the OUTPUT gear is below the 'O' gear, connected to it by gears or vertical axles. The P indicates where you should hook power up, and L indicates where load (gears or pumps that don't have a water source) should be connected, and ¦ and - are horizontal axles. The Is are gears linked to INPUTs (some gates have one input, but most have two).<br />
* Gates which incorporate a NOT will have the power network branch off from the 'O' gear, and have a train of power-draining stuff connected to the input gears, whereas gates which do not incorporate a NOT will have the power connected to the input gears instead. The principle behind normal gates is that when the INPUTs are ON, power is connected. The principle behind the NOT gates is that power is always connected, but when the INPUTs are ON, a large enough power requirement is connected to send the power requirements above the power supply, shutting down the system.<br />
* If your windmills produce no power, you'll have to come up with some way to use water wheels for power instead.<br />
* You should build only enough windmills (or water wheels) to power the system, and should not connect the network for one gate to another gate's network, since that would both gates up.<br />
* The gates' instructions will explain how much load and power you need to have at each P and L in the more complicated gates.<br />
<br />
===Legend===<br />
{| class="wikitable" border="1"<br />
|-<br />
! Symbol<br />
! Meaning<br />
|-<br />
| {{diagram|[#ff0]O}}<br />
| A gear which connects to your OUTPUT gear, which outputs power when the gate is producing an ON output.<br />
|-<br />
| {{diagram|[#aaf]I}}<br />
| A gear connected to an INPUT. In most gates you will have two Is, with each one connected to a different input.<br />
|-<br />
| {{diagram|-}} and {{diagram|¦}}<br />
| Horizontal axles<br />
|-<br />
| {{diagram|[#0f0]P}}<br />
| Power goes here<br />
|-<br />
| {{diagram|[#aaf]i}}<br />
| Two more gears, each connected to the two different inputs.<br />
|-<br />
| {{diagram|[#f00]L}}<br />
| a chain of gears or pumps which serve to add load to the system, generally shutting it off when connected.<br />
|-<br />
| {{diagram|*}}<br />
| A gear which isn't linked to any inputs or outputs and just serves to connect the power or whatever.<br />
|}<br />
<br />
===Mechanical identity gate ===<br />
{{diagram|<br />
[#ff0]O[#aaf]I--[#0f0]P}}<br />
<br />
* This takes an linked input signal and converts it to power without changing it. The unsourced fluid transfer NOT gate uses this, for instance.<br />
* Connected to the input gear, such that they will only be connected to the system if the input gear is receiving an ON signal, are gears with windmills on top of them. Build only enough windmills to power the devices that the gate's OUTPUT gear are connected to (and the gears/axles).<br />
* When the INPUT is ON, the INPUT gear will be active, and the network will provide power to the OUTPUT. When the INPUT is OFF, it will not provide power to the OUTPUT.<br />
<br />
===Mechanical NOT gate===<br />
{{diagram|<br />
[#ff0]O[#aaf]I[#f00]L<br />
¦<br />
¦<br />
[#0f0]P}}<br />
<br />
* When the INPUT is ON, the INPUT gear will be active, and the network should need more power than is available. The devices connected to OUTPUT should shut down. When INPUT is OFF, the devices should have power since the INPUT gear will be disconnected.<br />
<br />
===Mechanical NAND gate===<br />
{{diagram|<br />
[#ff0]O[#aaf]I[#aaf]I[#f00]L<br />
¦<br />
¦<br />
[#0f0]P}}<br />
<br />
* This works just like the NOT gate, except that there are two inputs and both have to be active to shut down the system instead of one. Make sure you have enough power to run the system when one of the input gears is active.<br />
<br />
===Mechanical AND gate===<br />
{{diagram|<br />
[#ff0]O[#aaf]I[#aaf]I[#0f0]P}}<br />
<br />
* This works like the identity gate, except that there are two inputs and both have to be active for the system to get power.<br />
<br />
===Mechanical OR gate===<br />
{{diagram|<br />
[#ff0]O[#aaf]I<br />
[#aaf]I*[#0f0]P}}<br />
<br />
* This works like the identity gate, except that there are two inputs, and if either is active, the system receives power. Note that the entire power network is connected to both inputs, such that if either input is active the entire power network is powering the system.<br />
<br />
===Mechanical NOR gate===<br />
{{diagram|<br />
[#aaf]I*[#f00]L<br />
[#ff0]O[#aaf]I<br />
¦<br />
¦<br />
[#0f0]P}}<br />
<br />
* This works like the NOT gate, except that there are two inputs, and if either is active, the gear train or pump stack signified by the 'L' will be connected to the system. You need to have enough load to push power requirements above the amount of power produced by the power supply, shutting the system down.<br />
<br />
===Mechanical XOR gate===<br />
{{diagram|<br />
[#ff0]O[#aaf]I<br />
[#aaf]I*--*[#0f0]P<br />
[#000].[#aaf]i[#000].[#000].[#aaf]i<br />
[#000].[#f00]L[#000].[#000].[#f00]L}}<br />
<br />
<br />
* Except for the 'i's and 'L's, this gate is identical to the OR gate. The additional components add the 'exclusive' part of the 'XOR' to the gate.<br />
* This gate may be a bit difficult to construct. First, the 'i's are additional gears connected to each of your inputs, and the Ls are additional load, however, neither load by itself should be enough to shut down the system. However, you need to make the two sets of load large enough that if both inputs are active at the same time, their power requirements become large enough to shut down the system, without making them large enough to shut it down when only one of them is active. It'll just require a little math on your part.<br />
<br />
===Mechanical XNOR gate===<br />
{{diagram|<br />
[#000].[#000].[#aaf]I*[#f00]L<br />
[#000].[#000].[#ff0]O[#aaf]I<br />
[#000].[#000].¦<br />
[#0f0]P[#aaf]-*[#aaf]i-[#0f0]P<br />
[#000].[#000].[#aaf]i<br />
[#000].[#000].¦<br />
[#000].[#000].[#0f0]P}}<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! A<br />
! B<br />
! Drain<br />
! Power<br />
! Extra Power<br />
! Result<br />
|-<br />
| 0<br />
| 0<br />
| No<br />
| No<br />
| No<br />
| 1<br />
|-<br />
| 0<br />
| 1<br />
| Yes<br />
| Yes<br />
| Half<br />
| 0<br />
|-<br />
| 1<br />
| 0<br />
| Yes<br />
| Yes<br />
| Half<br />
| 0<br />
|-<br />
| 1<br />
| 1<br />
| Yes<br />
| Yes<br />
| Full<br />
| 1<br />
|} <br />
<br />
* The XNOR gate is an equality gate: The output is ON when both inputs are equal, and OFF when they are not equal.<br />
* This gate may be '''even more complicated''' to build than the XOR gate!<br />
* First, your 'i's are again gears connected to your two inputs. The two extra Ps to the right and below them are additional power sources, ideally only one windmill each.<br />
* Here's where it gets complicated. The load has to be sufficient to shut down the system even when ONE of the inputs' additional power supplies are connected. However, when BOTH inputs are on, there needs to be enough power from both additional Ps to bring the system back online.<br />
* Thus our gate does what it is supposed to: Produce enough power to have the OUTPUT gear be ON when both A and B are either 0 or 1, but not when they are not equal.</div>SLhttp://dwarffortresswiki.org/index.php?title=v0.31:Mechanical_logic&diff=88763v0.31:Mechanical logic2010-04-10T05:53:42Z<p>SL: </p>
<hr />
<div>{{av}}<br />
{{human}}<br />
Mechanical logic is a discipline of [[DF2010:Computing|Computing]] which uses axles, gears, [[DF2010:power|power]], and load to perform logical computations and turn power on and off. At present, to convert a power output into a link signal output such as most dwarven devices (bridge, door, hatch, cage, etc) can use, you would need to build a power -> signal converter (aka "rotation sensor") out of a pump and pressure plate with (currently, no other designs have been made) an unlimited water source and drain - one for each gate.<br />
<br />
The principles powering mechanical logic are simple: Gears linked to [[DF2010:trigger|triggers]] will be disconnected when they receive an OFF signal. In this manner, you can conditionally attach either power supply (windmills or waterwheels) or load (additional gears or pumps) to a linked gear in various configurations in order to build logic gates.<br />
<br />
One of the weaknesses of mechanical logic is the substantial amount of materials it tends to require to construct the power and load devices, as well as the gears and axles making up the gates and connecting them to their outputs.<br />
<br />
==Mechanical signal-input power-output gates==<br />
* These gates can be used either by adding a power -> link signal converter (also known as a "rotation sensor"), or directly used to control pumps, such as in other logic gates (the unsourced fluid logic gates use these, for instance). The conventional "rotation sensor" consists of a pump powered by the gate's OUTPUT gear, pumping an infinite supply of water onto a water-sensing pressure plate with an infinite drain.<br />
* There are certain things important to all the gates:<br />
* Each gate has an OUTPUT gear, which will be placed next to a pump which the gate will control.<br />
* In diagrams, the OUTPUT gear is below the 'O' gear, connected to it by gears or vertical axles. The P indicates where you should hook power up, and L indicates where load (gears or pumps that don't have a water source) should be connected, and ¦ and - are horizontal axles. The Is are gears linked to INPUTs (some gates have one input, but most have two).<br />
* Gates which incorporate a NOT will have the power network branch off from the 'O' gear, and have a train of power-draining stuff connected to the input gears, whereas gates which do not incorporate a NOT will have the power connected to the input gears instead. The principle behind normal gates is that when the INPUTs are ON, power is connected. The principle behind the NOT gates is that power is always connected, but when the INPUTs are ON, a large enough power requirement is connected to send the power requirements above the power supply, shutting down the system.<br />
* If your windmills produce no power, you'll have to come up with some way to use water wheels for power instead.<br />
* You should build only enough windmills (or water wheels) to power the system, and should not connect the network for one gate to another gate's network, since that would both gates up.<br />
* The gates' instructions will explain how much load and power you need to have at each P and L in the more complicated gates.<br />
<br />
===Legend===<br />
{| class="wikitable" border="1"<br />
|-<br />
! Symbol<br />
! Meaning<br />
|-<br />
| {{diagram|[#ff0]O}}<br />
| A gear which connects to your OUTPUT gear, which outputs power when the gate is producing an ON output.<br />
|-<br />
| {{diagram|[#aaf]I}}<br />
| A gear connected to an INPUT. In most gates you will have two Is, with each one connected to a different input.<br />
|-<br />
| {{diagram|-}} and {{diagram|¦}}<br />
| Horizontal axles<br />
|-<br />
| {{diagram|[#0f0]P}}<br />
| Power goes here<br />
|-<br />
| {{diagram|[#aaf]i}}<br />
| Two more gears, each connected to the two different inputs.<br />
|-<br />
| {{diagram|[#f00]L}}<br />
| a chain of gears or pumps which serve to add load to the system, generally shutting it off when connected.<br />
|-<br />
| {{diagram|*}}<br />
| A gear which isn't linked to any inputs or outputs and just serves to connect the power or whatever.<br />
|}<br />
<br />
===Mechanical identity gate ===<br />
{{diagram|<br />
[#ff0]O[#aaf]I--[#0f0]P}}<br />
<br />
* This takes an linked input signal and converts it to power without changing it. The unsourced fluid transfer NOT gate uses this, for instance.<br />
* Connected to the input gear, such that they will only be connected to the system if the input gear is receiving an ON signal, are gears with windmills on top of them. Build only enough windmills to power the devices that the gate's OUTPUT gear are connected to (and the gears/axles).<br />
* When the INPUT is ON, the INPUT gear will be active, and the network will provide power to the OUTPUT. When the INPUT is OFF, it will not provide power to the OUTPUT.<br />
<br />
===Mechanical NOT gate===<br />
{{diagram|<br />
[#ff0]O[#aaf]I[#f00]L<br />
¦<br />
¦<br />
[#0f0]P}}<br />
<br />
* When the INPUT is ON, the INPUT gear will be active, and the network should need more power than is available. The devices connected to OUTPUT should shut down. When INPUT is OFF, the devices should have power since the INPUT gear will be disconnected.<br />
<br />
===Mechanical NAND gate===<br />
{{diagram|<br />
[#ff0]O[#aaf]I[#aaf]I[#f00]L<br />
¦<br />
¦<br />
[#0f0]P}}<br />
<br />
* This works just like the NOT gate, except that there are two inputs and both have to be active to shut down the system instead of one. Make sure you have enough power to run the system when one of the input gears is active.<br />
<br />
===Mechanical AND gate===<br />
{{diagram|<br />
[#ff0]O[#aaf]I[#aaf]I[#0f0]P}}<br />
<br />
* This works like the identity gate, except that there are two inputs and both have to be active for the system to get power.<br />
<br />
===Mechanical OR gate===<br />
{{diagram|<br />
[#ff0]O[#aaf]I<br />
[#aaf]I*[#0f0]P}}<br />
<br />
* This works like the identity gate, except that there are two inputs, and if either is active, the system receives power. Note that the entire power network is connected to both inputs, such that if either input is active the entire power network is powering the system.<br />
<br />
===Mechanical NOR gate===<br />
{{diagram|<br />
[#aaf]I*[#f00]L<br />
[#ff0]O[#aaf]I<br />
¦<br />
¦<br />
[#0f0]P}}<br />
<br />
* This works like the NOT gate, except that there are two inputs, and if either is active, the gear train or pump stack signified by the 'L' will be connected to the system. You need to have enough load to push power requirements above the amount of power produced by the power supply, shutting the system down.<br />
<br />
===Mechanical XOR gate===<br />
{{diagram|<br />
[#ff0]O[#aaf]I<br />
[#aaf]I*--*[#0f0]P<br />
[#000].[#aaf]i[#000].[#000].[#aaf]i<br />
[#000].[#f00]L[#000].[#000].[#f00]L}}<br />
<br />
<br />
* Except for the 'i's and 'L's, this gate is identical to the OR gate. The additional components add the 'exclusive' part of the 'XOR' to the gate.<br />
* This gate may be a bit difficult to construct. First, the 'i's are additional gears connected to each of your inputs, and the Ls are additional load, however, neither load by itself should be enough to shut down the system. However, you need to make the two sets of load large enough that if both inputs are active at the same time, their power requirements become large enough to shut down the system, without making them large enough to shut it down when only one of them is active. It'll just require a little math on your part.<br />
<br />
===Mechanical XNOR gate===<br />
{{diagram|<br />
[#000].[#000].[#aaf]I*[#f00]L<br />
[#000].[#000].[#ff0]O[#aaf]I<br />
[#000].[#000].¦<br />
[#0f0]P[#aaf]-*[#aaf]i-[#0f0]P<br />
[#000].[#000].[#aaf]i<br />
[#000].[#000].¦<br />
[#000].[#000].[#0f0]P}}<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! A<br />
! B<br />
! Drain<br />
! Power<br />
! Extra Power<br />
! Result<br />
|-<br />
| 0<br />
| 0<br />
| No<br />
| No<br />
| No<br />
| 1<br />
|-<br />
| 0<br />
| 1<br />
| Yes<br />
| Yes<br />
| Half<br />
| 0<br />
|-<br />
| 1<br />
| 0<br />
| Yes<br />
| Yes<br />
| Half<br />
| 0<br />
|-<br />
| 1<br />
| 1<br />
| Yes<br />
| Yes<br />
| Full<br />
| 1<br />
|} <br />
<br />
* The XNOR gate is an equality gate: The output is ON when both inputs are equal, and OFF when they are not equal.<br />
* This gate may be '''even more complicated''' to build than the XOR gate!<br />
* First, your 'i's are again gears connected to your two inputs. The two extra Ps to the right and below them are additional power sources, ideally only one windmill each.<br />
* Here's where it gets complicated. The load has to be sufficient to shut down the system even when ONE of the inputs' additional power supplies are connected. However, when BOTH inputs are on, there needs to be enough power from both additional Ps to bring the system back online.<br />
* Thus our gate does what it is supposed to: Produce enough power to have the OUTPUT gear be ON when both A and B are either 0 or 1, but not when they are not equal.</div>SLhttp://dwarffortresswiki.org/index.php?title=v0.31:Mechanical_logic&diff=88703v0.31:Mechanical logic2010-04-10T03:39:10Z<p>SL: /* Mechanical signal-input power-output gates */</p>
<hr />
<div>{{av}}<br />
{{human}}<br />
Mechanical logic is a discipline of [[DF2010:Computing|Computing]] which uses axles, gears, [[DF2010:power|power]], and load to perform logical computations and turn power on and off. At present, to convert a power output into a link signal output such as most dwarven devices (bridge, door, hatch, cage, etc) can use, you would need to build a power -> signal converter (aka "rotation sensor") out of a pump and pressure plate with (currently, no other designs have been made) an unlimited water source and drain - one for each gate.<br />
<br />
The principles powering mechanical logic are simple: Gears linked to [[DF2010:trigger|triggers]] will be disconnected when they receive an OFF signal. In this manner, you can conditionally attach either power supply (windmills or waterwheels) or load (additional gears or pumps) to a linked gear in various configurations in order to build logic gates.<br />
<br />
One of the weaknesses of mechanical logic is the substantial amount of materials it tends to require to construct the power and load devices, as well as the gears and axles making up the gates and connecting them to their outputs.<br />
<br />
==Mechanical signal-input power-output gates==<br />
* These gates can be used either by adding a power -> link signal converter (also known as a "rotation sensor"), or directly used to control pumps, such as in other logic gates (the unsourced fluid logic gates use these, for instance). The conventional "rotation sensor" consists of a pump powered by the gate's OUTPUT gear, pumping an infinite supply of water onto a water-sensing pressure plate with an infinite drain.<br />
* There are certain things important to all the gates:<br />
* Each gate has an OUTPUT gear, which will be placed next to a pump which the gate will control.<br />
* In diagrams, the OUTPUT gear is below the 'O' gear, connected to it by gears or vertical axles. The P indicates where you should hook power up, and L indicates where load (gears or pumps that don't have a water source) should be connected, and ¦ and - are horizontal axles. The Is are gears linked to INPUTs (some gates have one input, but most have two).<br />
* Gates which incorporate a NOT will have the power network branch off from the 'O' gear, and have a train of power-draining stuff connected to the input gears, whereas gates which do not incorporate a NOT will have the power connected to the input gears instead. The principle behind normal gates is that when the INPUTs are ON, power is connected. The principle behind the NOT gates is that power is always connected, but when the INPUTs are ON, a large enough power requirement is connected to send the power requirements above the power supply, shutting down the system.<br />
* If your windmills produce no power, you'll have to come up with some way to use water wheels for power instead.<br />
* You should build only enough windmills (or water wheels) to power the system, and should not connect the network for one gate to another gate's network, since that would both gates up.<br />
* The gates' instructions will explain how much load and power you need to have at each P and L in the more complicated gates.<br />
<br />
===Legend===<br />
{| class="wikitable" border="1"<br />
|-<br />
! Symbol<br />
! Meaning<br />
|-<br />
| {{diagram|[#ff0]O}}<br />
| A gear which connects to your OUTPUT gear, which outputs power when the gate is producing an ON output.<br />
|-<br />
| {{diagram|[#aaf]I}}<br />
| A gear connected to an INPUT. In most gates you will have two Is, with each one connected to a different input.<br />
|-<br />
| {{diagram|-}} and {{diagram|¦}}<br />
| Horizontal axles<br />
|-<br />
| {{diagram|[#0f0]P}}<br />
| Power goes here<br />
|-<br />
| {{diagram|[#aaf]i}}<br />
| Two more gears, each connected to the two different inputs.<br />
|-<br />
| {{diagram|[#f00]L}}<br />
| a chain of gears or pumps which serve to add load to the system, generally shutting it off when connected.<br />
|-<br />
| {{diagram|*}}<br />
| A gear which isn't linked to any inputs or outputs and just serves to connect the power or whatever.<br />
|}<br />
<br />
===Mechanical identity gate ===<br />
(Example diagram, yours will vary based on how much power is needed)<br />
{{diagram|<br />
[#ff0]O[#aaf]I--[#0f0]P}}<br />
<br />
* This takes an linked input signal and converts it to power without changing it. The unsourced fluid transfer NOT gate uses this, for instance.<br />
* Connected to the input gear, such that they will only be connected to the system if the input gear is receiving an ON signal, are gears with windmills on top of them. Build only enough windmills to power the devices that the gate's OUTPUT gear are connected to (and the gears/axles).<br />
* When the INPUT is ON, the INPUT gear will be active, and the network will provide power to the OUTPUT. When the INPUT is OFF, it will not provide power to the OUTPUT.<br />
<br />
===Mechanical NOT gate===<br />
(Example diagram, yours will vary based on how much power is needed)<br />
{{diagram|<br />
[#ff0]O[#aaf]I[#f00]L<br />
¦<br />
¦<br />
[#0f0]P}}<br />
<br />
* When the INPUT is ON, the INPUT gear will be active, and the network should need more power than is available. The devices connected to OUTPUT should shut down. When INPUT is OFF, the devices should have power since the INPUT gear will be disconnected.<br />
<br />
===Mechanical NAND gate===<br />
<br />
(Example diagram, yours will vary based on how much power is needed)<br />
{{diagram|<br />
[#ff0]O[#aaf]I[#aaf]I[#f00]L<br />
¦<br />
¦<br />
[#0f0]P}}<br />
<br />
* This works just like the NOT gate, except that there are two inputs and both have to be active to shut down the system instead of one. Make sure you have enough power to run the system when one of the input gears is active.<br />
<br />
===Mechanical AND gate===<br />
<br />
(Example diagram, yours will vary based on how much power is needed)<br />
{{diagram|<br />
[#ff0]O[#aaf]I[#aaf]I[#0f0]P}}<br />
<br />
* This works like the identity gate, except that there are two inputs and both have to be active for the system to get power.<br />
<br />
===Mechanical OR gate===<br />
<br />
(Example diagram, yours will vary based on how much power is needed)<br />
{{diagram|<br />
[#ff0]O[#aaf]I<br />
[#aaf]I*[#0f0]P}}<br />
<br />
* This works like the identity gate, except that there are two inputs, and if either is active, the system receives power. Note that the entire power network is connected to both inputs, such that if either input is active the entire power network is powering the system.<br />
<br />
===Mechanical NOR gate===<br />
<br />
(Example diagram, yours will vary based on how much power is needed)<br />
<br />
{{diagram|<br />
[#aaf]I*[#f00]L<br />
[#ff0]O[#aaf]I<br />
¦<br />
¦<br />
[#0f0]P}}<br />
<br />
* This works like the NOT gate, except that there are two inputs, and if either is active, the gear train or pump stack signified by the 'L' will be connected to the system. You need to have enough load to push power requirements above the amount of power produced by the power supply, shutting the system down.<br />
<br />
===Mechanical XOR gate===<br />
<br />
(Example diagram, yours will vary based on how much power is needed)<br />
{{diagram|<br />
[#ff0]O[#aaf]I<br />
[#aaf]I*--*[#0f0]P<br />
[#000].[#aaf]i[#000].[#000].[#aaf]i<br />
[#000].[#f00]L[#000].[#000].[#f00]L}}<br />
<br />
<br />
* Except for the 'i's and 'L's, this gate is identical to the OR gate. The additional components add the 'exclusive' part of the 'XOR' to the gate.<br />
* This gate may be a bit difficult to construct. First, the 'i's are additional gears connected to each of your inputs, and the Ls are additional load, however, neither load by itself should be enough to shut down the system. However, you need to make the two sets of load large enough that if both inputs are active at the same time, their power requirements become large enough to shut down the system, without making them large enough to shut it down when only one of them is active. It'll just require a little math on your part.<br />
<br />
===Mechanical XNOR gate===<br />
<br />
(Example diagram, yours will vary based on how much power is needed)<br />
<br />
{{diagram|<br />
[#000].[#000].[#aaf]I*[#f00]L<br />
[#000].[#000].[#ff0]O[#aaf]I<br />
[#000].[#000].¦<br />
[#0f0]P[#aaf]-*[#aaf]i-[#0f0]P<br />
[#000].[#000].[#aaf]i<br />
[#000].[#000].¦<br />
[#000].[#000].[#0f0]P}}<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! A<br />
! B<br />
! Drain<br />
! Power<br />
! Extra Power<br />
! Result<br />
|-<br />
| 0<br />
| 0<br />
| No<br />
| No<br />
| No<br />
| 1<br />
|-<br />
| 0<br />
| 1<br />
| Yes<br />
| Yes<br />
| Half<br />
| 0<br />
|-<br />
| 1<br />
| 0<br />
| Yes<br />
| Yes<br />
| Half<br />
| 0<br />
|-<br />
| 1<br />
| 1<br />
| Yes<br />
| Yes<br />
| Full<br />
| 1<br />
|} <br />
<br />
* The XNOR gate is an equality gate: The output is ON when both inputs are equal, and OFF when they are not equal.<br />
* This gate may be '''even more complicated''' to build than the XOR gate!<br />
* First, your 'i's are again gears connected to your two inputs. The two extra Ps to the right and below them are additional power sources, ideally only one windmill each.<br />
* Here's where it gets complicated. The load has to be sufficient to shut down the system even when ONE of the inputs' additional power supplies are connected. However, when BOTH inputs are on, there needs to be enough power from both additional Ps to bring the system back online.<br />
* Thus our gate does what it is supposed to: Produce enough power to have the OUTPUT gear be ON when both A and B are either 0 or 1, but not when they are not equal.</div>SLhttp://dwarffortresswiki.org/index.php?title=v0.31:Mechanical_logic&diff=88657v0.31:Mechanical logic2010-04-10T03:11:52Z<p>SL: Added color to the diagrams, diagram and color stuff to the legend, fixed stuff with the diagrams, and so on</p>
<hr />
<div>{{av}}<br />
{{human}}<br />
Mechanical logic is a discipline of [[DF2010:Computing|Computing]] which uses axles, gears, [[DF2010:power|power]], and load to perform logical computations and turn power on and off. At present, to convert a power output into a link signal output such as most dwarven devices (bridge, door, hatch, cage, etc) can use, you would need to build a power -> signal converter (aka "rotation sensor") out of a pump and pressure plate with (currently, no other designs have been made) an unlimited water source and drain - one for each gate.<br />
<br />
The principles powering mechanical logic are simple: Gears linked to [[DF2010:trigger|triggers]] will be disconnected when they receive an OFF signal. In this manner, you can conditionally attach either power supply (windmills or waterwheels) or load (additional gears or pumps) to a linked gear in various configurations in order to build logic gates.<br />
<br />
One of the weaknesses of mechanical logic is the substantial amount of materials it tends to require to construct the power and load devices, as well as the gears and axles making up the gates and connecting them to their outputs.<br />
<br />
==Mechanical signal-input power-output gates==<br />
* These gates can be used either by adding a power -> link signal converter (also known as a "rotation sensor"), or directly used to control pumps, such as in other logic gates (the unsourced fluid logic gates use these, for instance). The conventional "rotation sensor" consists of a pump powered by the gate's OUTPUT gear, pumping an infinite supply of water onto a water-sensing pressure plate with an infinite drain.<br />
* There are certain things important to all the gates:<br />
* Each gate has an OUTPUT gear, which will be placed next to a pump which the gate will control.<br />
* In diagrams, the OUTPUT gear is below the 'O' gear, connected to it by gears or vertical axles. The P indicates where you should hook power up, and L indicates where load (gears or pumps that don't have a water source) should be connected, and ¦ and - are horizontal axles. The Is are gears linked to INPUTs (some gates have one input, but most have two).<br />
* Gates which incorporate a NOT will have the power network branch off from the 'O' gear, and have a train of power-draining stuff connected to the input gears, whereas gates which do not incorporate a NOT will have the power connected to the input gears instead. The principle behind normal gates is that when the INPUTs are ON, power is connected. The principle behind the NOT gates is that power is always connected, but when the INPUTs are ON, a large enough power requirement is connected to send the power requirements above the power supply, shutting down the system.<br />
* If your windmills produce no power, the diagrams are basically useless to you since you'll have to come up with some way to use water wheels for power instead.<br />
* You should build only enough windmills (or water wheels) to power the system, and should not connect the network for one gate to another gate's network, since that would both gates up.<br />
* The gates' instructions will explain how much load and power you need to have at each P and L in the more complicated gates.<br />
<br />
===Legend===<br />
{| class="wikitable" border="1"<br />
|-<br />
! Symbol<br />
! Meaning<br />
|-<br />
| {{diagram|[#ff0]O}}<br />
| A gear which connects to your OUTPUT gear, which outputs power when the gate is producing an ON output.<br />
|-<br />
| {{diagram|[#aaf]I}}<br />
| A gear connected to an INPUT. In most gates you will have two Is, with each one connected to a different input.<br />
|-<br />
| {{diagram|-}} and {{diagram|¦}}<br />
| Horizontal axles<br />
|-<br />
| {{diagram|[#0f0]P}}<br />
| Power goes here<br />
|-<br />
| {{diagram|[#aaf]i}}<br />
| Two more gears, each connected to the two different inputs.<br />
|-<br />
| {{diagram|[#f00]L}}<br />
| a chain of gears or pumps which serve to add load to the system, generally shutting it off when connected.<br />
|-<br />
| {{diagram|*}}<br />
| A gear which isn't linked to any inputs or outputs and just serves to connect the power or whatever.<br />
|}<br />
<br />
===Mechanical identity gate ===<br />
(Example diagram, yours will vary based on how much power is needed)<br />
{{diagram|<br />
[#ff0]O[#aaf]I--[#0f0]P}}<br />
<br />
* This takes an linked input signal and converts it to power without changing it. The unsourced fluid transfer NOT gate uses this, for instance.<br />
* Connected to the input gear, such that they will only be connected to the system if the input gear is receiving an ON signal, are gears with windmills on top of them. Build only enough windmills to power the devices that the gate's OUTPUT gear are connected to (and the gears/axles).<br />
* When the INPUT is ON, the INPUT gear will be active, and the network will provide power to the OUTPUT. When the INPUT is OFF, it will not provide power to the OUTPUT.<br />
<br />
===Mechanical NOT gate===<br />
(Example diagram, yours will vary based on how much power is needed)<br />
{{diagram|<br />
[#ff0]O[#aaf]I[#f00]L<br />
¦<br />
¦<br />
[#0f0]P}}<br />
<br />
* When the INPUT is ON, the INPUT gear will be active, and the network should need more power than is available. The devices connected to OUTPUT should shut down. When INPUT is OFF, the devices should have power since the INPUT gear will be disconnected.<br />
<br />
===Mechanical NAND gate===<br />
<br />
(Example diagram, yours will vary based on how much power is needed)<br />
{{diagram|<br />
[#ff0]O[#aaf]I[#aaf]I[#f00]L<br />
¦<br />
¦<br />
[#0f0]P}}<br />
<br />
* This works just like the NOT gate, except that there are two inputs and both have to be active to shut down the system instead of one. Make sure you have enough power to run the system when one of the input gears is active.<br />
<br />
===Mechanical AND gate===<br />
<br />
(Example diagram, yours will vary based on how much power is needed)<br />
{{diagram|<br />
[#ff0]O[#aaf]I[#aaf]I[#0f0]P}}<br />
<br />
* This works like the identity gate, except that there are two inputs and both have to be active for the system to get power.<br />
<br />
===Mechanical OR gate===<br />
<br />
(Example diagram, yours will vary based on how much power is needed)<br />
{{diagram|<br />
[#ff0]O[#aaf]I<br />
[#aaf]I*[#0f0]P}}<br />
<br />
* This works like the identity gate, except that there are two inputs, and if either is active, the system receives power. Note that the entire power network is connected to both inputs, such that if either input is active the entire power network is powering the system.<br />
<br />
===Mechanical NOR gate===<br />
<br />
(Example diagram, yours will vary based on how much power is needed)<br />
<br />
{{diagram|<br />
[#aaf]I*[#f00]L<br />
[#ff0]O[#aaf]I<br />
¦<br />
¦<br />
[#0f0]P}}<br />
<br />
* This works like the NOT gate, except that there are two inputs, and if either is active, the gear train or pump stack signified by the 'L' will be connected to the system. You need to have enough load to push power requirements above the amount of power produced by the power supply, shutting the system down.<br />
<br />
===Mechanical XOR gate===<br />
<br />
(Example diagram, yours will vary based on how much power is needed)<br />
{{diagram|<br />
[#ff0]O[#aaf]I<br />
[#aaf]I*--*[#0f0]P<br />
[#000].[#aaf]i[#000].[#000].[#aaf]i<br />
[#000].[#f00]L[#000].[#000].[#f00]L}}<br />
<br />
<br />
* Except for the 'i's and 'L's, this gate is identical to the OR gate. The additional components add the 'exclusive' part of the 'XOR' to the gate.<br />
* This gate may be a bit difficult to construct. First, the 'i's are additional gears connected to each of your inputs, and the Ls are additional load, however, neither load by itself should be enough to shut down the system. However, you need to make the two sets of load large enough that if both inputs are active at the same time, their power requirements become large enough to shut down the system, without making them large enough to shut it down when only one of them is active. It'll just require a little math on your part.<br />
<br />
===Mechanical XNOR gate===<br />
<br />
(Example diagram, yours will vary based on how much power is needed)<br />
<br />
{{diagram|<br />
[#000].[#000].[#aaf]I*[#f00]L<br />
[#000].[#000].[#ff0]O[#aaf]I<br />
[#000].[#000].¦<br />
[#0f0]P[#aaf]-*[#aaf]i-[#0f0]P<br />
[#000].[#000].[#aaf]i<br />
[#000].[#000].¦<br />
[#000].[#000].[#0f0]P}}<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! A<br />
! B<br />
! Drain<br />
! Power<br />
! Extra Power<br />
! Result<br />
|-<br />
| 0<br />
| 0<br />
| No<br />
| No<br />
| No<br />
| 1<br />
|-<br />
| 0<br />
| 1<br />
| Yes<br />
| Yes<br />
| Half<br />
| 0<br />
|-<br />
| 1<br />
| 0<br />
| Yes<br />
| Yes<br />
| Half<br />
| 0<br />
|-<br />
| 1<br />
| 1<br />
| Yes<br />
| Yes<br />
| Full<br />
| 1<br />
|} <br />
<br />
* The XNOR gate is an equality gate: The output is ON when both inputs are equal, and OFF when they are not equal.<br />
* This gate may be '''even more complicated''' to build than the XOR gate!<br />
* First, your 'i's are again gears connected to your two inputs. The two extra Ps to the right and below them are additional power sources, ideally only one windmill each.<br />
* Here's where it gets complicated. The load has to be sufficient to shut down the system even when ONE of the inputs' additional power supplies are connected. However, when BOTH inputs are on, there needs to be enough power from both additional Ps to bring the system back online.<br />
* Thus our gate does what it is supposed to: Produce enough power to have the OUTPUT gear be ON when both A and B are either 0 or 1, but not when they are not equal.</div>SLhttp://dwarffortresswiki.org/index.php?title=v0.31:Mechanical_logic&diff=88596v0.31:Mechanical logic2010-04-10T02:45:01Z<p>SL: </p>
<hr />
<div>{{av}}<br />
{{human}}<br />
Mechanical logic uses axles, gears, [[DF2010:power|power]], and load to perform logical computations and turn power on and off. At present, to convert a power output into a link signal output such as most dwarven devices (bridge, door, hatch, cage, etc) can use, you would need to build a power -> signal converter (aka "rotation sensor") out of a pump and pressure plate with (currently, no other designs have been made) an unlimited water source and drain - one for each gate.<br />
<br />
The principles powering mechanical logic are simple: Gears linked to [[DF2010:trigger|triggers]] will be disconnected when they receive an OFF signal. In this manner, you can conditionally attach either power supply (windmills or waterwheels) or load (additional gears or pumps) to a linked gear in various configurations in order to build logic gates.<br />
<br />
One of the weaknesses of mechanical logic is the substantial amount of materials it tends to require to construct the power and load devices, as well as the gears and axles making up the gates and connecting them to their outputs.<br />
<br />
==Mechanical signal-input power-output gates==<br />
* These gates can be used either by adding a power -> link signal converter (also known as a "rotation sensor"), or directly used to control pumps, such as in other logic gates (the unsourced fluid logic gates use these, for instance). The conventional "rotation sensor" consists of a pump powered by the gate's OUTPUT gear, pumping an infinite supply of water onto a water-sensing pressure plate with an infinite drain.<br />
* There are certain things important to all the gates:<br />
* Each gate has an OUTPUT gear, which will be placed next to a pump which the gate will control.<br />
* In diagrams, the OUTPUT gear is below the 'O' gear, connected to it by gears or vertical axles. The P indicates where you should hook power up, and L indicates where load (gears or pumps that don't have a water source) should be connected, and ║ and - are horizontal axles. The Is are gears linked to INPUTs (some gates have one input, but most have two).<br />
* Gates which incorporate a NOT will have the power network branch off from the 'O' gear, and have a train of power-draining stuff connected to the input gears, whereas gates which do not incorporate a NOT will have the power connected to the input gears instead. The principle behind normal gates is that when the INPUTs are ON, power is connected. The principle behind the NOT gates is that power is always connected, but when the INPUTs are ON, a large enough power requirement is connected to send the power requirements above the power supply, shutting down the system.<br />
* If your windmills produce no power, the diagrams are basically useless to you since you'll have to come up with some way to use water wheels for power instead.<br />
* You should build only enough windmills (or water wheels) to power the system, and should not connect the network for one gate to another gate's network, since that would both gates up.<br />
* The gates' instructions will explain how much load and power you need to have at each P and L in the more complicated gates.<br />
<br />
===Legend===<br />
{| class="wikitable" border="1"<br />
|-<br />
! Symbol<br />
! Meaning<br />
|-<br />
| O<br />
| A gear which connects to your OUTPUT gear, which outputs power when the gate is producing an ON output.<br />
|-<br />
| I<br />
| A gear connected to an INPUT. In most gates you will have two Is, with each one connected to a different input.<br />
|-<br />
| - and ║<br />
| Horizontal axles<br />
|-<br />
| P<br />
| Power goes here<br />
|-<br />
| i<br />
| Two more gears, each connected to the two different inputs.<br />
|-<br />
| Load<br />
| a chain of gears or pumps which serve to add load to the system, generally shutting it off when connected.<br />
|-<br />
| *<br />
| A gear which isn't linked to any inputs or outputs and just serves to connect the power or whatever.<br />
|}<br />
<br />
===Mechanical identity gate ===<br />
(Example diagram, yours will vary based on how much power is needed)<br />
{{diagram|<br />
OI--P}}<br />
<br />
* This takes an linked input signal and converts it to power without changing it. The unsourced fluid transfer NOT gate uses this, for instance.<br />
* Connected to the input gear, such that they will only be connected to the system if the input gear is receiving an ON signal, are gears with windmills on top of them. Build only enough windmills to power the devices that the gate's OUTPUT gear are connected to (and the gears/axles).<br />
* When the INPUT is ON, the INPUT gear will be active, and the network will provide power to the OUTPUT. When the INPUT is OFF, it will not provide power to the OUTPUT.<br />
<br />
===Mechanical NOT gate===<br />
(Example diagram, yours will vary based on how much power is needed)<br />
{{diagram|<br />
OIL<br />
║<br />
║<br />
P}}<br />
<br />
* When the INPUT is ON, the INPUT gear will be active, and the network should need more power than is available. The devices connected to OUTPUT should shut down. When INPUT is OFF, the devices should have power since the INPUT gear will be disconnected.<br />
<br />
===Mechanical NAND gate===<br />
<br />
(Example diagram, yours will vary based on how much power is needed)<br />
{{diagram|<br />
OIIL<br />
║<br />
║<br />
P}}<br />
<br />
* This works just like the NOT gate, except that there are two inputs and both have to be active to shut down the system instead of one. Make sure you have enough power to run the system when one of the input gears is active.<br />
<br />
===Mechanical AND gate===<br />
<br />
(Example diagram, yours will vary based on how much power is needed)<br />
{{diagram|<br />
OIIP}}<br />
<br />
* This works like the identity gate, except that there are two inputs and both have to be active for the system to get power.<br />
<br />
===Mechanical OR gate===<br />
<br />
(Example diagram, yours will vary based on how much power is needed)<br />
{{diagram|<br />
OI<br />
I*P}}<br />
<br />
* This works like the identity gate, except that there are two inputs, and if either is active, the system receives power. Note that the entire power network is connected to both inputs, such that if either input is active the entire power network is powering the system.<br />
<br />
===Mechanical NOR gate===<br />
<br />
(Example diagram, yours will vary based on how much power is needed)<br />
<br />
{{diagram|<br />
I*L<br />
OI<br />
║<br />
║<br />
P}}<br />
<br />
* This works like the NOT gate, except that there are two inputs, and if either is active, the gear train or pump stack signified by the 'L' will be connected to the system. You need to have enough load to push power requirements above the amount of power produced by the power supply, shutting the system down.<br />
<br />
===Mechanical XOR gate===<br />
<br />
(Example diagram, yours will vary based on how much power is needed)<br />
{{diagram|<br />
OI<br />
I*PiL<br />
[#000].[#000].[#000].[#000].[#000].[#000].[#000].[#000].[#000].[#000].i<br />
[#000].[#000].[#000].[#000].[#000].[#000].[#000].[#000].[#000].[#000].L}}<br />
<br />
<br />
* Except for the 'i's and 'L's, this gate is identical to the OR gate. The additional components add the 'exclusive' part of the 'XOR' to the gate.<br />
* This gate may be a bit difficult to construct. First, the 'i's are additional gears connected to each of your inputs, and the Ls are additional load, however, neither load by itself should be enough to shut down the system. However, you need to make the two sets of load large enough that if both inputs are active at the same time, their power requirements become large enough to shut down the system, without making them large enough to shut it down when only one of them is active. It'll just require a little math on your part.<br />
<br />
===Mechanical XNOR gate===<br />
<br />
(Example diagram, yours will vary based on how much power is needed)<br />
<br />
{{diagram|<br />
I*L<br />
OI<br />
║<br />
Pi-P<br />
[#000].[#000].[#000].[#000].[#000].[#000].i<br />
[#000].[#000].[#000].[#000].[#000].[#000].║<br />
[#000].[#000].[#000].[#000].[#000].[#000].P}}<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! A<br />
! B<br />
! Drain<br />
! Power<br />
! Extra Power<br />
! Result<br />
|-<br />
| 0<br />
| 0<br />
| No<br />
| No<br />
| No<br />
| 1<br />
|-<br />
| 0<br />
| 1<br />
| Yes<br />
| Yes<br />
| Half<br />
| 0<br />
|-<br />
| 1<br />
| 0<br />
| Yes<br />
| Yes<br />
| Half<br />
| 0<br />
|-<br />
| 1<br />
| 1<br />
| Yes<br />
| Yes<br />
| Full<br />
| 1<br />
|} <br />
<br />
* The XNOR gate is an equality gate: The output is ON when both inputs are equal, and OFF when they are not equal.<br />
* This gate may be '''even more complicated''' to build than the XOR gate!<br />
* First, your 'i's are again gears connected to your two inputs. The two extra Ps to the right and below them are additional power sources, ideally only one windmill each.<br />
* Here's where it gets complicated. The load has to be sufficient to shut down the system even when ONE of the inputs' additional power supplies are connected. However, when BOTH inputs are on, there needs to be enough power from both additional Ps to bring the system back online.<br />
* Thus our gate does what it is supposed to: Produce enough power to have the OUTPUT gear be ON when both A and B are either 0 or 1, but not when they are not equal.</div>SLhttp://dwarffortresswiki.org/index.php?title=v0.31:Mechanical_logic&diff=88589v0.31:Mechanical logic2010-04-10T02:42:19Z<p>SL: Revised the diagrams and such a bit</p>
<hr />
<div>Mechanical logic uses axles, gears, [[DF2010:power|power]], and load to perform logical computations and turn power on and off. At present, to convert a power output into a link signal output such as most dwarven devices (bridge, door, hatch, cage, etc) can use, you would need to build a power -> signal converter (aka "rotation sensor") out of a pump and pressure plate with (currently, no other designs have been made) an unlimited water source and drain - one for each gate.<br />
<br />
The principles powering mechanical logic are simple: Gears linked to [[DF2010:trigger|triggers]] will be disconnected when they receive an OFF signal. In this manner, you can conditionally attach either power supply (windmills or waterwheels) or load (additional gears or pumps) to a linked gear in various configurations in order to build logic gates.<br />
<br />
One of the weaknesses of mechanical logic is the substantial amount of materials it tends to require to construct the power and load devices, as well as the gears and axles making up the gates and connecting them to their outputs.<br />
<br />
==Mechanical signal-input power-output gates==<br />
* These gates can be used either by adding a power -> link signal converter (also known as a "rotation sensor"), or directly used to control pumps, such as in other logic gates (the unsourced fluid logic gates use these, for instance). The conventional "rotation sensor" consists of a pump powered by the gate's OUTPUT gear, pumping an infinite supply of water onto a water-sensing pressure plate with an infinite drain.<br />
* There are certain things important to all the gates:<br />
* Each gate has an OUTPUT gear, which will be placed next to a pump which the gate will control.<br />
* In diagrams, the OUTPUT gear is below the 'O' gear, connected to it by gears or vertical axles. The P indicates where you should hook power up, and L indicates where load (gears or pumps that don't have a water source) should be connected, and ║ and - are horizontal axles. The Is are gears linked to INPUTs (some gates have one input, but most have two).<br />
* Gates which incorporate a NOT will have the power network branch off from the 'O' gear, and have a train of power-draining stuff connected to the input gears, whereas gates which do not incorporate a NOT will have the power connected to the input gears instead. The principle behind normal gates is that when the INPUTs are ON, power is connected. The principle behind the NOT gates is that power is always connected, but when the INPUTs are ON, a large enough power requirement is connected to send the power requirements above the power supply, shutting down the system.<br />
* If your windmills produce no power, the diagrams are basically useless to you since you'll have to come up with some way to use water wheels for power instead.<br />
* You should build only enough windmills (or water wheels) to power the system, and should not connect the network for one gate to another gate's network, since that would both gates up.<br />
* The gates' instructions will explain how much load and power you need to have at each P and L in the more complicated gates.<br />
<br />
===Legend===<br />
* O - A gear which connects to your OUTPUT gear, which outputs power when the gate is producing an ON output.<br />
* I - A gear connected to an INPUT. In most gates you will have two Is, with each one connected to a different input.<br />
* - and ║ : Horizontal axles<br />
* P - power goes here<br />
* i - Two more gears, each connected to the two different inputs.<br />
* L - Load: a chain of gears or pumps which serve to add load to the system, generally shutting it off when connected.<br />
* * - A gear which isn't linked to any inputs or outputs and just serves to connect the power or whatever.<br />
<br />
===Mechanical identity gate ===<br />
(Example diagram, yours will vary based on how much power is needed)<br />
{{diagram|<br />
OI--P}}<br />
<br />
* This takes an linked input signal and converts it to power without changing it. The unsourced fluid transfer NOT gate uses this, for instance.<br />
* Connected to the input gear, such that they will only be connected to the system if the input gear is receiving an ON signal, are gears with windmills on top of them. Build only enough windmills to power the devices that the gate's OUTPUT gear are connected to (and the gears/axles).<br />
* When the INPUT is ON, the INPUT gear will be active, and the network will provide power to the OUTPUT. When the INPUT is OFF, it will not provide power to the OUTPUT.<br />
<br />
===Mechanical NOT gate===<br />
(Example diagram, yours will vary based on how much power is needed)<br />
{{diagram|<br />
OIL<br />
║<br />
║<br />
P}}<br />
<br />
* When the INPUT is ON, the INPUT gear will be active, and the network should need more power than is available. The devices connected to OUTPUT should shut down. When INPUT is OFF, the devices should have power since the INPUT gear will be disconnected.<br />
<br />
===Mechanical NAND gate===<br />
<br />
(Example diagram, yours will vary based on how much power is needed)<br />
{{diagram|<br />
OIIL<br />
║<br />
║<br />
P}}<br />
<br />
* This works just like the NOT gate, except that there are two inputs and both have to be active to shut down the system instead of one. Make sure you have enough power to run the system when one of the input gears is active.<br />
<br />
===Mechanical AND gate===<br />
<br />
(Example diagram, yours will vary based on how much power is needed)<br />
{{diagram|<br />
OIIP}}<br />
<br />
* This works like the identity gate, except that there are two inputs and both have to be active for the system to get power.<br />
<br />
===Mechanical OR gate===<br />
<br />
(Example diagram, yours will vary based on how much power is needed)<br />
{{diagram|<br />
OI<br />
I*P}}<br />
<br />
* This works like the identity gate, except that there are two inputs, and if either is active, the system receives power. Note that the entire power network is connected to both inputs, such that if either input is active the entire power network is powering the system.<br />
<br />
===Mechanical NOR gate===<br />
<br />
(Example diagram, yours will vary based on how much power is needed)<br />
<br />
{{diagram|<br />
I*L<br />
OI<br />
║<br />
║<br />
P}}<br />
<br />
* This works like the NOT gate, except that there are two inputs, and if either is active, the gear train or pump stack signified by the 'L' will be connected to the system. You need to have enough load to push power requirements above the amount of power produced by the power supply, shutting the system down.<br />
<br />
===Mechanical XOR gate===<br />
<br />
(Example diagram, yours will vary based on how much power is needed)<br />
{{diagram|<br />
OI<br />
I*PiL<br />
[#000].[#000].[#000].[#000].[#000].[#000].[#000].[#000].[#000].[#000].i<br />
[#000].[#000].[#000].[#000].[#000].[#000].[#000].[#000].[#000].[#000].L}}<br />
<br />
<br />
* Except for the 'i's and 'L's, this gate is identical to the OR gate. The additional components add the 'exclusive' part of the 'XOR' to the gate.<br />
* This gate may be a bit difficult to construct. First, the 'i's are additional gears connected to each of your inputs, and the Ls are additional load, however, neither load by itself should be enough to shut down the system. However, you need to make the two sets of load large enough that if both inputs are active at the same time, their power requirements become large enough to shut down the system, without making them large enough to shut it down when only one of them is active. It'll just require a little math on your part.<br />
<br />
===Mechanical XNOR gate===<br />
<br />
(Example diagram, yours will vary based on how much power is needed)<br />
<br />
{{diagram|<br />
I*L<br />
OI<br />
║<br />
Pi-P<br />
[#000].[#000].[#000].[#000].[#000].[#000].i<br />
[#000].[#000].[#000].[#000].[#000].[#000].║<br />
[#000].[#000].[#000].[#000].[#000].[#000].P}}<br />
<br />
{| class="wikitable"<br />
|-<br />
! A<br />
! B<br />
! Drain<br />
! Power<br />
! Extra Power<br />
! Result<br />
|-<br />
| 0<br />
| 0<br />
| No<br />
| No<br />
| No<br />
| 1<br />
|-<br />
| 0<br />
| 1<br />
| Yes<br />
| Yes<br />
| Half<br />
| 0<br />
|-<br />
| 1<br />
| 0<br />
| Yes<br />
| Yes<br />
| Half<br />
| 0<br />
|-<br />
| 1<br />
| 1<br />
| Yes<br />
| Yes<br />
| Full<br />
| 1<br />
|} <br />
<br />
* The XNOR gate is an equality gate: The output is ON when both inputs are equal, and OFF when they are not equal.<br />
* This gate may be '''even more complicated''' to build than the XOR gate!<br />
* First, your 'i's are again gears connected to your two inputs. The two extra Ps to the right and below them are additional power sources, ideally only one windmill each.<br />
* Here's where it gets complicated. The load has to be sufficient to shut down the system even when ONE of the inputs' additional power supplies are connected. However, when BOTH inputs are on, there needs to be enough power from both additional Ps to bring the system back online.<br />
* Thus our gate does what it is supposed to: Produce enough power to have the OUTPUT gear be ON when both A and B are either 0 or 1, but not when they are not equal.</div>SLhttp://dwarffortresswiki.org/index.php?title=v0.31_Talk:Mechanical_logic&diff=88566v0.31 Talk:Mechanical logic2010-04-10T02:27:29Z<p>SL: Created page with 'The designs on the 40d mechanical logic gates page were incomprehensible, so I designed some new ones and put them here. I haven't put up a "rotation sensor" design yet, since (a…'</p>
<hr />
<div>The designs on the 40d mechanical logic gates page were incomprehensible, so I designed some new ones and put them here. I haven't put up a "rotation sensor" design yet, since (a) the description is self-explanatory, and (b) I'm designing flowless water logic gates at the moment and am wondering if it's possible to make a flowless version. --[[User:SL|SL]] 02:27, 10 April 2010 (UTC)</div>SLhttp://dwarffortresswiki.org/index.php?title=v0.31:Mechanical_logic&diff=88559v0.31:Mechanical logic2010-04-10T02:21:49Z<p>SL: </p>
<hr />
<div>Mechanical logic uses axles, gears, [[DF2010:power|power]], and load to perform logical computations and turn power on and off. At present, to convert a power output into a link signal output such as most dwarven devices (bridge, door, hatch, cage, etc) can use, you would need to build a power -> signal converter (aka "rotation sensor") out of a pump and pressure plate with (currently, no other designs have been made) an unlimited water source and drain - one for each gate.<br />
<br />
The principles powering mechanical logic are simple: Gears linked to [[DF2010:trigger|triggers]] will be disconnected when they receive an OFF signal. In this manner, you can conditionally attach either power supply (windmills or waterwheels) or load (additional gears or pumps) to a linked gear in various configurations in order to build logic gates.<br />
<br />
One of the weaknesses of mechanical logic is the substantial amount of materials it tends to require to construct the power and load devices, as well as the gears and axles making up the gates and connecting them to their outputs.<br />
<br />
==Mechanical signal-input power-output gates==<br />
* These gates can be used either by adding a power -> link signal converter (also known as a "rotation sensor"), or directly used to control pumps, such as in other logic gates (the unsourced fluid logic gates use these, for instance). The conventional "rotation sensor" consists of a pump powered by the gate's OUTPUT gear, pumping an infinite supply of water onto a water-sensing pressure plate with an infinite drain.<br />
* There are certain things important to all the gates:<br />
* Each gate has an OUTPUT gear, which will be placed next to a pump which the gate will control.<br />
* In diagrams, the OUTPUT gear is below the 'O' gear, connected to it by gears or vertical axles. The 'w's are gears with windmills on top of them, and ║ and - are horizontal axles. The Is are gears linked to INPUTs (some gates have one input, but most have two).<br />
* Gates which incorporate a NOT will have the power network branch off from the 'O' gear, and have a train of power-draining stuff connected to the input gears, whereas gates which do not incorporate a NOT will have the power connected to the input gears instead. The principle behind normal gates is that when the INPUTs are ON, power is connected. The principle behind the NOT gates is that power is always connected, but when the INPUTs are ON, a large enough power requirement is connected to send the power requirements above the power supply, shutting down the system.<br />
* If your windmills produce no power, the diagrams are basically useless to you since you'll have to come up with some way to use water wheels for power instead.<br />
* You should build only enough windmills (or water wheels) to power the system, and should not connect the network for one gate to another gate's network, since that would both gates up.<br />
<br />
===Mechanical identity gate ===<br />
(Example diagram, yours will vary based on how much power is needed)<br />
{{diagram|<br />
OI--w--w--w--w}}<br />
<br />
* This takes an linked input signal and converts it to power without changing it. The unsourced fluid transfer NOT gate uses this, for instance.<br />
* Connected to the input gear, such that they will only be connected to the system if the input gear is receiving an ON signal, are gears with windmills on top of them. Build only enough windmills to power the devices that the gate's OUTPUT gear are connected to (and the gears/axles).<br />
* When the INPUT is ON, the INPUT gear will be active, and the network will provide power to the OUTPUT. When the INPUT is OFF, it will not provide power to the OUTPUT.<br />
<br />
===Mechanical NOT gate===<br />
(Example diagram, yours will vary based on how much power is needed)<br />
{{diagram|<br />
OIggggg<br />
║<br />
║<br />
w--w--w--w}}<br />
<br />
* When the INPUT is ON, the INPUT gear will be active, and the network should need more power than is available. The devices connected to OUTPUT should shut down. When INPUT is OFF, the devices should have power since the INPUT gear will be disconnected.<br />
<br />
===Mechanical NAND gate===<br />
<br />
(Example diagram, yours will vary based on how much power is needed)<br />
{{diagram|<br />
OIIggggg<br />
║<br />
║<br />
w--w--w--w}}<br />
<br />
* This works just like the NOT gate, except that there are two inputs and both have to be active to shut down the system instead of one. Make sure you have enough power to run the system when one of the input gears is active.<br />
<br />
===Mechanical AND gate===<br />
<br />
(Example diagram, yours will vary based on how much power is needed)<br />
{{diagram|<br />
OII--w--w--w--w}}<br />
<br />
* This works like the identity gate, except that there are two inputs and both have to be active for the system to get power.<br />
<br />
===Mechanical OR gate===<br />
<br />
(Example diagram, yours will vary based on how much power is needed)<br />
{{diagram|<br />
OI<br />
I*--w--w--w--w}}<br />
<br />
* This works like the identity gate, except that there are two inputs, and if either is active, the system receives power. Note that the entire power network is connected to both inputs, such that if either input is active the entire power network is powering the system.<br />
<br />
===Mechanical NOR gate===<br />
<br />
(Example diagram, yours will vary based on how much power is needed)<br />
<br />
{{diagram|<br />
I*ggggg<br />
OI<br />
║<br />
║<br />
w--w--w--w--w}}<br />
<br />
* This works like the NOT gate, except that there are two inputs, and if either is active, the gear train or pump stack signified by the 'g's will be connected to the system, pushing power requirements higher than power supply, shutting it down (if you've built it with the amount of windmills and gears/pumps needed to power it and to shut it down when an input turns on).<br />
<br />
===Mechanical XOR gate===<br />
<br />
(Example diagram, yours will vary based on how much power is needed)<br />
{{diagram|<br />
OI<br />
I*--w--w--wiggg<br />
[#000].[#000].[#000].[#000].[#000].[#000].[#000].[#000].[#000].[#000].i<br />
[#000].[#000].[#000].[#000].[#000].[#000].[#000].[#000].[#000].[#000].ggg}}<br />
<br />
<br />
* Except for the 'i's and 'g's, this gate is identical to the OR gate. The additional components add the 'exclusive' part of the 'XOR' to the gate.<br />
* This gate may be a bit difficult to construct. First, the 'i's are additional gears connected to each of your inputs, and the gs are gear trains, however, neither gear train by itself should be enough to shut down the system. However, you need to make the gear trains large enough that if both inputs are active at the same time, their power requirements become large enough to shut down the system, without making them large enough to shut it down when only one of them is active. It'll just require a little math on your part.<br />
<br />
===Mechanical XNOR gate===<br />
<br />
(Example diagram, yours will vary based on how much power is needed)<br />
<br />
{{diagram|<br />
I*gggggg<br />
OI<br />
║<br />
w--w--wi-w<br />
[#000].[#000].[#000].[#000].[#000].[#000].i<br />
[#000].[#000].[#000].[#000].[#000].[#000].║<br />
[#000].[#000].[#000].[#000].[#000].[#000].w}}<br />
<br />
{| class="wikitable"<br />
|-<br />
! A<br />
! B<br />
! Drain<br />
! Power<br />
! Extra Power<br />
! Result<br />
|-<br />
| 0<br />
| 0<br />
| No<br />
| No<br />
| No<br />
| 1<br />
|-<br />
| 0<br />
| 1<br />
| Yes<br />
| Yes<br />
| Half<br />
| 0<br />
|-<br />
| 1<br />
| 0<br />
| Yes<br />
| Yes<br />
| Half<br />
| 0<br />
|-<br />
| 1<br />
| 1<br />
| Yes<br />
| Yes<br />
| Full<br />
| 1<br />
|} <br />
<br />
* The XNOR gate is an equality gate: The output is ON when both inputs are equal, and OFF when they are not equal.<br />
* This gate may be '''even more complicated''' to build than the XOR gate!<br />
* First, your 'i's are again gears connected to your two inputs. The ws to the right and below them are additional windmills.<br />
* Here's where it gets complicated. The gear trains have to be sufficient to shut down the system even when ONE of the inputs' additional windmills are connected. However, when BOTH inputs are on, there needs to be enough power from the additional windmills to bring the system back online.<br />
* Thus our gate does what it is supposed to: Produce enough power to have the OUTPUT gear be ON when both A and B are either 0 or 1, but not when they are not equal.</div>SLhttp://dwarffortresswiki.org/index.php?title=v0.31:Mechanical_logic&diff=88558v0.31:Mechanical logic2010-04-10T02:21:27Z<p>SL: Created page with 'Mechanical logic uses axles, gears, [[DF2010:power|power], and load to perform logical computations and turn power on and off. At present, to convert a power output into a link s…'</p>
<hr />
<div>Mechanical logic uses axles, gears, [[DF2010:power|power], and load to perform logical computations and turn power on and off. At present, to convert a power output into a link signal output such as most dwarven devices (bridge, door, hatch, cage, etc) can use, you would need to build a power -> signal converter (aka "rotation sensor") out of a pump and pressure plate with (currently, no other designs have been made) an unlimited water source and drain - one for each gate.<br />
<br />
The principles powering mechanical logic are simple: Gears linked to [[DF2010:trigger|triggers]] will be disconnected when they receive an OFF signal. In this manner, you can conditionally attach either power supply (windmills or waterwheels) or load (additional gears or pumps) to a linked gear in various configurations in order to build logic gates.<br />
<br />
One of the weaknesses of mechanical logic is the substantial amount of materials it tends to require to construct the power and load devices, as well as the gears and axles making up the gates and connecting them to their outputs.<br />
<br />
==Mechanical signal-input power-output gates==<br />
* These gates can be used either by adding a power -> link signal converter (also known as a "rotation sensor"), or directly used to control pumps, such as in other logic gates (the unsourced fluid logic gates use these, for instance). The conventional "rotation sensor" consists of a pump powered by the gate's OUTPUT gear, pumping an infinite supply of water onto a water-sensing pressure plate with an infinite drain.<br />
* There are certain things important to all the gates:<br />
* Each gate has an OUTPUT gear, which will be placed next to a pump which the gate will control.<br />
* In diagrams, the OUTPUT gear is below the 'O' gear, connected to it by gears or vertical axles. The 'w's are gears with windmills on top of them, and ║ and - are horizontal axles. The Is are gears linked to INPUTs (some gates have one input, but most have two).<br />
* Gates which incorporate a NOT will have the power network branch off from the 'O' gear, and have a train of power-draining stuff connected to the input gears, whereas gates which do not incorporate a NOT will have the power connected to the input gears instead. The principle behind normal gates is that when the INPUTs are ON, power is connected. The principle behind the NOT gates is that power is always connected, but when the INPUTs are ON, a large enough power requirement is connected to send the power requirements above the power supply, shutting down the system.<br />
* If your windmills produce no power, the diagrams are basically useless to you since you'll have to come up with some way to use water wheels for power instead.<br />
* You should build only enough windmills (or water wheels) to power the system, and should not connect the network for one gate to another gate's network, since that would both gates up.<br />
<br />
===Mechanical identity gate ===<br />
(Example diagram, yours will vary based on how much power is needed)<br />
{{diagram|<br />
OI--w--w--w--w}}<br />
<br />
* This takes an linked input signal and converts it to power without changing it. The unsourced fluid transfer NOT gate uses this, for instance.<br />
* Connected to the input gear, such that they will only be connected to the system if the input gear is receiving an ON signal, are gears with windmills on top of them. Build only enough windmills to power the devices that the gate's OUTPUT gear are connected to (and the gears/axles).<br />
* When the INPUT is ON, the INPUT gear will be active, and the network will provide power to the OUTPUT. When the INPUT is OFF, it will not provide power to the OUTPUT.<br />
<br />
===Mechanical NOT gate===<br />
(Example diagram, yours will vary based on how much power is needed)<br />
{{diagram|<br />
OIggggg<br />
║<br />
║<br />
w--w--w--w}}<br />
<br />
* When the INPUT is ON, the INPUT gear will be active, and the network should need more power than is available. The devices connected to OUTPUT should shut down. When INPUT is OFF, the devices should have power since the INPUT gear will be disconnected.<br />
<br />
===Mechanical NAND gate===<br />
<br />
(Example diagram, yours will vary based on how much power is needed)<br />
{{diagram|<br />
OIIggggg<br />
║<br />
║<br />
w--w--w--w}}<br />
<br />
* This works just like the NOT gate, except that there are two inputs and both have to be active to shut down the system instead of one. Make sure you have enough power to run the system when one of the input gears is active.<br />
<br />
===Mechanical AND gate===<br />
<br />
(Example diagram, yours will vary based on how much power is needed)<br />
{{diagram|<br />
OII--w--w--w--w}}<br />
<br />
* This works like the identity gate, except that there are two inputs and both have to be active for the system to get power.<br />
<br />
===Mechanical OR gate===<br />
<br />
(Example diagram, yours will vary based on how much power is needed)<br />
{{diagram|<br />
OI<br />
I*--w--w--w--w}}<br />
<br />
* This works like the identity gate, except that there are two inputs, and if either is active, the system receives power. Note that the entire power network is connected to both inputs, such that if either input is active the entire power network is powering the system.<br />
<br />
===Mechanical NOR gate===<br />
<br />
(Example diagram, yours will vary based on how much power is needed)<br />
<br />
{{diagram|<br />
I*ggggg<br />
OI<br />
║<br />
║<br />
w--w--w--w--w}}<br />
<br />
* This works like the NOT gate, except that there are two inputs, and if either is active, the gear train or pump stack signified by the 'g's will be connected to the system, pushing power requirements higher than power supply, shutting it down (if you've built it with the amount of windmills and gears/pumps needed to power it and to shut it down when an input turns on).<br />
<br />
===Mechanical XOR gate===<br />
<br />
(Example diagram, yours will vary based on how much power is needed)<br />
{{diagram|<br />
OI<br />
I*--w--w--wiggg<br />
[#000].[#000].[#000].[#000].[#000].[#000].[#000].[#000].[#000].[#000].i<br />
[#000].[#000].[#000].[#000].[#000].[#000].[#000].[#000].[#000].[#000].ggg}}<br />
<br />
<br />
* Except for the 'i's and 'g's, this gate is identical to the OR gate. The additional components add the 'exclusive' part of the 'XOR' to the gate.<br />
* This gate may be a bit difficult to construct. First, the 'i's are additional gears connected to each of your inputs, and the gs are gear trains, however, neither gear train by itself should be enough to shut down the system. However, you need to make the gear trains large enough that if both inputs are active at the same time, their power requirements become large enough to shut down the system, without making them large enough to shut it down when only one of them is active. It'll just require a little math on your part.<br />
<br />
===Mechanical XNOR gate===<br />
<br />
(Example diagram, yours will vary based on how much power is needed)<br />
<br />
{{diagram|<br />
I*gggggg<br />
OI<br />
║<br />
w--w--wi-w<br />
[#000].[#000].[#000].[#000].[#000].[#000].i<br />
[#000].[#000].[#000].[#000].[#000].[#000].║<br />
[#000].[#000].[#000].[#000].[#000].[#000].w}}<br />
<br />
{| class="wikitable"<br />
|-<br />
! A<br />
! B<br />
! Drain<br />
! Power<br />
! Extra Power<br />
! Result<br />
|-<br />
| 0<br />
| 0<br />
| No<br />
| No<br />
| No<br />
| 1<br />
|-<br />
| 0<br />
| 1<br />
| Yes<br />
| Yes<br />
| Half<br />
| 0<br />
|-<br />
| 1<br />
| 0<br />
| Yes<br />
| Yes<br />
| Half<br />
| 0<br />
|-<br />
| 1<br />
| 1<br />
| Yes<br />
| Yes<br />
| Full<br />
| 1<br />
|} <br />
<br />
* The XNOR gate is an equality gate: The output is ON when both inputs are equal, and OFF when they are not equal.<br />
* This gate may be '''even more complicated''' to build than the XOR gate!<br />
* First, your 'i's are again gears connected to your two inputs. The ws to the right and below them are additional windmills.<br />
* Here's where it gets complicated. The gear trains have to be sufficient to shut down the system even when ONE of the inputs' additional windmills are connected. However, when BOTH inputs are on, there needs to be enough power from the additional windmills to bring the system back online.<br />
* Thus our gate does what it is supposed to: Produce enough power to have the OUTPUT gear be ON when both A and B are either 0 or 1, but not when they are not equal.</div>SLhttp://dwarffortresswiki.org/index.php?title=v0.31:Computing&diff=88518v0.31:Computing2010-04-10T01:46:42Z<p>SL: After designing a whole set of mechanical logic gates, it doesn't seem anywhere near as incomprehensible as the old 40d mechanical logic page had made it seem :P</p>
<hr />
<div>{{av}}<br />
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. 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.<br />
=== Binary information ===<br />
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:<br />
* on/off state or signal of a [[DF2010:trigger|trigger]] (pressure plate, lever)<br />
* power or connection state of a [[DF2010:machine component|machine component]]<br />
* open or closed state of a [[DF2010:door|door]] or similar buildings<br />
* [[DF2010:pressure plate|low/high]] or [[DF2010:flow|flowing/standing]] [[DF2010:water|fluid]]<br />
* present [[DF2010:creature|creature]]s and [[DF2010:dwarf|borgs]]<br />
<br />
Electronic devices and computers base on this elementary form of information, and if you want to go into computing, you’ll have to familiarize yourself with it. [http://en.wikipedia.org/wiki/Propositional_calculus propositional calculus]<br />
=== Input/Output ===<br />
Input can be any device which can be linked to another device with mechanisms, such as [[DF2010:lever|levers]] or [[DF2010:pressure plate|pressure plates]]. Pressure plates can measure water, magma, or creature weight, and can be set to react to your own dwarves if measuring creature weight. If measuring water or magma you specify the minimum and maximum levels at which it should output 'on', and at all other levels it will output an 'off' signal. Regardless of the actual amount of water, magma, or creature weight on your pressure plate, the plate can only output an 'on' or 'off' signal (1 or 0) to whatever devices it is linked to. So everything you build will have a binary base.<br />
<br />
====Input elements====<br />
* manual: [[DF2010:lever|lever]] -> binary on/off signal<br />
* triggered: [[DF2010:pressure plate|pressure plate]] -> binary on/off signal<br />
<br />
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. In some special configurations - when [[DF2010:mechanical logic|mechanical logic]] is involved - output may not be a on/off signal but power, thus running or not running a machine component.<br />
<br />
Currently to convert from power to an on/off signal, the only way is to use a screw pump connected to that power source with an unlimited amount of water and drainage at the output, and a pressure plate to measure whether water is being pumped out by the pump.<br />
<br />
====Output elements====<br />
* signal: [[DF2010:pressure plate|pressure plate]] -> binary on/off signal -> linkable Object(s)<br />
* power: [[DF2010:gear assembly|gear assembly]] -> binary power on/power off -> machine<br />
<br />
=== Binary logic ===<br />
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'''.<br /><br />
* NOT - takes one input and returns the opposite of the input<br /><br /><br />
{| class="wikitable" border=1<br />
|-<br />
! input A <br />
! NOT<br />
|-<br />
| 0<br />
| 1<br />
|-<br />
| 1<br />
| 0<br />
|}<br /><br />
* AND - takes two inputs and returns true if both inputs are true<br />
* OR - takes two inputs and returns true if at least one input is true<br />
* XOR - takes two inputs and returns true if exactly one input is true<br />
* NAND - takes two inputs and returns true if either input is false<br />
* NOR - takes two inputs and returns true if both inputs are false<br />
* NXOR - takes two inputs and returns true if both inputs are identical<br /><br /><br />
{| class="wikitable" border=1<br />
|-<br />
! input A<br />
! input B<br />
! AND<br />
! OR<br />
! XOR<br />
! NAND<br />
! NOR<br />
! NXOR<br />
|-<br />
| 0<br />
| 0<br />
| 0<br />
| 0<br />
| 0<br />
| 1<br />
| 1<br />
| 1<br />
|-<br />
| 0<br />
| 1<br />
| 0<br />
| 1<br />
| 1<br />
| 1<br />
| 0<br />
| 0<br />
|-<br />
| 1<br />
| 0<br />
| 0<br />
| 1<br />
| 1<br />
| 1<br />
| 0<br />
| 0<br />
|-<br />
| 1<br />
| 1<br />
| 1<br />
| 1<br />
| 0<br />
| 0<br />
| 0<br />
| 1<br />
|}<br /><br />
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. Designing each individual gate that you will need (or using designs that had each individual gate designed) rather than building a gate out of multiple NAND gates or the like will generally result in your dorfputer reacting faster and using less resources (power, water, kittens, construction materials, what-have-you).<br />
<br />
=== Complex gates ===<br />
* [[DF2010:Latch|Latch]] - storing and reading a single binary value<br />
* [[DF2010:Repeater|Repeater]] - sending a repeating signal<br />
* [[DF2010:Counter|Counter]]/[[DF2010:Adder|Adder]] - binary calculation<br />
<br />
== Disciplines ==<br />
Historically, prior to DF2010 there have been 3 main disciplines of dwarfputing, depending on what would drive the dwarfputer. Each of them had its assets and drawbacks. So far, DF2010 at 0.31.01 appears to be essentially the same as far as power transmission goes, barring some differences with pump vertical power transmission (they don't without the floor between being channeled, apparently). Science! will determine what, if anything, differs as far as water flow, falling, and animal pathfinding.<br />
<br />
The three disciplines are:<br />
=== Fluid logic ===<br />
[[DF2010:Infinite flow fluid logic|Infinite flow 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 [[DF2010:evaporation|evaporation]] and [[DF2010:Water#Water_in_Fortress_Mode|destruction]].<br />
=== Mechanical logic ===<br />
[[DF2010:Mechanical logic|Mechanical logic]] uses systems of axles and [[DF2010:gear assemblies|gear assemblies]] to build logical gates. Mechanical logic reacts very fast and can be easily constructed, except for the need for a fluid-pump-based power->signal converter in every gate. Since every gear can itself be linked to a trigger (or multiple triggers), and automatically connect to adjacent gears for transferring either power or load, mechanical logic gates are very flexible and don't require anywhere near the number of different devices that tend to be used in fluid logic gates (except, again, for the requirement for a fluid-pump-based power->signal converter in every gate, unless you intend to use it to control a pump). On the other hand this discipline uses a LOT of mechanical power, and due to the lack of a power->signal converter, also referred to as a "rotation sensor" (a device to convert from power to on/off link signals), you need to build one using fluid logic components (the only design currently uses a pump, pressure plate, unlimited fluid, and unlimited drain) if you want to connect multiple mechanical logic gates together or connect a mechanical logic gate to any output other than a pump. So, in truth, current mechanical logic is more correctly termed mechanical-fluid hybrid logic, as you need an essentially unlimited source of water along with an unlimited drain to power the pump-based signal converters. (That said, an aquifer would work perfectly)<br />
<br />
=== Animal logic ===<br />
[[DF2010:Animal logic|Animal logic]] places animals in an enclosed room, with a door blocking the path to where they desire to go, and a pressure plate below a hatch, with obstacles which are controlled by triggers. The animal thinks it can walk through the door, and if it has a path to the door will walk up to it and stand on the hatch. When the hatch is opened by a trigger, it falls onto the pressure plate. As long as the hatch is open, or other obstacles block its path to the door it remains on the pressure plate and the output is 'on'. Once it sees a path to the door it will leave the pressure plate. Generally this is made possibly by the fact that animals try to go to their parent while they're children, or to the meeting area. There are also be designs which use captured hostiles.<br />
<br />
There was a fourth, theoretical, discipline, Borg Logic, but there was never any reported success inventing any functioning and useful borg logic systems.<br />
<br />
===Examples of things you could do with logic gates===<br />
* Repeater: Repeatedly toggling hatches open and closed, or spikes up and down.<br />
* Latch: Making resettable one-use pressure plates which are reset by a lever.<br />
* NOT gate: Reversing the effect of a switch or creature-sensing pressure plate, generally linked to a latch device. You can, of course, mod the latch device to send the opposite signal instead of using a NOT gate.<br />
* AND gate: Requiring more than one condition to be true for something to occur. For instance, you could have a group of AND gates, with a system on/off switch, and and other triggers, with each trigger linked to a different AND gate with the system on/off switch linked to the the second input on all the AND gates, so that when the system on/off switch is OFF the output will be OFF on all the AND gates.<br />
* OR gate: You could link two 1-7 water sensors to an OR gate, and link that to a NOT gate, and link that to some floodgates or doors which act as emergency bulkheads, closing when water is detected in the area. Or, link the OR gate to bridges which raise instead (but you may crush things, and bridges are slower than doors).<br />
* XOR gate: You could use pressure plates hooked to latches at different points in your fort to detect enemy intrusion, and set them up to seal off the area with both an interior and exterior bulkhead when the intrusion occurs, but hook your latches up with an XOR gate and hook the output to the interior bulkhead to unseal that one if your pressure plates have detected that the enemy has gotten past it.<br />
* NOR gate: A NOR gate returns TRUE (ON) only if both inputs are FALSE. Instead of using the OR gate example with a NOT gate, you could use a NOR gate linked to two 1-7 water sensors, whose output goes to doors or floodgates. When the pressure plates are both waterless, the floodgates will be open. When one detects water, the floodgates close. (If you used 0-0 pressure plates with an OR, you would get an OFF signal if both plates detected water, or an ON signal otherwise (which is the same as 1-7 NAND 1-7))<br />
* NAND gate: A NAND gate returns TRUE (ON) whenever both inputs are not both TRUE (e.g. ON NAND ON is OFF, but every other combination is ON). Instead of the OR NOT or NOR example, you could link two 0-0 water sensors to a NAND gate, and link the NAND gate's output to raising bridges. 0-0 NAND 0-0 is the same as 1-7 OR 1-7. If there is no water on both pressure plates, the NAND gate will output an OFF signal. If, however, either has water, it will output an ON signal.<br />
<br />
* And here's a more complicated example, omitting the details of what gates to use: An automated swimming training room, where you pull a lever to close exit doors and open hatches to drop water into it, then pressure plates detect when there's enough water and close the hatches, and after a certain amount of time (using a very slow repeater, for instance), drains and exit doors open and the system resets until you pull the lever again. Or, the lever could be taken out entirely and the system could be made fully automatic (with dwarves set to train in the room, for instance) using the repeater.</div>SLhttp://dwarffortresswiki.org/index.php?title=User:SL&diff=86762User:SL2010-04-08T06:00:10Z<p>SL: Blanked the page</p>
<hr />
<div></div>SLhttp://dwarffortresswiki.org/index.php?title=v0.31:Computing&diff=86754v0.31:Computing2010-04-08T05:46:40Z<p>SL: </p>
<hr />
<div>{{av}}<br />
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. 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.<br />
=== Binary information ===<br />
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:<br />
* on/off state or signal of a [[DF2010:trigger|trigger]] (pressure plate, lever)<br />
* power or connection state of a [[DF2010:machine component|machine component]]<br />
* open or closed state of a [[DF2010:door|door]] or similar buildings<br />
* [[DF2010:pressure plate|low/high]] or [[DF2010:flow|flowing/standing]] [[DF2010:water|fluid]]<br />
* present [[DF2010:creature|creature]]s and [[DF2010:dwarf|borgs]]<br />
<br />
Electronic devices and computers base on this elementary form of information, and if you want to go into computing, you’ll have to familiarize yourself with it. [http://en.wikipedia.org/wiki/Propositional_calculus propositional calculus]<br />
=== Input/Output ===<br />
Input can be any device which can be linked to another device with mechanisms, such as [[DF2010:lever|levers]] or [[DF2010:pressure plate|pressure plates]]. Pressure plates can measure water, magma, or creature weight, and can be set to react to your own dwarves if measuring creature weight. If measuring water or magma you specify the minimum and maximum levels at which it should output 'on', and at all other levels it will output an 'off' signal. Regardless of the actual amount of water, magma, or creature weight on your pressure plate, the plate can only output an 'on' or 'off' signal (1 or 0) to whatever devices it is linked to. So everything you build will have a binary base.<br />
<br />
====Input elements====<br />
* manual: [[DF2010:lever|lever]] -> binary on/off signal<br />
* triggered: [[DF2010:pressure plate|pressure plate]] -> binary on/off signal<br />
<br />
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. In some special configurations - when [[DF2010:mechanical logic|mechanical logic]] is involved - output may not be a on/off signal but power, thus running or not running a machine component.<br />
<br />
Currently to convert from power to an on/off signal, the only way is to use a screw pump connected to that power source with an unlimited amount of water and drainage at the output, and a pressure plate to measure whether water is being pumped out by the pump.<br />
<br />
====Output elements====<br />
* signal: [[DF2010:pressure plate|pressure plate]] -> binary on/off signal -> linkable Object(s)<br />
* power: [[DF2010:gear assembly|gear assembly]] -> binary power on/power off -> machine<br />
<br />
=== Binary logic ===<br />
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'''.<br /><br />
* NOT - takes one input and returns the opposite of the input<br /><br /><br />
{| class="wikitable" border=1<br />
|-<br />
! input A <br />
! NOT<br />
|-<br />
| 0<br />
| 1<br />
|-<br />
| 1<br />
| 0<br />
|}<br /><br />
* AND - takes two inputs and returns true if both inputs are true<br />
* OR - takes two inputs and returns true if at least one input is true<br />
* XOR - takes two inputs and returns true if exactly one input is true<br />
* NAND - takes two inputs and returns true if either input is false<br />
* NOR - takes two inputs and returns true if both inputs are false<br />
* NXOR - takes two inputs and returns true if both inputs are identical<br /><br /><br />
{| class="wikitable" border=1<br />
|-<br />
! input A<br />
! input B<br />
! AND<br />
! OR<br />
! XOR<br />
! NAND<br />
! NOR<br />
! NXOR<br />
|-<br />
| 0<br />
| 0<br />
| 0<br />
| 0<br />
| 0<br />
| 1<br />
| 1<br />
| 1<br />
|-<br />
| 0<br />
| 1<br />
| 0<br />
| 1<br />
| 1<br />
| 1<br />
| 0<br />
| 0<br />
|-<br />
| 1<br />
| 0<br />
| 0<br />
| 1<br />
| 1<br />
| 1<br />
| 0<br />
| 0<br />
|-<br />
| 1<br />
| 1<br />
| 1<br />
| 1<br />
| 0<br />
| 0<br />
| 0<br />
| 1<br />
|}<br /><br />
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. Designing each individual gate that you will need (or using designs that had each individual gate designed) rather than building a gate out of multiple NAND gates or the like will generally result in your dorfputer reacting faster and using less resources (power, water, kittens, construction materials, what-have-you).<br />
<br />
=== Complex gates ===<br />
* [[DF2010:Latch|Latch]] - storing and reading a single binary value<br />
* [[DF2010:Repeater|Repeater]] - sending a repeating signal<br />
* [[DF2010:Counter|Counter]]/[[DF2010:Adder|Adder]] - binary calculation<br />
<br />
== Disciplines ==<br />
Historically, prior to DF2010 there have been 3 main disciplines of dwarfputing, depending on what would drive the dwarfputer. Each of them had its assets and drawbacks. So far, DF2010 at 0.31.01 appears to be essentially the same as far as power transmission goes, barring some differences with pump vertical power transmission (they don't without the floor between being channeled, apparently). Science! will determine what, if anything, differs as far as water flow, falling, and animal pathfinding.<br />
<br />
The three disciplines are:<br />
=== Fluid logic ===<br />
[[DF2010:Infinite flow fluid logic|Infinite flow 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 [[DF2010:evaporation|evaporation]] and [[DF2010:Water#Water_in_Fortress_Mode|destruction]].<br />
=== Mechanical logic ===<br />
[[DF2010:Mechanical logic|Mechanical logic]] uses systems of axles and [[DF2010:gear assemblies|gear assemblies]] to build logical gates. Mechanical logic reacts very fast and can be easily constructed (if not as easily understood and designed as fluid logic gates), except for the need for a fluid-pump-based power->signal converter in every gate. <!-- "The feature of gears to toggle on every signal instead of reacting different to on/off signals makes mechanical logic gates very flexible." I can't tell what the Urist that sentence is supposed to mean, so I'm removing it. -SL --> Since every gear can itself be linked to a trigger (or multiple triggers), and automatically connect to adjacent gears for transferring power, mechanical logic gates are very flexible and don't require anywhere near the number of different devices that tend to be used in fluid logic gates (except, again, for the requirement for a fluid-pump-based power->signal converter in every gate). On the other hand this discipline uses a LOT of mechanical power, and due to the lack of a power->signal converter, also referred to as a "rotation sensor" (a device to convert from power to on/off link signals), you need to build one using fluid logic components (pump, pressure plate, unlimited fluid, unlimited drain) if you want to connect multiple mechanical logic gates together or connect a mechanical logic gate to any output other than a pump. So, in truth, current mechanical logic is more correctly termed mechanical-fluid hybrid logic, as you need an essentially unlimited source of water along with an unlimited drain to power the pump-based signal converters. (That said, an aquifer would work perfectly)<br />
=== Animal logic ===<br />
[[DF2010:Animal logic|Animal logic]] places animals in an enclosed room, with a door blocking the path to where they desire to go, and a pressure plate below a hatch, with obstacles which are controlled by triggers. The animal thinks it can walk through the door, and if it has a path to the door will walk up to it and stand on the hatch. When the hatch is opened by a trigger, it falls onto the pressure plate. As long as the hatch is open, or other obstacles block its path to the door it remains on the pressure plate and the output is 'on'. Once it sees a path to the door it will leave the pressure plate. Generally this is made possibly by the fact that animals try to go to their parent while they're children, or to the meeting area. There are also be designs which use captured hostiles.<br />
<br />
There was a fourth, theoretical, discipline, Borg Logic, but there was never any reported success inventing any functioning and useful borg logic systems.<br />
<br />
===Examples of things you could do with logic gates===<br />
* Repeater: Repeatedly toggling hatches open and closed, or spikes up and down.<br />
* Latch: Making resettable one-use pressure plates which are reset by a lever.<br />
* NOT gate: Reversing the effect of a switch or creature-sensing pressure plate, generally linked to a latch device. You can, of course, mod the latch device to send the opposite signal instead of using a NOT gate.<br />
* AND gate: Requiring more than one condition to be true for something to occur. For instance, you could have a group of AND gates, with a system on/off switch, and and other triggers, with each trigger linked to a different AND gate with the system on/off switch linked to the the second input on all the AND gates, so that when the system on/off switch is OFF the output will be OFF on all the AND gates.<br />
* OR gate: You could link two 1-7 water sensors to an OR gate, and link that to a NOT gate, and link that to some floodgates or doors which act as emergency bulkheads, closing when water is detected in the area. Or, link the OR gate to bridges which raise instead (but you may crush things, and bridges are slower than doors).<br />
* XOR gate: You could use pressure plates hooked to latches at different points in your fort to detect enemy intrusion, and set them up to seal off the area with both an interior and exterior bulkhead when the intrusion occurs, but hook your latches up with an XOR gate and hook the output to the interior bulkhead to unseal that one if your pressure plates have detected that the enemy has gotten past it.<br />
* NOR gate: A NOR gate returns TRUE (ON) only if both inputs are FALSE. Instead of using the OR gate example with a NOT gate, you could use a NOR gate linked to two 1-7 water sensors, whose output goes to doors or floodgates. When the pressure plates are both waterless, the floodgates will be open. When one detects water, the floodgates close. (If you used 0-0 pressure plates with an OR, you would get an OFF signal if both plates detected water, or an ON signal otherwise (which is the same as 1-7 NAND 1-7))<br />
* NAND gate: A NAND gate returns TRUE (ON) whenever both inputs are not both TRUE (e.g. ON NAND ON is OFF, but every other combination is ON). Instead of the OR NOT or NOR example, you could link two 0-0 water sensors to a NAND gate, and link the NAND gate's output to raising bridges. 0-0 NAND 0-0 is the same as 1-7 OR 1-7. If there is no water on both pressure plates, the NAND gate will output an OFF signal. If, however, either has water, it will output an ON signal.<br />
<br />
* And here's a more complicated example, omitting the details of what gates to use: An automated swimming training room, where you pull a lever to close exit doors and open hatches to drop water into it, then pressure plates detect when there's enough water and close the hatches, and after a certain amount of time (using a very slow repeater, for instance), drains and exit doors open and the system resets until you pull the lever again. Or, the lever could be taken out entirely and the system could be made fully automatic (with dwarves set to train in the room, for instance) using the repeater.</div>SLhttp://dwarffortresswiki.org/index.php?title=v0.31:Computing&diff=86751v0.31:Computing2010-04-08T05:45:45Z<p>SL: Used stuff from the 40d computing article, but went through the entire thing and edited it for accuracy. Note that many of the links are to nonexistant pages currently.</p>
<hr />
<div>{{av}}<br />
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. 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.<br />
=== Binary information ===<br />
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:<br />
* on/off state or signal of a [[DF2010:trigger|trigger]] (pressure plate, lever)<br />
* power or connection state of a [[DF2010:machine component|machine component]]<br />
* open or closed state of a [[DF2010:door|door]] or similar buildings<br />
* [[DF2010:pressure plate|low/high]] or [[DF2010:flow|flowing/standing]] [[DF2010:water|fluid]]<br />
* present [[DF2010:creature|creature]]s and [[DF2010:dwarf|borgs]]<br />
<br />
Electronic devices and computers base on this elementary form of information, and if you want to go into computing, you’ll have to familiarize yourself with it. [http://en.wikipedia.org/wiki/Propositional_calculus propositional calculus]<br />
=== Input/Output ===<br />
Input can be any device which can be linked to another device with mechanisms, such as [[DF2010:lever|levers]] or [[DF2010:pressure plate|pressure plates]]. Pressure plates can measure water, magma, or creature weight, and can be set to react to your own dwarves if measuring creature weight. If measuring water or magma you specify the minimum and maximum levels at which it should output 'on', and at all other levels it will output an 'off' signal. Regardless of the actual amount of water, magma, or creature weight on your pressure plate, the plate can only output an 'on' or 'off' signal (1 or 0) to whatever devices it is linked to. So everything you build will have a binary base.<br />
<br />
====Input elements====<br />
* manual: [[DF2010:lever|lever]] -> binary on/off signal<br />
* triggered: [[DF2010:pressure plate|pressure plate]] -> binary on/off signal<br />
<br />
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. In some special configurations - when [[DF2010:mechanical logic|mechanical logic]] is involved - output may not be a on/off signal but power, thus running or not running a machine component.<br />
<br />
Currently to convert from power to an on/off signal, the only way is to use a screw pump connected to that power source with an unlimited amount of water and drainage at the output, and a pressure plate to measure whether water is being pumped out by the pump.<br />
<br />
====Output elements====<br />
* signal: [[DF2010:pressure plate|pressure plate]] -> binary on/off signal -> linkable Object(s)<br />
* power: [[DF2010:gear assembly|gear assembly]] -> binary power on/power off -> machine<br />
<br />
=== Binary logic ===<br />
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'''.<br /><br />
* NOT - takes one input and returns the opposite of the input<br /><br /><br />
{| class="wikitable" border=1<br />
|-<br />
! input A <br />
! NOT<br />
|-<br />
| 0<br />
| 1<br />
|-<br />
| 1<br />
| 0<br />
|}<br /><br />
* AND - takes two inputs and returns true if both inputs are true<br />
* OR - takes two inputs and returns true if at least one input is true<br />
* XOR - takes two inputs and returns true if exactly one input is true<br />
* NAND - takes two inputs and returns true if either input is false<br />
* NOR - takes two inputs and returns true if both inputs are false<br />
* NXOR - takes two inputs and returns true if both inputs are identical<br /><br /><br />
{| class="wikitable" border=1<br />
|-<br />
! input A<br />
! input B<br />
! AND<br />
! OR<br />
! XOR<br />
! NAND<br />
! NOR<br />
! NXOR<br />
|-<br />
| 0<br />
| 0<br />
| 0<br />
| 0<br />
| 0<br />
| 1<br />
| 1<br />
| 1<br />
|-<br />
| 0<br />
| 1<br />
| 0<br />
| 1<br />
| 1<br />
| 1<br />
| 0<br />
| 0<br />
|-<br />
| 1<br />
| 0<br />
| 0<br />
| 1<br />
| 1<br />
| 1<br />
| 0<br />
| 0<br />
|-<br />
| 1<br />
| 1<br />
| 1<br />
| 1<br />
| 0<br />
| 0<br />
| 0<br />
| 1<br />
|}<br /><br />
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. Designing each individual gate that you will need (or using designs that had each individual gate designed) rather than building a gate out of multiple NAND gates or the like will generally result in your dorfputer reacting faster and using less resources (power, water, kittens, construction materials, what-have-you).<br />
<br />
=== Complex gates ===<br />
* [[DF2010:Latch|Latch]] - storing and reading a single binary value<br />
* [[DF2010:Repeater|Repeater]] - sending a repeating signal<br />
* [[DF2010:Counter|Counter]]/[[DF2010:Adder|Adder]] - binary calculation<br />
<br />
== Disciplines ==<br />
Historically, prior to DF2010 there have been 3 main disciplines of dwarfputing, depending on what would drive the dwarfputer. Each of them had its assets and drawbacks. So far, DF2010 at 0.31.01 appears to be essentially the same as far as power transmission goes, barring some differences with pump vertical power transmission (they don't without the floor between being channeled, apparently). Science! will determine what, if anything, differs as far as water flow, falling, and animal pathfinding.<br />
<br />
The three disciplines are:<br />
=== Fluid logic ===<br />
[[DF2010:Infinite flow fluid logic|Infinite flow 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 [[DF2010:evaporation|evaporation]] and [[DF2010:Water#Water_in_Fortress_Mode|destruction]].<br />
=== Mechanical logic ===<br />
[[DF2010:Mechanical logic|Mechanical logic]] uses systems of axles and [[DF2010:gear assemblies|gear assemblies]] to build logical gates. Mechanical logic reacts very fast and can be easily constructed (if not as easily understood and designed as fluid logic gates), except for the need for a fluid-pump-based power->signal converter in every gate. <!-- "The feature of gears to toggle on every signal instead of reacting different to on/off signals makes mechanical logic gates very flexible." I can't tell what the Urist that sentence is supposed to mean, so I'm removing it. -SL --> Since every gear can itself be linked to a trigger (or multiple triggers), and automatically connect to adjacent gears for transferring power, mechanical logic gates are very flexible and don't require anywhere near the number of different devices that tend to be used in fluid logic gates (except, again, for the requirement for a fluid-pump-based power->signal converter in every gate). On the other hand this discipline uses a LOT of mechanical power, and due to the lack of a power->signal converter, also referred to as a "rotation sensor" (a device to convert from power to on/off link signals), you need to build one using fluid logic components (pump, pressure plate, unlimited fluid, unlimited drain) if you want to connect multiple mechanical logic gates together or connect a mechanical logic gate to any output other than a pump. So, in truth, current mechanical logic is more correctly termed mechanical-fluid hybrid logic, as you need an essentially unlimited source of water along with an unlimited drain to power the pump-based signal converters. (That said, an aquifer would work perfectly)<br />
=== Animal logic ===<br />
[[DF2010:Animal logic|Animal logic]] places animals in an enclosed room, with a door blocking the path to where they desire to go, and a pressure plate below a hatch, with obstacles which are controlled by triggers. The animal thinks it can walk through the door, and if it has a path to the door will walk up to it and stand on the hatch. When the hatch is opened by a trigger, it falls onto the pressure plate. As long as the hatch is open, or other obstacles block its path to the door it remains on the pressure plate and the output is 'on'. Once it sees a path to the door it will leave the pressure plate. Generally this is made possibly by the fact that animals try to go to their parent while they're children, or to the meeting area. There are also be designs which use captured hostiles.<br />
<br />
There was a fourth, theoretical, discipline, Borg Logic, but there was never any reported success inventing any functioning and useful borg logic systems.<br />
<br />
===Examples of things you could do with logic gates===<br />
Repeater: Repeatedly toggling hatches open and closed, or spikes up and down.<br />
Latch: Making resettable one-use pressure plates which are reset by a lever.<br />
NOT gate: Reversing the effect of a switch or creature-sensing pressure plate, generally linked to a latch device. You can, of course, mod the latch device to send the opposite signal instead of using a NOT gate.<br />
AND gate: Requiring more than one condition to be true for something to occur. For instance, you could have a group of AND gates, with a system on/off switch, and and other triggers, with each trigger linked to a different AND gate with the system on/off switch linked to the the second input on all the AND gates, so that when the system on/off switch is OFF the output will be OFF on all the AND gates.<br />
OR gate: You could link two 1-7 water sensors to an OR gate, and link that to a NOT gate, and link that to some floodgates or doors which act as emergency bulkheads, closing when water is detected in the area. Or, link the OR gate to bridges which raise instead (but you may crush things, and bridges are slower than doors).<br />
XOR gate: You could use pressure plates hooked to latches at different points in your fort to detect enemy intrusion, and set them up to seal off the area with both an interior and exterior bulkhead when the intrusion occurs, but hook your latches up with an XOR gate and hook the output to the interior bulkhead to unseal that one if your pressure plates have detected that the enemy has gotten past it.<br />
NOR gate: A NOR gate returns TRUE (ON) only if both inputs are FALSE. Instead of using the OR gate example with a NOT gate, you could use a NOR gate linked to two 1-7 water sensors, whose output goes to doors or floodgates. When the pressure plates are both waterless, the floodgates will be open. When one detects water, the floodgates close. (If you used 0-0 pressure plates with an OR, you would get an OFF signal if both plates detected water, or an ON signal otherwise (which is the same as 1-7 NAND 1-7))<br />
NAND gate: A NAND gate returns TRUE (ON) whenever both inputs are not both TRUE (e.g. ON NAND ON is OFF, but every other combination is ON). Instead of the OR NOT or NOR example, you could link two 0-0 water sensors to a NAND gate, and link the NAND gate's output to raising bridges. 0-0 NAND 0-0 is the same as 1-7 OR 1-7. If there is no water on both pressure plates, the NAND gate will output an OFF signal. If, however, either has water, it will output an ON signal.<br />
<br />
And here's a more complicated example, omitting the details of what gates to use: An automated swimming training room, where you pull a lever to close exit doors and open hatches to drop water into it, then pressure plates detect when there's enough water and close the hatches, and after a certain amount of time (using a very slow repeater, for instance), drains and exit doors open and the system resets until you pull the lever again. Or, the lever could be taken out entirely and the system could be made fully automatic (with dwarves set to train in the room, for instance) using the repeater.</div>SLhttp://dwarffortresswiki.org/index.php?title=User:SL/Borg_Logic_Gates&diff=63180User:SL/Borg Logic Gates2010-02-17T03:42:43Z<p>SL: </p>
<hr />
<div>I'm mostly just pondering borg logic at the moment.<br />
<br />
In order to make borg logic reliable without forcing dwarves to stand around, we may need to base it on a memory gate first. The memory gate requires either water or an animal:<br />
This one uses water: http://dwarffortresswiki.net/index.php/User:SL/Logic_Gates#Memory<br />
This one uses a kitten (or other animal): http://dwarffortresswiki.net/index.php/User:Bidok#Memory<br />
<br />
If you use my water-based memory gate, put it on top of a reservoir, aquifer, or ocean. If you use Bidok's, just make sure the door is non-pet-passable, put an animal inside, and have the door leads to a hall that leads to the activity zone (whereever the pets meet normally).<br />
<br />
As I design each gate, I'll explain what to link the SET and CLEAR inputs and the OUTPUT to.<br />
<br />
Note: It is possible for both the SET and CLEAR outputs to be triggered at the same time on the memory gate with these designs. With the water-based memory gate, this may result in an unpredictible output for a small amount of time. With the kitten based gate, well, I'm not sure what the kitten will do. The hatch would be open, so it couldn't try to go to the door, but would it try to walk up to the hatch, or would it keep standing on the pressure plate until the hatch closed?<br />
<br />
Also, these gates are only theoretical and have not yet been tested.<br />
<br />
So far, from the NOT gate's design, it looks like these would probably respond slowly (slower than water gates), and would disrupt dwarf tasks on top of it. Not so good. Hmm.<br />
<br />
=== NOT gate ===<br />
###<br />
B^B<br />
B^B<br />
B^B<br />
O#O<br />
FvF<br />
FvF<br />
FvF<br />
###<br />
<br />
'O': Service doors, normally locked - so that you can get in to perform maintenance on the pressure plates and whatnot.<br />
INPUT : All the floodgates, labelled F, and the bars or grates, labelled B. Your input is some lever, or something else, which you want to negate the value of.<br />
SET OUTPUT: 'v' tiles are pressure plates set to detect dwarves, linked to the SET output on a memory gate. They are given a pathing priority with the highest possible value (Important!). They should each also be linked to the adjacent 'F's or 'B's in case a dwarf is trapped inside.<br />
CLEAR OUTPUT: '^' tiles are pressure plates set to detect dwarves, linked to the CLEAR output on a memory gate.<br />
<br />
How it works: If the INPUT is ON, the doors are opened, and newly calculated paths will be routed over the SET OUTPUT pressure plates. If the doors are closed, newly calculated paths will be routed over the CLEAR OUTPUT pressure plates instead. This will unfortunately cause dwarves who have already calculated a path through the now-closed doors to run into the doors and exclaim "WTF."<br />
<br />
That's all so far. From the looks of it, it probably isn't worth working on any further, so I wouldn't expect anything further on this page.</div>SLhttp://dwarffortresswiki.org/index.php?title=User:SL/Borg_Logic_Gates&diff=63128User:SL/Borg Logic Gates2010-02-15T20:41:32Z<p>SL: </p>
<hr />
<div>I'm mostly just pondering borg logic at the moment.<br />
<br />
In order to make borg logic reliable without forcing dwarves to stand around, we may need to base it on a memory gate first. The memory gate requires either water or an animal:<br />
This one uses water: http://dwarffortresswiki.net/index.php/User:SL/Logic_Gates#Memory<br />
This one uses a kitten (or other animal): http://dwarffortresswiki.net/index.php/User:Bidok#Memory<br />
<br />
If you use my water-based memory gate, put it on top of a reservoir, aquifer, or ocean. If you use Bidok's, just make sure the door is non-pet-passable, put an animal inside, and have the door leads to a hall that leads to the activity zone (whereever the pets meet normally).<br />
<br />
As I design each gate, I'll explain what to link the SET and CLEAR inputs and the OUTPUT to.<br />
<br />
Note: It is possible for both the SET and CLEAR outputs to be triggered at the same time on the memory gate with these designs. With the water-based memory gate, this may result in an unpredictible output for a small amount of time. With the kitten based gate, well, I'm not sure what the kitten will do. The hatch would be open, so it couldn't try to go to the door, but would it try to walk up to the hatch, or would it keep standing on the pressure plate until the hatch closed?<br />
<br />
Also, these gates are only theoretical and have not yet been tested.<br />
<br />
So far, from the NOT gate's design, it looks like these would probably respond slowly (slower than water gates), and would disrupt dwarf tasks on top of it. Not so good. Hmm.<br />
<br />
Thoughts before I get DF running:<br />
Do dwarves still cancel jobs and drop items when they run into obstacles which weren't there when they calculated their paths?<br />
<br />
=== NOT gate ===<br />
###<br />
B^B<br />
B^B<br />
B^B<br />
O#O<br />
FvF<br />
FvF<br />
FvF<br />
###<br />
<br />
'O': Service doors, normally locked - so that you can get in to perform maintenance on the pressure plates and whatnot.<br />
INPUT : All the floodgates, labelled F, and the bars or grates, labelled B. Your input is some lever, or something else, which you want to negate the value of.<br />
SET OUTPUT: 'v' tiles are pressure plates set to detect dwarves, linked to the SET output on a memory gate. They are given a pathing priority with the highest possible value (Important!). They should each also be linked to the adjacent 'F's or 'B's in case a dwarf is trapped inside.<br />
CLEAR OUTPUT: '^' tiles are pressure plates set to detect dwarves, linked to the CLEAR output on a memory gate.<br />
<br />
How it works: If the INPUT is ON, the doors are opened, and newly calculated paths will be routed over the SET OUTPUT pressure plates. If the doors are closed, newly calculated paths will be routed over the CLEAR OUTPUT pressure plates instead. This will unfortunately cause dwarves who have already calculated a path through the now-closed doors to run into the doors and exclaim "WTF."</div>SLhttp://dwarffortresswiki.org/index.php?title=User:SL/Borg_Logic_Gates&diff=63126User:SL/Borg Logic Gates2010-02-15T19:58:49Z<p>SL: </p>
<hr />
<div>I'm mostly just pondering borg logic at the moment.<br />
<br />
In order to make borg logic reliable without forcing dwarves to stand around, we may need to base it on a memory gate first. The memory gate requires either water or an animal:<br />
This one uses water: http://dwarffortresswiki.net/index.php/User:SL/Logic_Gates#Memory<br />
This one uses a kitten (or other animal): http://dwarffortresswiki.net/index.php/User:Bidok#Memory<br />
<br />
If you use my water-based memory gate, put it on top of a reservoir, aquifer, or ocean. If you use Bidok's, just make sure the door is non-pet-passable, put an animal inside, and have the door leads to a hall that leads to the activity zone (whereever the pets meet normally).<br />
<br />
As I design each gate, I'll explain what to link the SET and CLEAR inputs and the OUTPUT to.<br />
<br />
Note: It is possible for both the SET and CLEAR outputs to be triggered at the same time on the memory gate with these designs. With the water-based memory gate, this may result in an unpredictible output for a small amount of time. With the kitten based gate, well, I'm not sure what the kitten will do. The hatch would be open, so it couldn't try to go to the door, but would it try to walk up to the hatch, or would it keep standing on the pressure plate until the hatch closed?<br />
<br />
Also, these gates are only theoretical and have not yet been tested.<br />
<br />
So far, from the NOT gate's design, it looks like these would probably respond slowly (slower than water gates), and would disrupt dwarf tasks on top of it. Not so good. Hmm.<br />
<br />
Thoughts before I get DF running:<br />
Do jobs on a millstone get cancelled? If not, we could toggle power to a millstone and have a pressure plate in front of it, using it as a dwarf magnet.<br />
Do dwarves still cancel jobs and drop items when they run into obstacles which weren't there when they calculated their paths?<br />
<br />
=== NOT gate ===<br />
###<br />
B^B<br />
B^B<br />
B^B<br />
O#O<br />
FvF<br />
FvF<br />
FvF<br />
###<br />
<br />
'O': Service doors, normally locked - so that you can get in to perform maintenance on the pressure plates and whatnot.<br />
INPUT : All the floodgates, labelled F, and the bars or grates, labelled B. Your input is some lever, or something else, which you want to negate the value of.<br />
SET OUTPUT: 'v' tiles are pressure plates set to detect dwarves, linked to the SET output on a memory gate. They are given a pathing priority with the highest possible value (Important!). They should each also be linked to the adjacent 'F's or 'B's in case a dwarf is trapped inside.<br />
CLEAR OUTPUT: '^' tiles are pressure plates set to detect dwarves, linked to the CLEAR output on a memory gate.<br />
<br />
How it works: If the INPUT is ON, the doors are opened, and newly calculated paths will be routed over the SET OUTPUT pressure plates. If the doors are closed, newly calculated paths will be routed over the CLEAR OUTPUT pressure plates instead. This will unfortunately cause dwarves who have already calculated a path through the now-closed doors to run into the doors and exclaim "WTF."</div>SLhttp://dwarffortresswiki.org/index.php?title=User:SL/Borg_Logic_Gates&diff=63116User:SL/Borg Logic Gates2010-02-15T10:29:54Z<p>SL: </p>
<hr />
<div>I'm mostly just pondering borg logic at the moment.<br />
<br />
In order to make borg logic reliable without forcing dwarves to stand around, we may need to base it on a memory gate first. The memory gate requires either water or an animal:<br />
This one uses water: http://dwarffortresswiki.net/index.php/User:SL/Logic_Gates#Memory<br />
This one uses a kitten (or other animal): http://dwarffortresswiki.net/index.php/User:Bidok#Memory<br />
<br />
If you use my water-based memory gate, put it on top of a reservoir, aquifer, or ocean. If you use Bidok's, just make sure the door is non-pet-passable, put an animal inside, and have the door leads to a hall that leads to the activity zone (whereever the pets meet normally).<br />
<br />
As I design each gate, I'll explain what to link the SET and CLEAR inputs and the OUTPUT to.<br />
<br />
Note: It is possible for both the SET and CLEAR outputs to be triggered at the same time on the memory gate with these designs. With the water-based memory gate, this may result in an unpredictible output for a small amount of time. With the kitten based gate, well, I'm not sure what the kitten will do. The hatch would be open, so it couldn't try to go to the door, but would it try to walk up to the hatch, or would it keep standing on the pressure plate until the hatch closed?<br />
<br />
Also, these gates are only theoretical and have not yet been tested.<br />
<br />
So far, from the NOT gate's design, it looks like these would probably respond slowly (slower than water gates), and would disrupt dwarf tasks on top of it. Not so good. Hmm.<br />
<br />
=== NOT gate ===<br />
###<br />
B^B<br />
B^B<br />
B^B<br />
O#O<br />
FvF<br />
FvF<br />
FvF<br />
###<br />
<br />
'O': Service doors, normally locked - so that you can get in to perform maintenance on the pressure plates and whatnot.<br />
INPUT : All the floodgates, labelled F, and the bars or grates, labelled B. Your input is some lever, or something else, which you want to negate the value of.<br />
SET OUTPUT: 'v' tiles are pressure plates set to detect dwarves, linked to the SET output on a memory gate. They are given a pathing priority with the highest possible value (Important!). They should each also be linked to the adjacent 'F's or 'B's in case a dwarf is trapped inside.<br />
CLEAR OUTPUT: '^' tiles are pressure plates set to detect dwarves, linked to the CLEAR output on a memory gate.<br />
<br />
How it works: If the INPUT is ON, the doors are opened, and newly calculated paths will be routed over the SET OUTPUT pressure plates. If the doors are closed, newly calculated paths will be routed over the CLEAR OUTPUT pressure plates instead. This will unfortunately cause dwarves who have already calculated a path through the now-closed doors to run into the doors and exclaim "WTF."</div>SLhttp://dwarffortresswiki.org/index.php?title=User:SL/Borg_Logic_Gates&diff=63115User:SL/Borg Logic Gates2010-02-15T10:05:29Z<p>SL: </p>
<hr />
<div>I'm mostly just pondering borg logic at the moment.<br />
<br />
In order to make borg logic reliable without forcing dwarves to stand around, we may need to base it on a memory gate first. The memory gate requires water. We can use the simple one from my water/mechanism-connected logic gates: http://dwarffortresswiki.net/index.php/User:SL/Logic_Gates#Memory<br />
<br />
The kitten logic gates sound more optimal, but I want to see where this leads.<br />
<br />
You would build the memory gate on top of a reservoir, aquifer, or ocean. As I design each gate, I'll explain what to link the SET and CLEAR inputs and the OUTPUT to.<br />
<br />
Note: It is possible for both the SET and CLEAR outputs to be triggered at the same time on the memory gate with these designs. This may result in an unpredictible output for a small amount of time.<br />
<br />
Also, these gates are only theoretical and have not yet been tested.<br />
<br />
So far, from the NOT gate's design, it looks like these would probably respond slowly (slower than water gates), and still require water (for the memory gates), and would disrupt dwarf tasks on top of it. Not so good. Hmm.<br />
<br />
=== NOT gate ===<br />
###<br />
B^B<br />
B^B<br />
B^B<br />
O#O<br />
FvF<br />
FvF<br />
FvF<br />
###<br />
<br />
'O': Service doors, normally locked - so that you can get in to perform maintenance on the pressure plates and whatnot.<br />
INPUT : All the floodgates, labelled F, and the bars or grates, labelled B. Your input is some lever, or something else, which you want to negate the value of.<br />
SET OUTPUT: 'v' tiles are pressure plates set to detect dwarves, linked to the SET output on a memory gate. They are given a pathing priority with the highest possible value (Important!). They should each also be linked to the adjacent 'F's or 'B's in case a dwarf is trapped inside.<br />
CLEAR OUTPUT: '^' tiles are pressure plates set to detect dwarves, linked to the CLEAR output on a memory gate. They are given a pathing priority with the lowest possible value (Important!).<br />
<br />
How it works: If the INPUT is ON, the doors are opened, and newly calculated paths will be routed over the SET OUTPUT pressure plates. If the doors are closed, newly calculated paths will be routed over the CLEAR OUTPUT pressure plates instead. This will unfortunately cause dwarves who have already calculated a path through the now-closed doors to run into the doors and exclaim "WTF."</div>SLhttp://dwarffortresswiki.org/index.php?title=User:SL/Borg_Logic_Gates&diff=63114User:SL/Borg Logic Gates2010-02-15T10:03:29Z<p>SL: </p>
<hr />
<div>I'm mostly just pondering borg logic at the moment.<br />
<br />
In order to make borg logic reliable without forcing dwarves to stand around, we may need to base it on a memory gate first. The memory gate requires water. We can use the simple one from my water/mechanism-connected logic gates: http://dwarffortresswiki.net/index.php/User:SL/Logic_Gates#Memory<br />
<br />
The kitten logic gates sound more optimal, but I want to see where this leads.<br />
<br />
You would build the memory gate on top of a reservoir, aquifer, or ocean. As I design each gate, I'll explain what to link the SET and CLEAR inputs and the OUTPUT to.<br />
<br />
Note: It is possible for both the SET and CLEAR outputs to be triggered at the same time on the memory gate with these designs. This may result in an unpredictible output for a small amount of time.<br />
<br />
Also, these gates are only theoretical and have not yet been tested.<br />
<br />
=== NOT gate ===<br />
###<br />
B^B<br />
B^B<br />
B^B<br />
O#O<br />
FvF<br />
FvF<br />
FvF<br />
###<br />
<br />
'O': Service doors, normally locked - so that you can get in to perform maintenance on the pressure plates and whatnot.<br />
INPUT : All the floodgates, labelled F, and the bars or grates, labelled B. Your input is some lever, or something else, which you want to negate the value of.<br />
SET OUTPUT: 'v' tiles are pressure plates set to detect dwarves, linked to the SET output on a memory gate. They are given a pathing priority with the highest possible value (Important!). They should each also be linked to the adjacent 'F's or 'B's in case a dwarf is trapped inside.<br />
CLEAR OUTPUT: '^' tiles are pressure plates set to detect dwarves, linked to the CLEAR output on a memory gate. They are given a pathing priority with the lowest possible value (Important!).<br />
<br />
How it works: If the INPUT is ON, the doors are opened, and newly calculated paths will be routed over the SET OUTPUT pressure plates. If the doors are closed, newly calculated paths will be routed over the CLEAR OUTPUT pressure plates instead. This will unfortunately cause dwarves who have already calculated a path through the now-closed doors to run into the doors and exclaim "WTF."</div>SLhttp://dwarffortresswiki.org/index.php?title=User:SL/Borg_Logic_Gates&diff=63113User:SL/Borg Logic Gates2010-02-15T10:02:54Z<p>SL: </p>
<hr />
<div>I'm mostly just pondering whether it might be possible to make a hybrid borg-mechanical system at the moment.<br />
<br />
In order to make borg logic reliable without forcing dwarves to stand around, we may need to base it on a memory gate first. The memory gate requires water. We can use the simple one from my water/mechanism-connected logic gates: http://dwarffortresswiki.net/index.php/User:SL/Logic_Gates#Memory<br />
<br />
The kitten logic gates sound more optimal, but I want to see where this leads.<br />
<br />
You would build the memory gate on top of a reservoir, aquifer, or ocean. As I design each gate, I'll explain what to link the SET and CLEAR inputs and the OUTPUT to.<br />
<br />
Note: It is possible for both the SET and CLEAR outputs to be triggered at the same time on the memory gate with these designs. This may result in an unpredictible output for a small amount of time.<br />
<br />
Also, these gates are only theoretical and have not yet been tested.<br />
<br />
=== NOT gate ===<br />
###<br />
B^B<br />
B^B<br />
B^B<br />
O#O<br />
FvF<br />
FvF<br />
FvF<br />
###<br />
<br />
'O': Service doors, normally locked - so that you can get in to perform maintenance on the pressure plates and whatnot.<br />
INPUT : All the floodgates, labelled F, and the bars or grates, labelled B. Your input is some lever, or something else, which you want to negate the value of.<br />
SET OUTPUT: 'v' tiles are pressure plates set to detect dwarves, linked to the SET output on a memory gate. They are given a pathing priority with the highest possible value (Important!). They should each also be linked to the adjacent 'F's or 'B's in case a dwarf is trapped inside.<br />
CLEAR OUTPUT: '^' tiles are pressure plates set to detect dwarves, linked to the CLEAR output on a memory gate. They are given a pathing priority with the lowest possible value (Important!).<br />
<br />
How it works: If the INPUT is ON, the doors are opened, and newly calculated paths will be routed over the SET OUTPUT pressure plates. If the doors are closed, newly calculated paths will be routed over the CLEAR OUTPUT pressure plates instead. This will unfortunately cause dwarves who have already calculated a path through the now-closed doors to run into the doors and exclaim "WTF."</div>SLhttp://dwarffortresswiki.org/index.php?title=User:SL/Borg_Logic_Gates&diff=63112User:SL/Borg Logic Gates2010-02-15T09:50:43Z<p>SL: </p>
<hr />
<div>I'm mostly just pondering whether it might be possible to make a hybrid borg-mechanical system at the moment.<br />
<br />
In order to make borg logic reliable without forcing dwarves to stand around, we may need to base it on a memory gate first. The memory gate requires water. We can use the simple one from my water/mechanism-connected logic gates: http://dwarffortresswiki.net/index.php/User:SL/Logic_Gates#Memory<br />
<br />
The kitten logic gates sound more optimal, but I want to see where this leads.<br />
<br />
You would build the memory gate on top of a reservoir, aquifer, or ocean. I'll explain what to link the SET and CLEAR inputs and the OUTPUT to if/when I come up with designs for the rest of the logic gates. :P<br />
<br />
=== NOT gate ===<br />
###<br />
^<br />
^<br />
^<br />
###<br />
DvD<br />
DvD<br />
DvD<br />
###<br />
<br />
INPUT : All the doors, labelled D. Your input is some lever, or something else, which you want to negate the value of.<br />
SET OUTPUT: 'v' tiles are pressure plates set to detect dwarves, linked to the SET output on a memory gate. They are given a pathing priority with the highest possible value (Important!).<br />
CLEAR OUTPUT: '^' tiles are pressure plates set to detect dwarves, linked to the CLEAR output on a memory gate. They are given a pathing priority with the lowest possible value (Important!).<br />
<br />
How it works: If the INPUT is ON, the doors are opened, and newly calculated paths will be routed over the SET OUTPUT pressure plates. If the doors are closed, newly calculated paths will be routed over the CLEAR OUTPUT pressure plates instead. This will unfortunately cause dwarves who have already calculated a path through the now-closed doors to run into the doors and exclaim "WTF."</div>SLhttp://dwarffortresswiki.org/index.php?title=User:SL/Borg_Logic_Gates&diff=63110User:SL/Borg Logic Gates2010-02-15T09:38:30Z<p>SL: </p>
<hr />
<div>I'm mostly just pondering whether it might be possible to make a hybrid borg-mechanical system at the moment.<br />
<br />
In order to make borg logic reliable without forcing dwarves to stand around, we may need to base it on a memory gate first. The memory gate requires water. We can use the simple one from my water/mechanism-connected logic gates: http://dwarffortresswiki.net/index.php/User:SL/Logic_Gates#Memory<br />
<br />
The kitten logic gates sound more optimal, but I want to see where this leads.<br />
<br />
You would build the memory gate on top of a reservoir, aquifer, or ocean. I'll explain what to link the SET and CLEAR inputs and the OUTPUT to if/when I come up with designs for the rest of the logic gates. :P</div>SLhttp://dwarffortresswiki.org/index.php?title=User:SL/Logic_Gates&diff=63109User:SL/Logic Gates2010-02-15T09:36:48Z<p>SL: </p>
<hr />
<div>This page may contain references to bugs in older versions of DF which no longer exist, for example catastrophic overflowing. I haven't messed with these in DF recently, but pumps shouldn't pump water up to their own z-level anymore.<br />
<br />
I'm pondering borg logic gates here as of 2/15/2010: http://dwarffortresswiki.net/index.php/User:SL/Borg_Logic_Gates<br />
<br />
This includes:<br />
* [[#NOT_gate|NOT]], [[#AND_gate|AND]], [[#OR_gate|OR]], and [[#XOR_gate|XOR gates]]. [[#NOR_gate|NOR]] and [[#NAND_gate|NAND gates]] have single-sentence instructions, since you can build them by changing one pressure plate in an OR or AND gate, respectively.<br />
* [[#Repeater|Repeater]] (which repeatedly toggles the output signals (it has two) between ON and OFF)<br />
* [[#Memory|Memory]] - intended for replacing one-use pressure plates with resettable versions (one SET input signal, one CLEAR input signal, one output signal)<br />
<br />
The most useful things are the repeater and memory, in my opinion, but the others can be useful too.<br />
<br />
==Example uses for each gate==<br />
[[#Repeater|Repeater]]: Repeatedly toggling things between ON and OFF states (like hatches, spikes, etc)<br />
<br />
[[#Memory|Memory]]: Making resettable one-use pressure plates which are reset by a lever. When the SET input (from one of the aforementioned pressure plates) is triggered, the memory changes its output to the ON state until it receives the CLEAR (reset) signal. The pressure plate turning off does not turn off the memory's output.<br />
<br />
[[#NOT_gate|NOT gate]]: Reversing the effect of a switch or creature-sensing pressure plate, generally linked to a memory device. You can, of course, mod the memory device to send the opposite signal instead of using a NOT gate.<br />
<br />
[[#AND_gate|AND gate]]: Requiring more than one condition to be true for something to occur. For instance, a system on/off switch and the output of a memory device could both be linked to an AND gate, and the AND gate's output could be linked to a repeater. The repeater would not run if the system on/off switch was OFF, or if the memory device was not outputting ON.<br />
<br />
[[#OR_gate|OR gate]]: You could link two 1-7 water sensors to an OR gate, and link that to a NOT gate, and link that to some floodgates or doors which act as emergency bulkheads, closing when water is detected in the area. Or, link the OR gate to bridges which raise instead (but you may crush things, and bridges are slower than doors).<br />
<br />
[[#XOR_gate|XOR gate]]: If you wanted hallways with raising bridge bulkheads which closed if water approached but opened if water got past them, you could build a water 1-7 pressure plate on either end of the hallway, outside the bulkheads, and link them to an XOR whose output is linked to the bulkheads. When water reaches one pressure plate, the bridge bulkheads would both raise. If the water was moving so fast that it filled most of the hall before the bulkheads closed, and it then reached the second bulkhead some time later, both bulkheads would open. I'm not sure how this would actually be *useful*, though. :P<br />
<br />
[[#NOR_gate|NOR gate]]: A NOR gate returns TRUE (ON) only if both inputs are FALSE. Instead of using the OR gate example with a NOT gate, you could use a NOR gate linked to two 1-7 water sensors, whose output goes to doors or floodgates. When the pressure plates are both waterless, the floodgates will be open. When one detects water, the floodgates close. (If you used 0-0 pressure plates with an OR, you would get an OFF signal if both plates detected water, or an ON signal otherwise (which is the same as 1-7 NAND 1-7))<br />
<br />
[[#NAND_gate|NAND gate]]: A NAND gate returns TRUE (ON) whenever both inputs are not both TRUE (e.g. ON NAND ON is OFF, but every other combination is ON). Instead of the OR NOT or NOR example, you could link two 0-0 water sensors to a NAND gate, and link the NAND gate's output to raising bridges. 0-0 NAND 0-0 is the same as 1-7 OR 1-7. If there is no water on both pressure plates, the NAND gate will output an OFF signal. If, however, either has water, it will output an ON signal.<br />
<br />
==Bigger example of something useful==<br />
Example combination of devices to make invaders trigger repeating spikes until you disable them via a lever, and to allow you to turn the device completely off and make it not activate even if something walks over the pressure plates:<br />
* Devices required: Pressure plates, spikes, memory, repeater, AND gate, two levers, optional NOT gate for one of the levers.<br />
<br />
* '''System On/Off Switch''': A lever, hooked to AND gate's first input. Should be ON when you want the device to work, and OFF when you want it to not work. If you want it reversed, then instead hook the lever to a NOT gate's input and hook the NOT gate's output to the AND gate's first input.<br />
* '''Invaders Fled Switch''': A lever, hooked to Memory's CLEAR input. Pull (switch to ON) to make the repeater shut down, then pull again (switch to OFF) to set the lever up for the next time it has to be used.<br />
* '''Pressure plates''' for detecting Mobile Bad Things: Each one is hooked to memory's SET input. Place a row of these in your entrance or what have you, so that there's no way to get past them without stepping on one.<br />
* '''[[#Memory|Memory]]''': SET input hooked to all of the aforementioned pressure plates. CLEAR input hooked to Invaders Fled switch. Output hooked to AND gate's second input.<br />
* '''[[#AND_gate|AND gate]]''': First input hooked to System On/Off Switch. Second input hooked to Memory's output. Output hooked to Repeater's ENABLE input.<br />
* '''[[#Repeater|Repeater]]''': ENABLE input hooked to AND gate's output. First output hooked to checkerboard black square spikes. Second input hooked to checkerboard white square spikes.<br />
* '''Checkerboard patterned spikes:'''<br />
** Black squares: All hooked to repeater's first output.<br />
** White squares: All hooked to repeater's second output.<br />
* Note: Spikes take about twice as long as hatches or doors to respond to signals. Bridges are also slow. (I haven't tried floodgates, since doors are fast)<br />
<br />
Demonstration of one repeater hooked to both spikes and hatches, showing the speed difference etc: http://mkv25.net/dfma/movie-281-repeaterinaction<br />
<br />
==What you need to make these==<br />
These gates use water for computing, but input and output signals are mechanical in nature (linked pressure plates etc). They require power and are constructed on top of (ideally) a murky pool, (non-pressurized) dwarf-made cistern, river, stream, brook, or aquifer. Each one uses one or two pumps only, so the power requirements are small.<br />
<br />
The ideal thing to build these on top of would be an aquifer, since it is capable of absorbing huge amounts of water while also providing huge amounts fairly rapidly. Building on a river or stream may be dangerous (maybe only if the river is entirely 7/7 despite the gates' pump) - it is possible to cause a catastrophic overflow centered on the pump which can only be ended by blocking the pump's input square with a hatch or disconnecting it from power. Damming the river MIGHT prevent an overflow, but would not stop one that is already in progress. {{version|33g}}<br />
<br />
You could theoretically replace the pump and input hatch with a hatch in a channel above the pump output square, and provide water from above. You'd have to be sure to floor over the top of the gates, though, to make sure that the pressurized water doesn't overflow, and you'd have to be careful about overflow from whereever the water drains to, too (if it fills to 7/7 it could flow up through other drain channels, or stairs, etc).<br />
<br />
===Advice for building these on pools===<br />
* These gates slowly deplete the water source which they are connected to while pumping, if it is a finite source (e.g. a murky pool).<br />
* Running them on top of a a pool which is filled to 7/7 is safe.<br />
* Refilling a pool to 7/7 from another water source is (usually) safe.<br />
* Running a pump on top of a pool which is connected to a water source is, however, NOT safe.<br />
* If you want to build gates on murky pools or dwarf-made cisterns, the best thing to do is to provide a means of disabling all the gates remotely (lever linked to gear assemblies between the gates and power, for instance), and provide a connection to an infinite source (river, brook, aquifer, or the like) via a floodgate which is controlled by another lever. Disable your gates prior to refilling, then open the floodgate to refill, then close the floodgate to disconnect the pool from the water source, and only then re-enable the gates. The pressurization and overflow problem can (theoretically) only occur on a murky pool if something refills the pool while there is water in the logic gates (But I'm not 100% certain about that).<br />
* Make sure your refiller's source (pumps are sources, or a water source if it's directly connected to it without pumps) is on the same z level as the pool, or you will likely cause a castastrophic overflow even if you don't have any gates on top of it.<br />
<br />
===General advice and information on variants===<br />
Keep in mind that there IS a delay in operation with these gates due to the delay in hatch response to pressure plate signals. (Doors, by the way, respond at the same speed as hatches. Bridges are slower.)<br />
<br />
I've built two variants of these gates, 'Faster' and 'Safer'.<br />
<br />
===='''Short description of both variants'''====<br />
* 'Faster' is faster but can become unreliable if the pump runs out of water. In practice, the 'faster' pumps usually will run out of water in a murky pool, or in a river which is flowing from the output's side towards the drain's side (haven't tried the other way, but it might work better).<br />
* 'Safer' has blocked drains when sending an ON* signal, so it is safer, but generally switches from ON* to OFF* a little more slowly than 'Faster'.<br />
* * = For NOT, NAND, and NOR gates, swap ON and OFF in the previous sentence to get the correct meaning.<br />
<br />
===='''Detail'''====<br />
* The 'Faster' variant does not use bridges to prevent water from draining while it is being pumped, whereas the 'Safer' variant does. This causes the 'Faster' gates to switch states faster when the 'Safer' bridges would be lowering, but if the water source is low, the gate can become unreliable. In testing, a 'Faster' NOT gate (for instance) sending an OFF signal, built on a small murky pool, periodically flips its output ON for a couple seconds. The 'safer' variant does not become unreliable unless you run almost completely out of water in the entire pool/brook/etc, but switching can be a little bit slower in one direction due to the bridges.<br />
* Larger murky pools, and having your input in the center instead of the edge of the pool, or in a strong river or the like (especially if you pump from the river feed end towards the river drain end, or better still, if river water enters the map from both ends of the river (Hard to tell unless you try to drain it!)), should reduce the likelihood of the 'Faster' variant becoming unreliable.<br />
<br />
===='''Useful note for 'Safer' '''====<br />
* You can mitigate the slowdown for 'safer' variants by changing all 4-7 pressure plates to 7-7, and all 0-3 to 0-6, if you are building on a river or aquifer. If your water level is low, however, this will make the gates take longer to switch to ON*, or they may never turn on. (That will not work at all on the repeater because of the way it tests water depth at water level instead of in a pump-fed chamber)<br />
* * = For NOT, NAND, and NOR gates, replace ON with OFF in that sentence.<br />
<br />
==Gate Diagrams==<br />
<br />
All diagrams are top-down.<br />
<br />
===Common symbols in the diagrams===<br />
* # is a wall.<br />
* @> is a pump which pumps from west to east. An @ with a v below it pumps from north to south (the only one of these is in the OR gate).<br />
* H is a hatch, almost always over water.<br />
* ^ is a pressure plate.<br />
* . is a channel over water.<br />
<br />
Doors for maintenance and construction are not shown. You may replace any walls with doors (as long as DF allows it). I generally have two doors per gate.<br />
<br />
Power sources are not shown. You will probably want to build windmills on top of these, but you can provide power in any way you see fit.<br />
<br />
===NOT gate===<br />
====Faster====<br />
#######<br />
#H@>^.#<br />
#######<br />
====Safer====<br />
########<br />
#H@>^B.#<br />
########<br />
<br />
====Details====<br />
* The H is a hatch which should be over open water. The @> is a pump which pumps from the west, to the east. The ^ is a water 0-3 pressure plate. The . is a channel, which is connected to the water source below.<br />
* For the safer variant, the B is a 1x1 bridge which raises to the west. It should be linked to your input signal.<br />
* The H is linked to your input signal.<br />
* The ^ is linked to your output devices.<br />
* You will need a windmill or the like to power the pump.<br />
<br />
====How this works====<br />
* If the input is OFF, the hatch will be closed, water will not be pumpable, and water already on the pressure plate will and evaporate or go down the drain.<br />
* If the input is ON, the hatch will be open, allowing water to be pumped up. The pump pumps water fast enough to keep the pressure plate above 3 water, keeping the output signal OFF.<br />
* In the safer variant, the bridge will block water when the input is ON, keeping it on the pressure plate.<br />
<br />
<br />
===AND gate===<br />
====Faster====<br />
########<br />
#H@>D^.#<br />
########<br />
====Safer====<br />
#########<br />
#H@>D^B.#<br />
######B##<br />
###<br />
<br />
====Details====<br />
* The H is a hatch which should be over open water. The @> is a pump which pumps from the west, to the east. The D is a door. The ^ is a water 4-7 pressure plate. The . is a channel, which is connected to the water source below.<br />
* The H is linked to your first input signal.<br />
* The D is linked to your second input signal.<br />
* The ^ is linked to your output devices.<br />
* For the safer variant, each B is a 1x1 bridge which raises west. Each one should be linked to a different input signal.<br />
* You will need a windmill or the like to power the pump.<br />
<br />
====How this works====<br />
* Both inputs have to be ON to allow water to reach the pressure plate.<br />
* For the safer variant, if either input is OFF there will be a path through one bridge to the drain. It is only blocked when both are ON.<br />
<br />
===OR gate===<br />
====Faster====<br />
###<br />
#H#<br />
#@#<br />
####v#<br />
#H@>^##<br />
#####.#<br />
###<br />
<br />
====Safer====<br />
Replace the bottom-right 3x3 area with this 5x3 area:<br />
^####<br />
#BB.#<br />
#####<br />
<br />
====Details====<br />
* Note that the safer OR gate is quite a bit slower at shutting off than the faster one, due to the added distance to the drain as well as the bridge delay.<br />
* The Hs are hatches which should be over open water. The @> is a pump which pumps from the west to the east, and the @v is a pump which pumps from the north to the south. The ^ is a water 4-7 pressure plate. The . is a channel, which is connected to the water source below.<br />
* The top H is linked to your first input signal. The bottom H is linked to your second input signal.<br />
* The ^ is linked to your output devices.<br />
* You will need a windmill or the like to power the pump.<br />
* For the safer variant, each B is a 1x1 bridge raising west, each of which should be linked to a different input signal.<br />
<br />
====How this works====<br />
* If either input is ON, water will flow into the center and cover the pressure plate.<br />
* For the safer variant, if either input is ON the path to the drain will be blocked. Both have to be OFF for the drain to be accessible.<br />
<br />
===XOR gate===<br />
====Faster====<br />
########<br />
#H@>B###<br />
#H@>B^.#<br />
########<br />
====Safer====<br />
#########<br />
#H@>B#DD##<br />
#H@>B^BB.#<br />
##########<br />
<br />
====Details====<br />
* The Hs are hatches which should be over open water. The @> are pumps which pump from the west, to the east. The ^ is a water 4-7 pressure plate. Each B is a 1x1 bridge which raises west. Each . is a channel, which is connected to the water source below.<br />
* The top H is linked to your first input signal. The bottom H is linked to your second input signal.<br />
* The top (top-left if you're using 'safer') B is linked to your second input signal. The bottom (bottom-left if you're using 'safer') B is linked to your first input signal.<br />
* The ^ is linked to your output devices.<br />
* You will need a windmill or the like to power the pumps.<br />
* For the safer variant: The Ds are doors. For the following instructions, consider 'left' to be the leftmost in the set of two doors/bridges to the right, and consider 'right' to be the rightmost one. The left door and the right bridge should be linked to the first input, and the right door and the left bridge should be linked to the second input.<br />
<br />
====How this works====<br />
* If no inputs are ON, the hatches are closed, and the bridges are all lowered (passable). Any water in the system will drain, and none will be pumped.<br />
* If one input is ON, one hatch will be open, and one bridge will be blocking. Water will flow through the non-blocking bridge, so the pressure plate will be triggered.<br />
* If both inputs are ON, both hatches will be open, but both bridges will be blocking. Water will not reach the pressure plate.<br />
* For the safer variant's drain:<br />
* * If no inputs are ON, both right bridges are passable and both doors are closed. Water will flow over the bridges.<br />
* * If the first input is ON, the left bridge will be raised (blocking), the right door will be open, and the left door will be closed. Water can not reach the drain.<br />
* * If the second input is ON, the right bridge will be raised (blocking), the left door will be open, and the right door will be closed. Water can not reach the drain.<br />
* * If both inpust are ON, both bridges will be raised (blocking), and both doors will be open. Water will flow through the open doors.<br />
<br />
===NOR gate===<br />
Identical to the OR gate, except that the pressure plate is 0-3 instead of 4-7.<br />
<br />
===NAND gate===<br />
Identical to the AND gate, except that the pressure plate is 0-3 instead of 4-7.<br />
<br />
===Repeater===<br />
* This is two levels in size. The bottom level should be at the same level as a water source such as a murky pond.<br />
* X is a floodgate which allows or disallows water entering the system. @> is a pump which draws from the west and pumps to the east.<br />
* ~ is the water source. Ideally it should actually be a solid dirt/rock/whatever tile on the side of a pool/river/whatever before you start construction. You can install the floodgate first, and then dig your channel above, which will let the tile fill with water.<br />
* There is only one version of this, no 'faster' or 'safer' variants. (2 or more of these will increase the frequency(speed), however they have to be desynchronized)<br />
<br />
====Bottom level====<br />
####<br />
#^^X~<br />
####<br />
<br />
====Top level==== <br />
######<br />
#H@>.#<br />
######<br />
<br />
====Details====<br />
* The hatch (H) should be just above the leftmost (4-7) pressure plate, and should be linked to it.<br />
* The floodgate (X) is your ENABLE input. Hook it to something to enable or disable the system. (An ON signal enables the repeater, an OFF signal causes it to stop repeating after a short delay)<br />
* The left pressure plate is water 4-7, and the right pressure plate is water 0-1. The right pressure plate is ... iffy. Whether it flips regularly or not depends on how fast water enters the gate. It appears that once the repeater is turned on, it may take a minute or two for the right pressure plate to begin flipping regularly (the repeater seems to somehow slow down how fast water enters it after a minute or so of running).<br />
* The left pressure plate and the right pressure plate can be linked to different things that need to toggle repeatedly. The left pressure plate is very reliable. The right one is not so reliable. It will generally (if it's working) be ON while the left one is OFF, and vice versa.<br />
* You may optionally want to hook an additional lever to the hatch in order to open it temporarily to allow full draining in the event that you need to let dwarves into the repeater body. That would be your MAINTENANCE input.<br />
<br />
===Memory===<br />
* The primary purpose for this is replacing one-use pressure plates with resettable versions which use this device to remember the ON signal from the pressure plate until a lever (or whatnot) is flipped to clear it.<br />
* This has two input signals (SET and CLEAR), and one output signal.<br />
* Note: If either the SET or CLEAR signals are levers, you should flip them off again after flipping them on.<br />
<br />
====Diagram====<br />
#######<br />
#H@>^H#<br />
#######<br />
<br />
====Details====<br />
* The Hs are hatches which should be over open water. The @> is a pump which pumps from the west, to the east. The ^ is a water 7-7 pressure plate.<br />
* The left H is linked to your SET input signal. The right H is linked to your CLEAR input signal.<br />
* The ^ is linked to your output devices.<br />
* You will need a windmill or the like to power the pump.<br />
<br />
====How this works====<br />
* When the SET signal is received (e.g. the pressure plate is stepped on, whatever), the left hatch opens, and the pump fills the right compartment with water. Our pressure plate (the output) flips to ON.<br />
* When the SET signal is no longer being received, the pump can no longer pump, but the compartment remains filled, so the pressure plate remains ON.<br />
* When the CLEAR signal is received, the right hatch opens, and the water drains. If the hatch is not open for very long, enough will still drain that our pressure is no longer at 7/7 water, so it will flip OFF.<br />
* If the SET signal and CLEAR signal are both ON at the same time, the output is unknown and possibly unpredictable: If the pump can hold the pressure plate tile at 7/7 despite the drain, it will be ON. If it runs out of water to pump and the tile stays below 7/7, it will be OFF. If it oscillates between 7/7 and lower values, you may (or may not, depending on the speed at which it changes) get seemingly random signals from the output.<br />
<br />
====Extra notes on the Memory device====<br />
* If you want to avoid the simultaneous SET + CLEAR = INSANITY problem (As described in the last note in the "How this works" section), and do not mind CLEARing taking a little longer, you may use a 4-7 pressure plate instead of a 7-7 one. This should result in an ON signal whenever both SET and CLEAR are ON at the same time. Note that if you aren't having that problem (it's staying at 7/7 despite the drain), if your water source depletes over time the problem may start occuring some time in the future.<br />
* Sending multiple SET or CLEAR signals is harmless, which means you can hook as many pressure plates as you want up to one memory's SET input.</div>SL