<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.factorio.com/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=My3DS</id>
	<title>Official Factorio Wiki - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.factorio.com/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=My3DS"/>
	<link rel="alternate" type="text/html" href="https://wiki.factorio.com/Special:Contributions/My3DS"/>
	<updated>2026-04-22T22:07:24Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.43.5</generator>
	<entry>
		<id>https://wiki.factorio.com/index.php?title=Tutorial:Combinator_tutorial&amp;diff=159152</id>
		<title>Tutorial:Combinator tutorial</title>
		<link rel="alternate" type="text/html" href="https://wiki.factorio.com/index.php?title=Tutorial:Combinator_tutorial&amp;diff=159152"/>
		<updated>2018-05-12T00:54:41Z</updated>

		<summary type="html">&lt;p&gt;My3DS: /* Binary AND */ made a whoopsie&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Languages}}&lt;br /&gt;
== Introduction ==&lt;br /&gt;
Combinator logic is achieved by cross-connecting outputs to inputs in such a way to achieve the desired logic. While advanced logic requires a multitude of combinators, some very useful basic logic can be achieved using only a handful of combinators. &#039;&#039;&#039;Combinator logic works because Factorio only updates at 60 times per second, such that combinators analyze their logic in a step, and then sum and/or decide the resulting output values on the next step.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
When logic values are computed by combinators, the outputs are not recognized by the circuit network until the following step. So when a decider combinator is used to detect a certain input condition, it&#039;s output value will not take effect on the circuit network until the next step. &#039;&#039;&#039;This behavior is important to remember and can result in sequencing errors and significant delays when multiple combinators are connected in series.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Circuit wires act like a wire bus in electronics, it carries information in the connected wires, meaning that &#039;&#039;&#039;if there are similar signals on a wire, it will add them automatically, unless if it is a different signal, that means it will be carried in that wire as well, but as a different signal.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
When cross-connecting combinators &#039;&#039;&#039;it&#039;s good practice to use the unused color to cross-connect, this will split the input and output networks and prevent unwanted inputs from accidentally connecting to a larger circuit network.&#039;&#039;&#039; Combinators will sum the red &amp;amp;/or green inputs prior to calculation, so either color can be used when wiring the output back to the input, but in most cases, it is more useful to use the opposing colour of the wire so that it will not interfere with the resulting output and input.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;There is also an example heavy [[Circuit-network_Cookbook|circuit network cookbook]] that you may find helpful to learn and refer to about circuit networks.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Virtual Signals ==&lt;br /&gt;
&lt;br /&gt;
===Everything Wildcard:===&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
This Red Wildcard serves to check all the specifed input signals.&lt;br /&gt;
&lt;br /&gt;
As the Decider Combinator, &amp;lt;br /&amp;gt;&lt;br /&gt;
its input is used to serve if all inputs meets the specified signals or variables. &amp;lt;br /&amp;gt;&lt;br /&gt;
its output is used to serve output every signal. &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Side note: &amp;quot;Everything&amp;quot; outputs true by default even if there is no signal to guarantee if that is true. &#039;&#039;Everything is false when every input does not meet the condition, otherwise, output true.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
===Anything Wildcard:===&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
This Green Wildcard serves to check all the specifed input signals.&lt;br /&gt;
&lt;br /&gt;
As the Decider Combinator, &lt;br /&gt;
its input is used to serve if any of its inputs meets the specified signals or variables.&lt;br /&gt;
&lt;br /&gt;
Side note: &amp;quot;Anything&amp;quot; outputs false by default if there is no signal to guarantee if it is true. &#039;&#039;Anything is false when any of inputs do not meet the condition, otherwise, it is true.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
===Each Wildcard:===&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
This Yellow Wildcard serves to check for each the specifed input signals.&lt;br /&gt;
&lt;br /&gt;
As the Decider Combinator, &amp;lt;br /&amp;gt;&lt;br /&gt;
its input is used to serve if any inputs meets the specified signals or variables. &amp;lt;br /&amp;gt;&lt;br /&gt;
its output is used to serve output the each variable. &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As the Arithmetic Combinator, &amp;lt;br /&amp;gt;&lt;br /&gt;
its input is used to serve each input, then the following summations are summed and outputted, with each signal as its own respective signals.&lt;br /&gt;
&lt;br /&gt;
== Input Isolator &amp;amp; Gate ==&lt;br /&gt;
An arithmetic combinator set to (In: Each + 0, Out: Each) can be used to swap wire colors and as an isolator to prevent downstream logic from backfeeding into the circuit network&#039;s inputs.&lt;br /&gt;
&lt;br /&gt;
A decider combinator set to (Out: Everything, Input-&amp;gt; Output) will also function as an isolator as long as the set logic condition is true. This can also selectively pass or &#039;gate&#039; inputs only when desired. This could be used to sequentially poll remote train stations for their chest contents, and include only desired stations.&lt;br /&gt;
&lt;br /&gt;
== Set/Reset Latching Switch ==&lt;br /&gt;
You want something to SET a trigger at some quantity, but then STAY on until that quantity hits some other value, the RESET value. You&#039;ll need one decider combinator and one arithmetic combinator. Two decider combinators and a constant combinator can also be used for more complex multi-channel conditions.&lt;br /&gt;
&lt;br /&gt;
Setup the first decider combinator to the desired set conditional and to output a 1. Then connect the output to the input of an arithmetic combinator, and configure it to multiply by the bias value, the difference between the set and reset values, and wire the arithmetic output to the input of the decider. The arithmetic output channel MUST be set the same as the decider&#039;s input channel. That&#039;s it! Whenever your set conditional is reached, the decider will output a &#039;1&#039;, and the bias of the arithmetic combinator will be applied. This will &#039;hold&#039; the output true until the value goes back below the reset point.&lt;br /&gt;
&lt;br /&gt;
Here&#039;s a more specific example : &lt;br /&gt;
i want the pump to run when petrol reach 2000, and turn off when reach 200.&amp;lt;br&amp;gt;&lt;br /&gt;
only with green wire&amp;lt;br&amp;gt;&lt;br /&gt;
Tank -&amp;gt; in decider&amp;lt;br&amp;gt;&lt;br /&gt;
out decider-&amp;gt; in arithmetic&amp;lt;br&amp;gt;&lt;br /&gt;
out arithmetic -&amp;gt; in decider&amp;lt;br&amp;gt;&lt;br /&gt;
green wire from in decider, to pump&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Pump have the same condition as the decider (Petrol &amp;gt; 2000)&lt;br /&gt;
&lt;br /&gt;
Decider : Petrol &amp;gt; 2000&amp;lt;br&amp;gt;&lt;br /&gt;
out : A = 1&amp;lt;br&amp;gt;&lt;br /&gt;
Arithmetic : A x 1800 (2000 - 200 )&amp;lt;br&amp;gt;&lt;br /&gt;
out : petrol&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:Factorio combinator switch.png|620px]]&lt;br /&gt;
&lt;br /&gt;
Backup steam power example with detailed configuration and explanation can be found here:&amp;lt;br /&amp;gt;[[Tutorial:Circuit-network_Cookbook#SR_latch_-_single_decider_version|Tutorial:Circuit-network_Cookbook#SR latch - single decider version]]&lt;br /&gt;
&lt;br /&gt;
== Smart Train Loading ==&lt;br /&gt;
This solves the problem of loading logistics into chests, which tend to be unequal and is slower in the rate of loading logistics into the cargo of trains.&lt;br /&gt;
&lt;br /&gt;
To setup the design, you require an Arithmetic Combinator, as well as Red and Green wires. &#039;&#039;&#039;Wire all the chests used, to the input of the Arithmetic Combinator&#039;&#039;&#039;. &#039;&#039;&#039;Then write (Logistics Item / -Amount of chests) and as the output as the Logistics Item in the Arithmetic Combinator&#039;&#039;&#039;, this will average the amount of items within the chests. Lastly, &#039;&#039;&#039;wire all the inserters used to the output of the Arithmetic Combinator and have the other color of the wire be wired to the adjacent chest&#039;&#039;&#039;. &#039;&#039;&#039;Have the inserters enabled when Logistics Item &amp;lt; 1&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
A more visual representation as well as questions about the design can be found in a reddit post: [https://www.reddit.com/r/factorio/comments/4e03g2/madzuris_smart_loading_train_station_guide/ MadZuri&#039;s smart loading train station].&lt;br /&gt;
&lt;br /&gt;
Explanation of why this works:&lt;br /&gt;
It compares the average amount of total items within the chests and the chest adjacent to the inserter so that it activates when the average number of items is higher than the amount within the chest.&lt;br /&gt;
The reason for why the division denominator is negative is because if the items in the chests are 0, it basically makes it so that it adds 1 to the equation.&lt;br /&gt;
&lt;br /&gt;
== Memory ==&lt;br /&gt;
How to store a constant value for later use, either for a basic counter or for more advanced logic. A decider combinator wired output tied to input and configured greater than zero (for positive values), input -&amp;gt; output will &#039;hold&#039; a value, as long as all other inputs on the network are zero.&lt;br /&gt;
&lt;br /&gt;
Any non-zero input condition will create a basic clock; incrementing the stored value by the sum of all connected input values every cycle. A single pulse of an input will cause a single increment by the pulsed value. Reset to zero occurs whenever the set condition is no longer met, or if a negative pulse equal to the input occurs.&lt;br /&gt;
&lt;br /&gt;
== Basic Clocks ==&lt;br /&gt;
[[File:Timer.png|thumb|right|377px|A basic clock. 30 ticks is the ceiling for Signal 1; which is continuously added.]]&lt;br /&gt;
Clocks are constructed by having the output of a combinator tied back to its own input, such that every cycle advances its own count. Either the arithmetic combinator or the decider combinator can be used.&lt;br /&gt;
&lt;br /&gt;
An arithmetic combinator tied to itself is fun to watch and will happily run-away, but requires additional control logic to reset.&lt;br /&gt;
&lt;br /&gt;
A self-resetting clock requires just a single decider combinator with output wired to input and configured with Less Than (&amp;lt;) and Input -&amp;gt; Output. When a constant combinator is then connected to the input, every cycle it will count up by the value of the Constant Combinator until the set conditional value is reached, then output a zero which will be summed with the constant combinator, and reset the process.&lt;br /&gt;
&lt;br /&gt;
The clock sequence will not include zero, will begin at the value set by the constant combinator, and will include whatever value eventually causes the conditional to be false. An arithmetic combinator can modify the clock sequence but remember its outputs will occur one cycle later than the clock cycle values.&lt;br /&gt;
&lt;br /&gt;
A clock that only counts once can be built using the following setup:&lt;br /&gt;
&lt;br /&gt;
[[File:Onetime_Clock.png|thumb|none|360px|One-time clock. Runs until T=Z+1. Reset via R&amp;gt;0.]]&lt;br /&gt;
&lt;br /&gt;
== Pulse Generators ==&lt;br /&gt;
&lt;br /&gt;
Connecting an additional (=) decider combinator to the output of a basic clock will create a pulse generator, and will pulse a single output every time the clock cycles through the set condition. Any output value can be used, either directly from the clock sequence (input-&amp;gt;output), a 1, or some value on a separate logic channel on the circuit network, such as set by a constant combinator. or by the circuit network.&amp;lt;br /&amp;gt;&lt;br /&gt;
[[File:PulseGen.png|500px]]&lt;br /&gt;
*&#039;&#039;The value 1 can be written as any positive integer, so long as it is within the cap or ceiling of your timer.&#039;&#039;&lt;br /&gt;
*&#039;&#039;As an example from the above timer, this light will pulse every 1st tick after the timer reaches 30 ticks, making it pulse 1/30th of a second, as Factorio updates at 60 times per second.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Counter ==&lt;br /&gt;
A counter is used to count the number of input events, and output the sum of that count. Any pulsing input into a decider combinator configured input -&amp;gt; output and wired between output and input will create a counter, but this input must be zero at all other times or else the combinator will run away like a clock. A pulse generator is normally used to accomplish this. Combining several gating decider isolators set with sequential conditionals, a clock, and a pulse generator to the input of a counter will allow remote polling and counting of each isolator&#039;s contents.&lt;br /&gt;
&lt;br /&gt;
== Logic Gates ==&lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;Unary NOT&#039;&#039;&#039;===&lt;br /&gt;
----&lt;br /&gt;
[[File:NOT.png|415px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;Binary OR&#039;&#039;&#039;===&lt;br /&gt;
----&lt;br /&gt;
[[File:OR.png|300px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 2!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1  || 1&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;*Note: The Arithmetic Combinator&#039;s OR option is bitwise.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;Binary NOR&#039;&#039;&#039;===&lt;br /&gt;
----&lt;br /&gt;
[[File:NOR.png|415px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 2!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;Binary XOR&#039;&#039;&#039;===&lt;br /&gt;
----&lt;br /&gt;
[[File:XOR.png|300px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 1!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 ||  0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 ||  1 || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 ||  0 || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 ||  1 || 0&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;*Note: The Arithmetic Combinator&#039;s XOR option is bitwise.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;Binary AND&#039;&#039;&#039;===&lt;br /&gt;
----&lt;br /&gt;
[[File:AND.png|530px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 2!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1 || 1&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;*Note:The Arithmetic Combinator&#039;s AND option is bitwise.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;Trinary AND&#039;&#039;&#039;===&lt;br /&gt;
----&lt;br /&gt;
[[File:TrinaryAND.png|415px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 2!!Input 3!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0  || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1  || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0  || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1  || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0  || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1  || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0  || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1  || 1  || 1&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;Binary NAND&#039;&#039;&#039;===&lt;br /&gt;
----&lt;br /&gt;
[[File:NAND.png|300px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 2!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;Binary XNOR/XAND&#039;&#039;&#039;===&lt;br /&gt;
----&lt;br /&gt;
[[File:XAND.png|300px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 2!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1  || 1&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Memory Cells ==&lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;Simple Latch&#039;&#039;&#039;===&lt;br /&gt;
&lt;br /&gt;
When looping the combinator to itself, use a different colour of wire from your main inputs or outputs. &lt;br /&gt;
&lt;br /&gt;
[[File:SimpleLatchv2.png|300px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Output 1!!Input 1!!Input 2!! Output 1 (t+1)&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 0 || 1&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0 || 0 || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1 || 0 || 1 &#039;&#039;(2)&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0 || 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1 || 1 || 1 &#039;&#039;(2)&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&#039;&#039;Output 1 is the green wire loop seen in the picture, it carries the value to latch.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Input 1 is Set, while Input 2 is Reset.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;Binary Cell&#039;&#039;&#039;===&lt;br /&gt;
&lt;br /&gt;
RS NOR Latch&lt;br /&gt;
[[File:RS-NOR.png|500px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;Advanced Cell&#039;&#039;&#039;===&lt;br /&gt;
&lt;br /&gt;
Cell for storing a positive value:&lt;br /&gt;
&lt;br /&gt;
[[File:AdvancedMemoryCell.png|500px]]&lt;br /&gt;
&lt;br /&gt;
Connect the desired value as signal 3 on the right side to set the memory cell and connect a negative value as signal 3 to reset the cell.  *Please note the arithmetic combinator&#039;s output should be facing the opposite direction of the decider combinators.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Address Enable Switch&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== See Also ==&lt;br /&gt;
*[http://www.factorioforums.com/forum/viewtopic.php?f=18&amp;amp;t=14556 Combinators 101 (Tutorial)]&lt;br /&gt;
*[[Arithmetic combinator]]&lt;br /&gt;
*[[Constant combinator]]&lt;br /&gt;
*[[Decider combinator]]&lt;br /&gt;
*[[Circuit network]]&lt;br /&gt;
*[[Circuit-network_Cookbook]]&lt;/div&gt;</summary>
		<author><name>My3DS</name></author>
	</entry>
	<entry>
		<id>https://wiki.factorio.com/index.php?title=Tutorial:Combinator_tutorial&amp;diff=159151</id>
		<title>Tutorial:Combinator tutorial</title>
		<link rel="alternate" type="text/html" href="https://wiki.factorio.com/index.php?title=Tutorial:Combinator_tutorial&amp;diff=159151"/>
		<updated>2018-05-12T00:54:13Z</updated>

		<summary type="html">&lt;p&gt;My3DS: /* Binary AND */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Languages}}&lt;br /&gt;
== Introduction ==&lt;br /&gt;
Combinator logic is achieved by cross-connecting outputs to inputs in such a way to achieve the desired logic. While advanced logic requires a multitude of combinators, some very useful basic logic can be achieved using only a handful of combinators. &#039;&#039;&#039;Combinator logic works because Factorio only updates at 60 times per second, such that combinators analyze their logic in a step, and then sum and/or decide the resulting output values on the next step.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
When logic values are computed by combinators, the outputs are not recognized by the circuit network until the following step. So when a decider combinator is used to detect a certain input condition, it&#039;s output value will not take effect on the circuit network until the next step. &#039;&#039;&#039;This behavior is important to remember and can result in sequencing errors and significant delays when multiple combinators are connected in series.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Circuit wires act like a wire bus in electronics, it carries information in the connected wires, meaning that &#039;&#039;&#039;if there are similar signals on a wire, it will add them automatically, unless if it is a different signal, that means it will be carried in that wire as well, but as a different signal.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
When cross-connecting combinators &#039;&#039;&#039;it&#039;s good practice to use the unused color to cross-connect, this will split the input and output networks and prevent unwanted inputs from accidentally connecting to a larger circuit network.&#039;&#039;&#039; Combinators will sum the red &amp;amp;/or green inputs prior to calculation, so either color can be used when wiring the output back to the input, but in most cases, it is more useful to use the opposing colour of the wire so that it will not interfere with the resulting output and input.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;There is also an example heavy [[Circuit-network_Cookbook|circuit network cookbook]] that you may find helpful to learn and refer to about circuit networks.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Virtual Signals ==&lt;br /&gt;
&lt;br /&gt;
===Everything Wildcard:===&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
This Red Wildcard serves to check all the specifed input signals.&lt;br /&gt;
&lt;br /&gt;
As the Decider Combinator, &amp;lt;br /&amp;gt;&lt;br /&gt;
its input is used to serve if all inputs meets the specified signals or variables. &amp;lt;br /&amp;gt;&lt;br /&gt;
its output is used to serve output every signal. &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Side note: &amp;quot;Everything&amp;quot; outputs true by default even if there is no signal to guarantee if that is true. &#039;&#039;Everything is false when every input does not meet the condition, otherwise, output true.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
===Anything Wildcard:===&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
This Green Wildcard serves to check all the specifed input signals.&lt;br /&gt;
&lt;br /&gt;
As the Decider Combinator, &lt;br /&gt;
its input is used to serve if any of its inputs meets the specified signals or variables.&lt;br /&gt;
&lt;br /&gt;
Side note: &amp;quot;Anything&amp;quot; outputs false by default if there is no signal to guarantee if it is true. &#039;&#039;Anything is false when any of inputs do not meet the condition, otherwise, it is true.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
===Each Wildcard:===&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
This Yellow Wildcard serves to check for each the specifed input signals.&lt;br /&gt;
&lt;br /&gt;
As the Decider Combinator, &amp;lt;br /&amp;gt;&lt;br /&gt;
its input is used to serve if any inputs meets the specified signals or variables. &amp;lt;br /&amp;gt;&lt;br /&gt;
its output is used to serve output the each variable. &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As the Arithmetic Combinator, &amp;lt;br /&amp;gt;&lt;br /&gt;
its input is used to serve each input, then the following summations are summed and outputted, with each signal as its own respective signals.&lt;br /&gt;
&lt;br /&gt;
== Input Isolator &amp;amp; Gate ==&lt;br /&gt;
An arithmetic combinator set to (In: Each + 0, Out: Each) can be used to swap wire colors and as an isolator to prevent downstream logic from backfeeding into the circuit network&#039;s inputs.&lt;br /&gt;
&lt;br /&gt;
A decider combinator set to (Out: Everything, Input-&amp;gt; Output) will also function as an isolator as long as the set logic condition is true. This can also selectively pass or &#039;gate&#039; inputs only when desired. This could be used to sequentially poll remote train stations for their chest contents, and include only desired stations.&lt;br /&gt;
&lt;br /&gt;
== Set/Reset Latching Switch ==&lt;br /&gt;
You want something to SET a trigger at some quantity, but then STAY on until that quantity hits some other value, the RESET value. You&#039;ll need one decider combinator and one arithmetic combinator. Two decider combinators and a constant combinator can also be used for more complex multi-channel conditions.&lt;br /&gt;
&lt;br /&gt;
Setup the first decider combinator to the desired set conditional and to output a 1. Then connect the output to the input of an arithmetic combinator, and configure it to multiply by the bias value, the difference between the set and reset values, and wire the arithmetic output to the input of the decider. The arithmetic output channel MUST be set the same as the decider&#039;s input channel. That&#039;s it! Whenever your set conditional is reached, the decider will output a &#039;1&#039;, and the bias of the arithmetic combinator will be applied. This will &#039;hold&#039; the output true until the value goes back below the reset point.&lt;br /&gt;
&lt;br /&gt;
Here&#039;s a more specific example : &lt;br /&gt;
i want the pump to run when petrol reach 2000, and turn off when reach 200.&amp;lt;br&amp;gt;&lt;br /&gt;
only with green wire&amp;lt;br&amp;gt;&lt;br /&gt;
Tank -&amp;gt; in decider&amp;lt;br&amp;gt;&lt;br /&gt;
out decider-&amp;gt; in arithmetic&amp;lt;br&amp;gt;&lt;br /&gt;
out arithmetic -&amp;gt; in decider&amp;lt;br&amp;gt;&lt;br /&gt;
green wire from in decider, to pump&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Pump have the same condition as the decider (Petrol &amp;gt; 2000)&lt;br /&gt;
&lt;br /&gt;
Decider : Petrol &amp;gt; 2000&amp;lt;br&amp;gt;&lt;br /&gt;
out : A = 1&amp;lt;br&amp;gt;&lt;br /&gt;
Arithmetic : A x 1800 (2000 - 200 )&amp;lt;br&amp;gt;&lt;br /&gt;
out : petrol&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:Factorio combinator switch.png|620px]]&lt;br /&gt;
&lt;br /&gt;
Backup steam power example with detailed configuration and explanation can be found here:&amp;lt;br /&amp;gt;[[Tutorial:Circuit-network_Cookbook#SR_latch_-_single_decider_version|Tutorial:Circuit-network_Cookbook#SR latch - single decider version]]&lt;br /&gt;
&lt;br /&gt;
== Smart Train Loading ==&lt;br /&gt;
This solves the problem of loading logistics into chests, which tend to be unequal and is slower in the rate of loading logistics into the cargo of trains.&lt;br /&gt;
&lt;br /&gt;
To setup the design, you require an Arithmetic Combinator, as well as Red and Green wires. &#039;&#039;&#039;Wire all the chests used, to the input of the Arithmetic Combinator&#039;&#039;&#039;. &#039;&#039;&#039;Then write (Logistics Item / -Amount of chests) and as the output as the Logistics Item in the Arithmetic Combinator&#039;&#039;&#039;, this will average the amount of items within the chests. Lastly, &#039;&#039;&#039;wire all the inserters used to the output of the Arithmetic Combinator and have the other color of the wire be wired to the adjacent chest&#039;&#039;&#039;. &#039;&#039;&#039;Have the inserters enabled when Logistics Item &amp;lt; 1&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
A more visual representation as well as questions about the design can be found in a reddit post: [https://www.reddit.com/r/factorio/comments/4e03g2/madzuris_smart_loading_train_station_guide/ MadZuri&#039;s smart loading train station].&lt;br /&gt;
&lt;br /&gt;
Explanation of why this works:&lt;br /&gt;
It compares the average amount of total items within the chests and the chest adjacent to the inserter so that it activates when the average number of items is higher than the amount within the chest.&lt;br /&gt;
The reason for why the division denominator is negative is because if the items in the chests are 0, it basically makes it so that it adds 1 to the equation.&lt;br /&gt;
&lt;br /&gt;
== Memory ==&lt;br /&gt;
How to store a constant value for later use, either for a basic counter or for more advanced logic. A decider combinator wired output tied to input and configured greater than zero (for positive values), input -&amp;gt; output will &#039;hold&#039; a value, as long as all other inputs on the network are zero.&lt;br /&gt;
&lt;br /&gt;
Any non-zero input condition will create a basic clock; incrementing the stored value by the sum of all connected input values every cycle. A single pulse of an input will cause a single increment by the pulsed value. Reset to zero occurs whenever the set condition is no longer met, or if a negative pulse equal to the input occurs.&lt;br /&gt;
&lt;br /&gt;
== Basic Clocks ==&lt;br /&gt;
[[File:Timer.png|thumb|right|377px|A basic clock. 30 ticks is the ceiling for Signal 1; which is continuously added.]]&lt;br /&gt;
Clocks are constructed by having the output of a combinator tied back to its own input, such that every cycle advances its own count. Either the arithmetic combinator or the decider combinator can be used.&lt;br /&gt;
&lt;br /&gt;
An arithmetic combinator tied to itself is fun to watch and will happily run-away, but requires additional control logic to reset.&lt;br /&gt;
&lt;br /&gt;
A self-resetting clock requires just a single decider combinator with output wired to input and configured with Less Than (&amp;lt;) and Input -&amp;gt; Output. When a constant combinator is then connected to the input, every cycle it will count up by the value of the Constant Combinator until the set conditional value is reached, then output a zero which will be summed with the constant combinator, and reset the process.&lt;br /&gt;
&lt;br /&gt;
The clock sequence will not include zero, will begin at the value set by the constant combinator, and will include whatever value eventually causes the conditional to be false. An arithmetic combinator can modify the clock sequence but remember its outputs will occur one cycle later than the clock cycle values.&lt;br /&gt;
&lt;br /&gt;
A clock that only counts once can be built using the following setup:&lt;br /&gt;
&lt;br /&gt;
[[File:Onetime_Clock.png|thumb|none|360px|One-time clock. Runs until T=Z+1. Reset via R&amp;gt;0.]]&lt;br /&gt;
&lt;br /&gt;
== Pulse Generators ==&lt;br /&gt;
&lt;br /&gt;
Connecting an additional (=) decider combinator to the output of a basic clock will create a pulse generator, and will pulse a single output every time the clock cycles through the set condition. Any output value can be used, either directly from the clock sequence (input-&amp;gt;output), a 1, or some value on a separate logic channel on the circuit network, such as set by a constant combinator. or by the circuit network.&amp;lt;br /&amp;gt;&lt;br /&gt;
[[File:PulseGen.png|500px]]&lt;br /&gt;
*&#039;&#039;The value 1 can be written as any positive integer, so long as it is within the cap or ceiling of your timer.&#039;&#039;&lt;br /&gt;
*&#039;&#039;As an example from the above timer, this light will pulse every 1st tick after the timer reaches 30 ticks, making it pulse 1/30th of a second, as Factorio updates at 60 times per second.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Counter ==&lt;br /&gt;
A counter is used to count the number of input events, and output the sum of that count. Any pulsing input into a decider combinator configured input -&amp;gt; output and wired between output and input will create a counter, but this input must be zero at all other times or else the combinator will run away like a clock. A pulse generator is normally used to accomplish this. Combining several gating decider isolators set with sequential conditionals, a clock, and a pulse generator to the input of a counter will allow remote polling and counting of each isolator&#039;s contents.&lt;br /&gt;
&lt;br /&gt;
== Logic Gates ==&lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;Unary NOT&#039;&#039;&#039;===&lt;br /&gt;
----&lt;br /&gt;
[[File:NOT.png|415px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;Binary OR&#039;&#039;&#039;===&lt;br /&gt;
----&lt;br /&gt;
[[File:OR.png|300px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 2!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1  || 1&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;*Note: The Arithmetic Combinator&#039;s OR option is bitwise.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;Binary NOR&#039;&#039;&#039;===&lt;br /&gt;
----&lt;br /&gt;
[[File:NOR.png|415px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 2!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;Binary XOR&#039;&#039;&#039;===&lt;br /&gt;
----&lt;br /&gt;
[[File:XOR.png|300px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 1!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 ||  0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 ||  1 || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 ||  0 || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 ||  1 || 0&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;*Note: The Arithmetic Combinator&#039;s XOR option is bitwise.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;Binary AND&#039;&#039;&#039;===&lt;br /&gt;
----&lt;br /&gt;
[[File:AND.png|530px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 2!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1 || 1&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;*Note: the Arithmetic Combinator&#039;s AND option is bitwise.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;Trinary AND&#039;&#039;&#039;===&lt;br /&gt;
----&lt;br /&gt;
[[File:TrinaryAND.png|415px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 2!!Input 3!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0  || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1  || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0  || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1  || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0  || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1  || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0  || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1  || 1  || 1&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;Binary NAND&#039;&#039;&#039;===&lt;br /&gt;
----&lt;br /&gt;
[[File:NAND.png|300px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 2!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;Binary XNOR/XAND&#039;&#039;&#039;===&lt;br /&gt;
----&lt;br /&gt;
[[File:XAND.png|300px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 2!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1  || 1&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Memory Cells ==&lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;Simple Latch&#039;&#039;&#039;===&lt;br /&gt;
&lt;br /&gt;
When looping the combinator to itself, use a different colour of wire from your main inputs or outputs. &lt;br /&gt;
&lt;br /&gt;
[[File:SimpleLatchv2.png|300px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Output 1!!Input 1!!Input 2!! Output 1 (t+1)&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 0 || 1&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0 || 0 || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1 || 0 || 1 &#039;&#039;(2)&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0 || 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1 || 1 || 1 &#039;&#039;(2)&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&#039;&#039;Output 1 is the green wire loop seen in the picture, it carries the value to latch.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Input 1 is Set, while Input 2 is Reset.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;Binary Cell&#039;&#039;&#039;===&lt;br /&gt;
&lt;br /&gt;
RS NOR Latch&lt;br /&gt;
[[File:RS-NOR.png|500px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;Advanced Cell&#039;&#039;&#039;===&lt;br /&gt;
&lt;br /&gt;
Cell for storing a positive value:&lt;br /&gt;
&lt;br /&gt;
[[File:AdvancedMemoryCell.png|500px]]&lt;br /&gt;
&lt;br /&gt;
Connect the desired value as signal 3 on the right side to set the memory cell and connect a negative value as signal 3 to reset the cell.  *Please note the arithmetic combinator&#039;s output should be facing the opposite direction of the decider combinators.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Address Enable Switch&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== See Also ==&lt;br /&gt;
*[http://www.factorioforums.com/forum/viewtopic.php?f=18&amp;amp;t=14556 Combinators 101 (Tutorial)]&lt;br /&gt;
*[[Arithmetic combinator]]&lt;br /&gt;
*[[Constant combinator]]&lt;br /&gt;
*[[Decider combinator]]&lt;br /&gt;
*[[Circuit network]]&lt;br /&gt;
*[[Circuit-network_Cookbook]]&lt;/div&gt;</summary>
		<author><name>My3DS</name></author>
	</entry>
	<entry>
		<id>https://wiki.factorio.com/index.php?title=Tutorial:Combinator_tutorial&amp;diff=159150</id>
		<title>Tutorial:Combinator tutorial</title>
		<link rel="alternate" type="text/html" href="https://wiki.factorio.com/index.php?title=Tutorial:Combinator_tutorial&amp;diff=159150"/>
		<updated>2018-05-12T00:53:24Z</updated>

		<summary type="html">&lt;p&gt;My3DS: /* Binary XOR */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Languages}}&lt;br /&gt;
== Introduction ==&lt;br /&gt;
Combinator logic is achieved by cross-connecting outputs to inputs in such a way to achieve the desired logic. While advanced logic requires a multitude of combinators, some very useful basic logic can be achieved using only a handful of combinators. &#039;&#039;&#039;Combinator logic works because Factorio only updates at 60 times per second, such that combinators analyze their logic in a step, and then sum and/or decide the resulting output values on the next step.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
When logic values are computed by combinators, the outputs are not recognized by the circuit network until the following step. So when a decider combinator is used to detect a certain input condition, it&#039;s output value will not take effect on the circuit network until the next step. &#039;&#039;&#039;This behavior is important to remember and can result in sequencing errors and significant delays when multiple combinators are connected in series.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Circuit wires act like a wire bus in electronics, it carries information in the connected wires, meaning that &#039;&#039;&#039;if there are similar signals on a wire, it will add them automatically, unless if it is a different signal, that means it will be carried in that wire as well, but as a different signal.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
When cross-connecting combinators &#039;&#039;&#039;it&#039;s good practice to use the unused color to cross-connect, this will split the input and output networks and prevent unwanted inputs from accidentally connecting to a larger circuit network.&#039;&#039;&#039; Combinators will sum the red &amp;amp;/or green inputs prior to calculation, so either color can be used when wiring the output back to the input, but in most cases, it is more useful to use the opposing colour of the wire so that it will not interfere with the resulting output and input.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;There is also an example heavy [[Circuit-network_Cookbook|circuit network cookbook]] that you may find helpful to learn and refer to about circuit networks.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Virtual Signals ==&lt;br /&gt;
&lt;br /&gt;
===Everything Wildcard:===&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
This Red Wildcard serves to check all the specifed input signals.&lt;br /&gt;
&lt;br /&gt;
As the Decider Combinator, &amp;lt;br /&amp;gt;&lt;br /&gt;
its input is used to serve if all inputs meets the specified signals or variables. &amp;lt;br /&amp;gt;&lt;br /&gt;
its output is used to serve output every signal. &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Side note: &amp;quot;Everything&amp;quot; outputs true by default even if there is no signal to guarantee if that is true. &#039;&#039;Everything is false when every input does not meet the condition, otherwise, output true.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
===Anything Wildcard:===&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
This Green Wildcard serves to check all the specifed input signals.&lt;br /&gt;
&lt;br /&gt;
As the Decider Combinator, &lt;br /&gt;
its input is used to serve if any of its inputs meets the specified signals or variables.&lt;br /&gt;
&lt;br /&gt;
Side note: &amp;quot;Anything&amp;quot; outputs false by default if there is no signal to guarantee if it is true. &#039;&#039;Anything is false when any of inputs do not meet the condition, otherwise, it is true.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
===Each Wildcard:===&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
This Yellow Wildcard serves to check for each the specifed input signals.&lt;br /&gt;
&lt;br /&gt;
As the Decider Combinator, &amp;lt;br /&amp;gt;&lt;br /&gt;
its input is used to serve if any inputs meets the specified signals or variables. &amp;lt;br /&amp;gt;&lt;br /&gt;
its output is used to serve output the each variable. &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As the Arithmetic Combinator, &amp;lt;br /&amp;gt;&lt;br /&gt;
its input is used to serve each input, then the following summations are summed and outputted, with each signal as its own respective signals.&lt;br /&gt;
&lt;br /&gt;
== Input Isolator &amp;amp; Gate ==&lt;br /&gt;
An arithmetic combinator set to (In: Each + 0, Out: Each) can be used to swap wire colors and as an isolator to prevent downstream logic from backfeeding into the circuit network&#039;s inputs.&lt;br /&gt;
&lt;br /&gt;
A decider combinator set to (Out: Everything, Input-&amp;gt; Output) will also function as an isolator as long as the set logic condition is true. This can also selectively pass or &#039;gate&#039; inputs only when desired. This could be used to sequentially poll remote train stations for their chest contents, and include only desired stations.&lt;br /&gt;
&lt;br /&gt;
== Set/Reset Latching Switch ==&lt;br /&gt;
You want something to SET a trigger at some quantity, but then STAY on until that quantity hits some other value, the RESET value. You&#039;ll need one decider combinator and one arithmetic combinator. Two decider combinators and a constant combinator can also be used for more complex multi-channel conditions.&lt;br /&gt;
&lt;br /&gt;
Setup the first decider combinator to the desired set conditional and to output a 1. Then connect the output to the input of an arithmetic combinator, and configure it to multiply by the bias value, the difference between the set and reset values, and wire the arithmetic output to the input of the decider. The arithmetic output channel MUST be set the same as the decider&#039;s input channel. That&#039;s it! Whenever your set conditional is reached, the decider will output a &#039;1&#039;, and the bias of the arithmetic combinator will be applied. This will &#039;hold&#039; the output true until the value goes back below the reset point.&lt;br /&gt;
&lt;br /&gt;
Here&#039;s a more specific example : &lt;br /&gt;
i want the pump to run when petrol reach 2000, and turn off when reach 200.&amp;lt;br&amp;gt;&lt;br /&gt;
only with green wire&amp;lt;br&amp;gt;&lt;br /&gt;
Tank -&amp;gt; in decider&amp;lt;br&amp;gt;&lt;br /&gt;
out decider-&amp;gt; in arithmetic&amp;lt;br&amp;gt;&lt;br /&gt;
out arithmetic -&amp;gt; in decider&amp;lt;br&amp;gt;&lt;br /&gt;
green wire from in decider, to pump&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Pump have the same condition as the decider (Petrol &amp;gt; 2000)&lt;br /&gt;
&lt;br /&gt;
Decider : Petrol &amp;gt; 2000&amp;lt;br&amp;gt;&lt;br /&gt;
out : A = 1&amp;lt;br&amp;gt;&lt;br /&gt;
Arithmetic : A x 1800 (2000 - 200 )&amp;lt;br&amp;gt;&lt;br /&gt;
out : petrol&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:Factorio combinator switch.png|620px]]&lt;br /&gt;
&lt;br /&gt;
Backup steam power example with detailed configuration and explanation can be found here:&amp;lt;br /&amp;gt;[[Tutorial:Circuit-network_Cookbook#SR_latch_-_single_decider_version|Tutorial:Circuit-network_Cookbook#SR latch - single decider version]]&lt;br /&gt;
&lt;br /&gt;
== Smart Train Loading ==&lt;br /&gt;
This solves the problem of loading logistics into chests, which tend to be unequal and is slower in the rate of loading logistics into the cargo of trains.&lt;br /&gt;
&lt;br /&gt;
To setup the design, you require an Arithmetic Combinator, as well as Red and Green wires. &#039;&#039;&#039;Wire all the chests used, to the input of the Arithmetic Combinator&#039;&#039;&#039;. &#039;&#039;&#039;Then write (Logistics Item / -Amount of chests) and as the output as the Logistics Item in the Arithmetic Combinator&#039;&#039;&#039;, this will average the amount of items within the chests. Lastly, &#039;&#039;&#039;wire all the inserters used to the output of the Arithmetic Combinator and have the other color of the wire be wired to the adjacent chest&#039;&#039;&#039;. &#039;&#039;&#039;Have the inserters enabled when Logistics Item &amp;lt; 1&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
A more visual representation as well as questions about the design can be found in a reddit post: [https://www.reddit.com/r/factorio/comments/4e03g2/madzuris_smart_loading_train_station_guide/ MadZuri&#039;s smart loading train station].&lt;br /&gt;
&lt;br /&gt;
Explanation of why this works:&lt;br /&gt;
It compares the average amount of total items within the chests and the chest adjacent to the inserter so that it activates when the average number of items is higher than the amount within the chest.&lt;br /&gt;
The reason for why the division denominator is negative is because if the items in the chests are 0, it basically makes it so that it adds 1 to the equation.&lt;br /&gt;
&lt;br /&gt;
== Memory ==&lt;br /&gt;
How to store a constant value for later use, either for a basic counter or for more advanced logic. A decider combinator wired output tied to input and configured greater than zero (for positive values), input -&amp;gt; output will &#039;hold&#039; a value, as long as all other inputs on the network are zero.&lt;br /&gt;
&lt;br /&gt;
Any non-zero input condition will create a basic clock; incrementing the stored value by the sum of all connected input values every cycle. A single pulse of an input will cause a single increment by the pulsed value. Reset to zero occurs whenever the set condition is no longer met, or if a negative pulse equal to the input occurs.&lt;br /&gt;
&lt;br /&gt;
== Basic Clocks ==&lt;br /&gt;
[[File:Timer.png|thumb|right|377px|A basic clock. 30 ticks is the ceiling for Signal 1; which is continuously added.]]&lt;br /&gt;
Clocks are constructed by having the output of a combinator tied back to its own input, such that every cycle advances its own count. Either the arithmetic combinator or the decider combinator can be used.&lt;br /&gt;
&lt;br /&gt;
An arithmetic combinator tied to itself is fun to watch and will happily run-away, but requires additional control logic to reset.&lt;br /&gt;
&lt;br /&gt;
A self-resetting clock requires just a single decider combinator with output wired to input and configured with Less Than (&amp;lt;) and Input -&amp;gt; Output. When a constant combinator is then connected to the input, every cycle it will count up by the value of the Constant Combinator until the set conditional value is reached, then output a zero which will be summed with the constant combinator, and reset the process.&lt;br /&gt;
&lt;br /&gt;
The clock sequence will not include zero, will begin at the value set by the constant combinator, and will include whatever value eventually causes the conditional to be false. An arithmetic combinator can modify the clock sequence but remember its outputs will occur one cycle later than the clock cycle values.&lt;br /&gt;
&lt;br /&gt;
A clock that only counts once can be built using the following setup:&lt;br /&gt;
&lt;br /&gt;
[[File:Onetime_Clock.png|thumb|none|360px|One-time clock. Runs until T=Z+1. Reset via R&amp;gt;0.]]&lt;br /&gt;
&lt;br /&gt;
== Pulse Generators ==&lt;br /&gt;
&lt;br /&gt;
Connecting an additional (=) decider combinator to the output of a basic clock will create a pulse generator, and will pulse a single output every time the clock cycles through the set condition. Any output value can be used, either directly from the clock sequence (input-&amp;gt;output), a 1, or some value on a separate logic channel on the circuit network, such as set by a constant combinator. or by the circuit network.&amp;lt;br /&amp;gt;&lt;br /&gt;
[[File:PulseGen.png|500px]]&lt;br /&gt;
*&#039;&#039;The value 1 can be written as any positive integer, so long as it is within the cap or ceiling of your timer.&#039;&#039;&lt;br /&gt;
*&#039;&#039;As an example from the above timer, this light will pulse every 1st tick after the timer reaches 30 ticks, making it pulse 1/30th of a second, as Factorio updates at 60 times per second.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Counter ==&lt;br /&gt;
A counter is used to count the number of input events, and output the sum of that count. Any pulsing input into a decider combinator configured input -&amp;gt; output and wired between output and input will create a counter, but this input must be zero at all other times or else the combinator will run away like a clock. A pulse generator is normally used to accomplish this. Combining several gating decider isolators set with sequential conditionals, a clock, and a pulse generator to the input of a counter will allow remote polling and counting of each isolator&#039;s contents.&lt;br /&gt;
&lt;br /&gt;
== Logic Gates ==&lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;Unary NOT&#039;&#039;&#039;===&lt;br /&gt;
----&lt;br /&gt;
[[File:NOT.png|415px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;Binary OR&#039;&#039;&#039;===&lt;br /&gt;
----&lt;br /&gt;
[[File:OR.png|300px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 2!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1  || 1&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;*Note: The Arithmetic Combinator&#039;s OR option is bitwise.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;Binary NOR&#039;&#039;&#039;===&lt;br /&gt;
----&lt;br /&gt;
[[File:NOR.png|415px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 2!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;Binary XOR&#039;&#039;&#039;===&lt;br /&gt;
----&lt;br /&gt;
[[File:XOR.png|300px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 1!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 ||  0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 ||  1 || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 ||  0 || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 ||  1 || 0&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;*Note: The Arithmetic Combinator&#039;s XOR option is bitwise.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;Binary AND&#039;&#039;&#039;===&lt;br /&gt;
----&lt;br /&gt;
[[File:AND.png|530px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 2!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1 || 1&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;*Deprecated: Use the Arithmetic Combinator&#039;s AND option instead.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;Trinary AND&#039;&#039;&#039;===&lt;br /&gt;
----&lt;br /&gt;
[[File:TrinaryAND.png|415px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 2!!Input 3!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0  || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1  || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0  || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1  || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0  || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1  || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0  || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1  || 1  || 1&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;Binary NAND&#039;&#039;&#039;===&lt;br /&gt;
----&lt;br /&gt;
[[File:NAND.png|300px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 2!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;Binary XNOR/XAND&#039;&#039;&#039;===&lt;br /&gt;
----&lt;br /&gt;
[[File:XAND.png|300px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 2!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1  || 1&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Memory Cells ==&lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;Simple Latch&#039;&#039;&#039;===&lt;br /&gt;
&lt;br /&gt;
When looping the combinator to itself, use a different colour of wire from your main inputs or outputs. &lt;br /&gt;
&lt;br /&gt;
[[File:SimpleLatchv2.png|300px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Output 1!!Input 1!!Input 2!! Output 1 (t+1)&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 0 || 1&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0 || 0 || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1 || 0 || 1 &#039;&#039;(2)&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0 || 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1 || 1 || 1 &#039;&#039;(2)&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&#039;&#039;Output 1 is the green wire loop seen in the picture, it carries the value to latch.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Input 1 is Set, while Input 2 is Reset.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;Binary Cell&#039;&#039;&#039;===&lt;br /&gt;
&lt;br /&gt;
RS NOR Latch&lt;br /&gt;
[[File:RS-NOR.png|500px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;Advanced Cell&#039;&#039;&#039;===&lt;br /&gt;
&lt;br /&gt;
Cell for storing a positive value:&lt;br /&gt;
&lt;br /&gt;
[[File:AdvancedMemoryCell.png|500px]]&lt;br /&gt;
&lt;br /&gt;
Connect the desired value as signal 3 on the right side to set the memory cell and connect a negative value as signal 3 to reset the cell.  *Please note the arithmetic combinator&#039;s output should be facing the opposite direction of the decider combinators.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Address Enable Switch&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== See Also ==&lt;br /&gt;
*[http://www.factorioforums.com/forum/viewtopic.php?f=18&amp;amp;t=14556 Combinators 101 (Tutorial)]&lt;br /&gt;
*[[Arithmetic combinator]]&lt;br /&gt;
*[[Constant combinator]]&lt;br /&gt;
*[[Decider combinator]]&lt;br /&gt;
*[[Circuit network]]&lt;br /&gt;
*[[Circuit-network_Cookbook]]&lt;/div&gt;</summary>
		<author><name>My3DS</name></author>
	</entry>
	<entry>
		<id>https://wiki.factorio.com/index.php?title=Tutorial:Combinator_tutorial&amp;diff=159149</id>
		<title>Tutorial:Combinator tutorial</title>
		<link rel="alternate" type="text/html" href="https://wiki.factorio.com/index.php?title=Tutorial:Combinator_tutorial&amp;diff=159149"/>
		<updated>2018-05-12T00:51:40Z</updated>

		<summary type="html">&lt;p&gt;My3DS: /* Binary OR */ changed deprecated to a note (will soon update on bitwise!)&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Languages}}&lt;br /&gt;
== Introduction ==&lt;br /&gt;
Combinator logic is achieved by cross-connecting outputs to inputs in such a way to achieve the desired logic. While advanced logic requires a multitude of combinators, some very useful basic logic can be achieved using only a handful of combinators. &#039;&#039;&#039;Combinator logic works because Factorio only updates at 60 times per second, such that combinators analyze their logic in a step, and then sum and/or decide the resulting output values on the next step.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
When logic values are computed by combinators, the outputs are not recognized by the circuit network until the following step. So when a decider combinator is used to detect a certain input condition, it&#039;s output value will not take effect on the circuit network until the next step. &#039;&#039;&#039;This behavior is important to remember and can result in sequencing errors and significant delays when multiple combinators are connected in series.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Circuit wires act like a wire bus in electronics, it carries information in the connected wires, meaning that &#039;&#039;&#039;if there are similar signals on a wire, it will add them automatically, unless if it is a different signal, that means it will be carried in that wire as well, but as a different signal.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
When cross-connecting combinators &#039;&#039;&#039;it&#039;s good practice to use the unused color to cross-connect, this will split the input and output networks and prevent unwanted inputs from accidentally connecting to a larger circuit network.&#039;&#039;&#039; Combinators will sum the red &amp;amp;/or green inputs prior to calculation, so either color can be used when wiring the output back to the input, but in most cases, it is more useful to use the opposing colour of the wire so that it will not interfere with the resulting output and input.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;There is also an example heavy [[Circuit-network_Cookbook|circuit network cookbook]] that you may find helpful to learn and refer to about circuit networks.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Virtual Signals ==&lt;br /&gt;
&lt;br /&gt;
===Everything Wildcard:===&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
This Red Wildcard serves to check all the specifed input signals.&lt;br /&gt;
&lt;br /&gt;
As the Decider Combinator, &amp;lt;br /&amp;gt;&lt;br /&gt;
its input is used to serve if all inputs meets the specified signals or variables. &amp;lt;br /&amp;gt;&lt;br /&gt;
its output is used to serve output every signal. &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Side note: &amp;quot;Everything&amp;quot; outputs true by default even if there is no signal to guarantee if that is true. &#039;&#039;Everything is false when every input does not meet the condition, otherwise, output true.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
===Anything Wildcard:===&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
This Green Wildcard serves to check all the specifed input signals.&lt;br /&gt;
&lt;br /&gt;
As the Decider Combinator, &lt;br /&gt;
its input is used to serve if any of its inputs meets the specified signals or variables.&lt;br /&gt;
&lt;br /&gt;
Side note: &amp;quot;Anything&amp;quot; outputs false by default if there is no signal to guarantee if it is true. &#039;&#039;Anything is false when any of inputs do not meet the condition, otherwise, it is true.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
===Each Wildcard:===&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
This Yellow Wildcard serves to check for each the specifed input signals.&lt;br /&gt;
&lt;br /&gt;
As the Decider Combinator, &amp;lt;br /&amp;gt;&lt;br /&gt;
its input is used to serve if any inputs meets the specified signals or variables. &amp;lt;br /&amp;gt;&lt;br /&gt;
its output is used to serve output the each variable. &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As the Arithmetic Combinator, &amp;lt;br /&amp;gt;&lt;br /&gt;
its input is used to serve each input, then the following summations are summed and outputted, with each signal as its own respective signals.&lt;br /&gt;
&lt;br /&gt;
== Input Isolator &amp;amp; Gate ==&lt;br /&gt;
An arithmetic combinator set to (In: Each + 0, Out: Each) can be used to swap wire colors and as an isolator to prevent downstream logic from backfeeding into the circuit network&#039;s inputs.&lt;br /&gt;
&lt;br /&gt;
A decider combinator set to (Out: Everything, Input-&amp;gt; Output) will also function as an isolator as long as the set logic condition is true. This can also selectively pass or &#039;gate&#039; inputs only when desired. This could be used to sequentially poll remote train stations for their chest contents, and include only desired stations.&lt;br /&gt;
&lt;br /&gt;
== Set/Reset Latching Switch ==&lt;br /&gt;
You want something to SET a trigger at some quantity, but then STAY on until that quantity hits some other value, the RESET value. You&#039;ll need one decider combinator and one arithmetic combinator. Two decider combinators and a constant combinator can also be used for more complex multi-channel conditions.&lt;br /&gt;
&lt;br /&gt;
Setup the first decider combinator to the desired set conditional and to output a 1. Then connect the output to the input of an arithmetic combinator, and configure it to multiply by the bias value, the difference between the set and reset values, and wire the arithmetic output to the input of the decider. The arithmetic output channel MUST be set the same as the decider&#039;s input channel. That&#039;s it! Whenever your set conditional is reached, the decider will output a &#039;1&#039;, and the bias of the arithmetic combinator will be applied. This will &#039;hold&#039; the output true until the value goes back below the reset point.&lt;br /&gt;
&lt;br /&gt;
Here&#039;s a more specific example : &lt;br /&gt;
i want the pump to run when petrol reach 2000, and turn off when reach 200.&amp;lt;br&amp;gt;&lt;br /&gt;
only with green wire&amp;lt;br&amp;gt;&lt;br /&gt;
Tank -&amp;gt; in decider&amp;lt;br&amp;gt;&lt;br /&gt;
out decider-&amp;gt; in arithmetic&amp;lt;br&amp;gt;&lt;br /&gt;
out arithmetic -&amp;gt; in decider&amp;lt;br&amp;gt;&lt;br /&gt;
green wire from in decider, to pump&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Pump have the same condition as the decider (Petrol &amp;gt; 2000)&lt;br /&gt;
&lt;br /&gt;
Decider : Petrol &amp;gt; 2000&amp;lt;br&amp;gt;&lt;br /&gt;
out : A = 1&amp;lt;br&amp;gt;&lt;br /&gt;
Arithmetic : A x 1800 (2000 - 200 )&amp;lt;br&amp;gt;&lt;br /&gt;
out : petrol&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:Factorio combinator switch.png|620px]]&lt;br /&gt;
&lt;br /&gt;
Backup steam power example with detailed configuration and explanation can be found here:&amp;lt;br /&amp;gt;[[Tutorial:Circuit-network_Cookbook#SR_latch_-_single_decider_version|Tutorial:Circuit-network_Cookbook#SR latch - single decider version]]&lt;br /&gt;
&lt;br /&gt;
== Smart Train Loading ==&lt;br /&gt;
This solves the problem of loading logistics into chests, which tend to be unequal and is slower in the rate of loading logistics into the cargo of trains.&lt;br /&gt;
&lt;br /&gt;
To setup the design, you require an Arithmetic Combinator, as well as Red and Green wires. &#039;&#039;&#039;Wire all the chests used, to the input of the Arithmetic Combinator&#039;&#039;&#039;. &#039;&#039;&#039;Then write (Logistics Item / -Amount of chests) and as the output as the Logistics Item in the Arithmetic Combinator&#039;&#039;&#039;, this will average the amount of items within the chests. Lastly, &#039;&#039;&#039;wire all the inserters used to the output of the Arithmetic Combinator and have the other color of the wire be wired to the adjacent chest&#039;&#039;&#039;. &#039;&#039;&#039;Have the inserters enabled when Logistics Item &amp;lt; 1&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
A more visual representation as well as questions about the design can be found in a reddit post: [https://www.reddit.com/r/factorio/comments/4e03g2/madzuris_smart_loading_train_station_guide/ MadZuri&#039;s smart loading train station].&lt;br /&gt;
&lt;br /&gt;
Explanation of why this works:&lt;br /&gt;
It compares the average amount of total items within the chests and the chest adjacent to the inserter so that it activates when the average number of items is higher than the amount within the chest.&lt;br /&gt;
The reason for why the division denominator is negative is because if the items in the chests are 0, it basically makes it so that it adds 1 to the equation.&lt;br /&gt;
&lt;br /&gt;
== Memory ==&lt;br /&gt;
How to store a constant value for later use, either for a basic counter or for more advanced logic. A decider combinator wired output tied to input and configured greater than zero (for positive values), input -&amp;gt; output will &#039;hold&#039; a value, as long as all other inputs on the network are zero.&lt;br /&gt;
&lt;br /&gt;
Any non-zero input condition will create a basic clock; incrementing the stored value by the sum of all connected input values every cycle. A single pulse of an input will cause a single increment by the pulsed value. Reset to zero occurs whenever the set condition is no longer met, or if a negative pulse equal to the input occurs.&lt;br /&gt;
&lt;br /&gt;
== Basic Clocks ==&lt;br /&gt;
[[File:Timer.png|thumb|right|377px|A basic clock. 30 ticks is the ceiling for Signal 1; which is continuously added.]]&lt;br /&gt;
Clocks are constructed by having the output of a combinator tied back to its own input, such that every cycle advances its own count. Either the arithmetic combinator or the decider combinator can be used.&lt;br /&gt;
&lt;br /&gt;
An arithmetic combinator tied to itself is fun to watch and will happily run-away, but requires additional control logic to reset.&lt;br /&gt;
&lt;br /&gt;
A self-resetting clock requires just a single decider combinator with output wired to input and configured with Less Than (&amp;lt;) and Input -&amp;gt; Output. When a constant combinator is then connected to the input, every cycle it will count up by the value of the Constant Combinator until the set conditional value is reached, then output a zero which will be summed with the constant combinator, and reset the process.&lt;br /&gt;
&lt;br /&gt;
The clock sequence will not include zero, will begin at the value set by the constant combinator, and will include whatever value eventually causes the conditional to be false. An arithmetic combinator can modify the clock sequence but remember its outputs will occur one cycle later than the clock cycle values.&lt;br /&gt;
&lt;br /&gt;
A clock that only counts once can be built using the following setup:&lt;br /&gt;
&lt;br /&gt;
[[File:Onetime_Clock.png|thumb|none|360px|One-time clock. Runs until T=Z+1. Reset via R&amp;gt;0.]]&lt;br /&gt;
&lt;br /&gt;
== Pulse Generators ==&lt;br /&gt;
&lt;br /&gt;
Connecting an additional (=) decider combinator to the output of a basic clock will create a pulse generator, and will pulse a single output every time the clock cycles through the set condition. Any output value can be used, either directly from the clock sequence (input-&amp;gt;output), a 1, or some value on a separate logic channel on the circuit network, such as set by a constant combinator. or by the circuit network.&amp;lt;br /&amp;gt;&lt;br /&gt;
[[File:PulseGen.png|500px]]&lt;br /&gt;
*&#039;&#039;The value 1 can be written as any positive integer, so long as it is within the cap or ceiling of your timer.&#039;&#039;&lt;br /&gt;
*&#039;&#039;As an example from the above timer, this light will pulse every 1st tick after the timer reaches 30 ticks, making it pulse 1/30th of a second, as Factorio updates at 60 times per second.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Counter ==&lt;br /&gt;
A counter is used to count the number of input events, and output the sum of that count. Any pulsing input into a decider combinator configured input -&amp;gt; output and wired between output and input will create a counter, but this input must be zero at all other times or else the combinator will run away like a clock. A pulse generator is normally used to accomplish this. Combining several gating decider isolators set with sequential conditionals, a clock, and a pulse generator to the input of a counter will allow remote polling and counting of each isolator&#039;s contents.&lt;br /&gt;
&lt;br /&gt;
== Logic Gates ==&lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;Unary NOT&#039;&#039;&#039;===&lt;br /&gt;
----&lt;br /&gt;
[[File:NOT.png|415px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;Binary OR&#039;&#039;&#039;===&lt;br /&gt;
----&lt;br /&gt;
[[File:OR.png|300px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 2!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1  || 1&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;*Note: The Arithmetic Combinator&#039;s OR option is bitwise.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;Binary NOR&#039;&#039;&#039;===&lt;br /&gt;
----&lt;br /&gt;
[[File:NOR.png|415px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 2!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;Binary XOR&#039;&#039;&#039;===&lt;br /&gt;
----&lt;br /&gt;
[[File:XOR.png|300px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 1!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 ||  0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 ||  1 || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 ||  0 || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 ||  1 || 0&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;*Deprecated: Use the Arithmetic Combinator&#039;s XOR option instead.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;Binary AND&#039;&#039;&#039;===&lt;br /&gt;
----&lt;br /&gt;
[[File:AND.png|530px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 2!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1 || 1&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;*Deprecated: Use the Arithmetic Combinator&#039;s AND option instead.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;Trinary AND&#039;&#039;&#039;===&lt;br /&gt;
----&lt;br /&gt;
[[File:TrinaryAND.png|415px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 2!!Input 3!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0  || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1  || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0  || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1  || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0  || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1  || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0  || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1  || 1  || 1&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;Binary NAND&#039;&#039;&#039;===&lt;br /&gt;
----&lt;br /&gt;
[[File:NAND.png|300px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 2!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;Binary XNOR/XAND&#039;&#039;&#039;===&lt;br /&gt;
----&lt;br /&gt;
[[File:XAND.png|300px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 2!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1  || 1&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Memory Cells ==&lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;Simple Latch&#039;&#039;&#039;===&lt;br /&gt;
&lt;br /&gt;
When looping the combinator to itself, use a different colour of wire from your main inputs or outputs. &lt;br /&gt;
&lt;br /&gt;
[[File:SimpleLatchv2.png|300px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Output 1!!Input 1!!Input 2!! Output 1 (t+1)&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 0 || 1&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0 || 0 || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1 || 0 || 1 &#039;&#039;(2)&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0 || 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1 || 1 || 1 &#039;&#039;(2)&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&#039;&#039;Output 1 is the green wire loop seen in the picture, it carries the value to latch.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Input 1 is Set, while Input 2 is Reset.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;Binary Cell&#039;&#039;&#039;===&lt;br /&gt;
&lt;br /&gt;
RS NOR Latch&lt;br /&gt;
[[File:RS-NOR.png|500px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;Advanced Cell&#039;&#039;&#039;===&lt;br /&gt;
&lt;br /&gt;
Cell for storing a positive value:&lt;br /&gt;
&lt;br /&gt;
[[File:AdvancedMemoryCell.png|500px]]&lt;br /&gt;
&lt;br /&gt;
Connect the desired value as signal 3 on the right side to set the memory cell and connect a negative value as signal 3 to reset the cell.  *Please note the arithmetic combinator&#039;s output should be facing the opposite direction of the decider combinators.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Address Enable Switch&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== See Also ==&lt;br /&gt;
*[http://www.factorioforums.com/forum/viewtopic.php?f=18&amp;amp;t=14556 Combinators 101 (Tutorial)]&lt;br /&gt;
*[[Arithmetic combinator]]&lt;br /&gt;
*[[Constant combinator]]&lt;br /&gt;
*[[Decider combinator]]&lt;br /&gt;
*[[Circuit network]]&lt;br /&gt;
*[[Circuit-network_Cookbook]]&lt;/div&gt;</summary>
		<author><name>My3DS</name></author>
	</entry>
	<entry>
		<id>https://wiki.factorio.com/index.php?title=Tutorial:Combinator_tutorial&amp;diff=155257</id>
		<title>Tutorial:Combinator tutorial</title>
		<link rel="alternate" type="text/html" href="https://wiki.factorio.com/index.php?title=Tutorial:Combinator_tutorial&amp;diff=155257"/>
		<updated>2018-02-11T03:04:46Z</updated>

		<summary type="html">&lt;p&gt;My3DS: /* Virtual Signals */ changed to special i/os, simplified text&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Languages}}&lt;br /&gt;
== Introduction ==&lt;br /&gt;
=== Basics ===&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
Let us start with how combinator logic is processed. Combinators update at each tick, meaning if that your computer is running at 60 updates per second (UPS), your combinator similarly runs at 60 processes per second. &lt;br /&gt;
&lt;br /&gt;
This is important to take into account as you build larger scale projects, as it will affect how fast your logic will run, and how much your logic will heavily task on Factorio. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Think of each signal like the number of boxes, where a wire will transport that box into other combinators that will process those boxes. &amp;lt;br&amp;gt;&lt;br /&gt;
Think of a wire being that highway where boxes are transported, so boxes with the same name/label get merged as they transport those boxes, whereas boxes with different labels remain unmerged. &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The first highway will not interact with another highway, so boxes with the same label do not get merged with one another when they are given separate highways - i.e. values in the green wire will not merge with values in the red wire - when those highways are connected to the same combinator, the combinator will merge those boxes.&lt;br /&gt;
&lt;br /&gt;
=== Ability of a Combinator ===&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
Combinators can work in both positive and negative values, and is in base-10. This allows you to work with boolean/binary values &#039;&#039;(0 or 1)&#039;&#039;, and integer values. &lt;br /&gt;
&lt;br /&gt;
Float points do not exist in Factorio, and will be instead be bit-shifted to the nearest integer. &amp;lt;br&amp;gt; &#039;&#039;(9.3 becomes 9) and (10.7 becomes 10)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
There is a risk for integer overflow, as combinators use signed 32-bit int, meaning the numeric range is from &#039;&#039;-2,147,483,648&#039;&#039; to &#039;&#039;2,147,483,647&#039;&#039;, as it can only hold 2³², or 4 billion+ values.&lt;br /&gt;
&lt;br /&gt;
=== Basic Arithmetic ===&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
Begin with very simple maths. &amp;lt;br&amp;gt; Say that you wanted some production of item X to be stopped when you reached a certain amount in the logistics network.&lt;br /&gt;
&lt;br /&gt;
How can we approach this problem? &amp;lt;br&amp;gt; The most straight-forward approach is to link the inserter that outputs the item to a passive provider chest to the logistics network when X ≥ number.&lt;br /&gt;
&lt;br /&gt;
Say that instead of when X ≥ number, you instead wanted to store that item as a temporary buffer, so it produces in batches rather than being continuous. &amp;lt;br&amp;gt; You wanted a combinator to toggle when some value is reaches a number that sets itself, and reset itself afterwards. &amp;lt;br&amp;gt; &#039;&#039;This is otherwise known as a hysteresis.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The idea you have is: &amp;lt;br&amp;gt;When S ≤ value, send a boolean value to store, and when R ≥ value, send a boolean value to reset.&lt;br /&gt;
&lt;br /&gt;
But how can we go making the mechanism that stores memory? &amp;lt;br&amp;gt; &#039;&#039;We can make a decider combinator that feedbacks to itself!&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Given that when S &amp;gt; R, S can send a signal to itself saying that this condition will still hold true until R makes the condition false.&lt;br /&gt;
&lt;br /&gt;
There are other approaches too, but this is the most intuitive to look at.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&#039;&#039;There is also an example heavy [[Circuit-network_Cookbook|circuit network cookbook]] that you may find helpful to learn and refer to about circuit networks.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Special I/Os ==&lt;br /&gt;
&lt;br /&gt;
=== Everything Wildcard ===&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
This red wildcard serves to check every input signal.&lt;br /&gt;
&lt;br /&gt;
If used in the Decider/Arithematic Combinator, &amp;lt;br /&amp;gt;&lt;br /&gt;
It will test and operate for every signal for its input, &amp;lt;br /&amp;gt;&lt;br /&gt;
It will output every signal at its input, to its output, so long as it meets the given condition. &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For example, &amp;lt;br&amp;gt;&lt;br /&gt;
If Everything ≥ 5, and its inputs are 1 iron, and 1 copper, it will not output any information, as the condition will be false.&amp;lt;br&amp;gt;&lt;br /&gt;
If its inputs are now 5 iron, and 5 copper, it will output all information, given that Everything is used as an output. &amp;lt;br&amp;gt;&lt;br /&gt;
But if its inputs are 5 iron, and 0 copper, it will output all information, as 0 copper is the same as no/null signal in Factorio.&lt;br /&gt;
&lt;br /&gt;
===Anything Wildcard:===&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
This Green Wildcard serves to check all the specifed input signals.&lt;br /&gt;
&lt;br /&gt;
As the Decider Combinator, &lt;br /&gt;
its input is used to serve if any of its inputs meets the specified signals or variables.&lt;br /&gt;
&lt;br /&gt;
Side note: &amp;quot;Anything&amp;quot; outputs false by default if there is no signal to guarantee if it is true. &#039;&#039;Anything is false when any of inputs do not meet the condition, otherwise, it is true.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
===Each Wildcard:===&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
This Yellow Wildcard serves to check for each the specifed input signals.&lt;br /&gt;
&lt;br /&gt;
As the Decider Combinator, &amp;lt;br /&amp;gt;&lt;br /&gt;
its input is used to serve if any inputs meets the specified signals or variables. &amp;lt;br /&amp;gt;&lt;br /&gt;
its output is used to serve output the each variable. &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As the Arithmetic Combinator, &amp;lt;br /&amp;gt;&lt;br /&gt;
its input is used to serve each input, then the following summations are summed and outputted, with each signal as its own respective signals.&lt;br /&gt;
&lt;br /&gt;
== Input Isolator &amp;amp; Gate ==&lt;br /&gt;
An arithmetic combinator set to (In: Each + 0, Out: Each) can be used to swap wire colors and as an isolator to prevent downstream logic from backfeeding into the circuit network&#039;s inputs.&lt;br /&gt;
&lt;br /&gt;
A decider combinator set to (Out: Everything, Input-&amp;gt; Output) will also function as an isolator as long as the set logic condition is true. This can also selectively pass or &#039;gate&#039; inputs only when desired. This could be used to sequentially poll remote train stations for their chest contents, and include only desired stations.&lt;br /&gt;
&lt;br /&gt;
== Set/Reset Latching Switch ==&lt;br /&gt;
You want something to SET a trigger at some quantity, but then STAY on until that quantity hits some other value, the RESET value. You&#039;ll need one decider combinator and one arithmetic combinator. Two decider combinators and a constant combinator can also be used for more complex multi-channel conditions.&lt;br /&gt;
&lt;br /&gt;
Setup the first decider combinator to the desired set conditional and to output a 1. Then connect the output to the input of an arithmetic combinator, and configure it to multiply by the bias value, the difference between the set and reset values, and wire the arithmetic output to the input of the decider. The arithmetic output channel MUST be set the same as the decider&#039;s input channel. That&#039;s it! Whenever your set conditional is reached, the decider will output a &#039;1&#039;, and the bias of the arithmetic combinator will be applied. This will &#039;hold&#039; the output true until the value goes back below the reset point.&lt;br /&gt;
&lt;br /&gt;
Here&#039;s a more specific example : &lt;br /&gt;
i want the pump to run when petrol reach 2000, and turn off when reach 200.&amp;lt;br&amp;gt;&lt;br /&gt;
only with green wire&amp;lt;br&amp;gt;&lt;br /&gt;
Tank -&amp;gt; in decider&amp;lt;br&amp;gt;&lt;br /&gt;
out decider-&amp;gt; in arithmetic&amp;lt;br&amp;gt;&lt;br /&gt;
out arithmetic -&amp;gt; in decider&amp;lt;br&amp;gt;&lt;br /&gt;
green wire from in decider, to pump&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Pump have the same condition as the decider (Petrol &amp;gt; 2000)&lt;br /&gt;
&lt;br /&gt;
Decider : Petrol &amp;gt; 2000&amp;lt;br&amp;gt;&lt;br /&gt;
out : A = 1&amp;lt;br&amp;gt;&lt;br /&gt;
Arithmetic : A x 1800 (2000 - 200 )&amp;lt;br&amp;gt;&lt;br /&gt;
out : petrol&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:Factorio combinator switch.png|620px]]&lt;br /&gt;
&lt;br /&gt;
Backup steam power example with detailed configuration and explanation can be found here:&amp;lt;br /&amp;gt;[[Tutorial:Circuit-network_Cookbook#SR_latch_-_single_decider_version|Tutorial:Circuit-network_Cookbook#SR latch - single decider version]]&lt;br /&gt;
&lt;br /&gt;
== Smart Train Loading ==&lt;br /&gt;
&lt;br /&gt;
Initially designed by [https://www.youtube.com/user/Darkphade MadZuri],&lt;br /&gt;
&lt;br /&gt;
This solves the problem of loading logistics into chests, which tend to be unequal and is slower in the rate of loading logistics into the cargo of trains.&lt;br /&gt;
&lt;br /&gt;
To setup the design, you require an Arithmetic Combinator, as well as Red and Green wires. &#039;&#039;&#039;Wire all the chests used, to the input of the Arithmetic Combinator&#039;&#039;&#039;. &#039;&#039;&#039;Then write (Logistics Item / -Amount of chests) and as the output as the Logistics Item in the Arithmetic Combinator&#039;&#039;&#039;, this will average the amount of items within the chests. Lastly, &#039;&#039;&#039;wire all the inserters used to the output of the Arithmetic Combinator and have the other color of the wire be wired to the adjacent chest&#039;&#039;&#039;. &#039;&#039;&#039;Have the inserters enabled when Logistics Item &amp;lt; 1&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
A more visual representation as well as questions for the design can be found [https://www.reddit.com/r/factorio/comments/4e03g2/madzuris_smart_loading_train_station_guide/ here].&lt;br /&gt;
&lt;br /&gt;
Explanation of why this works:&lt;br /&gt;
It compares the average amount of total items within the chests and the chest adjacent to the inserter so that it activates when the average number of items is higher than the amount within the chest.&lt;br /&gt;
The reason for why the division denominator is negative is because if the items in the chests are 0, it basically makes it so that it adds 1 to the equation.&lt;br /&gt;
&lt;br /&gt;
== Memory ==&lt;br /&gt;
How to store a constant value for later use, either for a basic counter or for more advanced logic. A decider combinator wired output tied to input and configured greater than zero (for positive values), input -&amp;gt; output will &#039;hold&#039; a value, as long as all other inputs on the network are zero.&lt;br /&gt;
&lt;br /&gt;
Any non-zero input condition will create a basic clock; incrementing the stored value by the sum of all connected input values every cycle. A single pulse of an input will cause a single increment by the pulsed value. Reset to zero occurs whenever the set condition is no longer met, or if a negative pulse equal to the input occurs.&lt;br /&gt;
&lt;br /&gt;
== Basic Clocks ==&lt;br /&gt;
[[File:Timer.png|thumb|right|377px|A basic clock. 30 ticks is the ceiling for Signal 1; which is continuously added.]]&lt;br /&gt;
Clocks are constructed by having the output of a combinator tied back to its own input, such that every cycle advances its own count. Either the arithmetic combinator or the decider combinator can be used.&lt;br /&gt;
&lt;br /&gt;
An arithmetic combinator tied to itself is fun to watch and will happily run-away, but requires additional control logic to reset.&lt;br /&gt;
&lt;br /&gt;
A self-resetting clock requires just a single decider combinator with output wired to input and configured with Less Than (&amp;lt;) and Input -&amp;gt; Output. When a constant combinator is then connected to the input, every cycle it will count up by the value of the Constant Combinator until the set conditional value is reached, then output a zero which will be summed with the constant combinator, and reset the process.&lt;br /&gt;
&lt;br /&gt;
The clock sequence will not include zero, will begin at the value set by the constant combinator, and will include whatever value eventually causes the conditional to be false. An arithmetic combinator can modify the clock sequence but remember its outputs will occur one cycle later than the clock cycle values.&lt;br /&gt;
&lt;br /&gt;
A clock that only counts once can be built using the following setup:&lt;br /&gt;
&lt;br /&gt;
[[File:Onetime_Clock.png|thumb|none|360px|One-time clock. Runs until T=Z+1. Reset via R&amp;gt;0.]]&lt;br /&gt;
&lt;br /&gt;
== Pulse Generators ==&lt;br /&gt;
&lt;br /&gt;
Connecting an additional (=) decider combinator to the output of a basic clock will create a pulse generator, and will pulse a single output every time the clock cycles through the set condition. Any output value can be used, either directly from the clock sequence (input-&amp;gt;output), a 1, or some value on a separate logic channel on the circuit network, such as set by a constant combinator. or by the circuit network.&amp;lt;br /&amp;gt;&lt;br /&gt;
[[File:PulseGen.png|500px]]&lt;br /&gt;
*&#039;&#039;The value 1 can be written as any positive integer, so long as it is within the cap or ceiling of your timer.&#039;&#039;&lt;br /&gt;
*&#039;&#039;As an example from the above timer, this light will pulse every 1st tick after the timer reaches 30 ticks, making it pulse 1/30th of a second, as Factorio updates at 60 times per second.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Counter ==&lt;br /&gt;
A counter is used to count the number of input events, and output the sum of that count. Any pulsing input into a decider combinator configured input -&amp;gt; output and wired between output and input will create a counter, but this input must be zero at all other times or else the combinator will run away like a clock. A pulse generator is normally used to accomplish this. Combining several gating decider isolators set with sequential conditionals, a clock, and a pulse generator to the input of a counter will allow remote polling and counting of each isolator&#039;s contents.&lt;br /&gt;
&lt;br /&gt;
== Logic Gates ==&lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;Unary NOT&#039;&#039;&#039;===&lt;br /&gt;
----&lt;br /&gt;
[[File:NOT.png|415px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;Binary OR&#039;&#039;&#039;===&lt;br /&gt;
----&lt;br /&gt;
[[File:OR.png|300px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 2!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1  || 1&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;*Deprecated: Use the Arithmetic Combinator&#039;s OR option instead.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;Binary NOR&#039;&#039;&#039;===&lt;br /&gt;
----&lt;br /&gt;
[[File:NOR.png|415px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 2!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;Binary XOR&#039;&#039;&#039;===&lt;br /&gt;
----&lt;br /&gt;
[[File:XOR.png|300px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 1!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 ||  0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 ||  1 || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 ||  0 || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 ||  1 || 0&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;*Deprecated: Use the Arithmetic Combinator&#039;s XOR option instead.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;Binary AND&#039;&#039;&#039;===&lt;br /&gt;
----&lt;br /&gt;
[[File:AND.png|530px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 2!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1 || 1&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;*Deprecated: Use the Arithmetic Combinator&#039;s AND option instead.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;Trinary AND&#039;&#039;&#039;===&lt;br /&gt;
----&lt;br /&gt;
[[File:TrinaryAND.png|415px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 2!!Input 3!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0  || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1  || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0  || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1  || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0  || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1  || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0  || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1  || 1  || 1&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;Binary NAND&#039;&#039;&#039;===&lt;br /&gt;
----&lt;br /&gt;
[[File:NAND.png|300px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 2!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;Binary XNOR/XAND&#039;&#039;&#039;===&lt;br /&gt;
----&lt;br /&gt;
[[File:XAND.png|300px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 2!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1  || 1&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Memory Cells ==&lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;Simple Latch&#039;&#039;&#039;===&lt;br /&gt;
&lt;br /&gt;
When looping the combinator to itself, use a different colour of wire from your main inputs or outputs. &lt;br /&gt;
&lt;br /&gt;
[[File:SimpleLatchv2.png|300px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Output 1!!Input 1!!Input 2!! Output 1 (t+1)&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 0 || 1&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0 || 0 || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1 || 0 || 1 &#039;&#039;(2)&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0 || 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1 || 1 || 1 &#039;&#039;(2)&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&#039;&#039;Output 1 is the green wire loop seen in the picture, it carries the value to latch.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Input 1 is Set, while Input 2 is Reset.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;Binary Cell&#039;&#039;&#039;===&lt;br /&gt;
&lt;br /&gt;
RS NOR Latch&lt;br /&gt;
[[File:RS-NOR.png|500px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;Advanced Cell&#039;&#039;&#039;===&lt;br /&gt;
&lt;br /&gt;
Cell for storing a positive value:&lt;br /&gt;
&lt;br /&gt;
[[File:AdvancedMemoryCell.png|500px]]&lt;br /&gt;
&lt;br /&gt;
Connect the desired value as signal 3 on the right side to set the memory cell and connect a negative value as signal 3 to reset the cell.  *Please note the arithmetic combinator&#039;s output should be facing the opposite direction of the decider combinators.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Address Enable Switch&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== See Also ==&lt;br /&gt;
*[http://www.factorioforums.com/forum/viewtopic.php?f=18&amp;amp;t=14556 Combinators 101 (Tutorial)]&lt;br /&gt;
*[[Arithmetic combinator]]&lt;br /&gt;
*[[Constant combinator]]&lt;br /&gt;
*[[Decider combinator]]&lt;br /&gt;
*[[Circuit network]]&lt;br /&gt;
*[[Circuit-network_Cookbook]]&lt;/div&gt;</summary>
		<author><name>My3DS</name></author>
	</entry>
	<entry>
		<id>https://wiki.factorio.com/index.php?title=Tutorial:Combinator_tutorial&amp;diff=154612</id>
		<title>Tutorial:Combinator tutorial</title>
		<link rel="alternate" type="text/html" href="https://wiki.factorio.com/index.php?title=Tutorial:Combinator_tutorial&amp;diff=154612"/>
		<updated>2018-02-06T13:00:12Z</updated>

		<summary type="html">&lt;p&gt;My3DS: /* Introduction */ added basic arithmetic, changed older basic arithmetic to ability of a combinator&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Languages}}&lt;br /&gt;
== Introduction ==&lt;br /&gt;
=== Basics ===&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
Let us start with how combinator logic is processed. Combinators update at each tick, meaning if that your computer is running at 60 updates per second (UPS), your combinator similarly runs at 60 processes per second. &lt;br /&gt;
&lt;br /&gt;
This is important to take into account as you build larger scale projects, as it will affect how fast your logic will run, and how much your logic will heavily task on Factorio. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Think of each signal like the number of boxes, where a wire will transport that box into other combinators that will process those boxes. &amp;lt;br&amp;gt;&lt;br /&gt;
Think of a wire being that highway where boxes are transported, so boxes with the same name/label get merged as they transport those boxes, whereas boxes with different labels remain unmerged. &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The first highway will not interact with another highway, so boxes with the same label do not get merged with one another when they are given separate highways - i.e. values in the green wire will not merge with values in the red wire - when those highways are connected to the same combinator, the combinator will merge those boxes.&lt;br /&gt;
&lt;br /&gt;
=== Ability of a Combinator ===&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
Combinators can work in both positive and negative values, and is in base-10. This allows you to work with boolean/binary values &#039;&#039;(0 or 1)&#039;&#039;, and integer values. &lt;br /&gt;
&lt;br /&gt;
Float points do not exist in Factorio, and will be instead be bit-shifted to the nearest integer. &amp;lt;br&amp;gt; &#039;&#039;(9.3 becomes 9) and (10.7 becomes 10)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
There is a risk for integer overflow, as combinators use signed 32-bit int, meaning the numeric range is from &#039;&#039;-2,147,483,648&#039;&#039; to &#039;&#039;2,147,483,647&#039;&#039;, as it can only hold 2³², or 4 billion+ values.&lt;br /&gt;
&lt;br /&gt;
=== Basic Arithmetic ===&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
Begin with very simple maths. &amp;lt;br&amp;gt; Say that you wanted some production of item X to be stopped when you reached a certain amount in the logistics network.&lt;br /&gt;
&lt;br /&gt;
How can we approach this problem? &amp;lt;br&amp;gt; The most straight-forward approach is to link the inserter that outputs the item to a passive provider chest to the logistics network when X ≥ number.&lt;br /&gt;
&lt;br /&gt;
Say that instead of when X ≥ number, you instead wanted to store that item as a temporary buffer, so it produces in batches rather than being continuous. &amp;lt;br&amp;gt; You wanted a combinator to toggle when some value is reaches a number that sets itself, and reset itself afterwards. &amp;lt;br&amp;gt; &#039;&#039;This is otherwise known as a hysteresis.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The idea you have is: &amp;lt;br&amp;gt;When S ≤ value, send a boolean value to store, and when R ≥ value, send a boolean value to reset.&lt;br /&gt;
&lt;br /&gt;
But how can we go making the mechanism that stores memory? &amp;lt;br&amp;gt; &#039;&#039;We can make a decider combinator that feedbacks to itself!&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Given that when S &amp;gt; R, S can send a signal to itself saying that this condition will still hold true until R makes the condition false.&lt;br /&gt;
&lt;br /&gt;
There are other approaches too, but this is the most intuitive to look at.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&#039;&#039;There is also an example heavy [[Circuit-network_Cookbook|circuit network cookbook]] that you may find helpful to learn and refer to about circuit networks.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Virtual Signals ==&lt;br /&gt;
&lt;br /&gt;
===Everything Wildcard:===&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
This Red Wildcard serves to check all the specifed input signals.&lt;br /&gt;
&lt;br /&gt;
As the Decider Combinator, &amp;lt;br /&amp;gt;&lt;br /&gt;
its input is used to serve if all inputs meets the specified signals or variables. &amp;lt;br /&amp;gt;&lt;br /&gt;
its output is used to serve output every signal. &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Side note: &amp;quot;Everything&amp;quot; outputs true by default even if there is no signal to guarantee if that is true. &#039;&#039;Everything is false when every input does not meet the condition, otherwise, output true.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
===Anything Wildcard:===&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
This Green Wildcard serves to check all the specifed input signals.&lt;br /&gt;
&lt;br /&gt;
As the Decider Combinator, &lt;br /&gt;
its input is used to serve if any of its inputs meets the specified signals or variables.&lt;br /&gt;
&lt;br /&gt;
Side note: &amp;quot;Anything&amp;quot; outputs false by default if there is no signal to guarantee if it is true. &#039;&#039;Anything is false when any of inputs do not meet the condition, otherwise, it is true.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
===Each Wildcard:===&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
This Yellow Wildcard serves to check for each the specifed input signals.&lt;br /&gt;
&lt;br /&gt;
As the Decider Combinator, &amp;lt;br /&amp;gt;&lt;br /&gt;
its input is used to serve if any inputs meets the specified signals or variables. &amp;lt;br /&amp;gt;&lt;br /&gt;
its output is used to serve output the each variable. &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As the Arithmetic Combinator, &amp;lt;br /&amp;gt;&lt;br /&gt;
its input is used to serve each input, then the following summations are summed and outputted, with each signal as its own respective signals.&lt;br /&gt;
&lt;br /&gt;
== Input Isolator &amp;amp; Gate ==&lt;br /&gt;
An arithmetic combinator set to (In: Each + 0, Out: Each) can be used to swap wire colors and as an isolator to prevent downstream logic from backfeeding into the circuit network&#039;s inputs.&lt;br /&gt;
&lt;br /&gt;
A decider combinator set to (Out: Everything, Input-&amp;gt; Output) will also function as an isolator as long as the set logic condition is true. This can also selectively pass or &#039;gate&#039; inputs only when desired. This could be used to sequentially poll remote train stations for their chest contents, and include only desired stations.&lt;br /&gt;
&lt;br /&gt;
== Set/Reset Latching Switch ==&lt;br /&gt;
You want something to SET a trigger at some quantity, but then STAY on until that quantity hits some other value, the RESET value. You&#039;ll need one decider combinator and one arithmetic combinator. Two decider combinators and a constant combinator can also be used for more complex multi-channel conditions.&lt;br /&gt;
&lt;br /&gt;
Setup the first decider combinator to the desired set conditional and to output a 1. Then connect the output to the input of an arithmetic combinator, and configure it to multiply by the bias value, the difference between the set and reset values, and wire the arithmetic output to the input of the decider. The arithmetic output channel MUST be set the same as the decider&#039;s input channel. That&#039;s it! Whenever your set conditional is reached, the decider will output a &#039;1&#039;, and the bias of the arithmetic combinator will be applied. This will &#039;hold&#039; the output true until the value goes back below the reset point.&lt;br /&gt;
&lt;br /&gt;
Here&#039;s a more specific example : &lt;br /&gt;
i want the pump to run when petrol reach 2000, and turn off when reach 200.&amp;lt;br&amp;gt;&lt;br /&gt;
only with green wire&amp;lt;br&amp;gt;&lt;br /&gt;
Tank -&amp;gt; in decider&amp;lt;br&amp;gt;&lt;br /&gt;
out decider-&amp;gt; in arithmetic&amp;lt;br&amp;gt;&lt;br /&gt;
out arithmetic -&amp;gt; in decider&amp;lt;br&amp;gt;&lt;br /&gt;
green wire from in decider, to pump&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Pump have the same condition as the decider (Petrol &amp;gt; 2000)&lt;br /&gt;
&lt;br /&gt;
Decider : Petrol &amp;gt; 2000&amp;lt;br&amp;gt;&lt;br /&gt;
out : A = 1&amp;lt;br&amp;gt;&lt;br /&gt;
Arithmetic : A x 1800 (2000 - 200 )&amp;lt;br&amp;gt;&lt;br /&gt;
out : petrol&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:Factorio combinator switch.png|620px]]&lt;br /&gt;
&lt;br /&gt;
Backup steam power example with detailed configuration and explanation can be found here:&amp;lt;br /&amp;gt;[[Tutorial:Circuit-network_Cookbook#SR_latch_-_single_decider_version|Tutorial:Circuit-network_Cookbook#SR latch - single decider version]]&lt;br /&gt;
&lt;br /&gt;
== Smart Train Loading ==&lt;br /&gt;
&lt;br /&gt;
Initially designed by [https://www.youtube.com/user/Darkphade MadZuri],&lt;br /&gt;
&lt;br /&gt;
This solves the problem of loading logistics into chests, which tend to be unequal and is slower in the rate of loading logistics into the cargo of trains.&lt;br /&gt;
&lt;br /&gt;
To setup the design, you require an Arithmetic Combinator, as well as Red and Green wires. &#039;&#039;&#039;Wire all the chests used, to the input of the Arithmetic Combinator&#039;&#039;&#039;. &#039;&#039;&#039;Then write (Logistics Item / -Amount of chests) and as the output as the Logistics Item in the Arithmetic Combinator&#039;&#039;&#039;, this will average the amount of items within the chests. Lastly, &#039;&#039;&#039;wire all the inserters used to the output of the Arithmetic Combinator and have the other color of the wire be wired to the adjacent chest&#039;&#039;&#039;. &#039;&#039;&#039;Have the inserters enabled when Logistics Item &amp;lt; 1&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
A more visual representation as well as questions for the design can be found [https://www.reddit.com/r/factorio/comments/4e03g2/madzuris_smart_loading_train_station_guide/ here].&lt;br /&gt;
&lt;br /&gt;
Explanation of why this works:&lt;br /&gt;
It compares the average amount of total items within the chests and the chest adjacent to the inserter so that it activates when the average number of items is higher than the amount within the chest.&lt;br /&gt;
The reason for why the division denominator is negative is because if the items in the chests are 0, it basically makes it so that it adds 1 to the equation.&lt;br /&gt;
&lt;br /&gt;
== Memory ==&lt;br /&gt;
How to store a constant value for later use, either for a basic counter or for more advanced logic. A decider combinator wired output tied to input and configured greater than zero (for positive values), input -&amp;gt; output will &#039;hold&#039; a value, as long as all other inputs on the network are zero.&lt;br /&gt;
&lt;br /&gt;
Any non-zero input condition will create a basic clock; incrementing the stored value by the sum of all connected input values every cycle. A single pulse of an input will cause a single increment by the pulsed value. Reset to zero occurs whenever the set condition is no longer met, or if a negative pulse equal to the input occurs.&lt;br /&gt;
&lt;br /&gt;
== Basic Clocks ==&lt;br /&gt;
[[File:Timer.png|thumb|right|377px|A basic clock. 30 ticks is the ceiling for Signal 1; which is continuously added.]]&lt;br /&gt;
Clocks are constructed by having the output of a combinator tied back to its own input, such that every cycle advances its own count. Either the arithmetic combinator or the decider combinator can be used.&lt;br /&gt;
&lt;br /&gt;
An arithmetic combinator tied to itself is fun to watch and will happily run-away, but requires additional control logic to reset.&lt;br /&gt;
&lt;br /&gt;
A self-resetting clock requires just a single decider combinator with output wired to input and configured with Less Than (&amp;lt;) and Input -&amp;gt; Output. When a constant combinator is then connected to the input, every cycle it will count up by the value of the Constant Combinator until the set conditional value is reached, then output a zero which will be summed with the constant combinator, and reset the process.&lt;br /&gt;
&lt;br /&gt;
The clock sequence will not include zero, will begin at the value set by the constant combinator, and will include whatever value eventually causes the conditional to be false. An arithmetic combinator can modify the clock sequence but remember its outputs will occur one cycle later than the clock cycle values.&lt;br /&gt;
&lt;br /&gt;
A clock that only counts once can be built using the following setup:&lt;br /&gt;
&lt;br /&gt;
[[File:Onetime_Clock.png|thumb|none|360px|One-time clock. Runs until T=Z+1. Reset via R&amp;gt;0.]]&lt;br /&gt;
&lt;br /&gt;
== Pulse Generators ==&lt;br /&gt;
&lt;br /&gt;
Connecting an additional (=) decider combinator to the output of a basic clock will create a pulse generator, and will pulse a single output every time the clock cycles through the set condition. Any output value can be used, either directly from the clock sequence (input-&amp;gt;output), a 1, or some value on a separate logic channel on the circuit network, such as set by a constant combinator. or by the circuit network.&amp;lt;br /&amp;gt;&lt;br /&gt;
[[File:PulseGen.png|500px]]&lt;br /&gt;
*&#039;&#039;The value 1 can be written as any positive integer, so long as it is within the cap or ceiling of your timer.&#039;&#039;&lt;br /&gt;
*&#039;&#039;As an example from the above timer, this light will pulse every 1st tick after the timer reaches 30 ticks, making it pulse 1/30th of a second, as Factorio updates at 60 times per second.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Counter ==&lt;br /&gt;
A counter is used to count the number of input events, and output the sum of that count. Any pulsing input into a decider combinator configured input -&amp;gt; output and wired between output and input will create a counter, but this input must be zero at all other times or else the combinator will run away like a clock. A pulse generator is normally used to accomplish this. Combining several gating decider isolators set with sequential conditionals, a clock, and a pulse generator to the input of a counter will allow remote polling and counting of each isolator&#039;s contents.&lt;br /&gt;
&lt;br /&gt;
== Logic Gates ==&lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;Unary NOT&#039;&#039;&#039;===&lt;br /&gt;
----&lt;br /&gt;
[[File:NOT.png|415px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;Binary OR&#039;&#039;&#039;===&lt;br /&gt;
----&lt;br /&gt;
[[File:OR.png|300px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 2!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1  || 1&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;*Deprecated: Use the Arithmetic Combinator&#039;s OR option instead.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;Binary NOR&#039;&#039;&#039;===&lt;br /&gt;
----&lt;br /&gt;
[[File:NOR.png|415px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 2!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;Binary XOR&#039;&#039;&#039;===&lt;br /&gt;
----&lt;br /&gt;
[[File:XOR.png|300px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 1!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 ||  0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 ||  1 || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 ||  0 || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 ||  1 || 0&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;*Deprecated: Use the Arithmetic Combinator&#039;s XOR option instead.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;Binary AND&#039;&#039;&#039;===&lt;br /&gt;
----&lt;br /&gt;
[[File:AND.png|530px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 2!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1 || 1&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;*Deprecated: Use the Arithmetic Combinator&#039;s AND option instead.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;Trinary AND&#039;&#039;&#039;===&lt;br /&gt;
----&lt;br /&gt;
[[File:TrinaryAND.png|415px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 2!!Input 3!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0  || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1  || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0  || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1  || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0  || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1  || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0  || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1  || 1  || 1&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;Binary NAND&#039;&#039;&#039;===&lt;br /&gt;
----&lt;br /&gt;
[[File:NAND.png|300px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 2!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;Binary XNOR/XAND&#039;&#039;&#039;===&lt;br /&gt;
----&lt;br /&gt;
[[File:XAND.png|300px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 2!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1  || 1&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Memory Cells ==&lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;Simple Latch&#039;&#039;&#039;===&lt;br /&gt;
&lt;br /&gt;
When looping the combinator to itself, use a different colour of wire from your main inputs or outputs. &lt;br /&gt;
&lt;br /&gt;
[[File:SimpleLatchv2.png|300px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Output 1!!Input 1!!Input 2!! Output 1 (t+1)&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 0 || 1&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0 || 0 || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1 || 0 || 1 &#039;&#039;(2)&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0 || 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1 || 1 || 1 &#039;&#039;(2)&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&#039;&#039;Output 1 is the green wire loop seen in the picture, it carries the value to latch.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Input 1 is Set, while Input 2 is Reset.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;Binary Cell&#039;&#039;&#039;===&lt;br /&gt;
&lt;br /&gt;
RS NOR Latch&lt;br /&gt;
[[File:RS-NOR.png|500px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;Advanced Cell&#039;&#039;&#039;===&lt;br /&gt;
&lt;br /&gt;
Cell for storing a positive value:&lt;br /&gt;
&lt;br /&gt;
[[File:AdvancedMemoryCell.png|500px]]&lt;br /&gt;
&lt;br /&gt;
Connect the desired value as signal 3 on the right side to set the memory cell and connect a negative value as signal 3 to reset the cell.  *Please note the arithmetic combinator&#039;s output should be facing the opposite direction of the decider combinators.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Address Enable Switch&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== See Also ==&lt;br /&gt;
*[http://www.factorioforums.com/forum/viewtopic.php?f=18&amp;amp;t=14556 Combinators 101 (Tutorial)]&lt;br /&gt;
*[[Arithmetic combinator]]&lt;br /&gt;
*[[Constant combinator]]&lt;br /&gt;
*[[Decider combinator]]&lt;br /&gt;
*[[Circuit network]]&lt;br /&gt;
*[[Circuit-network_Cookbook]]&lt;/div&gt;</summary>
		<author><name>My3DS</name></author>
	</entry>
	<entry>
		<id>https://wiki.factorio.com/index.php?title=Tutorial:Combinator_tutorial&amp;diff=154604</id>
		<title>Tutorial:Combinator tutorial</title>
		<link rel="alternate" type="text/html" href="https://wiki.factorio.com/index.php?title=Tutorial:Combinator_tutorial&amp;diff=154604"/>
		<updated>2018-02-06T12:19:23Z</updated>

		<summary type="html">&lt;p&gt;My3DS: /* Basics */ changed analogy a bit&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Languages}}&lt;br /&gt;
== Introduction ==&lt;br /&gt;
=== Basics ===&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
Let us start with how combinator logic is processed. Combinators update at each tick, meaning if that your computer is running at 60 updates per second (UPS), your combinator similarly runs at 60 processes per second. &lt;br /&gt;
&lt;br /&gt;
This is important to take into account as you build larger scale projects, as it will affect how fast your logic will run, and how much your logic will heavily task on Factorio. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Think of each signal like the number of boxes, where a wire will transport that box into other combinators that will process those boxes. &amp;lt;br&amp;gt;&lt;br /&gt;
Think of a wire being that highway where boxes are transported, so boxes with the same name/label get merged as they transport those boxes, whereas boxes with different labels remain unmerged. &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The first highway will not interact with another highway, so boxes with the same label do not get merged with one another when they are given separate highways - i.e. values in the green wire will not merge with values in the red wire - when those highways are connected to the same combinator, the combinator will merge those boxes.&lt;br /&gt;
&lt;br /&gt;
=== Basic Arithmetic ===&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
Combinators can work in both positive and negative values, and is in base-10. This allows you to work with boolean values &#039;&#039;(0 or 1)&#039;&#039;, and integer values. &lt;br /&gt;
&lt;br /&gt;
Float points do not exist in Factorio, and will be instead be bit-shifted to the nearest integer. &amp;lt;br&amp;gt; &#039;&#039;(9.3 becomes 9) and (10.7 becomes 10)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
There is a risk for integer overflow, as combinators use signed 32-bit int, meaning the numeric range is from &#039;&#039;-2,147,483,648&#039;&#039; to &#039;&#039;2,147,483,647&#039;&#039;, as it can only hold 2³², or 4 billion+ values.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&#039;&#039;There is also an example heavy [[Circuit-network_Cookbook|circuit network cookbook]] that you may find helpful to learn and refer to about circuit networks.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Virtual Signals ==&lt;br /&gt;
&lt;br /&gt;
===Everything Wildcard:===&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
This Red Wildcard serves to check all the specifed input signals.&lt;br /&gt;
&lt;br /&gt;
As the Decider Combinator, &amp;lt;br /&amp;gt;&lt;br /&gt;
its input is used to serve if all inputs meets the specified signals or variables. &amp;lt;br /&amp;gt;&lt;br /&gt;
its output is used to serve output every signal. &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Side note: &amp;quot;Everything&amp;quot; outputs true by default even if there is no signal to guarantee if that is true. &#039;&#039;Everything is false when every input does not meet the condition, otherwise, output true.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
===Anything Wildcard:===&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
This Green Wildcard serves to check all the specifed input signals.&lt;br /&gt;
&lt;br /&gt;
As the Decider Combinator, &lt;br /&gt;
its input is used to serve if any of its inputs meets the specified signals or variables.&lt;br /&gt;
&lt;br /&gt;
Side note: &amp;quot;Anything&amp;quot; outputs false by default if there is no signal to guarantee if it is true. &#039;&#039;Anything is false when any of inputs do not meet the condition, otherwise, it is true.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
===Each Wildcard:===&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
This Yellow Wildcard serves to check for each the specifed input signals.&lt;br /&gt;
&lt;br /&gt;
As the Decider Combinator, &amp;lt;br /&amp;gt;&lt;br /&gt;
its input is used to serve if any inputs meets the specified signals or variables. &amp;lt;br /&amp;gt;&lt;br /&gt;
its output is used to serve output the each variable. &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As the Arithmetic Combinator, &amp;lt;br /&amp;gt;&lt;br /&gt;
its input is used to serve each input, then the following summations are summed and outputted, with each signal as its own respective signals.&lt;br /&gt;
&lt;br /&gt;
== Input Isolator &amp;amp; Gate ==&lt;br /&gt;
An arithmetic combinator set to (In: Each + 0, Out: Each) can be used to swap wire colors and as an isolator to prevent downstream logic from backfeeding into the circuit network&#039;s inputs.&lt;br /&gt;
&lt;br /&gt;
A decider combinator set to (Out: Everything, Input-&amp;gt; Output) will also function as an isolator as long as the set logic condition is true. This can also selectively pass or &#039;gate&#039; inputs only when desired. This could be used to sequentially poll remote train stations for their chest contents, and include only desired stations.&lt;br /&gt;
&lt;br /&gt;
== Set/Reset Latching Switch ==&lt;br /&gt;
You want something to SET a trigger at some quantity, but then STAY on until that quantity hits some other value, the RESET value. You&#039;ll need one decider combinator and one arithmetic combinator. Two decider combinators and a constant combinator can also be used for more complex multi-channel conditions.&lt;br /&gt;
&lt;br /&gt;
Setup the first decider combinator to the desired set conditional and to output a 1. Then connect the output to the input of an arithmetic combinator, and configure it to multiply by the bias value, the difference between the set and reset values, and wire the arithmetic output to the input of the decider. The arithmetic output channel MUST be set the same as the decider&#039;s input channel. That&#039;s it! Whenever your set conditional is reached, the decider will output a &#039;1&#039;, and the bias of the arithmetic combinator will be applied. This will &#039;hold&#039; the output true until the value goes back below the reset point.&lt;br /&gt;
&lt;br /&gt;
Here&#039;s a more specific example : &lt;br /&gt;
i want the pump to run when petrol reach 2000, and turn off when reach 200.&amp;lt;br&amp;gt;&lt;br /&gt;
only with green wire&amp;lt;br&amp;gt;&lt;br /&gt;
Tank -&amp;gt; in decider&amp;lt;br&amp;gt;&lt;br /&gt;
out decider-&amp;gt; in arithmetic&amp;lt;br&amp;gt;&lt;br /&gt;
out arithmetic -&amp;gt; in decider&amp;lt;br&amp;gt;&lt;br /&gt;
green wire from in decider, to pump&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Pump have the same condition as the decider (Petrol &amp;gt; 2000)&lt;br /&gt;
&lt;br /&gt;
Decider : Petrol &amp;gt; 2000&amp;lt;br&amp;gt;&lt;br /&gt;
out : A = 1&amp;lt;br&amp;gt;&lt;br /&gt;
Arithmetic : A x 1800 (2000 - 200 )&amp;lt;br&amp;gt;&lt;br /&gt;
out : petrol&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:Factorio combinator switch.png|620px]]&lt;br /&gt;
&lt;br /&gt;
Backup steam power example with detailed configuration and explanation can be found here:&amp;lt;br /&amp;gt;[[Tutorial:Circuit-network_Cookbook#SR_latch_-_single_decider_version|Tutorial:Circuit-network_Cookbook#SR latch - single decider version]]&lt;br /&gt;
&lt;br /&gt;
== Smart Train Loading ==&lt;br /&gt;
&lt;br /&gt;
Initially designed by [https://www.youtube.com/user/Darkphade MadZuri],&lt;br /&gt;
&lt;br /&gt;
This solves the problem of loading logistics into chests, which tend to be unequal and is slower in the rate of loading logistics into the cargo of trains.&lt;br /&gt;
&lt;br /&gt;
To setup the design, you require an Arithmetic Combinator, as well as Red and Green wires. &#039;&#039;&#039;Wire all the chests used, to the input of the Arithmetic Combinator&#039;&#039;&#039;. &#039;&#039;&#039;Then write (Logistics Item / -Amount of chests) and as the output as the Logistics Item in the Arithmetic Combinator&#039;&#039;&#039;, this will average the amount of items within the chests. Lastly, &#039;&#039;&#039;wire all the inserters used to the output of the Arithmetic Combinator and have the other color of the wire be wired to the adjacent chest&#039;&#039;&#039;. &#039;&#039;&#039;Have the inserters enabled when Logistics Item &amp;lt; 1&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
A more visual representation as well as questions for the design can be found [https://www.reddit.com/r/factorio/comments/4e03g2/madzuris_smart_loading_train_station_guide/ here].&lt;br /&gt;
&lt;br /&gt;
Explanation of why this works:&lt;br /&gt;
It compares the average amount of total items within the chests and the chest adjacent to the inserter so that it activates when the average number of items is higher than the amount within the chest.&lt;br /&gt;
The reason for why the division denominator is negative is because if the items in the chests are 0, it basically makes it so that it adds 1 to the equation.&lt;br /&gt;
&lt;br /&gt;
== Memory ==&lt;br /&gt;
How to store a constant value for later use, either for a basic counter or for more advanced logic. A decider combinator wired output tied to input and configured greater than zero (for positive values), input -&amp;gt; output will &#039;hold&#039; a value, as long as all other inputs on the network are zero.&lt;br /&gt;
&lt;br /&gt;
Any non-zero input condition will create a basic clock; incrementing the stored value by the sum of all connected input values every cycle. A single pulse of an input will cause a single increment by the pulsed value. Reset to zero occurs whenever the set condition is no longer met, or if a negative pulse equal to the input occurs.&lt;br /&gt;
&lt;br /&gt;
== Basic Clocks ==&lt;br /&gt;
[[File:Timer.png|thumb|right|377px|A basic clock. 30 ticks is the ceiling for Signal 1; which is continuously added.]]&lt;br /&gt;
Clocks are constructed by having the output of a combinator tied back to its own input, such that every cycle advances its own count. Either the arithmetic combinator or the decider combinator can be used.&lt;br /&gt;
&lt;br /&gt;
An arithmetic combinator tied to itself is fun to watch and will happily run-away, but requires additional control logic to reset.&lt;br /&gt;
&lt;br /&gt;
A self-resetting clock requires just a single decider combinator with output wired to input and configured with Less Than (&amp;lt;) and Input -&amp;gt; Output. When a constant combinator is then connected to the input, every cycle it will count up by the value of the Constant Combinator until the set conditional value is reached, then output a zero which will be summed with the constant combinator, and reset the process.&lt;br /&gt;
&lt;br /&gt;
The clock sequence will not include zero, will begin at the value set by the constant combinator, and will include whatever value eventually causes the conditional to be false. An arithmetic combinator can modify the clock sequence but remember its outputs will occur one cycle later than the clock cycle values.&lt;br /&gt;
&lt;br /&gt;
A clock that only counts once can be built using the following setup:&lt;br /&gt;
&lt;br /&gt;
[[File:Onetime_Clock.png|thumb|none|360px|One-time clock. Runs until T=Z+1. Reset via R&amp;gt;0.]]&lt;br /&gt;
&lt;br /&gt;
== Pulse Generators ==&lt;br /&gt;
&lt;br /&gt;
Connecting an additional (=) decider combinator to the output of a basic clock will create a pulse generator, and will pulse a single output every time the clock cycles through the set condition. Any output value can be used, either directly from the clock sequence (input-&amp;gt;output), a 1, or some value on a separate logic channel on the circuit network, such as set by a constant combinator. or by the circuit network.&amp;lt;br /&amp;gt;&lt;br /&gt;
[[File:PulseGen.png|500px]]&lt;br /&gt;
*&#039;&#039;The value 1 can be written as any positive integer, so long as it is within the cap or ceiling of your timer.&#039;&#039;&lt;br /&gt;
*&#039;&#039;As an example from the above timer, this light will pulse every 1st tick after the timer reaches 30 ticks, making it pulse 1/30th of a second, as Factorio updates at 60 times per second.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Counter ==&lt;br /&gt;
A counter is used to count the number of input events, and output the sum of that count. Any pulsing input into a decider combinator configured input -&amp;gt; output and wired between output and input will create a counter, but this input must be zero at all other times or else the combinator will run away like a clock. A pulse generator is normally used to accomplish this. Combining several gating decider isolators set with sequential conditionals, a clock, and a pulse generator to the input of a counter will allow remote polling and counting of each isolator&#039;s contents.&lt;br /&gt;
&lt;br /&gt;
== Logic Gates ==&lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;Unary NOT&#039;&#039;&#039;===&lt;br /&gt;
----&lt;br /&gt;
[[File:NOT.png|415px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;Binary OR&#039;&#039;&#039;===&lt;br /&gt;
----&lt;br /&gt;
[[File:OR.png|300px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 2!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1  || 1&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;*Deprecated: Use the Arithmetic Combinator&#039;s OR option instead.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;Binary NOR&#039;&#039;&#039;===&lt;br /&gt;
----&lt;br /&gt;
[[File:NOR.png|415px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 2!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;Binary XOR&#039;&#039;&#039;===&lt;br /&gt;
----&lt;br /&gt;
[[File:XOR.png|300px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 1!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 ||  0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 ||  1 || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 ||  0 || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 ||  1 || 0&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;*Deprecated: Use the Arithmetic Combinator&#039;s XOR option instead.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;Binary AND&#039;&#039;&#039;===&lt;br /&gt;
----&lt;br /&gt;
[[File:AND.png|530px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 2!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1 || 1&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;*Deprecated: Use the Arithmetic Combinator&#039;s AND option instead.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;Trinary AND&#039;&#039;&#039;===&lt;br /&gt;
----&lt;br /&gt;
[[File:TrinaryAND.png|415px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 2!!Input 3!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0  || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1  || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0  || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1  || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0  || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1  || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0  || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1  || 1  || 1&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;Binary NAND&#039;&#039;&#039;===&lt;br /&gt;
----&lt;br /&gt;
[[File:NAND.png|300px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 2!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;Binary XNOR/XAND&#039;&#039;&#039;===&lt;br /&gt;
----&lt;br /&gt;
[[File:XAND.png|300px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 2!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1  || 1&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Memory Cells ==&lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;Simple Latch&#039;&#039;&#039;===&lt;br /&gt;
&lt;br /&gt;
When looping the combinator to itself, use a different colour of wire from your main inputs or outputs. &lt;br /&gt;
&lt;br /&gt;
[[File:SimpleLatchv2.png|300px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Output 1!!Input 1!!Input 2!! Output 1 (t+1)&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 0 || 1&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0 || 0 || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1 || 0 || 1 &#039;&#039;(2)&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0 || 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1 || 1 || 1 &#039;&#039;(2)&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&#039;&#039;Output 1 is the green wire loop seen in the picture, it carries the value to latch.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Input 1 is Set, while Input 2 is Reset.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;Binary Cell&#039;&#039;&#039;===&lt;br /&gt;
&lt;br /&gt;
RS NOR Latch&lt;br /&gt;
[[File:RS-NOR.png|500px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;Advanced Cell&#039;&#039;&#039;===&lt;br /&gt;
&lt;br /&gt;
Cell for storing a positive value:&lt;br /&gt;
&lt;br /&gt;
[[File:AdvancedMemoryCell.png|500px]]&lt;br /&gt;
&lt;br /&gt;
Connect the desired value as signal 3 on the right side to set the memory cell and connect a negative value as signal 3 to reset the cell.  *Please note the arithmetic combinator&#039;s output should be facing the opposite direction of the decider combinators.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Address Enable Switch&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== See Also ==&lt;br /&gt;
*[http://www.factorioforums.com/forum/viewtopic.php?f=18&amp;amp;t=14556 Combinators 101 (Tutorial)]&lt;br /&gt;
*[[Arithmetic combinator]]&lt;br /&gt;
*[[Constant combinator]]&lt;br /&gt;
*[[Decider combinator]]&lt;br /&gt;
*[[Circuit network]]&lt;br /&gt;
*[[Circuit-network_Cookbook]]&lt;/div&gt;</summary>
		<author><name>My3DS</name></author>
	</entry>
	<entry>
		<id>https://wiki.factorio.com/index.php?title=Tutorial:Combinator_tutorial&amp;diff=154599</id>
		<title>Tutorial:Combinator tutorial</title>
		<link rel="alternate" type="text/html" href="https://wiki.factorio.com/index.php?title=Tutorial:Combinator_tutorial&amp;diff=154599"/>
		<updated>2018-02-06T11:55:40Z</updated>

		<summary type="html">&lt;p&gt;My3DS: /* Basics */ added basic arithmetic, given better analogy&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Languages}}&lt;br /&gt;
== Introduction ==&lt;br /&gt;
=== Basics ===&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
Let us start with how combinator logic is processed. Combinators update at each tick, meaning if that your computer is running at 60 updates per second (UPS), your combinator similarly runs at 60 processes per second. &lt;br /&gt;
&lt;br /&gt;
This is important to take into account as you build larger scale projects, as it will affect how fast your logic will run, and how much your logic will heavily task on Factorio. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Think of each signal like a box with value being things in the box, where a wire will transport that box into other combinators that will process that box. &amp;lt;br&amp;gt;&lt;br /&gt;
Think of a wire being that highway where a box is transported, so boxes with the same name/label get merged as they transport that box, whereas boxes with different labels remain unmerged. &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The first highway will not interact with another highway, so boxes with the same label do not get merged with one another when they are given separate highways - i.e. values in the green wire will not merge with values in the red wire - when those highways are connected to the same combinator, the combinator will automatically merge those boxes.&lt;br /&gt;
&lt;br /&gt;
=== Basic Arithmetic ===&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
Combinators can work in both positive and negative values, and is in base-10. This allows you to work with boolean values &#039;&#039;(0 or 1)&#039;&#039;, and integer values. &lt;br /&gt;
&lt;br /&gt;
Float points do not exist in Factorio, and will be instead be bit-shifted to the nearest integer. &amp;lt;br&amp;gt; &#039;&#039;(9.3 becomes 9) and (10.7 becomes 10)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
There is a risk for integer overflow, as combinators use signed 32-bit int, meaning the numeric range is from &#039;&#039;-2,147,483,648&#039;&#039; to &#039;&#039;2,147,483,647&#039;&#039;, as it can only hold 2³², or 4 billion+ values.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&#039;&#039;There is also an example heavy [[Circuit-network_Cookbook|circuit network cookbook]] that you may find helpful to learn and refer to about circuit networks.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Virtual Signals ==&lt;br /&gt;
&lt;br /&gt;
===Everything Wildcard:===&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
This Red Wildcard serves to check all the specifed input signals.&lt;br /&gt;
&lt;br /&gt;
As the Decider Combinator, &amp;lt;br /&amp;gt;&lt;br /&gt;
its input is used to serve if all inputs meets the specified signals or variables. &amp;lt;br /&amp;gt;&lt;br /&gt;
its output is used to serve output every signal. &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Side note: &amp;quot;Everything&amp;quot; outputs true by default even if there is no signal to guarantee if that is true. &#039;&#039;Everything is false when every input does not meet the condition, otherwise, output true.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
===Anything Wildcard:===&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
This Green Wildcard serves to check all the specifed input signals.&lt;br /&gt;
&lt;br /&gt;
As the Decider Combinator, &lt;br /&gt;
its input is used to serve if any of its inputs meets the specified signals or variables.&lt;br /&gt;
&lt;br /&gt;
Side note: &amp;quot;Anything&amp;quot; outputs false by default if there is no signal to guarantee if it is true. &#039;&#039;Anything is false when any of inputs do not meet the condition, otherwise, it is true.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
===Each Wildcard:===&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
This Yellow Wildcard serves to check for each the specifed input signals.&lt;br /&gt;
&lt;br /&gt;
As the Decider Combinator, &amp;lt;br /&amp;gt;&lt;br /&gt;
its input is used to serve if any inputs meets the specified signals or variables. &amp;lt;br /&amp;gt;&lt;br /&gt;
its output is used to serve output the each variable. &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As the Arithmetic Combinator, &amp;lt;br /&amp;gt;&lt;br /&gt;
its input is used to serve each input, then the following summations are summed and outputted, with each signal as its own respective signals.&lt;br /&gt;
&lt;br /&gt;
== Input Isolator &amp;amp; Gate ==&lt;br /&gt;
An arithmetic combinator set to (In: Each + 0, Out: Each) can be used to swap wire colors and as an isolator to prevent downstream logic from backfeeding into the circuit network&#039;s inputs.&lt;br /&gt;
&lt;br /&gt;
A decider combinator set to (Out: Everything, Input-&amp;gt; Output) will also function as an isolator as long as the set logic condition is true. This can also selectively pass or &#039;gate&#039; inputs only when desired. This could be used to sequentially poll remote train stations for their chest contents, and include only desired stations.&lt;br /&gt;
&lt;br /&gt;
== Set/Reset Latching Switch ==&lt;br /&gt;
You want something to SET a trigger at some quantity, but then STAY on until that quantity hits some other value, the RESET value. You&#039;ll need one decider combinator and one arithmetic combinator. Two decider combinators and a constant combinator can also be used for more complex multi-channel conditions.&lt;br /&gt;
&lt;br /&gt;
Setup the first decider combinator to the desired set conditional and to output a 1. Then connect the output to the input of an arithmetic combinator, and configure it to multiply by the bias value, the difference between the set and reset values, and wire the arithmetic output to the input of the decider. The arithmetic output channel MUST be set the same as the decider&#039;s input channel. That&#039;s it! Whenever your set conditional is reached, the decider will output a &#039;1&#039;, and the bias of the arithmetic combinator will be applied. This will &#039;hold&#039; the output true until the value goes back below the reset point.&lt;br /&gt;
&lt;br /&gt;
Here&#039;s a more specific example : &lt;br /&gt;
i want the pump to run when petrol reach 2000, and turn off when reach 200.&amp;lt;br&amp;gt;&lt;br /&gt;
only with green wire&amp;lt;br&amp;gt;&lt;br /&gt;
Tank -&amp;gt; in decider&amp;lt;br&amp;gt;&lt;br /&gt;
out decider-&amp;gt; in arithmetic&amp;lt;br&amp;gt;&lt;br /&gt;
out arithmetic -&amp;gt; in decider&amp;lt;br&amp;gt;&lt;br /&gt;
green wire from in decider, to pump&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Pump have the same condition as the decider (Petrol &amp;gt; 2000)&lt;br /&gt;
&lt;br /&gt;
Decider : Petrol &amp;gt; 2000&amp;lt;br&amp;gt;&lt;br /&gt;
out : A = 1&amp;lt;br&amp;gt;&lt;br /&gt;
Arithmetic : A x 1800 (2000 - 200 )&amp;lt;br&amp;gt;&lt;br /&gt;
out : petrol&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:Factorio combinator switch.png|620px]]&lt;br /&gt;
&lt;br /&gt;
Backup steam power example with detailed configuration and explanation can be found here:&amp;lt;br /&amp;gt;[[Tutorial:Circuit-network_Cookbook#SR_latch_-_single_decider_version|Tutorial:Circuit-network_Cookbook#SR latch - single decider version]]&lt;br /&gt;
&lt;br /&gt;
== Smart Train Loading ==&lt;br /&gt;
&lt;br /&gt;
Initially designed by [https://www.youtube.com/user/Darkphade MadZuri],&lt;br /&gt;
&lt;br /&gt;
This solves the problem of loading logistics into chests, which tend to be unequal and is slower in the rate of loading logistics into the cargo of trains.&lt;br /&gt;
&lt;br /&gt;
To setup the design, you require an Arithmetic Combinator, as well as Red and Green wires. &#039;&#039;&#039;Wire all the chests used, to the input of the Arithmetic Combinator&#039;&#039;&#039;. &#039;&#039;&#039;Then write (Logistics Item / -Amount of chests) and as the output as the Logistics Item in the Arithmetic Combinator&#039;&#039;&#039;, this will average the amount of items within the chests. Lastly, &#039;&#039;&#039;wire all the inserters used to the output of the Arithmetic Combinator and have the other color of the wire be wired to the adjacent chest&#039;&#039;&#039;. &#039;&#039;&#039;Have the inserters enabled when Logistics Item &amp;lt; 1&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
A more visual representation as well as questions for the design can be found [https://www.reddit.com/r/factorio/comments/4e03g2/madzuris_smart_loading_train_station_guide/ here].&lt;br /&gt;
&lt;br /&gt;
Explanation of why this works:&lt;br /&gt;
It compares the average amount of total items within the chests and the chest adjacent to the inserter so that it activates when the average number of items is higher than the amount within the chest.&lt;br /&gt;
The reason for why the division denominator is negative is because if the items in the chests are 0, it basically makes it so that it adds 1 to the equation.&lt;br /&gt;
&lt;br /&gt;
== Memory ==&lt;br /&gt;
How to store a constant value for later use, either for a basic counter or for more advanced logic. A decider combinator wired output tied to input and configured greater than zero (for positive values), input -&amp;gt; output will &#039;hold&#039; a value, as long as all other inputs on the network are zero.&lt;br /&gt;
&lt;br /&gt;
Any non-zero input condition will create a basic clock; incrementing the stored value by the sum of all connected input values every cycle. A single pulse of an input will cause a single increment by the pulsed value. Reset to zero occurs whenever the set condition is no longer met, or if a negative pulse equal to the input occurs.&lt;br /&gt;
&lt;br /&gt;
== Basic Clocks ==&lt;br /&gt;
[[File:Timer.png|thumb|right|377px|A basic clock. 30 ticks is the ceiling for Signal 1; which is continuously added.]]&lt;br /&gt;
Clocks are constructed by having the output of a combinator tied back to its own input, such that every cycle advances its own count. Either the arithmetic combinator or the decider combinator can be used.&lt;br /&gt;
&lt;br /&gt;
An arithmetic combinator tied to itself is fun to watch and will happily run-away, but requires additional control logic to reset.&lt;br /&gt;
&lt;br /&gt;
A self-resetting clock requires just a single decider combinator with output wired to input and configured with Less Than (&amp;lt;) and Input -&amp;gt; Output. When a constant combinator is then connected to the input, every cycle it will count up by the value of the Constant Combinator until the set conditional value is reached, then output a zero which will be summed with the constant combinator, and reset the process.&lt;br /&gt;
&lt;br /&gt;
The clock sequence will not include zero, will begin at the value set by the constant combinator, and will include whatever value eventually causes the conditional to be false. An arithmetic combinator can modify the clock sequence but remember its outputs will occur one cycle later than the clock cycle values.&lt;br /&gt;
&lt;br /&gt;
A clock that only counts once can be built using the following setup:&lt;br /&gt;
&lt;br /&gt;
[[File:Onetime_Clock.png|thumb|none|360px|One-time clock. Runs until T=Z+1. Reset via R&amp;gt;0.]]&lt;br /&gt;
&lt;br /&gt;
== Pulse Generators ==&lt;br /&gt;
&lt;br /&gt;
Connecting an additional (=) decider combinator to the output of a basic clock will create a pulse generator, and will pulse a single output every time the clock cycles through the set condition. Any output value can be used, either directly from the clock sequence (input-&amp;gt;output), a 1, or some value on a separate logic channel on the circuit network, such as set by a constant combinator. or by the circuit network.&amp;lt;br /&amp;gt;&lt;br /&gt;
[[File:PulseGen.png|500px]]&lt;br /&gt;
*&#039;&#039;The value 1 can be written as any positive integer, so long as it is within the cap or ceiling of your timer.&#039;&#039;&lt;br /&gt;
*&#039;&#039;As an example from the above timer, this light will pulse every 1st tick after the timer reaches 30 ticks, making it pulse 1/30th of a second, as Factorio updates at 60 times per second.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Counter ==&lt;br /&gt;
A counter is used to count the number of input events, and output the sum of that count. Any pulsing input into a decider combinator configured input -&amp;gt; output and wired between output and input will create a counter, but this input must be zero at all other times or else the combinator will run away like a clock. A pulse generator is normally used to accomplish this. Combining several gating decider isolators set with sequential conditionals, a clock, and a pulse generator to the input of a counter will allow remote polling and counting of each isolator&#039;s contents.&lt;br /&gt;
&lt;br /&gt;
== Logic Gates ==&lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;Unary NOT&#039;&#039;&#039;===&lt;br /&gt;
----&lt;br /&gt;
[[File:NOT.png|415px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;Binary OR&#039;&#039;&#039;===&lt;br /&gt;
----&lt;br /&gt;
[[File:OR.png|300px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 2!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1  || 1&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;*Deprecated: Use the Arithmetic Combinator&#039;s OR option instead.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;Binary NOR&#039;&#039;&#039;===&lt;br /&gt;
----&lt;br /&gt;
[[File:NOR.png|415px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 2!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;Binary XOR&#039;&#039;&#039;===&lt;br /&gt;
----&lt;br /&gt;
[[File:XOR.png|300px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 1!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 ||  0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 ||  1 || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 ||  0 || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 ||  1 || 0&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;*Deprecated: Use the Arithmetic Combinator&#039;s XOR option instead.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;Binary AND&#039;&#039;&#039;===&lt;br /&gt;
----&lt;br /&gt;
[[File:AND.png|530px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 2!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1 || 1&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;*Deprecated: Use the Arithmetic Combinator&#039;s AND option instead.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;Trinary AND&#039;&#039;&#039;===&lt;br /&gt;
----&lt;br /&gt;
[[File:TrinaryAND.png|415px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 2!!Input 3!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0  || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1  || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0  || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1  || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0  || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1  || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0  || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1  || 1  || 1&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;Binary NAND&#039;&#039;&#039;===&lt;br /&gt;
----&lt;br /&gt;
[[File:NAND.png|300px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 2!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;Binary XNOR/XAND&#039;&#039;&#039;===&lt;br /&gt;
----&lt;br /&gt;
[[File:XAND.png|300px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 2!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1  || 1&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Memory Cells ==&lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;Simple Latch&#039;&#039;&#039;===&lt;br /&gt;
&lt;br /&gt;
When looping the combinator to itself, use a different colour of wire from your main inputs or outputs. &lt;br /&gt;
&lt;br /&gt;
[[File:SimpleLatchv2.png|300px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Output 1!!Input 1!!Input 2!! Output 1 (t+1)&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 0 || 1&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0 || 0 || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1 || 0 || 1 &#039;&#039;(2)&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0 || 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1 || 1 || 1 &#039;&#039;(2)&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&#039;&#039;Output 1 is the green wire loop seen in the picture, it carries the value to latch.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Input 1 is Set, while Input 2 is Reset.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;Binary Cell&#039;&#039;&#039;===&lt;br /&gt;
&lt;br /&gt;
RS NOR Latch&lt;br /&gt;
[[File:RS-NOR.png|500px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;Advanced Cell&#039;&#039;&#039;===&lt;br /&gt;
&lt;br /&gt;
Cell for storing a positive value:&lt;br /&gt;
&lt;br /&gt;
[[File:AdvancedMemoryCell.png|500px]]&lt;br /&gt;
&lt;br /&gt;
Connect the desired value as signal 3 on the right side to set the memory cell and connect a negative value as signal 3 to reset the cell.  *Please note the arithmetic combinator&#039;s output should be facing the opposite direction of the decider combinators.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Address Enable Switch&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== See Also ==&lt;br /&gt;
*[http://www.factorioforums.com/forum/viewtopic.php?f=18&amp;amp;t=14556 Combinators 101 (Tutorial)]&lt;br /&gt;
*[[Arithmetic combinator]]&lt;br /&gt;
*[[Constant combinator]]&lt;br /&gt;
*[[Decider combinator]]&lt;br /&gt;
*[[Circuit network]]&lt;br /&gt;
*[[Circuit-network_Cookbook]]&lt;/div&gt;</summary>
		<author><name>My3DS</name></author>
	</entry>
	<entry>
		<id>https://wiki.factorio.com/index.php?title=Tutorial:Combinator_tutorial&amp;diff=154587</id>
		<title>Tutorial:Combinator tutorial</title>
		<link rel="alternate" type="text/html" href="https://wiki.factorio.com/index.php?title=Tutorial:Combinator_tutorial&amp;diff=154587"/>
		<updated>2018-02-06T11:12:40Z</updated>

		<summary type="html">&lt;p&gt;My3DS: /* Introduction */  Simplified text&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Languages}}&lt;br /&gt;
== Introduction ==&lt;br /&gt;
=== Basics ===&lt;br /&gt;
----&lt;br /&gt;
Let us start with how combinator logic is processed. Combinators update at each tick, meaning if that your computer is running at 60 updates per second (UPS), your combinator similarly runs at 60 processes per second. &lt;br /&gt;
&lt;br /&gt;
This is important to take into account as you build larger scale projects, as it will affect how fast your logic will run, and how much your logic will heavily task on Factorio. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In the vanilla build of Factorio, you can use either red or green wires. They act as a main bus for signals, so similar signals with its values sum in the same colour of wire, while different signals will remain as different signals in the same colour of wire.&lt;br /&gt;
&lt;br /&gt;
Conversely, signals in different colour of wires will remain separated, even if they are the same signal symbol/name; useful for isolating functions, but when both colours of wires attach to the same combinator, those values will be summed in that combinator.&lt;br /&gt;
&lt;br /&gt;
Combinators transmit signals in both colour of wires if both colour of wires are connected to the combinator.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;There is also an example heavy [[Circuit-network_Cookbook|circuit network cookbook]] that you may find helpful to learn and refer to about circuit networks.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Virtual Signals ==&lt;br /&gt;
&lt;br /&gt;
===Everything Wildcard:===&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
This Red Wildcard serves to check all the specifed input signals.&lt;br /&gt;
&lt;br /&gt;
As the Decider Combinator, &amp;lt;br /&amp;gt;&lt;br /&gt;
its input is used to serve if all inputs meets the specified signals or variables. &amp;lt;br /&amp;gt;&lt;br /&gt;
its output is used to serve output every signal. &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Side note: &amp;quot;Everything&amp;quot; outputs true by default even if there is no signal to guarantee if that is true. &#039;&#039;Everything is false when every input does not meet the condition, otherwise, output true.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
===Anything Wildcard:===&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
This Green Wildcard serves to check all the specifed input signals.&lt;br /&gt;
&lt;br /&gt;
As the Decider Combinator, &lt;br /&gt;
its input is used to serve if any of its inputs meets the specified signals or variables.&lt;br /&gt;
&lt;br /&gt;
Side note: &amp;quot;Anything&amp;quot; outputs false by default if there is no signal to guarantee if it is true. &#039;&#039;Anything is false when any of inputs do not meet the condition, otherwise, it is true.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
===Each Wildcard:===&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
This Yellow Wildcard serves to check for each the specifed input signals.&lt;br /&gt;
&lt;br /&gt;
As the Decider Combinator, &amp;lt;br /&amp;gt;&lt;br /&gt;
its input is used to serve if any inputs meets the specified signals or variables. &amp;lt;br /&amp;gt;&lt;br /&gt;
its output is used to serve output the each variable. &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As the Arithmetic Combinator, &amp;lt;br /&amp;gt;&lt;br /&gt;
its input is used to serve each input, then the following summations are summed and outputted, with each signal as its own respective signals.&lt;br /&gt;
&lt;br /&gt;
== Input Isolator &amp;amp; Gate ==&lt;br /&gt;
An arithmetic combinator set to (In: Each + 0, Out: Each) can be used to swap wire colors and as an isolator to prevent downstream logic from backfeeding into the circuit network&#039;s inputs.&lt;br /&gt;
&lt;br /&gt;
A decider combinator set to (Out: Everything, Input-&amp;gt; Output) will also function as an isolator as long as the set logic condition is true. This can also selectively pass or &#039;gate&#039; inputs only when desired. This could be used to sequentially poll remote train stations for their chest contents, and include only desired stations.&lt;br /&gt;
&lt;br /&gt;
== Set/Reset Latching Switch ==&lt;br /&gt;
You want something to SET a trigger at some quantity, but then STAY on until that quantity hits some other value, the RESET value. You&#039;ll need one decider combinator and one arithmetic combinator. Two decider combinators and a constant combinator can also be used for more complex multi-channel conditions.&lt;br /&gt;
&lt;br /&gt;
Setup the first decider combinator to the desired set conditional and to output a 1. Then connect the output to the input of an arithmetic combinator, and configure it to multiply by the bias value, the difference between the set and reset values, and wire the arithmetic output to the input of the decider. The arithmetic output channel MUST be set the same as the decider&#039;s input channel. That&#039;s it! Whenever your set conditional is reached, the decider will output a &#039;1&#039;, and the bias of the arithmetic combinator will be applied. This will &#039;hold&#039; the output true until the value goes back below the reset point.&lt;br /&gt;
&lt;br /&gt;
Here&#039;s a more specific example : &lt;br /&gt;
i want the pump to run when petrol reach 2000, and turn off when reach 200.&amp;lt;br&amp;gt;&lt;br /&gt;
only with green wire&amp;lt;br&amp;gt;&lt;br /&gt;
Tank -&amp;gt; in decider&amp;lt;br&amp;gt;&lt;br /&gt;
out decider-&amp;gt; in arithmetic&amp;lt;br&amp;gt;&lt;br /&gt;
out arithmetic -&amp;gt; in decider&amp;lt;br&amp;gt;&lt;br /&gt;
green wire from in decider, to pump&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Pump have the same condition as the decider (Petrol &amp;gt; 2000)&lt;br /&gt;
&lt;br /&gt;
Decider : Petrol &amp;gt; 2000&amp;lt;br&amp;gt;&lt;br /&gt;
out : A = 1&amp;lt;br&amp;gt;&lt;br /&gt;
Arithmetic : A x 1800 (2000 - 200 )&amp;lt;br&amp;gt;&lt;br /&gt;
out : petrol&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:Factorio combinator switch.png|620px]]&lt;br /&gt;
&lt;br /&gt;
Backup steam power example with detailed configuration and explanation can be found here:&amp;lt;br /&amp;gt;[[Tutorial:Circuit-network_Cookbook#SR_latch_-_single_decider_version|Tutorial:Circuit-network_Cookbook#SR latch - single decider version]]&lt;br /&gt;
&lt;br /&gt;
== Smart Train Loading ==&lt;br /&gt;
&lt;br /&gt;
Initially designed by [https://www.youtube.com/user/Darkphade MadZuri],&lt;br /&gt;
&lt;br /&gt;
This solves the problem of loading logistics into chests, which tend to be unequal and is slower in the rate of loading logistics into the cargo of trains.&lt;br /&gt;
&lt;br /&gt;
To setup the design, you require an Arithmetic Combinator, as well as Red and Green wires. &#039;&#039;&#039;Wire all the chests used, to the input of the Arithmetic Combinator&#039;&#039;&#039;. &#039;&#039;&#039;Then write (Logistics Item / -Amount of chests) and as the output as the Logistics Item in the Arithmetic Combinator&#039;&#039;&#039;, this will average the amount of items within the chests. Lastly, &#039;&#039;&#039;wire all the inserters used to the output of the Arithmetic Combinator and have the other color of the wire be wired to the adjacent chest&#039;&#039;&#039;. &#039;&#039;&#039;Have the inserters enabled when Logistics Item &amp;lt; 1&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
A more visual representation as well as questions for the design can be found [https://www.reddit.com/r/factorio/comments/4e03g2/madzuris_smart_loading_train_station_guide/ here].&lt;br /&gt;
&lt;br /&gt;
Explanation of why this works:&lt;br /&gt;
It compares the average amount of total items within the chests and the chest adjacent to the inserter so that it activates when the average number of items is higher than the amount within the chest.&lt;br /&gt;
The reason for why the division denominator is negative is because if the items in the chests are 0, it basically makes it so that it adds 1 to the equation.&lt;br /&gt;
&lt;br /&gt;
== Memory ==&lt;br /&gt;
How to store a constant value for later use, either for a basic counter or for more advanced logic. A decider combinator wired output tied to input and configured greater than zero (for positive values), input -&amp;gt; output will &#039;hold&#039; a value, as long as all other inputs on the network are zero.&lt;br /&gt;
&lt;br /&gt;
Any non-zero input condition will create a basic clock; incrementing the stored value by the sum of all connected input values every cycle. A single pulse of an input will cause a single increment by the pulsed value. Reset to zero occurs whenever the set condition is no longer met, or if a negative pulse equal to the input occurs.&lt;br /&gt;
&lt;br /&gt;
== Basic Clocks ==&lt;br /&gt;
[[File:Timer.png|thumb|right|377px|A basic clock. 30 ticks is the ceiling for Signal 1; which is continuously added.]]&lt;br /&gt;
Clocks are constructed by having the output of a combinator tied back to its own input, such that every cycle advances its own count. Either the arithmetic combinator or the decider combinator can be used.&lt;br /&gt;
&lt;br /&gt;
An arithmetic combinator tied to itself is fun to watch and will happily run-away, but requires additional control logic to reset.&lt;br /&gt;
&lt;br /&gt;
A self-resetting clock requires just a single decider combinator with output wired to input and configured with Less Than (&amp;lt;) and Input -&amp;gt; Output. When a constant combinator is then connected to the input, every cycle it will count up by the value of the Constant Combinator until the set conditional value is reached, then output a zero which will be summed with the constant combinator, and reset the process.&lt;br /&gt;
&lt;br /&gt;
The clock sequence will not include zero, will begin at the value set by the constant combinator, and will include whatever value eventually causes the conditional to be false. An arithmetic combinator can modify the clock sequence but remember its outputs will occur one cycle later than the clock cycle values.&lt;br /&gt;
&lt;br /&gt;
A clock that only counts once can be built using the following setup:&lt;br /&gt;
&lt;br /&gt;
[[File:Onetime_Clock.png|thumb|none|360px|One-time clock. Runs until T=Z+1. Reset via R&amp;gt;0.]]&lt;br /&gt;
&lt;br /&gt;
== Pulse Generators ==&lt;br /&gt;
&lt;br /&gt;
Connecting an additional (=) decider combinator to the output of a basic clock will create a pulse generator, and will pulse a single output every time the clock cycles through the set condition. Any output value can be used, either directly from the clock sequence (input-&amp;gt;output), a 1, or some value on a separate logic channel on the circuit network, such as set by a constant combinator. or by the circuit network.&amp;lt;br /&amp;gt;&lt;br /&gt;
[[File:PulseGen.png|500px]]&lt;br /&gt;
*&#039;&#039;The value 1 can be written as any positive integer, so long as it is within the cap or ceiling of your timer.&#039;&#039;&lt;br /&gt;
*&#039;&#039;As an example from the above timer, this light will pulse every 1st tick after the timer reaches 30 ticks, making it pulse 1/30th of a second, as Factorio updates at 60 times per second.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Counter ==&lt;br /&gt;
A counter is used to count the number of input events, and output the sum of that count. Any pulsing input into a decider combinator configured input -&amp;gt; output and wired between output and input will create a counter, but this input must be zero at all other times or else the combinator will run away like a clock. A pulse generator is normally used to accomplish this. Combining several gating decider isolators set with sequential conditionals, a clock, and a pulse generator to the input of a counter will allow remote polling and counting of each isolator&#039;s contents.&lt;br /&gt;
&lt;br /&gt;
== Logic Gates ==&lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;Unary NOT&#039;&#039;&#039;===&lt;br /&gt;
----&lt;br /&gt;
[[File:NOT.png|415px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;Binary OR&#039;&#039;&#039;===&lt;br /&gt;
----&lt;br /&gt;
[[File:OR.png|300px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 2!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1  || 1&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;*Deprecated: Use the Arithmetic Combinator&#039;s OR option instead.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;Binary NOR&#039;&#039;&#039;===&lt;br /&gt;
----&lt;br /&gt;
[[File:NOR.png|415px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 2!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;Binary XOR&#039;&#039;&#039;===&lt;br /&gt;
----&lt;br /&gt;
[[File:XOR.png|300px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 1!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 ||  0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 ||  1 || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 ||  0 || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 ||  1 || 0&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;*Deprecated: Use the Arithmetic Combinator&#039;s XOR option instead.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;Binary AND&#039;&#039;&#039;===&lt;br /&gt;
----&lt;br /&gt;
[[File:AND.png|530px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 2!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1 || 1&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;*Deprecated: Use the Arithmetic Combinator&#039;s AND option instead.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;Trinary AND&#039;&#039;&#039;===&lt;br /&gt;
----&lt;br /&gt;
[[File:TrinaryAND.png|415px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 2!!Input 3!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0  || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1  || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0  || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1  || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0  || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1  || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0  || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1  || 1  || 1&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;Binary NAND&#039;&#039;&#039;===&lt;br /&gt;
----&lt;br /&gt;
[[File:NAND.png|300px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 2!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;Binary XNOR/XAND&#039;&#039;&#039;===&lt;br /&gt;
----&lt;br /&gt;
[[File:XAND.png|300px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 2!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1  || 1&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Memory Cells ==&lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;Simple Latch&#039;&#039;&#039;===&lt;br /&gt;
&lt;br /&gt;
When looping the combinator to itself, use a different colour of wire from your main inputs or outputs. &lt;br /&gt;
&lt;br /&gt;
[[File:SimpleLatchv2.png|300px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Output 1!!Input 1!!Input 2!! Output 1 (t+1)&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 0 || 1&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0 || 0 || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1 || 0 || 1 &#039;&#039;(2)&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0 || 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1 || 1 || 1 &#039;&#039;(2)&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&#039;&#039;Output 1 is the green wire loop seen in the picture, it carries the value to latch.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Input 1 is Set, while Input 2 is Reset.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;Binary Cell&#039;&#039;&#039;===&lt;br /&gt;
&lt;br /&gt;
RS NOR Latch&lt;br /&gt;
[[File:RS-NOR.png|500px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;Advanced Cell&#039;&#039;&#039;===&lt;br /&gt;
&lt;br /&gt;
Cell for storing a positive value:&lt;br /&gt;
&lt;br /&gt;
[[File:AdvancedMemoryCell.png|500px]]&lt;br /&gt;
&lt;br /&gt;
Connect the desired value as signal 3 on the right side to set the memory cell and connect a negative value as signal 3 to reset the cell.  *Please note the arithmetic combinator&#039;s output should be facing the opposite direction of the decider combinators.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Address Enable Switch&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== See Also ==&lt;br /&gt;
*[http://www.factorioforums.com/forum/viewtopic.php?f=18&amp;amp;t=14556 Combinators 101 (Tutorial)]&lt;br /&gt;
*[[Arithmetic combinator]]&lt;br /&gt;
*[[Constant combinator]]&lt;br /&gt;
*[[Decider combinator]]&lt;br /&gt;
*[[Circuit network]]&lt;br /&gt;
*[[Circuit-network_Cookbook]]&lt;/div&gt;</summary>
		<author><name>My3DS</name></author>
	</entry>
	<entry>
		<id>https://wiki.factorio.com/index.php?title=Tutorial:Combinator_tutorial&amp;diff=138368</id>
		<title>Tutorial:Combinator tutorial</title>
		<link rel="alternate" type="text/html" href="https://wiki.factorio.com/index.php?title=Tutorial:Combinator_tutorial&amp;diff=138368"/>
		<updated>2017-06-01T12:11:53Z</updated>

		<summary type="html">&lt;p&gt;My3DS: /* Everything Wildcard: */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
Combinator logic is achieved by cross-connecting outputs to inputs in such a way to achieve the desired logic. While advanced logic requires a multitude of combinators, some very useful basic logic can be achieved using only a handful of combinators. &#039;&#039;&#039;Combinator logic works because Factorio only updates at 60 times per second, such that combinators analyze their logic in a step, and then sum and/or decide the resulting output values on the next step.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
When logic values are computed by combinators, the outputs are not recognized by the circuit network until the following step. So when a decider combinator is used to detect a certain input condition, it&#039;s output value will not take effect on the circuit network until the next step. &#039;&#039;&#039;This behavior is important to remember and can result in sequencing errors and significant delays when multiple combinators are connected in series.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Circuit wires act like a wire bus in electronics, it carries information in the connected wires, meaning that &#039;&#039;&#039;if there are similar signals on a wire, it will add them automatically, unless if it is a different signal, that means it will be carried in that wire as well, but as a different signal.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
When cross-connecting combinators &#039;&#039;&#039;it&#039;s good practice to use the unused color to cross-connect, this will split the input and output networks and prevent unwanted inputs from accidentally connecting to a larger circuit network.&#039;&#039;&#039; Combinators will sum the red &amp;amp;/or green inputs prior to calculation, so either color can be used when wiring the output back to the input, but in most cases, it is more useful to use the opposing colour of the wire so that it will not interfere with the resulting output and input.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;There is also an example heavy [[Circuit-network_Cookbook|circuit network cookbook]] that you may find helpful to learn and refer to about circuit networks.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Virtual Signals ==&lt;br /&gt;
&lt;br /&gt;
===Everything Wildcard:===&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
This Red Wildcard serves to check all the specifed input signals.&lt;br /&gt;
&lt;br /&gt;
As the Decider Combinator, &amp;lt;br /&amp;gt;&lt;br /&gt;
its input is used to serve if all inputs meets the specified signals or variables. &amp;lt;br /&amp;gt;&lt;br /&gt;
its output is used to serve output every signal. &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Side note: &amp;quot;Everything&amp;quot; outputs true by default even if there is no signal to guarantee if that is true. &#039;&#039;Everything is false when every input does not meet the condition, otherwise, output true.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
===Anything Wildcard:===&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
This Green Wildcard serves to check all the specifed input signals.&lt;br /&gt;
&lt;br /&gt;
As the Decider Combinator, &lt;br /&gt;
its input is used to serve if any of its inputs meets the specified signals or variables.&lt;br /&gt;
&lt;br /&gt;
Side note: &amp;quot;Anything&amp;quot; outputs false by default if there is no signal to guarantee if it is true. &#039;&#039;Anything is false when any of inputs do not meet the condition, otherwise, it is true.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
===Each Wildcard:===&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
This Yellow Wildcard serves to check for each the specifed input signals.&lt;br /&gt;
&lt;br /&gt;
As the Decider Combinator, &amp;lt;br /&amp;gt;&lt;br /&gt;
its input is used to serve if any inputs meets the specified signals or variables. &amp;lt;br /&amp;gt;&lt;br /&gt;
its output is used to serve output the each variable. &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As the Arithmetic Combinator, &amp;lt;br /&amp;gt;&lt;br /&gt;
its input is used to serve each input, then the following summations are summed and outputted, with each signal as its own respective signals.&lt;br /&gt;
&lt;br /&gt;
== Input Isolator &amp;amp; Gate ==&lt;br /&gt;
An arithmetic combinator set to (In: Each + 0, Out: Each) can be used to swap wire colors and as an isolator to prevent downstream logic from backfeeding into the circuit network&#039;s inputs.&lt;br /&gt;
&lt;br /&gt;
A decider combinator set to (Out: Everything, Input-&amp;gt; Output) will also function as an isolator as long as the set logic condition is true. This can also selectively pass or &#039;gate&#039; inputs only when desired. This could be used to sequentially poll remote train stations for their chest contents, and include only desired stations.&lt;br /&gt;
&lt;br /&gt;
== Set/Reset Latching Switch ==&lt;br /&gt;
You want something to SET a trigger at some quantity, but then STAY on until that quantity hits some other value, the RESET value. You&#039;ll need one decider combinator and one arithmetic combinator. Two decider combinators and a constant combinator can also be used for more complex multi-channel conditions.&lt;br /&gt;
&lt;br /&gt;
Setup the first decider combinator to the desired set conditional and to output a 1. Then connect the output to the input of an arithmetic combinator, and configure it to multiply by the bias value, the difference between the set and reset values, and wire the arithmetic output to the input of the decider. The arithmetic output channel MUST be set the same as the decider&#039;s input channel. That&#039;s it! Whenever your set conditional is reached, the decider will output a &#039;1&#039;, and the bias of the arithmetic combinator will be applied. This will &#039;hold&#039; the output true until the value goes back below the reset point.&lt;br /&gt;
&lt;br /&gt;
Here&#039;s a more specific example : &lt;br /&gt;
i want the pump to run when petrol reach 2000, and turn off when reach 200.&amp;lt;br&amp;gt;&lt;br /&gt;
only with green wire&amp;lt;br&amp;gt;&lt;br /&gt;
Tank -&amp;gt; in decider&amp;lt;br&amp;gt;&lt;br /&gt;
out decider-&amp;gt; in arithmetic&amp;lt;br&amp;gt;&lt;br /&gt;
out arithmetic -&amp;gt; in decider&amp;lt;br&amp;gt;&lt;br /&gt;
green wire from in decider, to pump&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Pump have the same condition as the decider (Petrol &amp;gt; 2000)&lt;br /&gt;
&lt;br /&gt;
Decider : Petrol &amp;gt; 2000&amp;lt;br&amp;gt;&lt;br /&gt;
out : A = 1&amp;lt;br&amp;gt;&lt;br /&gt;
Arithmetic : A x 1800 (2000 - 200 )&amp;lt;br&amp;gt;&lt;br /&gt;
out : petrol&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:Factorio combinator switch.png|620px]]&lt;br /&gt;
&lt;br /&gt;
== Comparing Outputs ==&lt;br /&gt;
&lt;br /&gt;
== Addressing Outposts ==&lt;br /&gt;
&lt;br /&gt;
== Smart Train Loading ==&lt;br /&gt;
&lt;br /&gt;
Initially designed by [https://www.youtube.com/user/Darkphade MadZuri],&lt;br /&gt;
&lt;br /&gt;
This solves the problem of loading logistics into chests, which tend to be unequal and is slower in the rate of loading logistics into the cargo of trains.&lt;br /&gt;
&lt;br /&gt;
To setup the design, you require an Arithmetic Combinator, as well as Red and Green wires. &#039;&#039;&#039;Wire all the chests used, to the input of the Arithmetic Combinator&#039;&#039;&#039;. &#039;&#039;&#039;Then write (Logistics Item / -Amount of chests) and as the output as the Logistics Item in the Arithmetic Combinator&#039;&#039;&#039;, this will average the amount of items within the chests. Lastly, &#039;&#039;&#039;wire all the inserters used to the output of the Arithmetic Combinator and have the other color of the wire be wired to the adjacent chest&#039;&#039;&#039;. &#039;&#039;&#039;Have the inserters enabled when Logistics Item &amp;lt; 1&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
A more visual representation as well as questions for the design can be found [https://www.reddit.com/r/factorio/comments/4e03g2/madzuris_smart_loading_train_station_guide/ here].&lt;br /&gt;
&lt;br /&gt;
Explanation of why this works:&lt;br /&gt;
It compares the average amount of total items within the chests and the chest adjacent to the inserter so that it activates when the average number of items is higher than the amount within the chest.&lt;br /&gt;
The reason for why the division denominator is negative is because if the items in the chests are 0, it basically makes it so that it adds 1 to the equation.&lt;br /&gt;
&lt;br /&gt;
== Oil Control ==&lt;br /&gt;
&lt;br /&gt;
== Memory ==&lt;br /&gt;
How to store a constant value for later use, either for a basic counter or for more advanced logic. A decider combinator wired output tied to input and configured greater than zero (for positive values), input -&amp;gt; output will &#039;hold&#039; a value, as long as all other inputs on the network are zero.&lt;br /&gt;
&lt;br /&gt;
Any non-zero input condition will create a basic clock; incrementing the stored value by the sum of all connected input values every cycle. A single pulse of an input will cause a single increment by the pulsed value. Reset to zero occurs whenever the set condition is no longer met, or if a negative pulse equal to the input occurs.&lt;br /&gt;
&lt;br /&gt;
== Basic Clocks ==&lt;br /&gt;
[[File:Timer.png|thumb|right|377px|A basic clock. 30 ticks is the ceiling for Signal 1; which is continuously added.]]&lt;br /&gt;
Clocks are constructed by having the output of a combinator tied back to its own input, such that every cycle advances its own count. Either the arithmetic combinator or the decider combinator can be used.&lt;br /&gt;
&lt;br /&gt;
An arithmetic combinator tied to itself is fun to watch and will happily run-away, but requires additional control logic to reset.&lt;br /&gt;
&lt;br /&gt;
A self-resetting clock requires just a single decider combinator with output wired to input and configured with Less Than (&amp;lt;) and Input -&amp;gt; Output. When a constant combinator is then connected to the input, every cycle it will count up by the value of the Constant Combinator until the set conditional value is reached, then output a zero which will be summed with the constant combinator, and reset the process.&lt;br /&gt;
&lt;br /&gt;
The clock sequence will not include zero, will begin at the value set by the constant combinator, and will include whatever value eventually causes the conditional to be false. An arithmetic combinator can modify the clock sequence but remember its outputs will occur one cycle later than the clock cycle values.&lt;br /&gt;
&lt;br /&gt;
A clock that only counts once can be built using the following setup:&lt;br /&gt;
&lt;br /&gt;
[[File:Onetime_Clock.png|thumb|none|360px|One-time clock. Runs until T=Z+1. Reset via R&amp;gt;0.]]&lt;br /&gt;
&lt;br /&gt;
== Pulse Generators ==&lt;br /&gt;
&lt;br /&gt;
Connecting an additional (=) decider combinator to the output of a basic clock will create a pulse generator, and will pulse a single output every time the clock cycles through the set condition. Any output value can be used, either directly from the clock sequence (input-&amp;gt;output), a 1, or some value on a separate logic channel on the circuit network, such as set by a constant combinator. or by the circuit network.&amp;lt;br /&amp;gt;&lt;br /&gt;
[[File:PulseGen.png|500px]]&lt;br /&gt;
*&#039;&#039;The value 1 can be written as any positive integer, so long as it is within the cap or ceiling of your timer.&#039;&#039;&lt;br /&gt;
*&#039;&#039;As an example from the above timer, this light will pulse every 1st tick after the timer reaches 30 ticks, making it pulse 1/30th of a second, as Factorio updates at 60 times per second.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Counter ==&lt;br /&gt;
A counter is used to count the number of input events, and output the sum of that count. Any pulsing input into a decider combinator configured input -&amp;gt; output and wired between output and input will create a counter, but this input must be zero at all other times or else the combinator will run away like a clock. A pulse generator is normally used to accomplish this. Combining several gating decider isolators set with sequential conditionals, a clock, and a pulse generator to the input of a counter will allow remote polling and counting of each isolator&#039;s contents.&lt;br /&gt;
&lt;br /&gt;
== Logic Gates ==&lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;Unary NOT&#039;&#039;&#039;===&lt;br /&gt;
----&lt;br /&gt;
[[File:NOT.png|415px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;Binary OR&#039;&#039;&#039;===&lt;br /&gt;
----&lt;br /&gt;
[[File:OR.png|300px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 2!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1  || 1&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;*Deprecated: Use the Arithmetic Combinator&#039;s OR option instead.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;Binary NOR&#039;&#039;&#039;===&lt;br /&gt;
----&lt;br /&gt;
[[File:NOR.png|415px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 2!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;Binary XOR&#039;&#039;&#039;===&lt;br /&gt;
----&lt;br /&gt;
[[File:XOR.png|300px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 1!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 ||  0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 ||  1 || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 ||  0 || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 ||  1 || 0&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;*Deprecated: Use the Arithmetic Combinator&#039;s XOR option instead.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;Binary AND&#039;&#039;&#039;===&lt;br /&gt;
----&lt;br /&gt;
[[File:AND.png|530px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 2!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1 || 1&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;*Deprecated: Use the Arithmetic Combinator&#039;s AND option instead.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;Trinary AND&#039;&#039;&#039;===&lt;br /&gt;
----&lt;br /&gt;
[[File:TrinaryAND.png|415px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 2!!Input 3!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0  || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1  || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0  || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1  || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0  || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1  || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0  || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1  || 1  || 1&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;Binary NAND&#039;&#039;&#039;===&lt;br /&gt;
----&lt;br /&gt;
[[File:NAND.png|300px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 2!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;Binary XNOR/XAND&#039;&#039;&#039;===&lt;br /&gt;
----&lt;br /&gt;
[[File:XAND.png|300px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 2!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1  || 1&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Memory Cells ==&lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;Simple Latch&#039;&#039;&#039;===&lt;br /&gt;
&lt;br /&gt;
When looping the combinator to itself, use a different colour of wire from your main inputs or outputs. &lt;br /&gt;
&lt;br /&gt;
[[File:SimpleLatchv2.png|300px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Output 1!!Input 1!!Input 2!! Output 1 (t+1)&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 0 || 1&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0 || 0 || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1 || 0 || 1 &#039;&#039;(2)&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0 || 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1 || 1 || 1 &#039;&#039;(2)&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&#039;&#039;Output 1 is the green wire loop seen in the picture, it carries the value to latch.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Input 1 is Set, while Input 2 is Reset.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;Binary Cell&#039;&#039;&#039;===&lt;br /&gt;
&lt;br /&gt;
RS NOR Latch&lt;br /&gt;
[[File:RS-NOR.png|500px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;Advanced Cell&#039;&#039;&#039;===&lt;br /&gt;
&lt;br /&gt;
Cell for storing a positive value:&lt;br /&gt;
&lt;br /&gt;
[[File:AdvancedMemoryCell.png|500px]]&lt;br /&gt;
&lt;br /&gt;
Connect the desired value as signal 3 on the right side to set the memory cell and connect a negative value as signal 3 to reset the cell.  *Please note the arithmetic combinator&#039;s output should be facing the opposite direction of the decider combinators.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Address Enable Switch&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== See Also ==&lt;br /&gt;
*[http://www.factorioforums.com/forum/viewtopic.php?f=18&amp;amp;t=14556 Combinators 101 (Tutorial)]&lt;br /&gt;
*[[Arithmetic combinator]]&lt;br /&gt;
*[[Constant Combinator]]&lt;br /&gt;
*[[Decider Combinator]]&lt;br /&gt;
*[[Circuit network]]&lt;br /&gt;
*[[Circuit-network_Cookbook]]&lt;br /&gt;
[[Category:Tutorial]]&lt;br /&gt;
[[Category:English page]]&lt;/div&gt;</summary>
		<author><name>My3DS</name></author>
	</entry>
	<entry>
		<id>https://wiki.factorio.com/index.php?title=Tutorial:Combinator_tutorial&amp;diff=138367</id>
		<title>Tutorial:Combinator tutorial</title>
		<link rel="alternate" type="text/html" href="https://wiki.factorio.com/index.php?title=Tutorial:Combinator_tutorial&amp;diff=138367"/>
		<updated>2017-06-01T12:10:45Z</updated>

		<summary type="html">&lt;p&gt;My3DS: /* Anything Wildcard: */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
Combinator logic is achieved by cross-connecting outputs to inputs in such a way to achieve the desired logic. While advanced logic requires a multitude of combinators, some very useful basic logic can be achieved using only a handful of combinators. &#039;&#039;&#039;Combinator logic works because Factorio only updates at 60 times per second, such that combinators analyze their logic in a step, and then sum and/or decide the resulting output values on the next step.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
When logic values are computed by combinators, the outputs are not recognized by the circuit network until the following step. So when a decider combinator is used to detect a certain input condition, it&#039;s output value will not take effect on the circuit network until the next step. &#039;&#039;&#039;This behavior is important to remember and can result in sequencing errors and significant delays when multiple combinators are connected in series.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Circuit wires act like a wire bus in electronics, it carries information in the connected wires, meaning that &#039;&#039;&#039;if there are similar signals on a wire, it will add them automatically, unless if it is a different signal, that means it will be carried in that wire as well, but as a different signal.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
When cross-connecting combinators &#039;&#039;&#039;it&#039;s good practice to use the unused color to cross-connect, this will split the input and output networks and prevent unwanted inputs from accidentally connecting to a larger circuit network.&#039;&#039;&#039; Combinators will sum the red &amp;amp;/or green inputs prior to calculation, so either color can be used when wiring the output back to the input, but in most cases, it is more useful to use the opposing colour of the wire so that it will not interfere with the resulting output and input.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;There is also an example heavy [[Circuit-network_Cookbook|circuit network cookbook]] that you may find helpful to learn and refer to about circuit networks.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Virtual Signals ==&lt;br /&gt;
&lt;br /&gt;
===Everything Wildcard:===&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
This Red Wildcard serves to check all the specifed input signals.&lt;br /&gt;
&lt;br /&gt;
As the Decider Combinator, &amp;lt;br /&amp;gt;&lt;br /&gt;
its input is used to serve if all inputs meets the specified signals or variables. &amp;lt;br /&amp;gt;&lt;br /&gt;
its output is used to serve output every signal. &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Side note: &amp;quot;Everything&amp;quot; outputs true by default even if there is no signal to guarantee if that is true. &#039;&#039;Everything is false when all of inputs do not meet the condition, otherwise, output true.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
===Anything Wildcard:===&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
This Green Wildcard serves to check all the specifed input signals.&lt;br /&gt;
&lt;br /&gt;
As the Decider Combinator, &lt;br /&gt;
its input is used to serve if any of its inputs meets the specified signals or variables.&lt;br /&gt;
&lt;br /&gt;
Side note: &amp;quot;Anything&amp;quot; outputs false by default if there is no signal to guarantee if it is true. &#039;&#039;Anything is false when any of inputs do not meet the condition, otherwise, it is true.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
===Each Wildcard:===&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
This Yellow Wildcard serves to check for each the specifed input signals.&lt;br /&gt;
&lt;br /&gt;
As the Decider Combinator, &amp;lt;br /&amp;gt;&lt;br /&gt;
its input is used to serve if any inputs meets the specified signals or variables. &amp;lt;br /&amp;gt;&lt;br /&gt;
its output is used to serve output the each variable. &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As the Arithmetic Combinator, &amp;lt;br /&amp;gt;&lt;br /&gt;
its input is used to serve each input, then the following summations are summed and outputted, with each signal as its own respective signals.&lt;br /&gt;
&lt;br /&gt;
== Input Isolator &amp;amp; Gate ==&lt;br /&gt;
An arithmetic combinator set to (In: Each + 0, Out: Each) can be used to swap wire colors and as an isolator to prevent downstream logic from backfeeding into the circuit network&#039;s inputs.&lt;br /&gt;
&lt;br /&gt;
A decider combinator set to (Out: Everything, Input-&amp;gt; Output) will also function as an isolator as long as the set logic condition is true. This can also selectively pass or &#039;gate&#039; inputs only when desired. This could be used to sequentially poll remote train stations for their chest contents, and include only desired stations.&lt;br /&gt;
&lt;br /&gt;
== Set/Reset Latching Switch ==&lt;br /&gt;
You want something to SET a trigger at some quantity, but then STAY on until that quantity hits some other value, the RESET value. You&#039;ll need one decider combinator and one arithmetic combinator. Two decider combinators and a constant combinator can also be used for more complex multi-channel conditions.&lt;br /&gt;
&lt;br /&gt;
Setup the first decider combinator to the desired set conditional and to output a 1. Then connect the output to the input of an arithmetic combinator, and configure it to multiply by the bias value, the difference between the set and reset values, and wire the arithmetic output to the input of the decider. The arithmetic output channel MUST be set the same as the decider&#039;s input channel. That&#039;s it! Whenever your set conditional is reached, the decider will output a &#039;1&#039;, and the bias of the arithmetic combinator will be applied. This will &#039;hold&#039; the output true until the value goes back below the reset point.&lt;br /&gt;
&lt;br /&gt;
Here&#039;s a more specific example : &lt;br /&gt;
i want the pump to run when petrol reach 2000, and turn off when reach 200.&amp;lt;br&amp;gt;&lt;br /&gt;
only with green wire&amp;lt;br&amp;gt;&lt;br /&gt;
Tank -&amp;gt; in decider&amp;lt;br&amp;gt;&lt;br /&gt;
out decider-&amp;gt; in arithmetic&amp;lt;br&amp;gt;&lt;br /&gt;
out arithmetic -&amp;gt; in decider&amp;lt;br&amp;gt;&lt;br /&gt;
green wire from in decider, to pump&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Pump have the same condition as the decider (Petrol &amp;gt; 2000)&lt;br /&gt;
&lt;br /&gt;
Decider : Petrol &amp;gt; 2000&amp;lt;br&amp;gt;&lt;br /&gt;
out : A = 1&amp;lt;br&amp;gt;&lt;br /&gt;
Arithmetic : A x 1800 (2000 - 200 )&amp;lt;br&amp;gt;&lt;br /&gt;
out : petrol&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:Factorio combinator switch.png|620px]]&lt;br /&gt;
&lt;br /&gt;
== Comparing Outputs ==&lt;br /&gt;
&lt;br /&gt;
== Addressing Outposts ==&lt;br /&gt;
&lt;br /&gt;
== Smart Train Loading ==&lt;br /&gt;
&lt;br /&gt;
Initially designed by [https://www.youtube.com/user/Darkphade MadZuri],&lt;br /&gt;
&lt;br /&gt;
This solves the problem of loading logistics into chests, which tend to be unequal and is slower in the rate of loading logistics into the cargo of trains.&lt;br /&gt;
&lt;br /&gt;
To setup the design, you require an Arithmetic Combinator, as well as Red and Green wires. &#039;&#039;&#039;Wire all the chests used, to the input of the Arithmetic Combinator&#039;&#039;&#039;. &#039;&#039;&#039;Then write (Logistics Item / -Amount of chests) and as the output as the Logistics Item in the Arithmetic Combinator&#039;&#039;&#039;, this will average the amount of items within the chests. Lastly, &#039;&#039;&#039;wire all the inserters used to the output of the Arithmetic Combinator and have the other color of the wire be wired to the adjacent chest&#039;&#039;&#039;. &#039;&#039;&#039;Have the inserters enabled when Logistics Item &amp;lt; 1&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
A more visual representation as well as questions for the design can be found [https://www.reddit.com/r/factorio/comments/4e03g2/madzuris_smart_loading_train_station_guide/ here].&lt;br /&gt;
&lt;br /&gt;
Explanation of why this works:&lt;br /&gt;
It compares the average amount of total items within the chests and the chest adjacent to the inserter so that it activates when the average number of items is higher than the amount within the chest.&lt;br /&gt;
The reason for why the division denominator is negative is because if the items in the chests are 0, it basically makes it so that it adds 1 to the equation.&lt;br /&gt;
&lt;br /&gt;
== Oil Control ==&lt;br /&gt;
&lt;br /&gt;
== Memory ==&lt;br /&gt;
How to store a constant value for later use, either for a basic counter or for more advanced logic. A decider combinator wired output tied to input and configured greater than zero (for positive values), input -&amp;gt; output will &#039;hold&#039; a value, as long as all other inputs on the network are zero.&lt;br /&gt;
&lt;br /&gt;
Any non-zero input condition will create a basic clock; incrementing the stored value by the sum of all connected input values every cycle. A single pulse of an input will cause a single increment by the pulsed value. Reset to zero occurs whenever the set condition is no longer met, or if a negative pulse equal to the input occurs.&lt;br /&gt;
&lt;br /&gt;
== Basic Clocks ==&lt;br /&gt;
[[File:Timer.png|thumb|right|377px|A basic clock. 30 ticks is the ceiling for Signal 1; which is continuously added.]]&lt;br /&gt;
Clocks are constructed by having the output of a combinator tied back to its own input, such that every cycle advances its own count. Either the arithmetic combinator or the decider combinator can be used.&lt;br /&gt;
&lt;br /&gt;
An arithmetic combinator tied to itself is fun to watch and will happily run-away, but requires additional control logic to reset.&lt;br /&gt;
&lt;br /&gt;
A self-resetting clock requires just a single decider combinator with output wired to input and configured with Less Than (&amp;lt;) and Input -&amp;gt; Output. When a constant combinator is then connected to the input, every cycle it will count up by the value of the Constant Combinator until the set conditional value is reached, then output a zero which will be summed with the constant combinator, and reset the process.&lt;br /&gt;
&lt;br /&gt;
The clock sequence will not include zero, will begin at the value set by the constant combinator, and will include whatever value eventually causes the conditional to be false. An arithmetic combinator can modify the clock sequence but remember its outputs will occur one cycle later than the clock cycle values.&lt;br /&gt;
&lt;br /&gt;
A clock that only counts once can be built using the following setup:&lt;br /&gt;
&lt;br /&gt;
[[File:Onetime_Clock.png|thumb|none|360px|One-time clock. Runs until T=Z+1. Reset via R&amp;gt;0.]]&lt;br /&gt;
&lt;br /&gt;
== Pulse Generators ==&lt;br /&gt;
&lt;br /&gt;
Connecting an additional (=) decider combinator to the output of a basic clock will create a pulse generator, and will pulse a single output every time the clock cycles through the set condition. Any output value can be used, either directly from the clock sequence (input-&amp;gt;output), a 1, or some value on a separate logic channel on the circuit network, such as set by a constant combinator. or by the circuit network.&amp;lt;br /&amp;gt;&lt;br /&gt;
[[File:PulseGen.png|500px]]&lt;br /&gt;
*&#039;&#039;The value 1 can be written as any positive integer, so long as it is within the cap or ceiling of your timer.&#039;&#039;&lt;br /&gt;
*&#039;&#039;As an example from the above timer, this light will pulse every 1st tick after the timer reaches 30 ticks, making it pulse 1/30th of a second, as Factorio updates at 60 times per second.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Counter ==&lt;br /&gt;
A counter is used to count the number of input events, and output the sum of that count. Any pulsing input into a decider combinator configured input -&amp;gt; output and wired between output and input will create a counter, but this input must be zero at all other times or else the combinator will run away like a clock. A pulse generator is normally used to accomplish this. Combining several gating decider isolators set with sequential conditionals, a clock, and a pulse generator to the input of a counter will allow remote polling and counting of each isolator&#039;s contents.&lt;br /&gt;
&lt;br /&gt;
== Logic Gates ==&lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;Unary NOT&#039;&#039;&#039;===&lt;br /&gt;
----&lt;br /&gt;
[[File:NOT.png|415px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;Binary OR&#039;&#039;&#039;===&lt;br /&gt;
----&lt;br /&gt;
[[File:OR.png|300px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 2!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1  || 1&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;*Deprecated: Use the Arithmetic Combinator&#039;s OR option instead.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;Binary NOR&#039;&#039;&#039;===&lt;br /&gt;
----&lt;br /&gt;
[[File:NOR.png|415px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 2!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;Binary XOR&#039;&#039;&#039;===&lt;br /&gt;
----&lt;br /&gt;
[[File:XOR.png|300px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 1!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 ||  0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 ||  1 || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 ||  0 || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 ||  1 || 0&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;*Deprecated: Use the Arithmetic Combinator&#039;s XOR option instead.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;Binary AND&#039;&#039;&#039;===&lt;br /&gt;
----&lt;br /&gt;
[[File:AND.png|530px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 2!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1 || 1&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;*Deprecated: Use the Arithmetic Combinator&#039;s AND option instead.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;Trinary AND&#039;&#039;&#039;===&lt;br /&gt;
----&lt;br /&gt;
[[File:TrinaryAND.png|415px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 2!!Input 3!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0  || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1  || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0  || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1  || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0  || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1  || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0  || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1  || 1  || 1&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;Binary NAND&#039;&#039;&#039;===&lt;br /&gt;
----&lt;br /&gt;
[[File:NAND.png|300px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 2!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;Binary XNOR/XAND&#039;&#039;&#039;===&lt;br /&gt;
----&lt;br /&gt;
[[File:XAND.png|300px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 2!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1  || 1&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Memory Cells ==&lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;Simple Latch&#039;&#039;&#039;===&lt;br /&gt;
&lt;br /&gt;
When looping the combinator to itself, use a different colour of wire from your main inputs or outputs. &lt;br /&gt;
&lt;br /&gt;
[[File:SimpleLatchv2.png|300px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Output 1!!Input 1!!Input 2!! Output 1 (t+1)&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 0 || 1&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0 || 0 || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1 || 0 || 1 &#039;&#039;(2)&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0 || 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1 || 1 || 1 &#039;&#039;(2)&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&#039;&#039;Output 1 is the green wire loop seen in the picture, it carries the value to latch.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Input 1 is Set, while Input 2 is Reset.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;Binary Cell&#039;&#039;&#039;===&lt;br /&gt;
&lt;br /&gt;
RS NOR Latch&lt;br /&gt;
[[File:RS-NOR.png|500px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;Advanced Cell&#039;&#039;&#039;===&lt;br /&gt;
&lt;br /&gt;
Cell for storing a positive value:&lt;br /&gt;
&lt;br /&gt;
[[File:AdvancedMemoryCell.png|500px]]&lt;br /&gt;
&lt;br /&gt;
Connect the desired value as signal 3 on the right side to set the memory cell and connect a negative value as signal 3 to reset the cell.  *Please note the arithmetic combinator&#039;s output should be facing the opposite direction of the decider combinators.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Address Enable Switch&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== See Also ==&lt;br /&gt;
*[http://www.factorioforums.com/forum/viewtopic.php?f=18&amp;amp;t=14556 Combinators 101 (Tutorial)]&lt;br /&gt;
*[[Arithmetic combinator]]&lt;br /&gt;
*[[Constant Combinator]]&lt;br /&gt;
*[[Decider Combinator]]&lt;br /&gt;
*[[Circuit network]]&lt;br /&gt;
*[[Circuit-network_Cookbook]]&lt;br /&gt;
[[Category:Tutorial]]&lt;br /&gt;
[[Category:English page]]&lt;/div&gt;</summary>
		<author><name>My3DS</name></author>
	</entry>
	<entry>
		<id>https://wiki.factorio.com/index.php?title=Tutorial:Combinator_tutorial&amp;diff=138366</id>
		<title>Tutorial:Combinator tutorial</title>
		<link rel="alternate" type="text/html" href="https://wiki.factorio.com/index.php?title=Tutorial:Combinator_tutorial&amp;diff=138366"/>
		<updated>2017-06-01T11:51:11Z</updated>

		<summary type="html">&lt;p&gt;My3DS: /* Everything Wildcard: */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
Combinator logic is achieved by cross-connecting outputs to inputs in such a way to achieve the desired logic. While advanced logic requires a multitude of combinators, some very useful basic logic can be achieved using only a handful of combinators. &#039;&#039;&#039;Combinator logic works because Factorio only updates at 60 times per second, such that combinators analyze their logic in a step, and then sum and/or decide the resulting output values on the next step.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
When logic values are computed by combinators, the outputs are not recognized by the circuit network until the following step. So when a decider combinator is used to detect a certain input condition, it&#039;s output value will not take effect on the circuit network until the next step. &#039;&#039;&#039;This behavior is important to remember and can result in sequencing errors and significant delays when multiple combinators are connected in series.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Circuit wires act like a wire bus in electronics, it carries information in the connected wires, meaning that &#039;&#039;&#039;if there are similar signals on a wire, it will add them automatically, unless if it is a different signal, that means it will be carried in that wire as well, but as a different signal.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
When cross-connecting combinators &#039;&#039;&#039;it&#039;s good practice to use the unused color to cross-connect, this will split the input and output networks and prevent unwanted inputs from accidentally connecting to a larger circuit network.&#039;&#039;&#039; Combinators will sum the red &amp;amp;/or green inputs prior to calculation, so either color can be used when wiring the output back to the input, but in most cases, it is more useful to use the opposing colour of the wire so that it will not interfere with the resulting output and input.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;There is also an example heavy [[Circuit-network_Cookbook|circuit network cookbook]] that you may find helpful to learn and refer to about circuit networks.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Virtual Signals ==&lt;br /&gt;
&lt;br /&gt;
===Everything Wildcard:===&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
This Red Wildcard serves to check all the specifed input signals.&lt;br /&gt;
&lt;br /&gt;
As the Decider Combinator, &amp;lt;br /&amp;gt;&lt;br /&gt;
its input is used to serve if all inputs meets the specified signals or variables. &amp;lt;br /&amp;gt;&lt;br /&gt;
its output is used to serve output every signal. &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Side note: &amp;quot;Everything&amp;quot; outputs true by default even if there is no signal to guarantee if that is true. &#039;&#039;Everything is false when all of inputs do not meet the condition, otherwise, output true.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
===Anything Wildcard:===&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
This Green Wildcard serves to check all the specifed input signals.&lt;br /&gt;
&lt;br /&gt;
As the Decider Combinator, &lt;br /&gt;
its input is used to serve if any of its inputs meets the specified signals or variables.&lt;br /&gt;
&lt;br /&gt;
Side note: &amp;quot;Anything&amp;quot; outputs false by default if there is no signal to guarantee if it is true. &#039;&#039;P(x) is false if any x is neither true or false.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
===Each Wildcard:===&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
This Yellow Wildcard serves to check for each the specifed input signals.&lt;br /&gt;
&lt;br /&gt;
As the Decider Combinator, &amp;lt;br /&amp;gt;&lt;br /&gt;
its input is used to serve if any inputs meets the specified signals or variables. &amp;lt;br /&amp;gt;&lt;br /&gt;
its output is used to serve output the each variable. &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As the Arithmetic Combinator, &amp;lt;br /&amp;gt;&lt;br /&gt;
its input is used to serve each input, then the following summations are summed and outputted, with each signal as its own respective signals.&lt;br /&gt;
&lt;br /&gt;
== Input Isolator &amp;amp; Gate ==&lt;br /&gt;
An arithmetic combinator set to (In: Each + 0, Out: Each) can be used to swap wire colors and as an isolator to prevent downstream logic from backfeeding into the circuit network&#039;s inputs.&lt;br /&gt;
&lt;br /&gt;
A decider combinator set to (Out: Everything, Input-&amp;gt; Output) will also function as an isolator as long as the set logic condition is true. This can also selectively pass or &#039;gate&#039; inputs only when desired. This could be used to sequentially poll remote train stations for their chest contents, and include only desired stations.&lt;br /&gt;
&lt;br /&gt;
== Set/Reset Latching Switch ==&lt;br /&gt;
You want something to SET a trigger at some quantity, but then STAY on until that quantity hits some other value, the RESET value. You&#039;ll need one decider combinator and one arithmetic combinator. Two decider combinators and a constant combinator can also be used for more complex multi-channel conditions.&lt;br /&gt;
&lt;br /&gt;
Setup the first decider combinator to the desired set conditional and to output a 1. Then connect the output to the input of an arithmetic combinator, and configure it to multiply by the bias value, the difference between the set and reset values, and wire the arithmetic output to the input of the decider. The arithmetic output channel MUST be set the same as the decider&#039;s input channel. That&#039;s it! Whenever your set conditional is reached, the decider will output a &#039;1&#039;, and the bias of the arithmetic combinator will be applied. This will &#039;hold&#039; the output true until the value goes back below the reset point.&lt;br /&gt;
&lt;br /&gt;
Here&#039;s a more specific example : &lt;br /&gt;
i want the pump to run when petrol reach 2000, and turn off when reach 200.&amp;lt;br&amp;gt;&lt;br /&gt;
only with green wire&amp;lt;br&amp;gt;&lt;br /&gt;
Tank -&amp;gt; in decider&amp;lt;br&amp;gt;&lt;br /&gt;
out decider-&amp;gt; in arithmetic&amp;lt;br&amp;gt;&lt;br /&gt;
out arithmetic -&amp;gt; in decider&amp;lt;br&amp;gt;&lt;br /&gt;
green wire from in decider, to pump&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Pump have the same condition as the decider (Petrol &amp;gt; 2000)&lt;br /&gt;
&lt;br /&gt;
Decider : Petrol &amp;gt; 2000&amp;lt;br&amp;gt;&lt;br /&gt;
out : A = 1&amp;lt;br&amp;gt;&lt;br /&gt;
Arithmetic : A x 1800 (2000 - 200 )&amp;lt;br&amp;gt;&lt;br /&gt;
out : petrol&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:Factorio combinator switch.png|620px]]&lt;br /&gt;
&lt;br /&gt;
== Comparing Outputs ==&lt;br /&gt;
&lt;br /&gt;
== Addressing Outposts ==&lt;br /&gt;
&lt;br /&gt;
== Smart Train Loading ==&lt;br /&gt;
&lt;br /&gt;
Initially designed by [https://www.youtube.com/user/Darkphade MadZuri],&lt;br /&gt;
&lt;br /&gt;
This solves the problem of loading logistics into chests, which tend to be unequal and is slower in the rate of loading logistics into the cargo of trains.&lt;br /&gt;
&lt;br /&gt;
To setup the design, you require an Arithmetic Combinator, as well as Red and Green wires. &#039;&#039;&#039;Wire all the chests used, to the input of the Arithmetic Combinator&#039;&#039;&#039;. &#039;&#039;&#039;Then write (Logistics Item / -Amount of chests) and as the output as the Logistics Item in the Arithmetic Combinator&#039;&#039;&#039;, this will average the amount of items within the chests. Lastly, &#039;&#039;&#039;wire all the inserters used to the output of the Arithmetic Combinator and have the other color of the wire be wired to the adjacent chest&#039;&#039;&#039;. &#039;&#039;&#039;Have the inserters enabled when Logistics Item &amp;lt; 1&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
A more visual representation as well as questions for the design can be found [https://www.reddit.com/r/factorio/comments/4e03g2/madzuris_smart_loading_train_station_guide/ here].&lt;br /&gt;
&lt;br /&gt;
Explanation of why this works:&lt;br /&gt;
It compares the average amount of total items within the chests and the chest adjacent to the inserter so that it activates when the average number of items is higher than the amount within the chest.&lt;br /&gt;
The reason for why the division denominator is negative is because if the items in the chests are 0, it basically makes it so that it adds 1 to the equation.&lt;br /&gt;
&lt;br /&gt;
== Oil Control ==&lt;br /&gt;
&lt;br /&gt;
== Memory ==&lt;br /&gt;
How to store a constant value for later use, either for a basic counter or for more advanced logic. A decider combinator wired output tied to input and configured greater than zero (for positive values), input -&amp;gt; output will &#039;hold&#039; a value, as long as all other inputs on the network are zero.&lt;br /&gt;
&lt;br /&gt;
Any non-zero input condition will create a basic clock; incrementing the stored value by the sum of all connected input values every cycle. A single pulse of an input will cause a single increment by the pulsed value. Reset to zero occurs whenever the set condition is no longer met, or if a negative pulse equal to the input occurs.&lt;br /&gt;
&lt;br /&gt;
== Basic Clocks ==&lt;br /&gt;
[[File:Timer.png|thumb|right|377px|A basic clock. 30 ticks is the ceiling for Signal 1; which is continuously added.]]&lt;br /&gt;
Clocks are constructed by having the output of a combinator tied back to its own input, such that every cycle advances its own count. Either the arithmetic combinator or the decider combinator can be used.&lt;br /&gt;
&lt;br /&gt;
An arithmetic combinator tied to itself is fun to watch and will happily run-away, but requires additional control logic to reset.&lt;br /&gt;
&lt;br /&gt;
A self-resetting clock requires just a single decider combinator with output wired to input and configured with Less Than (&amp;lt;) and Input -&amp;gt; Output. When a constant combinator is then connected to the input, every cycle it will count up by the value of the Constant Combinator until the set conditional value is reached, then output a zero which will be summed with the constant combinator, and reset the process.&lt;br /&gt;
&lt;br /&gt;
The clock sequence will not include zero, will begin at the value set by the constant combinator, and will include whatever value eventually causes the conditional to be false. An arithmetic combinator can modify the clock sequence but remember its outputs will occur one cycle later than the clock cycle values.&lt;br /&gt;
&lt;br /&gt;
A clock that only counts once can be built using the following setup:&lt;br /&gt;
&lt;br /&gt;
[[File:Onetime_Clock.png|thumb|none|360px|One-time clock. Runs until T=Z+1. Reset via R&amp;gt;0.]]&lt;br /&gt;
&lt;br /&gt;
== Pulse Generators ==&lt;br /&gt;
&lt;br /&gt;
Connecting an additional (=) decider combinator to the output of a basic clock will create a pulse generator, and will pulse a single output every time the clock cycles through the set condition. Any output value can be used, either directly from the clock sequence (input-&amp;gt;output), a 1, or some value on a separate logic channel on the circuit network, such as set by a constant combinator. or by the circuit network.&amp;lt;br /&amp;gt;&lt;br /&gt;
[[File:PulseGen.png|500px]]&lt;br /&gt;
*&#039;&#039;The value 1 can be written as any positive integer, so long as it is within the cap or ceiling of your timer.&#039;&#039;&lt;br /&gt;
*&#039;&#039;As an example from the above timer, this light will pulse every 1st tick after the timer reaches 30 ticks, making it pulse 1/30th of a second, as Factorio updates at 60 times per second.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Counter ==&lt;br /&gt;
A counter is used to count the number of input events, and output the sum of that count. Any pulsing input into a decider combinator configured input -&amp;gt; output and wired between output and input will create a counter, but this input must be zero at all other times or else the combinator will run away like a clock. A pulse generator is normally used to accomplish this. Combining several gating decider isolators set with sequential conditionals, a clock, and a pulse generator to the input of a counter will allow remote polling and counting of each isolator&#039;s contents.&lt;br /&gt;
&lt;br /&gt;
== Logic Gates ==&lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;Unary NOT&#039;&#039;&#039;===&lt;br /&gt;
----&lt;br /&gt;
[[File:NOT.png|415px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;Binary OR&#039;&#039;&#039;===&lt;br /&gt;
----&lt;br /&gt;
[[File:OR.png|300px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 2!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1  || 1&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;*Deprecated: Use the Arithmetic Combinator&#039;s OR option instead.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;Binary NOR&#039;&#039;&#039;===&lt;br /&gt;
----&lt;br /&gt;
[[File:NOR.png|415px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 2!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;Binary XOR&#039;&#039;&#039;===&lt;br /&gt;
----&lt;br /&gt;
[[File:XOR.png|300px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 1!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 ||  0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 ||  1 || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 ||  0 || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 ||  1 || 0&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;*Deprecated: Use the Arithmetic Combinator&#039;s XOR option instead.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;Binary AND&#039;&#039;&#039;===&lt;br /&gt;
----&lt;br /&gt;
[[File:AND.png|530px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 2!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1 || 1&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;*Deprecated: Use the Arithmetic Combinator&#039;s AND option instead.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;Trinary AND&#039;&#039;&#039;===&lt;br /&gt;
----&lt;br /&gt;
[[File:TrinaryAND.png|415px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 2!!Input 3!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0  || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1  || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0  || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1  || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0  || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1  || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0  || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1  || 1  || 1&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;Binary NAND&#039;&#039;&#039;===&lt;br /&gt;
----&lt;br /&gt;
[[File:NAND.png|300px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 2!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;Binary XNOR/XAND&#039;&#039;&#039;===&lt;br /&gt;
----&lt;br /&gt;
[[File:XAND.png|300px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 2!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1  || 1&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Memory Cells ==&lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;Simple Latch&#039;&#039;&#039;===&lt;br /&gt;
&lt;br /&gt;
When looping the combinator to itself, use a different colour of wire from your main inputs or outputs. &lt;br /&gt;
&lt;br /&gt;
[[File:SimpleLatchv2.png|300px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Output 1!!Input 1!!Input 2!! Output 1 (t+1)&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 0 || 1&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0 || 0 || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1 || 0 || 1 &#039;&#039;(2)&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0 || 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1 || 1 || 1 &#039;&#039;(2)&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&#039;&#039;Output 1 is the green wire loop seen in the picture, it carries the value to latch.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Input 1 is Set, while Input 2 is Reset.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;Binary Cell&#039;&#039;&#039;===&lt;br /&gt;
&lt;br /&gt;
RS NOR Latch&lt;br /&gt;
[[File:RS-NOR.png|500px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;Advanced Cell&#039;&#039;&#039;===&lt;br /&gt;
&lt;br /&gt;
Cell for storing a positive value:&lt;br /&gt;
&lt;br /&gt;
[[File:AdvancedMemoryCell.png|500px]]&lt;br /&gt;
&lt;br /&gt;
Connect the desired value as signal 3 on the right side to set the memory cell and connect a negative value as signal 3 to reset the cell.  *Please note the arithmetic combinator&#039;s output should be facing the opposite direction of the decider combinators.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Address Enable Switch&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== See Also ==&lt;br /&gt;
*[http://www.factorioforums.com/forum/viewtopic.php?f=18&amp;amp;t=14556 Combinators 101 (Tutorial)]&lt;br /&gt;
*[[Arithmetic combinator]]&lt;br /&gt;
*[[Constant Combinator]]&lt;br /&gt;
*[[Decider Combinator]]&lt;br /&gt;
*[[Circuit network]]&lt;br /&gt;
*[[Circuit-network_Cookbook]]&lt;br /&gt;
[[Category:Tutorial]]&lt;br /&gt;
[[Category:English page]]&lt;/div&gt;</summary>
		<author><name>My3DS</name></author>
	</entry>
	<entry>
		<id>https://wiki.factorio.com/index.php?title=Tutorial:Combinator_tutorial&amp;diff=138359</id>
		<title>Tutorial:Combinator tutorial</title>
		<link rel="alternate" type="text/html" href="https://wiki.factorio.com/index.php?title=Tutorial:Combinator_tutorial&amp;diff=138359"/>
		<updated>2017-06-01T04:34:25Z</updated>

		<summary type="html">&lt;p&gt;My3DS: /* Binary OR */ spelling&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
Combinator logic is achieved by cross-connecting outputs to inputs in such a way to achieve the desired logic. While advanced logic requires a multitude of combinators, some very useful basic logic can be achieved using only a handful of combinators. &#039;&#039;&#039;Combinator logic works because Factorio only updates at 60 times per second, such that combinators analyze their logic in a step, and then sum and/or decide the resulting output values on the next step.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
When logic values are computed by combinators, the outputs are not recognized by the circuit network until the following step. So when a decider combinator is used to detect a certain input condition, it&#039;s output value will not take effect on the circuit network until the next step. &#039;&#039;&#039;This behavior is important to remember and can result in sequencing errors and significant delays when multiple combinators are connected in series.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Circuit wires act like a wire bus in electronics, it carries information in the connected wires, meaning that &#039;&#039;&#039;if there are similar signals on a wire, it will add them automatically, unless if it is a different signal, that means it will be carried in that wire as well, but as a different signal.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
When cross-connecting combinators &#039;&#039;&#039;it&#039;s good practice to use the unused color to cross-connect, this will split the input and output networks and prevent unwanted inputs from accidentally connecting to a larger circuit network.&#039;&#039;&#039; Combinators will sum the red &amp;amp;/or green inputs prior to calculation, so either color can be used when wiring the output back to the input, but in most cases, it is more useful to use the opposing colour of the wire so that it will not interfere with the resulting output and input.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;There is also an example heavy [[Circuit-network_Cookbook|circuit network cookbook]] that you may find helpful to learn and refer to about circuit networks.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Virtual Signals ==&lt;br /&gt;
&lt;br /&gt;
===Everything Wildcard:===&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
This Red Wildcard serves to check all the specifed input signals.&lt;br /&gt;
&lt;br /&gt;
As the Decider Combinator, &amp;lt;br /&amp;gt;&lt;br /&gt;
its input is used to serve if all inputs meets the specified signals or variables. &amp;lt;br /&amp;gt;&lt;br /&gt;
its output is used to serve output every signal. &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Side note: &amp;quot;Everything&amp;quot; outputs true by default even if there is no signal to guarantee if that is true. &#039;&#039;P(x) is true for all x; if x is neither true nor false&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
===Anything Wildcard:===&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
This Green Wildcard serves to check all the specifed input signals.&lt;br /&gt;
&lt;br /&gt;
As the Decider Combinator, &lt;br /&gt;
its input is used to serve if any of its inputs meets the specified signals or variables.&lt;br /&gt;
&lt;br /&gt;
Side note: &amp;quot;Anything&amp;quot; outputs false by default if there is no signal to guarantee if it is true. &#039;&#039;P(x) is false if any x is neither true or false.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
===Each Wildcard:===&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
This Yellow Wildcard serves to check for each the specifed input signals.&lt;br /&gt;
&lt;br /&gt;
As the Decider Combinator, &amp;lt;br /&amp;gt;&lt;br /&gt;
its input is used to serve if any inputs meets the specified signals or variables. &amp;lt;br /&amp;gt;&lt;br /&gt;
its output is used to serve output the each variable. &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As the Arithmetic Combinator, &amp;lt;br /&amp;gt;&lt;br /&gt;
its input is used to serve each input, then the following summations are summed and outputted, with each signal as its own respective signals.&lt;br /&gt;
&lt;br /&gt;
== Input Isolator &amp;amp; Gate ==&lt;br /&gt;
An arithmetic combinator set to (In: Each + 0, Out: Each) can be used to swap wire colors and as an isolator to prevent downstream logic from backfeeding into the circuit network&#039;s inputs.&lt;br /&gt;
&lt;br /&gt;
A decider combinator set to (Out: Everything, Input-&amp;gt; Output) will also function as an isolator as long as the set logic condition is true. This can also selectively pass or &#039;gate&#039; inputs only when desired. This could be used to sequentially poll remote train stations for their chest contents, and include only desired stations.&lt;br /&gt;
&lt;br /&gt;
== Set/Reset Latching Switch ==&lt;br /&gt;
You want something to SET a trigger at some quantity, but then STAY on until that quantity hits some other value, the RESET value. You&#039;ll need one decider combinator and one arithmetic combinator. Two decider combinators and a constant combinator can also be used for more complex multi-channel conditions.&lt;br /&gt;
&lt;br /&gt;
Setup the first decider combinator to the desired set conditional and to output a 1. Then connect the output to the input of an arithmetic combinator, and configure it to multiply by the bias value, the difference between the set and reset values, and wire the arithmetic output to the input of the decider. The arithmetic output channel MUST be set the same as the decider&#039;s input channel. That&#039;s it! Whenever your set conditional is reached, the decider will output a &#039;1&#039;, and the bias of the arithmetic combinator will be applied. This will &#039;hold&#039; the output true until the value goes back below the reset point.&lt;br /&gt;
&lt;br /&gt;
Here&#039;s a more specific example : &lt;br /&gt;
i want the pump to run when petrol reach 2000, and turn off when reach 200.&amp;lt;br&amp;gt;&lt;br /&gt;
only with green wire&amp;lt;br&amp;gt;&lt;br /&gt;
Tank -&amp;gt; in decider&amp;lt;br&amp;gt;&lt;br /&gt;
out decider-&amp;gt; in arithmetic&amp;lt;br&amp;gt;&lt;br /&gt;
out arithmetic -&amp;gt; in decider&amp;lt;br&amp;gt;&lt;br /&gt;
green wire from in decider, to pump&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Pump have the same condition as the decider (Petrol &amp;gt; 2000)&lt;br /&gt;
&lt;br /&gt;
Decider : Petrol &amp;gt; 2000&amp;lt;br&amp;gt;&lt;br /&gt;
out : A = 1&amp;lt;br&amp;gt;&lt;br /&gt;
Arithmetic : A x 1800 (2000 - 200 )&amp;lt;br&amp;gt;&lt;br /&gt;
out : petrol&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:Factorio combinator switch.png|620px]]&lt;br /&gt;
&lt;br /&gt;
== Comparing Outputs ==&lt;br /&gt;
&lt;br /&gt;
== Addressing Outposts ==&lt;br /&gt;
&lt;br /&gt;
== Smart Train Loading ==&lt;br /&gt;
&lt;br /&gt;
Initially designed by [https://www.youtube.com/user/Darkphade MadZuri],&lt;br /&gt;
&lt;br /&gt;
This solves the problem of loading logistics into chests, which tend to be unequal and is slower in the rate of loading logistics into the cargo of trains.&lt;br /&gt;
&lt;br /&gt;
To setup the design, you require an Arithmetic Combinator, as well as Red and Green wires. &#039;&#039;&#039;Wire all the chests used, to the input of the Arithmetic Combinator&#039;&#039;&#039;. &#039;&#039;&#039;Then write (Logistics Item / -Amount of chests) and as the output as the Logistics Item in the Arithmetic Combinator&#039;&#039;&#039;, this will average the amount of items within the chests. Lastly, &#039;&#039;&#039;wire all the inserters used to the output of the Arithmetic Combinator and have the other color of the wire be wired to the adjacent chest&#039;&#039;&#039;. &#039;&#039;&#039;Have the inserters enabled when Logistics Item &amp;lt; 1&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
A more visual representation as well as questions for the design can be found [https://www.reddit.com/r/factorio/comments/4e03g2/madzuris_smart_loading_train_station_guide/ here].&lt;br /&gt;
&lt;br /&gt;
Explanation of why this works:&lt;br /&gt;
It compares the average amount of total items within the chests and the chest adjacent to the inserter so that it activates when the average number of items is higher than the amount within the chest.&lt;br /&gt;
The reason for why the division denominator is negative is because if the items in the chests are 0, it basically makes it so that it adds 1 to the equation.&lt;br /&gt;
&lt;br /&gt;
== Oil Control ==&lt;br /&gt;
&lt;br /&gt;
== Memory ==&lt;br /&gt;
How to store a constant value for later use, either for a basic counter or for more advanced logic. A decider combinator wired output tied to input and configured greater than zero (for positive values), input -&amp;gt; output will &#039;hold&#039; a value, as long as all other inputs on the network are zero.&lt;br /&gt;
&lt;br /&gt;
Any non-zero input condition will create a basic clock; incrementing the stored value by the sum of all connected input values every cycle. A single pulse of an input will cause a single increment by the pulsed value. Reset to zero occurs whenever the set condition is no longer met, or if a negative pulse equal to the input occurs.&lt;br /&gt;
&lt;br /&gt;
== Basic Clocks ==&lt;br /&gt;
[[File:Timer.png|thumb|right|377px|A basic clock. 30 ticks is the ceiling for Signal 1; which is continuously added.]]&lt;br /&gt;
Clocks are constructed by having the output of a combinator tied back to its own input, such that every cycle advances its own count. Either the arithmetic combinator or the decider combinator can be used.&lt;br /&gt;
&lt;br /&gt;
An arithmetic combinator tied to itself is fun to watch and will happily run-away, but requires additional control logic to reset.&lt;br /&gt;
&lt;br /&gt;
A self-resetting clock requires just a single decider combinator with output wired to input and configured with Less Than (&amp;lt;) and Input -&amp;gt; Output. When a constant combinator is then connected to the input, every cycle it will count up by the value of the Constant Combinator until the set conditional value is reached, then output a zero which will be summed with the constant combinator, and reset the process.&lt;br /&gt;
&lt;br /&gt;
The clock sequence will not include zero, will begin at the value set by the constant combinator, and will include whatever value eventually causes the conditional to be false. An arithmetic combinator can modify the clock sequence but remember its outputs will occur one cycle later than the clock cycle values.&lt;br /&gt;
&lt;br /&gt;
A clock that only counts once can be built using the following setup:&lt;br /&gt;
&lt;br /&gt;
[[File:Onetime_Clock.png|thumb|none|360px|One-time clock. Runs until T=Z+1. Reset via R&amp;gt;0.]]&lt;br /&gt;
&lt;br /&gt;
== Pulse Generators ==&lt;br /&gt;
&lt;br /&gt;
Connecting an additional (=) decider combinator to the output of a basic clock will create a pulse generator, and will pulse a single output every time the clock cycles through the set condition. Any output value can be used, either directly from the clock sequence (input-&amp;gt;output), a 1, or some value on a separate logic channel on the circuit network, such as set by a constant combinator. or by the circuit network.&amp;lt;br /&amp;gt;&lt;br /&gt;
[[File:PulseGen.png|500px]]&lt;br /&gt;
*&#039;&#039;The value 1 can be written as any positive integer, so long as it is within the cap or ceiling of your timer.&#039;&#039;&lt;br /&gt;
*&#039;&#039;As an example from the above timer, this light will pulse every 1st tick after the timer reaches 30 ticks, making it pulse 1/30th of a second, as Factorio updates at 60 times per second.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Counter ==&lt;br /&gt;
A counter is used to count the number of input events, and output the sum of that count. Any pulsing input into a decider combinator configured input -&amp;gt; output and wired between output and input will create a counter, but this input must be zero at all other times or else the combinator will run away like a clock. A pulse generator is normally used to accomplish this. Combining several gating decider isolators set with sequential conditionals, a clock, and a pulse generator to the input of a counter will allow remote polling and counting of each isolator&#039;s contents.&lt;br /&gt;
&lt;br /&gt;
== Logic Gates ==&lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;Unary NOT&#039;&#039;&#039;===&lt;br /&gt;
----&lt;br /&gt;
[[File:NOT.png|415px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;Binary OR&#039;&#039;&#039;===&lt;br /&gt;
----&lt;br /&gt;
[[File:OR.png|300px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 2!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1  || 1&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;*Deprecated: Use the Arithmetic Combinator&#039;s OR option instead.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;Binary NOR&#039;&#039;&#039;===&lt;br /&gt;
----&lt;br /&gt;
[[File:NOR.png|415px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 2!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;Binary XOR&#039;&#039;&#039;===&lt;br /&gt;
----&lt;br /&gt;
[[File:XOR.png|300px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 1!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 ||  0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 ||  1 || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 ||  0 || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 ||  1 || 0&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;*Deprecated: Use the Arithmetic Combinator&#039;s XOR option instead.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;Binary AND&#039;&#039;&#039;===&lt;br /&gt;
----&lt;br /&gt;
[[File:AND.png|530px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 2!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1 || 1&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;*Deprecated: Use the Arithmetic Combinator&#039;s AND option instead.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;Trinary AND&#039;&#039;&#039;===&lt;br /&gt;
----&lt;br /&gt;
[[File:TrinaryAND.png|415px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 2!!Input 3!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0  || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1  || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0  || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1  || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0  || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1  || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0  || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1  || 1  || 1&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;Binary NAND&#039;&#039;&#039;===&lt;br /&gt;
----&lt;br /&gt;
[[File:NAND.png|300px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 2!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;Binary XNOR/XAND&#039;&#039;&#039;===&lt;br /&gt;
----&lt;br /&gt;
[[File:XAND.png|300px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 2!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1  || 1&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Memory Cells ==&lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;Simple Latch&#039;&#039;&#039;===&lt;br /&gt;
&lt;br /&gt;
When looping the combinator to itself, use a different colour of wire from your main inputs or outputs. &lt;br /&gt;
&lt;br /&gt;
[[File:SimpleLatchv2.png|300px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Output 1!!Input 1!!Input 2!! Output 1 (t+1)&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 0 || 1&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0 || 0 || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1 || 0 || 1 &#039;&#039;(2)&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0 || 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1 || 1 || 1 &#039;&#039;(2)&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&#039;&#039;Output 1 is the green wire loop seen in the picture, it carries the value to latch.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Input 1 is Set, while Input 2 is Reset.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;Binary Cell&#039;&#039;&#039;===&lt;br /&gt;
&lt;br /&gt;
RS NOR Latch&lt;br /&gt;
[[File:RS-NOR.png|500px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;Advanced Cell&#039;&#039;&#039;===&lt;br /&gt;
&lt;br /&gt;
Cell for storing a positive value:&lt;br /&gt;
&lt;br /&gt;
[[File:AdvancedMemoryCell.png|500px]]&lt;br /&gt;
&lt;br /&gt;
Connect the desired value as signal 3 on the right side to set the memory cell and connect a negative value as signal 3 to reset the cell.  *Please note the arithmetic combinator&#039;s output should be facing the opposite direction of the decider combinators.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Address Enable Switch&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== See Also ==&lt;br /&gt;
*[http://www.factorioforums.com/forum/viewtopic.php?f=18&amp;amp;t=14556 Combinators 101 (Tutorial)]&lt;br /&gt;
*[[Arithmetic combinator]]&lt;br /&gt;
*[[Constant Combinator]]&lt;br /&gt;
*[[Decider Combinator]]&lt;br /&gt;
*[[Circuit network]]&lt;br /&gt;
*[[Circuit-network_Cookbook]]&lt;br /&gt;
[[Category:Tutorial]]&lt;br /&gt;
[[Category:English page]]&lt;/div&gt;</summary>
		<author><name>My3DS</name></author>
	</entry>
	<entry>
		<id>https://wiki.factorio.com/index.php?title=Tutorial:Combinator_tutorial&amp;diff=138358</id>
		<title>Tutorial:Combinator tutorial</title>
		<link rel="alternate" type="text/html" href="https://wiki.factorio.com/index.php?title=Tutorial:Combinator_tutorial&amp;diff=138358"/>
		<updated>2017-06-01T04:33:55Z</updated>

		<summary type="html">&lt;p&gt;My3DS: /* Binary XOR */ spelling&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
Combinator logic is achieved by cross-connecting outputs to inputs in such a way to achieve the desired logic. While advanced logic requires a multitude of combinators, some very useful basic logic can be achieved using only a handful of combinators. &#039;&#039;&#039;Combinator logic works because Factorio only updates at 60 times per second, such that combinators analyze their logic in a step, and then sum and/or decide the resulting output values on the next step.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
When logic values are computed by combinators, the outputs are not recognized by the circuit network until the following step. So when a decider combinator is used to detect a certain input condition, it&#039;s output value will not take effect on the circuit network until the next step. &#039;&#039;&#039;This behavior is important to remember and can result in sequencing errors and significant delays when multiple combinators are connected in series.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Circuit wires act like a wire bus in electronics, it carries information in the connected wires, meaning that &#039;&#039;&#039;if there are similar signals on a wire, it will add them automatically, unless if it is a different signal, that means it will be carried in that wire as well, but as a different signal.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
When cross-connecting combinators &#039;&#039;&#039;it&#039;s good practice to use the unused color to cross-connect, this will split the input and output networks and prevent unwanted inputs from accidentally connecting to a larger circuit network.&#039;&#039;&#039; Combinators will sum the red &amp;amp;/or green inputs prior to calculation, so either color can be used when wiring the output back to the input, but in most cases, it is more useful to use the opposing colour of the wire so that it will not interfere with the resulting output and input.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;There is also an example heavy [[Circuit-network_Cookbook|circuit network cookbook]] that you may find helpful to learn and refer to about circuit networks.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Virtual Signals ==&lt;br /&gt;
&lt;br /&gt;
===Everything Wildcard:===&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
This Red Wildcard serves to check all the specifed input signals.&lt;br /&gt;
&lt;br /&gt;
As the Decider Combinator, &amp;lt;br /&amp;gt;&lt;br /&gt;
its input is used to serve if all inputs meets the specified signals or variables. &amp;lt;br /&amp;gt;&lt;br /&gt;
its output is used to serve output every signal. &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Side note: &amp;quot;Everything&amp;quot; outputs true by default even if there is no signal to guarantee if that is true. &#039;&#039;P(x) is true for all x; if x is neither true nor false&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
===Anything Wildcard:===&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
This Green Wildcard serves to check all the specifed input signals.&lt;br /&gt;
&lt;br /&gt;
As the Decider Combinator, &lt;br /&gt;
its input is used to serve if any of its inputs meets the specified signals or variables.&lt;br /&gt;
&lt;br /&gt;
Side note: &amp;quot;Anything&amp;quot; outputs false by default if there is no signal to guarantee if it is true. &#039;&#039;P(x) is false if any x is neither true or false.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
===Each Wildcard:===&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
This Yellow Wildcard serves to check for each the specifed input signals.&lt;br /&gt;
&lt;br /&gt;
As the Decider Combinator, &amp;lt;br /&amp;gt;&lt;br /&gt;
its input is used to serve if any inputs meets the specified signals or variables. &amp;lt;br /&amp;gt;&lt;br /&gt;
its output is used to serve output the each variable. &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As the Arithmetic Combinator, &amp;lt;br /&amp;gt;&lt;br /&gt;
its input is used to serve each input, then the following summations are summed and outputted, with each signal as its own respective signals.&lt;br /&gt;
&lt;br /&gt;
== Input Isolator &amp;amp; Gate ==&lt;br /&gt;
An arithmetic combinator set to (In: Each + 0, Out: Each) can be used to swap wire colors and as an isolator to prevent downstream logic from backfeeding into the circuit network&#039;s inputs.&lt;br /&gt;
&lt;br /&gt;
A decider combinator set to (Out: Everything, Input-&amp;gt; Output) will also function as an isolator as long as the set logic condition is true. This can also selectively pass or &#039;gate&#039; inputs only when desired. This could be used to sequentially poll remote train stations for their chest contents, and include only desired stations.&lt;br /&gt;
&lt;br /&gt;
== Set/Reset Latching Switch ==&lt;br /&gt;
You want something to SET a trigger at some quantity, but then STAY on until that quantity hits some other value, the RESET value. You&#039;ll need one decider combinator and one arithmetic combinator. Two decider combinators and a constant combinator can also be used for more complex multi-channel conditions.&lt;br /&gt;
&lt;br /&gt;
Setup the first decider combinator to the desired set conditional and to output a 1. Then connect the output to the input of an arithmetic combinator, and configure it to multiply by the bias value, the difference between the set and reset values, and wire the arithmetic output to the input of the decider. The arithmetic output channel MUST be set the same as the decider&#039;s input channel. That&#039;s it! Whenever your set conditional is reached, the decider will output a &#039;1&#039;, and the bias of the arithmetic combinator will be applied. This will &#039;hold&#039; the output true until the value goes back below the reset point.&lt;br /&gt;
&lt;br /&gt;
Here&#039;s a more specific example : &lt;br /&gt;
i want the pump to run when petrol reach 2000, and turn off when reach 200.&amp;lt;br&amp;gt;&lt;br /&gt;
only with green wire&amp;lt;br&amp;gt;&lt;br /&gt;
Tank -&amp;gt; in decider&amp;lt;br&amp;gt;&lt;br /&gt;
out decider-&amp;gt; in arithmetic&amp;lt;br&amp;gt;&lt;br /&gt;
out arithmetic -&amp;gt; in decider&amp;lt;br&amp;gt;&lt;br /&gt;
green wire from in decider, to pump&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Pump have the same condition as the decider (Petrol &amp;gt; 2000)&lt;br /&gt;
&lt;br /&gt;
Decider : Petrol &amp;gt; 2000&amp;lt;br&amp;gt;&lt;br /&gt;
out : A = 1&amp;lt;br&amp;gt;&lt;br /&gt;
Arithmetic : A x 1800 (2000 - 200 )&amp;lt;br&amp;gt;&lt;br /&gt;
out : petrol&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:Factorio combinator switch.png|620px]]&lt;br /&gt;
&lt;br /&gt;
== Comparing Outputs ==&lt;br /&gt;
&lt;br /&gt;
== Addressing Outposts ==&lt;br /&gt;
&lt;br /&gt;
== Smart Train Loading ==&lt;br /&gt;
&lt;br /&gt;
Initially designed by [https://www.youtube.com/user/Darkphade MadZuri],&lt;br /&gt;
&lt;br /&gt;
This solves the problem of loading logistics into chests, which tend to be unequal and is slower in the rate of loading logistics into the cargo of trains.&lt;br /&gt;
&lt;br /&gt;
To setup the design, you require an Arithmetic Combinator, as well as Red and Green wires. &#039;&#039;&#039;Wire all the chests used, to the input of the Arithmetic Combinator&#039;&#039;&#039;. &#039;&#039;&#039;Then write (Logistics Item / -Amount of chests) and as the output as the Logistics Item in the Arithmetic Combinator&#039;&#039;&#039;, this will average the amount of items within the chests. Lastly, &#039;&#039;&#039;wire all the inserters used to the output of the Arithmetic Combinator and have the other color of the wire be wired to the adjacent chest&#039;&#039;&#039;. &#039;&#039;&#039;Have the inserters enabled when Logistics Item &amp;lt; 1&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
A more visual representation as well as questions for the design can be found [https://www.reddit.com/r/factorio/comments/4e03g2/madzuris_smart_loading_train_station_guide/ here].&lt;br /&gt;
&lt;br /&gt;
Explanation of why this works:&lt;br /&gt;
It compares the average amount of total items within the chests and the chest adjacent to the inserter so that it activates when the average number of items is higher than the amount within the chest.&lt;br /&gt;
The reason for why the division denominator is negative is because if the items in the chests are 0, it basically makes it so that it adds 1 to the equation.&lt;br /&gt;
&lt;br /&gt;
== Oil Control ==&lt;br /&gt;
&lt;br /&gt;
== Memory ==&lt;br /&gt;
How to store a constant value for later use, either for a basic counter or for more advanced logic. A decider combinator wired output tied to input and configured greater than zero (for positive values), input -&amp;gt; output will &#039;hold&#039; a value, as long as all other inputs on the network are zero.&lt;br /&gt;
&lt;br /&gt;
Any non-zero input condition will create a basic clock; incrementing the stored value by the sum of all connected input values every cycle. A single pulse of an input will cause a single increment by the pulsed value. Reset to zero occurs whenever the set condition is no longer met, or if a negative pulse equal to the input occurs.&lt;br /&gt;
&lt;br /&gt;
== Basic Clocks ==&lt;br /&gt;
[[File:Timer.png|thumb|right|377px|A basic clock. 30 ticks is the ceiling for Signal 1; which is continuously added.]]&lt;br /&gt;
Clocks are constructed by having the output of a combinator tied back to its own input, such that every cycle advances its own count. Either the arithmetic combinator or the decider combinator can be used.&lt;br /&gt;
&lt;br /&gt;
An arithmetic combinator tied to itself is fun to watch and will happily run-away, but requires additional control logic to reset.&lt;br /&gt;
&lt;br /&gt;
A self-resetting clock requires just a single decider combinator with output wired to input and configured with Less Than (&amp;lt;) and Input -&amp;gt; Output. When a constant combinator is then connected to the input, every cycle it will count up by the value of the Constant Combinator until the set conditional value is reached, then output a zero which will be summed with the constant combinator, and reset the process.&lt;br /&gt;
&lt;br /&gt;
The clock sequence will not include zero, will begin at the value set by the constant combinator, and will include whatever value eventually causes the conditional to be false. An arithmetic combinator can modify the clock sequence but remember its outputs will occur one cycle later than the clock cycle values.&lt;br /&gt;
&lt;br /&gt;
A clock that only counts once can be built using the following setup:&lt;br /&gt;
&lt;br /&gt;
[[File:Onetime_Clock.png|thumb|none|360px|One-time clock. Runs until T=Z+1. Reset via R&amp;gt;0.]]&lt;br /&gt;
&lt;br /&gt;
== Pulse Generators ==&lt;br /&gt;
&lt;br /&gt;
Connecting an additional (=) decider combinator to the output of a basic clock will create a pulse generator, and will pulse a single output every time the clock cycles through the set condition. Any output value can be used, either directly from the clock sequence (input-&amp;gt;output), a 1, or some value on a separate logic channel on the circuit network, such as set by a constant combinator. or by the circuit network.&amp;lt;br /&amp;gt;&lt;br /&gt;
[[File:PulseGen.png|500px]]&lt;br /&gt;
*&#039;&#039;The value 1 can be written as any positive integer, so long as it is within the cap or ceiling of your timer.&#039;&#039;&lt;br /&gt;
*&#039;&#039;As an example from the above timer, this light will pulse every 1st tick after the timer reaches 30 ticks, making it pulse 1/30th of a second, as Factorio updates at 60 times per second.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Counter ==&lt;br /&gt;
A counter is used to count the number of input events, and output the sum of that count. Any pulsing input into a decider combinator configured input -&amp;gt; output and wired between output and input will create a counter, but this input must be zero at all other times or else the combinator will run away like a clock. A pulse generator is normally used to accomplish this. Combining several gating decider isolators set with sequential conditionals, a clock, and a pulse generator to the input of a counter will allow remote polling and counting of each isolator&#039;s contents.&lt;br /&gt;
&lt;br /&gt;
== Logic Gates ==&lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;Unary NOT&#039;&#039;&#039;===&lt;br /&gt;
----&lt;br /&gt;
[[File:NOT.png|415px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;Binary OR&#039;&#039;&#039;===&lt;br /&gt;
----&lt;br /&gt;
[[File:OR.png|300px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 2!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1  || 1&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;*Deprecated: Use the Arithemetic Combinator&#039;s OR option instead.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;Binary NOR&#039;&#039;&#039;===&lt;br /&gt;
----&lt;br /&gt;
[[File:NOR.png|415px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 2!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;Binary XOR&#039;&#039;&#039;===&lt;br /&gt;
----&lt;br /&gt;
[[File:XOR.png|300px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 1!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 ||  0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 ||  1 || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 ||  0 || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 ||  1 || 0&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;*Deprecated: Use the Arithmetic Combinator&#039;s XOR option instead.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;Binary AND&#039;&#039;&#039;===&lt;br /&gt;
----&lt;br /&gt;
[[File:AND.png|530px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 2!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1 || 1&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;*Deprecated: Use the Arithmetic Combinator&#039;s AND option instead.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;Trinary AND&#039;&#039;&#039;===&lt;br /&gt;
----&lt;br /&gt;
[[File:TrinaryAND.png|415px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 2!!Input 3!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0  || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1  || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0  || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1  || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0  || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1  || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0  || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1  || 1  || 1&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;Binary NAND&#039;&#039;&#039;===&lt;br /&gt;
----&lt;br /&gt;
[[File:NAND.png|300px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 2!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;Binary XNOR/XAND&#039;&#039;&#039;===&lt;br /&gt;
----&lt;br /&gt;
[[File:XAND.png|300px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 2!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1  || 1&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Memory Cells ==&lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;Simple Latch&#039;&#039;&#039;===&lt;br /&gt;
&lt;br /&gt;
When looping the combinator to itself, use a different colour of wire from your main inputs or outputs. &lt;br /&gt;
&lt;br /&gt;
[[File:SimpleLatchv2.png|300px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Output 1!!Input 1!!Input 2!! Output 1 (t+1)&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 0 || 1&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0 || 0 || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1 || 0 || 1 &#039;&#039;(2)&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0 || 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1 || 1 || 1 &#039;&#039;(2)&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&#039;&#039;Output 1 is the green wire loop seen in the picture, it carries the value to latch.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Input 1 is Set, while Input 2 is Reset.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;Binary Cell&#039;&#039;&#039;===&lt;br /&gt;
&lt;br /&gt;
RS NOR Latch&lt;br /&gt;
[[File:RS-NOR.png|500px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;Advanced Cell&#039;&#039;&#039;===&lt;br /&gt;
&lt;br /&gt;
Cell for storing a positive value:&lt;br /&gt;
&lt;br /&gt;
[[File:AdvancedMemoryCell.png|500px]]&lt;br /&gt;
&lt;br /&gt;
Connect the desired value as signal 3 on the right side to set the memory cell and connect a negative value as signal 3 to reset the cell.  *Please note the arithmetic combinator&#039;s output should be facing the opposite direction of the decider combinators.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Address Enable Switch&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== See Also ==&lt;br /&gt;
*[http://www.factorioforums.com/forum/viewtopic.php?f=18&amp;amp;t=14556 Combinators 101 (Tutorial)]&lt;br /&gt;
*[[Arithmetic combinator]]&lt;br /&gt;
*[[Constant Combinator]]&lt;br /&gt;
*[[Decider Combinator]]&lt;br /&gt;
*[[Circuit network]]&lt;br /&gt;
*[[Circuit-network_Cookbook]]&lt;br /&gt;
[[Category:Tutorial]]&lt;br /&gt;
[[Category:English page]]&lt;/div&gt;</summary>
		<author><name>My3DS</name></author>
	</entry>
	<entry>
		<id>https://wiki.factorio.com/index.php?title=Tutorial:Combinator_tutorial&amp;diff=138357</id>
		<title>Tutorial:Combinator tutorial</title>
		<link rel="alternate" type="text/html" href="https://wiki.factorio.com/index.php?title=Tutorial:Combinator_tutorial&amp;diff=138357"/>
		<updated>2017-06-01T04:33:36Z</updated>

		<summary type="html">&lt;p&gt;My3DS: /* Binary AND */ spelling&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
Combinator logic is achieved by cross-connecting outputs to inputs in such a way to achieve the desired logic. While advanced logic requires a multitude of combinators, some very useful basic logic can be achieved using only a handful of combinators. &#039;&#039;&#039;Combinator logic works because Factorio only updates at 60 times per second, such that combinators analyze their logic in a step, and then sum and/or decide the resulting output values on the next step.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
When logic values are computed by combinators, the outputs are not recognized by the circuit network until the following step. So when a decider combinator is used to detect a certain input condition, it&#039;s output value will not take effect on the circuit network until the next step. &#039;&#039;&#039;This behavior is important to remember and can result in sequencing errors and significant delays when multiple combinators are connected in series.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Circuit wires act like a wire bus in electronics, it carries information in the connected wires, meaning that &#039;&#039;&#039;if there are similar signals on a wire, it will add them automatically, unless if it is a different signal, that means it will be carried in that wire as well, but as a different signal.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
When cross-connecting combinators &#039;&#039;&#039;it&#039;s good practice to use the unused color to cross-connect, this will split the input and output networks and prevent unwanted inputs from accidentally connecting to a larger circuit network.&#039;&#039;&#039; Combinators will sum the red &amp;amp;/or green inputs prior to calculation, so either color can be used when wiring the output back to the input, but in most cases, it is more useful to use the opposing colour of the wire so that it will not interfere with the resulting output and input.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;There is also an example heavy [[Circuit-network_Cookbook|circuit network cookbook]] that you may find helpful to learn and refer to about circuit networks.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Virtual Signals ==&lt;br /&gt;
&lt;br /&gt;
===Everything Wildcard:===&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
This Red Wildcard serves to check all the specifed input signals.&lt;br /&gt;
&lt;br /&gt;
As the Decider Combinator, &amp;lt;br /&amp;gt;&lt;br /&gt;
its input is used to serve if all inputs meets the specified signals or variables. &amp;lt;br /&amp;gt;&lt;br /&gt;
its output is used to serve output every signal. &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Side note: &amp;quot;Everything&amp;quot; outputs true by default even if there is no signal to guarantee if that is true. &#039;&#039;P(x) is true for all x; if x is neither true nor false&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
===Anything Wildcard:===&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
This Green Wildcard serves to check all the specifed input signals.&lt;br /&gt;
&lt;br /&gt;
As the Decider Combinator, &lt;br /&gt;
its input is used to serve if any of its inputs meets the specified signals or variables.&lt;br /&gt;
&lt;br /&gt;
Side note: &amp;quot;Anything&amp;quot; outputs false by default if there is no signal to guarantee if it is true. &#039;&#039;P(x) is false if any x is neither true or false.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
===Each Wildcard:===&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
This Yellow Wildcard serves to check for each the specifed input signals.&lt;br /&gt;
&lt;br /&gt;
As the Decider Combinator, &amp;lt;br /&amp;gt;&lt;br /&gt;
its input is used to serve if any inputs meets the specified signals or variables. &amp;lt;br /&amp;gt;&lt;br /&gt;
its output is used to serve output the each variable. &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As the Arithmetic Combinator, &amp;lt;br /&amp;gt;&lt;br /&gt;
its input is used to serve each input, then the following summations are summed and outputted, with each signal as its own respective signals.&lt;br /&gt;
&lt;br /&gt;
== Input Isolator &amp;amp; Gate ==&lt;br /&gt;
An arithmetic combinator set to (In: Each + 0, Out: Each) can be used to swap wire colors and as an isolator to prevent downstream logic from backfeeding into the circuit network&#039;s inputs.&lt;br /&gt;
&lt;br /&gt;
A decider combinator set to (Out: Everything, Input-&amp;gt; Output) will also function as an isolator as long as the set logic condition is true. This can also selectively pass or &#039;gate&#039; inputs only when desired. This could be used to sequentially poll remote train stations for their chest contents, and include only desired stations.&lt;br /&gt;
&lt;br /&gt;
== Set/Reset Latching Switch ==&lt;br /&gt;
You want something to SET a trigger at some quantity, but then STAY on until that quantity hits some other value, the RESET value. You&#039;ll need one decider combinator and one arithmetic combinator. Two decider combinators and a constant combinator can also be used for more complex multi-channel conditions.&lt;br /&gt;
&lt;br /&gt;
Setup the first decider combinator to the desired set conditional and to output a 1. Then connect the output to the input of an arithmetic combinator, and configure it to multiply by the bias value, the difference between the set and reset values, and wire the arithmetic output to the input of the decider. The arithmetic output channel MUST be set the same as the decider&#039;s input channel. That&#039;s it! Whenever your set conditional is reached, the decider will output a &#039;1&#039;, and the bias of the arithmetic combinator will be applied. This will &#039;hold&#039; the output true until the value goes back below the reset point.&lt;br /&gt;
&lt;br /&gt;
Here&#039;s a more specific example : &lt;br /&gt;
i want the pump to run when petrol reach 2000, and turn off when reach 200.&amp;lt;br&amp;gt;&lt;br /&gt;
only with green wire&amp;lt;br&amp;gt;&lt;br /&gt;
Tank -&amp;gt; in decider&amp;lt;br&amp;gt;&lt;br /&gt;
out decider-&amp;gt; in arithmetic&amp;lt;br&amp;gt;&lt;br /&gt;
out arithmetic -&amp;gt; in decider&amp;lt;br&amp;gt;&lt;br /&gt;
green wire from in decider, to pump&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Pump have the same condition as the decider (Petrol &amp;gt; 2000)&lt;br /&gt;
&lt;br /&gt;
Decider : Petrol &amp;gt; 2000&amp;lt;br&amp;gt;&lt;br /&gt;
out : A = 1&amp;lt;br&amp;gt;&lt;br /&gt;
Arithmetic : A x 1800 (2000 - 200 )&amp;lt;br&amp;gt;&lt;br /&gt;
out : petrol&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:Factorio combinator switch.png|620px]]&lt;br /&gt;
&lt;br /&gt;
== Comparing Outputs ==&lt;br /&gt;
&lt;br /&gt;
== Addressing Outposts ==&lt;br /&gt;
&lt;br /&gt;
== Smart Train Loading ==&lt;br /&gt;
&lt;br /&gt;
Initially designed by [https://www.youtube.com/user/Darkphade MadZuri],&lt;br /&gt;
&lt;br /&gt;
This solves the problem of loading logistics into chests, which tend to be unequal and is slower in the rate of loading logistics into the cargo of trains.&lt;br /&gt;
&lt;br /&gt;
To setup the design, you require an Arithmetic Combinator, as well as Red and Green wires. &#039;&#039;&#039;Wire all the chests used, to the input of the Arithmetic Combinator&#039;&#039;&#039;. &#039;&#039;&#039;Then write (Logistics Item / -Amount of chests) and as the output as the Logistics Item in the Arithmetic Combinator&#039;&#039;&#039;, this will average the amount of items within the chests. Lastly, &#039;&#039;&#039;wire all the inserters used to the output of the Arithmetic Combinator and have the other color of the wire be wired to the adjacent chest&#039;&#039;&#039;. &#039;&#039;&#039;Have the inserters enabled when Logistics Item &amp;lt; 1&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
A more visual representation as well as questions for the design can be found [https://www.reddit.com/r/factorio/comments/4e03g2/madzuris_smart_loading_train_station_guide/ here].&lt;br /&gt;
&lt;br /&gt;
Explanation of why this works:&lt;br /&gt;
It compares the average amount of total items within the chests and the chest adjacent to the inserter so that it activates when the average number of items is higher than the amount within the chest.&lt;br /&gt;
The reason for why the division denominator is negative is because if the items in the chests are 0, it basically makes it so that it adds 1 to the equation.&lt;br /&gt;
&lt;br /&gt;
== Oil Control ==&lt;br /&gt;
&lt;br /&gt;
== Memory ==&lt;br /&gt;
How to store a constant value for later use, either for a basic counter or for more advanced logic. A decider combinator wired output tied to input and configured greater than zero (for positive values), input -&amp;gt; output will &#039;hold&#039; a value, as long as all other inputs on the network are zero.&lt;br /&gt;
&lt;br /&gt;
Any non-zero input condition will create a basic clock; incrementing the stored value by the sum of all connected input values every cycle. A single pulse of an input will cause a single increment by the pulsed value. Reset to zero occurs whenever the set condition is no longer met, or if a negative pulse equal to the input occurs.&lt;br /&gt;
&lt;br /&gt;
== Basic Clocks ==&lt;br /&gt;
[[File:Timer.png|thumb|right|377px|A basic clock. 30 ticks is the ceiling for Signal 1; which is continuously added.]]&lt;br /&gt;
Clocks are constructed by having the output of a combinator tied back to its own input, such that every cycle advances its own count. Either the arithmetic combinator or the decider combinator can be used.&lt;br /&gt;
&lt;br /&gt;
An arithmetic combinator tied to itself is fun to watch and will happily run-away, but requires additional control logic to reset.&lt;br /&gt;
&lt;br /&gt;
A self-resetting clock requires just a single decider combinator with output wired to input and configured with Less Than (&amp;lt;) and Input -&amp;gt; Output. When a constant combinator is then connected to the input, every cycle it will count up by the value of the Constant Combinator until the set conditional value is reached, then output a zero which will be summed with the constant combinator, and reset the process.&lt;br /&gt;
&lt;br /&gt;
The clock sequence will not include zero, will begin at the value set by the constant combinator, and will include whatever value eventually causes the conditional to be false. An arithmetic combinator can modify the clock sequence but remember its outputs will occur one cycle later than the clock cycle values.&lt;br /&gt;
&lt;br /&gt;
A clock that only counts once can be built using the following setup:&lt;br /&gt;
&lt;br /&gt;
[[File:Onetime_Clock.png|thumb|none|360px|One-time clock. Runs until T=Z+1. Reset via R&amp;gt;0.]]&lt;br /&gt;
&lt;br /&gt;
== Pulse Generators ==&lt;br /&gt;
&lt;br /&gt;
Connecting an additional (=) decider combinator to the output of a basic clock will create a pulse generator, and will pulse a single output every time the clock cycles through the set condition. Any output value can be used, either directly from the clock sequence (input-&amp;gt;output), a 1, or some value on a separate logic channel on the circuit network, such as set by a constant combinator. or by the circuit network.&amp;lt;br /&amp;gt;&lt;br /&gt;
[[File:PulseGen.png|500px]]&lt;br /&gt;
*&#039;&#039;The value 1 can be written as any positive integer, so long as it is within the cap or ceiling of your timer.&#039;&#039;&lt;br /&gt;
*&#039;&#039;As an example from the above timer, this light will pulse every 1st tick after the timer reaches 30 ticks, making it pulse 1/30th of a second, as Factorio updates at 60 times per second.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Counter ==&lt;br /&gt;
A counter is used to count the number of input events, and output the sum of that count. Any pulsing input into a decider combinator configured input -&amp;gt; output and wired between output and input will create a counter, but this input must be zero at all other times or else the combinator will run away like a clock. A pulse generator is normally used to accomplish this. Combining several gating decider isolators set with sequential conditionals, a clock, and a pulse generator to the input of a counter will allow remote polling and counting of each isolator&#039;s contents.&lt;br /&gt;
&lt;br /&gt;
== Logic Gates ==&lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;Unary NOT&#039;&#039;&#039;===&lt;br /&gt;
----&lt;br /&gt;
[[File:NOT.png|415px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;Binary OR&#039;&#039;&#039;===&lt;br /&gt;
----&lt;br /&gt;
[[File:OR.png|300px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 2!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1  || 1&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;*Deprecated: Use the Arithemetic Combinator&#039;s OR option instead.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;Binary NOR&#039;&#039;&#039;===&lt;br /&gt;
----&lt;br /&gt;
[[File:NOR.png|415px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 2!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;Binary XOR&#039;&#039;&#039;===&lt;br /&gt;
----&lt;br /&gt;
[[File:XOR.png|300px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 1!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 ||  0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 ||  1 || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 ||  0 || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 ||  1 || 0&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;*Deprecated: Use the Arithemetic Combinator&#039;s XOR option instead.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;Binary AND&#039;&#039;&#039;===&lt;br /&gt;
----&lt;br /&gt;
[[File:AND.png|530px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 2!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1 || 1&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;*Deprecated: Use the Arithmetic Combinator&#039;s AND option instead.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;Trinary AND&#039;&#039;&#039;===&lt;br /&gt;
----&lt;br /&gt;
[[File:TrinaryAND.png|415px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 2!!Input 3!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0  || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1  || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0  || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1  || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0  || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1  || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0  || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1  || 1  || 1&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;Binary NAND&#039;&#039;&#039;===&lt;br /&gt;
----&lt;br /&gt;
[[File:NAND.png|300px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 2!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;Binary XNOR/XAND&#039;&#039;&#039;===&lt;br /&gt;
----&lt;br /&gt;
[[File:XAND.png|300px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 2!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1  || 1&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Memory Cells ==&lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;Simple Latch&#039;&#039;&#039;===&lt;br /&gt;
&lt;br /&gt;
When looping the combinator to itself, use a different colour of wire from your main inputs or outputs. &lt;br /&gt;
&lt;br /&gt;
[[File:SimpleLatchv2.png|300px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Output 1!!Input 1!!Input 2!! Output 1 (t+1)&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 0 || 1&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0 || 0 || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1 || 0 || 1 &#039;&#039;(2)&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0 || 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1 || 1 || 1 &#039;&#039;(2)&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&#039;&#039;Output 1 is the green wire loop seen in the picture, it carries the value to latch.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Input 1 is Set, while Input 2 is Reset.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;Binary Cell&#039;&#039;&#039;===&lt;br /&gt;
&lt;br /&gt;
RS NOR Latch&lt;br /&gt;
[[File:RS-NOR.png|500px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;Advanced Cell&#039;&#039;&#039;===&lt;br /&gt;
&lt;br /&gt;
Cell for storing a positive value:&lt;br /&gt;
&lt;br /&gt;
[[File:AdvancedMemoryCell.png|500px]]&lt;br /&gt;
&lt;br /&gt;
Connect the desired value as signal 3 on the right side to set the memory cell and connect a negative value as signal 3 to reset the cell.  *Please note the arithmetic combinator&#039;s output should be facing the opposite direction of the decider combinators.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Address Enable Switch&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== See Also ==&lt;br /&gt;
*[http://www.factorioforums.com/forum/viewtopic.php?f=18&amp;amp;t=14556 Combinators 101 (Tutorial)]&lt;br /&gt;
*[[Arithmetic combinator]]&lt;br /&gt;
*[[Constant Combinator]]&lt;br /&gt;
*[[Decider Combinator]]&lt;br /&gt;
*[[Circuit network]]&lt;br /&gt;
*[[Circuit-network_Cookbook]]&lt;br /&gt;
[[Category:Tutorial]]&lt;br /&gt;
[[Category:English page]]&lt;/div&gt;</summary>
		<author><name>My3DS</name></author>
	</entry>
	<entry>
		<id>https://wiki.factorio.com/index.php?title=Tutorial:Combinator_tutorial&amp;diff=138356</id>
		<title>Tutorial:Combinator tutorial</title>
		<link rel="alternate" type="text/html" href="https://wiki.factorio.com/index.php?title=Tutorial:Combinator_tutorial&amp;diff=138356"/>
		<updated>2017-06-01T04:31:42Z</updated>

		<summary type="html">&lt;p&gt;My3DS: /* Everything Wildcard: */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
Combinator logic is achieved by cross-connecting outputs to inputs in such a way to achieve the desired logic. While advanced logic requires a multitude of combinators, some very useful basic logic can be achieved using only a handful of combinators. &#039;&#039;&#039;Combinator logic works because Factorio only updates at 60 times per second, such that combinators analyze their logic in a step, and then sum and/or decide the resulting output values on the next step.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
When logic values are computed by combinators, the outputs are not recognized by the circuit network until the following step. So when a decider combinator is used to detect a certain input condition, it&#039;s output value will not take effect on the circuit network until the next step. &#039;&#039;&#039;This behavior is important to remember and can result in sequencing errors and significant delays when multiple combinators are connected in series.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Circuit wires act like a wire bus in electronics, it carries information in the connected wires, meaning that &#039;&#039;&#039;if there are similar signals on a wire, it will add them automatically, unless if it is a different signal, that means it will be carried in that wire as well, but as a different signal.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
When cross-connecting combinators &#039;&#039;&#039;it&#039;s good practice to use the unused color to cross-connect, this will split the input and output networks and prevent unwanted inputs from accidentally connecting to a larger circuit network.&#039;&#039;&#039; Combinators will sum the red &amp;amp;/or green inputs prior to calculation, so either color can be used when wiring the output back to the input, but in most cases, it is more useful to use the opposing colour of the wire so that it will not interfere with the resulting output and input.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;There is also an example heavy [[Circuit-network_Cookbook|circuit network cookbook]] that you may find helpful to learn and refer to about circuit networks.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Virtual Signals ==&lt;br /&gt;
&lt;br /&gt;
===Everything Wildcard:===&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
This Red Wildcard serves to check all the specifed input signals.&lt;br /&gt;
&lt;br /&gt;
As the Decider Combinator, &amp;lt;br /&amp;gt;&lt;br /&gt;
its input is used to serve if all inputs meets the specified signals or variables. &amp;lt;br /&amp;gt;&lt;br /&gt;
its output is used to serve output every signal. &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Side note: &amp;quot;Everything&amp;quot; outputs true by default even if there is no signal to guarantee if that is true. &#039;&#039;P(x) is true for all x; if x is neither true nor false&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
===Anything Wildcard:===&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
This Green Wildcard serves to check all the specifed input signals.&lt;br /&gt;
&lt;br /&gt;
As the Decider Combinator, &lt;br /&gt;
its input is used to serve if any of its inputs meets the specified signals or variables.&lt;br /&gt;
&lt;br /&gt;
Side note: &amp;quot;Anything&amp;quot; outputs false by default if there is no signal to guarantee if it is true. &#039;&#039;P(x) is false if any x is neither true or false.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
===Each Wildcard:===&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
This Yellow Wildcard serves to check for each the specifed input signals.&lt;br /&gt;
&lt;br /&gt;
As the Decider Combinator, &amp;lt;br /&amp;gt;&lt;br /&gt;
its input is used to serve if any inputs meets the specified signals or variables. &amp;lt;br /&amp;gt;&lt;br /&gt;
its output is used to serve output the each variable. &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As the Arithmetic Combinator, &amp;lt;br /&amp;gt;&lt;br /&gt;
its input is used to serve each input, then the following summations are summed and outputted, with each signal as its own respective signals.&lt;br /&gt;
&lt;br /&gt;
== Input Isolator &amp;amp; Gate ==&lt;br /&gt;
An arithmetic combinator set to (In: Each + 0, Out: Each) can be used to swap wire colors and as an isolator to prevent downstream logic from backfeeding into the circuit network&#039;s inputs.&lt;br /&gt;
&lt;br /&gt;
A decider combinator set to (Out: Everything, Input-&amp;gt; Output) will also function as an isolator as long as the set logic condition is true. This can also selectively pass or &#039;gate&#039; inputs only when desired. This could be used to sequentially poll remote train stations for their chest contents, and include only desired stations.&lt;br /&gt;
&lt;br /&gt;
== Set/Reset Latching Switch ==&lt;br /&gt;
You want something to SET a trigger at some quantity, but then STAY on until that quantity hits some other value, the RESET value. You&#039;ll need one decider combinator and one arithmetic combinator. Two decider combinators and a constant combinator can also be used for more complex multi-channel conditions.&lt;br /&gt;
&lt;br /&gt;
Setup the first decider combinator to the desired set conditional and to output a 1. Then connect the output to the input of an arithmetic combinator, and configure it to multiply by the bias value, the difference between the set and reset values, and wire the arithmetic output to the input of the decider. The arithmetic output channel MUST be set the same as the decider&#039;s input channel. That&#039;s it! Whenever your set conditional is reached, the decider will output a &#039;1&#039;, and the bias of the arithmetic combinator will be applied. This will &#039;hold&#039; the output true until the value goes back below the reset point.&lt;br /&gt;
&lt;br /&gt;
Here&#039;s a more specific example : &lt;br /&gt;
i want the pump to run when petrol reach 2000, and turn off when reach 200.&amp;lt;br&amp;gt;&lt;br /&gt;
only with green wire&amp;lt;br&amp;gt;&lt;br /&gt;
Tank -&amp;gt; in decider&amp;lt;br&amp;gt;&lt;br /&gt;
out decider-&amp;gt; in arithmetic&amp;lt;br&amp;gt;&lt;br /&gt;
out arithmetic -&amp;gt; in decider&amp;lt;br&amp;gt;&lt;br /&gt;
green wire from in decider, to pump&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Pump have the same condition as the decider (Petrol &amp;gt; 2000)&lt;br /&gt;
&lt;br /&gt;
Decider : Petrol &amp;gt; 2000&amp;lt;br&amp;gt;&lt;br /&gt;
out : A = 1&amp;lt;br&amp;gt;&lt;br /&gt;
Arithmetic : A x 1800 (2000 - 200 )&amp;lt;br&amp;gt;&lt;br /&gt;
out : petrol&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:Factorio combinator switch.png|620px]]&lt;br /&gt;
&lt;br /&gt;
== Comparing Outputs ==&lt;br /&gt;
&lt;br /&gt;
== Addressing Outposts ==&lt;br /&gt;
&lt;br /&gt;
== Smart Train Loading ==&lt;br /&gt;
&lt;br /&gt;
Initially designed by [https://www.youtube.com/user/Darkphade MadZuri],&lt;br /&gt;
&lt;br /&gt;
This solves the problem of loading logistics into chests, which tend to be unequal and is slower in the rate of loading logistics into the cargo of trains.&lt;br /&gt;
&lt;br /&gt;
To setup the design, you require an Arithmetic Combinator, as well as Red and Green wires. &#039;&#039;&#039;Wire all the chests used, to the input of the Arithmetic Combinator&#039;&#039;&#039;. &#039;&#039;&#039;Then write (Logistics Item / -Amount of chests) and as the output as the Logistics Item in the Arithmetic Combinator&#039;&#039;&#039;, this will average the amount of items within the chests. Lastly, &#039;&#039;&#039;wire all the inserters used to the output of the Arithmetic Combinator and have the other color of the wire be wired to the adjacent chest&#039;&#039;&#039;. &#039;&#039;&#039;Have the inserters enabled when Logistics Item &amp;lt; 1&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
A more visual representation as well as questions for the design can be found [https://www.reddit.com/r/factorio/comments/4e03g2/madzuris_smart_loading_train_station_guide/ here].&lt;br /&gt;
&lt;br /&gt;
Explanation of why this works:&lt;br /&gt;
It compares the average amount of total items within the chests and the chest adjacent to the inserter so that it activates when the average number of items is higher than the amount within the chest.&lt;br /&gt;
The reason for why the division denominator is negative is because if the items in the chests are 0, it basically makes it so that it adds 1 to the equation.&lt;br /&gt;
&lt;br /&gt;
== Oil Control ==&lt;br /&gt;
&lt;br /&gt;
== Memory ==&lt;br /&gt;
How to store a constant value for later use, either for a basic counter or for more advanced logic. A decider combinator wired output tied to input and configured greater than zero (for positive values), input -&amp;gt; output will &#039;hold&#039; a value, as long as all other inputs on the network are zero.&lt;br /&gt;
&lt;br /&gt;
Any non-zero input condition will create a basic clock; incrementing the stored value by the sum of all connected input values every cycle. A single pulse of an input will cause a single increment by the pulsed value. Reset to zero occurs whenever the set condition is no longer met, or if a negative pulse equal to the input occurs.&lt;br /&gt;
&lt;br /&gt;
== Basic Clocks ==&lt;br /&gt;
[[File:Timer.png|thumb|right|377px|A basic clock. 30 ticks is the ceiling for Signal 1; which is continuously added.]]&lt;br /&gt;
Clocks are constructed by having the output of a combinator tied back to its own input, such that every cycle advances its own count. Either the arithmetic combinator or the decider combinator can be used.&lt;br /&gt;
&lt;br /&gt;
An arithmetic combinator tied to itself is fun to watch and will happily run-away, but requires additional control logic to reset.&lt;br /&gt;
&lt;br /&gt;
A self-resetting clock requires just a single decider combinator with output wired to input and configured with Less Than (&amp;lt;) and Input -&amp;gt; Output. When a constant combinator is then connected to the input, every cycle it will count up by the value of the Constant Combinator until the set conditional value is reached, then output a zero which will be summed with the constant combinator, and reset the process.&lt;br /&gt;
&lt;br /&gt;
The clock sequence will not include zero, will begin at the value set by the constant combinator, and will include whatever value eventually causes the conditional to be false. An arithmetic combinator can modify the clock sequence but remember its outputs will occur one cycle later than the clock cycle values.&lt;br /&gt;
&lt;br /&gt;
A clock that only counts once can be built using the following setup:&lt;br /&gt;
&lt;br /&gt;
[[File:Onetime_Clock.png|thumb|none|360px|One-time clock. Runs until T=Z+1. Reset via R&amp;gt;0.]]&lt;br /&gt;
&lt;br /&gt;
== Pulse Generators ==&lt;br /&gt;
&lt;br /&gt;
Connecting an additional (=) decider combinator to the output of a basic clock will create a pulse generator, and will pulse a single output every time the clock cycles through the set condition. Any output value can be used, either directly from the clock sequence (input-&amp;gt;output), a 1, or some value on a separate logic channel on the circuit network, such as set by a constant combinator. or by the circuit network.&amp;lt;br /&amp;gt;&lt;br /&gt;
[[File:PulseGen.png|500px]]&lt;br /&gt;
*&#039;&#039;The value 1 can be written as any positive integer, so long as it is within the cap or ceiling of your timer.&#039;&#039;&lt;br /&gt;
*&#039;&#039;As an example from the above timer, this light will pulse every 1st tick after the timer reaches 30 ticks, making it pulse 1/30th of a second, as Factorio updates at 60 times per second.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Counter ==&lt;br /&gt;
A counter is used to count the number of input events, and output the sum of that count. Any pulsing input into a decider combinator configured input -&amp;gt; output and wired between output and input will create a counter, but this input must be zero at all other times or else the combinator will run away like a clock. A pulse generator is normally used to accomplish this. Combining several gating decider isolators set with sequential conditionals, a clock, and a pulse generator to the input of a counter will allow remote polling and counting of each isolator&#039;s contents.&lt;br /&gt;
&lt;br /&gt;
== Logic Gates ==&lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;Unary NOT&#039;&#039;&#039;===&lt;br /&gt;
----&lt;br /&gt;
[[File:NOT.png|415px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;Binary OR&#039;&#039;&#039;===&lt;br /&gt;
----&lt;br /&gt;
[[File:OR.png|300px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 2!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1  || 1&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;*Deprecated: Use the Arithemetic Combinator&#039;s OR option instead.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;Binary NOR&#039;&#039;&#039;===&lt;br /&gt;
----&lt;br /&gt;
[[File:NOR.png|415px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 2!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;Binary XOR&#039;&#039;&#039;===&lt;br /&gt;
----&lt;br /&gt;
[[File:XOR.png|300px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 1!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 ||  0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 ||  1 || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 ||  0 || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 ||  1 || 0&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;*Deprecated: Use the Arithemetic Combinator&#039;s XOR option instead.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;Binary AND&#039;&#039;&#039;===&lt;br /&gt;
----&lt;br /&gt;
[[File:AND.png|530px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 2!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1 || 1&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;*Deprecated: Use the Arithemetic Combinator&#039;s AND option instead.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;Trinary AND&#039;&#039;&#039;===&lt;br /&gt;
----&lt;br /&gt;
[[File:TrinaryAND.png|415px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 2!!Input 3!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0  || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1  || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0  || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1  || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0  || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1  || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0  || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1  || 1  || 1&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;Binary NAND&#039;&#039;&#039;===&lt;br /&gt;
----&lt;br /&gt;
[[File:NAND.png|300px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 2!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;Binary XNOR/XAND&#039;&#039;&#039;===&lt;br /&gt;
----&lt;br /&gt;
[[File:XAND.png|300px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 2!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1  || 1&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Memory Cells ==&lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;Simple Latch&#039;&#039;&#039;===&lt;br /&gt;
&lt;br /&gt;
When looping the combinator to itself, use a different colour of wire from your main inputs or outputs. &lt;br /&gt;
&lt;br /&gt;
[[File:SimpleLatchv2.png|300px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Output 1!!Input 1!!Input 2!! Output 1 (t+1)&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 0 || 1&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0 || 0 || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1 || 0 || 1 &#039;&#039;(2)&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0 || 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1 || 1 || 1 &#039;&#039;(2)&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&#039;&#039;Output 1 is the green wire loop seen in the picture, it carries the value to latch.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Input 1 is Set, while Input 2 is Reset.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;Binary Cell&#039;&#039;&#039;===&lt;br /&gt;
&lt;br /&gt;
RS NOR Latch&lt;br /&gt;
[[File:RS-NOR.png|500px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;Advanced Cell&#039;&#039;&#039;===&lt;br /&gt;
&lt;br /&gt;
Cell for storing a positive value:&lt;br /&gt;
&lt;br /&gt;
[[File:AdvancedMemoryCell.png|500px]]&lt;br /&gt;
&lt;br /&gt;
Connect the desired value as signal 3 on the right side to set the memory cell and connect a negative value as signal 3 to reset the cell.  *Please note the arithmetic combinator&#039;s output should be facing the opposite direction of the decider combinators.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Address Enable Switch&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== See Also ==&lt;br /&gt;
*[http://www.factorioforums.com/forum/viewtopic.php?f=18&amp;amp;t=14556 Combinators 101 (Tutorial)]&lt;br /&gt;
*[[Arithmetic combinator]]&lt;br /&gt;
*[[Constant Combinator]]&lt;br /&gt;
*[[Decider Combinator]]&lt;br /&gt;
*[[Circuit network]]&lt;br /&gt;
*[[Circuit-network_Cookbook]]&lt;br /&gt;
[[Category:Tutorial]]&lt;br /&gt;
[[Category:English page]]&lt;/div&gt;</summary>
		<author><name>My3DS</name></author>
	</entry>
	<entry>
		<id>https://wiki.factorio.com/index.php?title=Tutorial:Combinator_tutorial&amp;diff=138355</id>
		<title>Tutorial:Combinator tutorial</title>
		<link rel="alternate" type="text/html" href="https://wiki.factorio.com/index.php?title=Tutorial:Combinator_tutorial&amp;diff=138355"/>
		<updated>2017-06-01T04:30:17Z</updated>

		<summary type="html">&lt;p&gt;My3DS: /* Anything Wildcard: */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
Combinator logic is achieved by cross-connecting outputs to inputs in such a way to achieve the desired logic. While advanced logic requires a multitude of combinators, some very useful basic logic can be achieved using only a handful of combinators. &#039;&#039;&#039;Combinator logic works because Factorio only updates at 60 times per second, such that combinators analyze their logic in a step, and then sum and/or decide the resulting output values on the next step.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
When logic values are computed by combinators, the outputs are not recognized by the circuit network until the following step. So when a decider combinator is used to detect a certain input condition, it&#039;s output value will not take effect on the circuit network until the next step. &#039;&#039;&#039;This behavior is important to remember and can result in sequencing errors and significant delays when multiple combinators are connected in series.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Circuit wires act like a wire bus in electronics, it carries information in the connected wires, meaning that &#039;&#039;&#039;if there are similar signals on a wire, it will add them automatically, unless if it is a different signal, that means it will be carried in that wire as well, but as a different signal.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
When cross-connecting combinators &#039;&#039;&#039;it&#039;s good practice to use the unused color to cross-connect, this will split the input and output networks and prevent unwanted inputs from accidentally connecting to a larger circuit network.&#039;&#039;&#039; Combinators will sum the red &amp;amp;/or green inputs prior to calculation, so either color can be used when wiring the output back to the input, but in most cases, it is more useful to use the opposing colour of the wire so that it will not interfere with the resulting output and input.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;There is also an example heavy [[Circuit-network_Cookbook|circuit network cookbook]] that you may find helpful to learn and refer to about circuit networks.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Virtual Signals ==&lt;br /&gt;
&lt;br /&gt;
===Everything Wildcard:===&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
This Red Wildcard serves to check all the specifed input signals.&lt;br /&gt;
&lt;br /&gt;
As the Decider Combinator, &amp;lt;br /&amp;gt;&lt;br /&gt;
its input is used to serve if all inputs meets the specified signals or variables. &amp;lt;br /&amp;gt;&lt;br /&gt;
its output is used to serve output every signal. &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Side note: &amp;quot;Everything&amp;quot; outputs true by default even if there is no signal to guarantee if that is true. &#039;&#039;P(x) is true for all x&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
===Anything Wildcard:===&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
This Green Wildcard serves to check all the specifed input signals.&lt;br /&gt;
&lt;br /&gt;
As the Decider Combinator, &lt;br /&gt;
its input is used to serve if any of its inputs meets the specified signals or variables.&lt;br /&gt;
&lt;br /&gt;
Side note: &amp;quot;Anything&amp;quot; outputs false by default if there is no signal to guarantee if it is true. &#039;&#039;P(x) is false if any x is neither true or false.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
===Each Wildcard:===&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
This Yellow Wildcard serves to check for each the specifed input signals.&lt;br /&gt;
&lt;br /&gt;
As the Decider Combinator, &amp;lt;br /&amp;gt;&lt;br /&gt;
its input is used to serve if any inputs meets the specified signals or variables. &amp;lt;br /&amp;gt;&lt;br /&gt;
its output is used to serve output the each variable. &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As the Arithmetic Combinator, &amp;lt;br /&amp;gt;&lt;br /&gt;
its input is used to serve each input, then the following summations are summed and outputted, with each signal as its own respective signals.&lt;br /&gt;
&lt;br /&gt;
== Input Isolator &amp;amp; Gate ==&lt;br /&gt;
An arithmetic combinator set to (In: Each + 0, Out: Each) can be used to swap wire colors and as an isolator to prevent downstream logic from backfeeding into the circuit network&#039;s inputs.&lt;br /&gt;
&lt;br /&gt;
A decider combinator set to (Out: Everything, Input-&amp;gt; Output) will also function as an isolator as long as the set logic condition is true. This can also selectively pass or &#039;gate&#039; inputs only when desired. This could be used to sequentially poll remote train stations for their chest contents, and include only desired stations.&lt;br /&gt;
&lt;br /&gt;
== Set/Reset Latching Switch ==&lt;br /&gt;
You want something to SET a trigger at some quantity, but then STAY on until that quantity hits some other value, the RESET value. You&#039;ll need one decider combinator and one arithmetic combinator. Two decider combinators and a constant combinator can also be used for more complex multi-channel conditions.&lt;br /&gt;
&lt;br /&gt;
Setup the first decider combinator to the desired set conditional and to output a 1. Then connect the output to the input of an arithmetic combinator, and configure it to multiply by the bias value, the difference between the set and reset values, and wire the arithmetic output to the input of the decider. The arithmetic output channel MUST be set the same as the decider&#039;s input channel. That&#039;s it! Whenever your set conditional is reached, the decider will output a &#039;1&#039;, and the bias of the arithmetic combinator will be applied. This will &#039;hold&#039; the output true until the value goes back below the reset point.&lt;br /&gt;
&lt;br /&gt;
Here&#039;s a more specific example : &lt;br /&gt;
i want the pump to run when petrol reach 2000, and turn off when reach 200.&amp;lt;br&amp;gt;&lt;br /&gt;
only with green wire&amp;lt;br&amp;gt;&lt;br /&gt;
Tank -&amp;gt; in decider&amp;lt;br&amp;gt;&lt;br /&gt;
out decider-&amp;gt; in arithmetic&amp;lt;br&amp;gt;&lt;br /&gt;
out arithmetic -&amp;gt; in decider&amp;lt;br&amp;gt;&lt;br /&gt;
green wire from in decider, to pump&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Pump have the same condition as the decider (Petrol &amp;gt; 2000)&lt;br /&gt;
&lt;br /&gt;
Decider : Petrol &amp;gt; 2000&amp;lt;br&amp;gt;&lt;br /&gt;
out : A = 1&amp;lt;br&amp;gt;&lt;br /&gt;
Arithmetic : A x 1800 (2000 - 200 )&amp;lt;br&amp;gt;&lt;br /&gt;
out : petrol&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:Factorio combinator switch.png|620px]]&lt;br /&gt;
&lt;br /&gt;
== Comparing Outputs ==&lt;br /&gt;
&lt;br /&gt;
== Addressing Outposts ==&lt;br /&gt;
&lt;br /&gt;
== Smart Train Loading ==&lt;br /&gt;
&lt;br /&gt;
Initially designed by [https://www.youtube.com/user/Darkphade MadZuri],&lt;br /&gt;
&lt;br /&gt;
This solves the problem of loading logistics into chests, which tend to be unequal and is slower in the rate of loading logistics into the cargo of trains.&lt;br /&gt;
&lt;br /&gt;
To setup the design, you require an Arithmetic Combinator, as well as Red and Green wires. &#039;&#039;&#039;Wire all the chests used, to the input of the Arithmetic Combinator&#039;&#039;&#039;. &#039;&#039;&#039;Then write (Logistics Item / -Amount of chests) and as the output as the Logistics Item in the Arithmetic Combinator&#039;&#039;&#039;, this will average the amount of items within the chests. Lastly, &#039;&#039;&#039;wire all the inserters used to the output of the Arithmetic Combinator and have the other color of the wire be wired to the adjacent chest&#039;&#039;&#039;. &#039;&#039;&#039;Have the inserters enabled when Logistics Item &amp;lt; 1&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
A more visual representation as well as questions for the design can be found [https://www.reddit.com/r/factorio/comments/4e03g2/madzuris_smart_loading_train_station_guide/ here].&lt;br /&gt;
&lt;br /&gt;
Explanation of why this works:&lt;br /&gt;
It compares the average amount of total items within the chests and the chest adjacent to the inserter so that it activates when the average number of items is higher than the amount within the chest.&lt;br /&gt;
The reason for why the division denominator is negative is because if the items in the chests are 0, it basically makes it so that it adds 1 to the equation.&lt;br /&gt;
&lt;br /&gt;
== Oil Control ==&lt;br /&gt;
&lt;br /&gt;
== Memory ==&lt;br /&gt;
How to store a constant value for later use, either for a basic counter or for more advanced logic. A decider combinator wired output tied to input and configured greater than zero (for positive values), input -&amp;gt; output will &#039;hold&#039; a value, as long as all other inputs on the network are zero.&lt;br /&gt;
&lt;br /&gt;
Any non-zero input condition will create a basic clock; incrementing the stored value by the sum of all connected input values every cycle. A single pulse of an input will cause a single increment by the pulsed value. Reset to zero occurs whenever the set condition is no longer met, or if a negative pulse equal to the input occurs.&lt;br /&gt;
&lt;br /&gt;
== Basic Clocks ==&lt;br /&gt;
[[File:Timer.png|thumb|right|377px|A basic clock. 30 ticks is the ceiling for Signal 1; which is continuously added.]]&lt;br /&gt;
Clocks are constructed by having the output of a combinator tied back to its own input, such that every cycle advances its own count. Either the arithmetic combinator or the decider combinator can be used.&lt;br /&gt;
&lt;br /&gt;
An arithmetic combinator tied to itself is fun to watch and will happily run-away, but requires additional control logic to reset.&lt;br /&gt;
&lt;br /&gt;
A self-resetting clock requires just a single decider combinator with output wired to input and configured with Less Than (&amp;lt;) and Input -&amp;gt; Output. When a constant combinator is then connected to the input, every cycle it will count up by the value of the Constant Combinator until the set conditional value is reached, then output a zero which will be summed with the constant combinator, and reset the process.&lt;br /&gt;
&lt;br /&gt;
The clock sequence will not include zero, will begin at the value set by the constant combinator, and will include whatever value eventually causes the conditional to be false. An arithmetic combinator can modify the clock sequence but remember its outputs will occur one cycle later than the clock cycle values.&lt;br /&gt;
&lt;br /&gt;
A clock that only counts once can be built using the following setup:&lt;br /&gt;
&lt;br /&gt;
[[File:Onetime_Clock.png|thumb|none|360px|One-time clock. Runs until T=Z+1. Reset via R&amp;gt;0.]]&lt;br /&gt;
&lt;br /&gt;
== Pulse Generators ==&lt;br /&gt;
&lt;br /&gt;
Connecting an additional (=) decider combinator to the output of a basic clock will create a pulse generator, and will pulse a single output every time the clock cycles through the set condition. Any output value can be used, either directly from the clock sequence (input-&amp;gt;output), a 1, or some value on a separate logic channel on the circuit network, such as set by a constant combinator. or by the circuit network.&amp;lt;br /&amp;gt;&lt;br /&gt;
[[File:PulseGen.png|500px]]&lt;br /&gt;
*&#039;&#039;The value 1 can be written as any positive integer, so long as it is within the cap or ceiling of your timer.&#039;&#039;&lt;br /&gt;
*&#039;&#039;As an example from the above timer, this light will pulse every 1st tick after the timer reaches 30 ticks, making it pulse 1/30th of a second, as Factorio updates at 60 times per second.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Counter ==&lt;br /&gt;
A counter is used to count the number of input events, and output the sum of that count. Any pulsing input into a decider combinator configured input -&amp;gt; output and wired between output and input will create a counter, but this input must be zero at all other times or else the combinator will run away like a clock. A pulse generator is normally used to accomplish this. Combining several gating decider isolators set with sequential conditionals, a clock, and a pulse generator to the input of a counter will allow remote polling and counting of each isolator&#039;s contents.&lt;br /&gt;
&lt;br /&gt;
== Logic Gates ==&lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;Unary NOT&#039;&#039;&#039;===&lt;br /&gt;
----&lt;br /&gt;
[[File:NOT.png|415px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;Binary OR&#039;&#039;&#039;===&lt;br /&gt;
----&lt;br /&gt;
[[File:OR.png|300px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 2!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1  || 1&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;*Deprecated: Use the Arithemetic Combinator&#039;s OR option instead.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;Binary NOR&#039;&#039;&#039;===&lt;br /&gt;
----&lt;br /&gt;
[[File:NOR.png|415px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 2!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;Binary XOR&#039;&#039;&#039;===&lt;br /&gt;
----&lt;br /&gt;
[[File:XOR.png|300px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 1!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 ||  0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 ||  1 || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 ||  0 || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 ||  1 || 0&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;*Deprecated: Use the Arithemetic Combinator&#039;s XOR option instead.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;Binary AND&#039;&#039;&#039;===&lt;br /&gt;
----&lt;br /&gt;
[[File:AND.png|530px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 2!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1 || 1&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;*Deprecated: Use the Arithemetic Combinator&#039;s AND option instead.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;Trinary AND&#039;&#039;&#039;===&lt;br /&gt;
----&lt;br /&gt;
[[File:TrinaryAND.png|415px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 2!!Input 3!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0  || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1  || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0  || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1  || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0  || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1  || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0  || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1  || 1  || 1&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;Binary NAND&#039;&#039;&#039;===&lt;br /&gt;
----&lt;br /&gt;
[[File:NAND.png|300px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 2!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;Binary XNOR/XAND&#039;&#039;&#039;===&lt;br /&gt;
----&lt;br /&gt;
[[File:XAND.png|300px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 2!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1  || 1&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Memory Cells ==&lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;Simple Latch&#039;&#039;&#039;===&lt;br /&gt;
&lt;br /&gt;
When looping the combinator to itself, use a different colour of wire from your main inputs or outputs. &lt;br /&gt;
&lt;br /&gt;
[[File:SimpleLatchv2.png|300px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Output 1!!Input 1!!Input 2!! Output 1 (t+1)&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 0 || 1&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0 || 0 || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1 || 0 || 1 &#039;&#039;(2)&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0 || 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1 || 1 || 1 &#039;&#039;(2)&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&#039;&#039;Output 1 is the green wire loop seen in the picture, it carries the value to latch.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Input 1 is Set, while Input 2 is Reset.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;Binary Cell&#039;&#039;&#039;===&lt;br /&gt;
&lt;br /&gt;
RS NOR Latch&lt;br /&gt;
[[File:RS-NOR.png|500px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;Advanced Cell&#039;&#039;&#039;===&lt;br /&gt;
&lt;br /&gt;
Cell for storing a positive value:&lt;br /&gt;
&lt;br /&gt;
[[File:AdvancedMemoryCell.png|500px]]&lt;br /&gt;
&lt;br /&gt;
Connect the desired value as signal 3 on the right side to set the memory cell and connect a negative value as signal 3 to reset the cell.  *Please note the arithmetic combinator&#039;s output should be facing the opposite direction of the decider combinators.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Address Enable Switch&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== See Also ==&lt;br /&gt;
*[http://www.factorioforums.com/forum/viewtopic.php?f=18&amp;amp;t=14556 Combinators 101 (Tutorial)]&lt;br /&gt;
*[[Arithmetic combinator]]&lt;br /&gt;
*[[Constant Combinator]]&lt;br /&gt;
*[[Decider Combinator]]&lt;br /&gt;
*[[Circuit network]]&lt;br /&gt;
*[[Circuit-network_Cookbook]]&lt;br /&gt;
[[Category:Tutorial]]&lt;br /&gt;
[[Category:English page]]&lt;/div&gt;</summary>
		<author><name>My3DS</name></author>
	</entry>
	<entry>
		<id>https://wiki.factorio.com/index.php?title=Tutorial:Combinator_tutorial&amp;diff=138354</id>
		<title>Tutorial:Combinator tutorial</title>
		<link rel="alternate" type="text/html" href="https://wiki.factorio.com/index.php?title=Tutorial:Combinator_tutorial&amp;diff=138354"/>
		<updated>2017-06-01T04:17:51Z</updated>

		<summary type="html">&lt;p&gt;My3DS: /* Everything Wildcard: */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
Combinator logic is achieved by cross-connecting outputs to inputs in such a way to achieve the desired logic. While advanced logic requires a multitude of combinators, some very useful basic logic can be achieved using only a handful of combinators. &#039;&#039;&#039;Combinator logic works because Factorio only updates at 60 times per second, such that combinators analyze their logic in a step, and then sum and/or decide the resulting output values on the next step.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
When logic values are computed by combinators, the outputs are not recognized by the circuit network until the following step. So when a decider combinator is used to detect a certain input condition, it&#039;s output value will not take effect on the circuit network until the next step. &#039;&#039;&#039;This behavior is important to remember and can result in sequencing errors and significant delays when multiple combinators are connected in series.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Circuit wires act like a wire bus in electronics, it carries information in the connected wires, meaning that &#039;&#039;&#039;if there are similar signals on a wire, it will add them automatically, unless if it is a different signal, that means it will be carried in that wire as well, but as a different signal.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
When cross-connecting combinators &#039;&#039;&#039;it&#039;s good practice to use the unused color to cross-connect, this will split the input and output networks and prevent unwanted inputs from accidentally connecting to a larger circuit network.&#039;&#039;&#039; Combinators will sum the red &amp;amp;/or green inputs prior to calculation, so either color can be used when wiring the output back to the input, but in most cases, it is more useful to use the opposing colour of the wire so that it will not interfere with the resulting output and input.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;There is also an example heavy [[Circuit-network_Cookbook|circuit network cookbook]] that you may find helpful to learn and refer to about circuit networks.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Virtual Signals ==&lt;br /&gt;
&lt;br /&gt;
===Everything Wildcard:===&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
This Red Wildcard serves to check all the specifed input signals.&lt;br /&gt;
&lt;br /&gt;
As the Decider Combinator, &amp;lt;br /&amp;gt;&lt;br /&gt;
its input is used to serve if all inputs meets the specified signals or variables. &amp;lt;br /&amp;gt;&lt;br /&gt;
its output is used to serve output every signal. &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Side note: &amp;quot;Everything&amp;quot; outputs true by default even if there is no signal to guarantee if that is true. &#039;&#039;P(x) is true for all x&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
===Anything Wildcard:===&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
This Green Wildcard serves to check all the specifed input signals.&lt;br /&gt;
&lt;br /&gt;
As the Decider Combinator, &lt;br /&gt;
its input is used to serve if any of its inputs meets the specified signals or variables.&lt;br /&gt;
&lt;br /&gt;
===Each Wildcard:===&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
This Yellow Wildcard serves to check for each the specifed input signals.&lt;br /&gt;
&lt;br /&gt;
As the Decider Combinator, &amp;lt;br /&amp;gt;&lt;br /&gt;
its input is used to serve if any inputs meets the specified signals or variables. &amp;lt;br /&amp;gt;&lt;br /&gt;
its output is used to serve output the each variable. &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As the Arithmetic Combinator, &amp;lt;br /&amp;gt;&lt;br /&gt;
its input is used to serve each input, then the following summations are summed and outputted, with each signal as its own respective signals.&lt;br /&gt;
&lt;br /&gt;
== Input Isolator &amp;amp; Gate ==&lt;br /&gt;
An arithmetic combinator set to (In: Each + 0, Out: Each) can be used to swap wire colors and as an isolator to prevent downstream logic from backfeeding into the circuit network&#039;s inputs.&lt;br /&gt;
&lt;br /&gt;
A decider combinator set to (Out: Everything, Input-&amp;gt; Output) will also function as an isolator as long as the set logic condition is true. This can also selectively pass or &#039;gate&#039; inputs only when desired. This could be used to sequentially poll remote train stations for their chest contents, and include only desired stations.&lt;br /&gt;
&lt;br /&gt;
== Set/Reset Latching Switch ==&lt;br /&gt;
You want something to SET a trigger at some quantity, but then STAY on until that quantity hits some other value, the RESET value. You&#039;ll need one decider combinator and one arithmetic combinator. Two decider combinators and a constant combinator can also be used for more complex multi-channel conditions.&lt;br /&gt;
&lt;br /&gt;
Setup the first decider combinator to the desired set conditional and to output a 1. Then connect the output to the input of an arithmetic combinator, and configure it to multiply by the bias value, the difference between the set and reset values, and wire the arithmetic output to the input of the decider. The arithmetic output channel MUST be set the same as the decider&#039;s input channel. That&#039;s it! Whenever your set conditional is reached, the decider will output a &#039;1&#039;, and the bias of the arithmetic combinator will be applied. This will &#039;hold&#039; the output true until the value goes back below the reset point.&lt;br /&gt;
&lt;br /&gt;
Here&#039;s a more specific example : &lt;br /&gt;
i want the pump to run when petrol reach 2000, and turn off when reach 200.&amp;lt;br&amp;gt;&lt;br /&gt;
only with green wire&amp;lt;br&amp;gt;&lt;br /&gt;
Tank -&amp;gt; in decider&amp;lt;br&amp;gt;&lt;br /&gt;
out decider-&amp;gt; in arithmetic&amp;lt;br&amp;gt;&lt;br /&gt;
out arithmetic -&amp;gt; in decider&amp;lt;br&amp;gt;&lt;br /&gt;
green wire from in decider, to pump&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Pump have the same condition as the decider (Petrol &amp;gt; 2000)&lt;br /&gt;
&lt;br /&gt;
Decider : Petrol &amp;gt; 2000&amp;lt;br&amp;gt;&lt;br /&gt;
out : A = 1&amp;lt;br&amp;gt;&lt;br /&gt;
Arithmetic : A x 1800 (2000 - 200 )&amp;lt;br&amp;gt;&lt;br /&gt;
out : petrol&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:Factorio combinator switch.png|620px]]&lt;br /&gt;
&lt;br /&gt;
== Comparing Outputs ==&lt;br /&gt;
&lt;br /&gt;
== Addressing Outposts ==&lt;br /&gt;
&lt;br /&gt;
== Smart Train Loading ==&lt;br /&gt;
&lt;br /&gt;
Initially designed by [https://www.youtube.com/user/Darkphade MadZuri],&lt;br /&gt;
&lt;br /&gt;
This solves the problem of loading logistics into chests, which tend to be unequal and is slower in the rate of loading logistics into the cargo of trains.&lt;br /&gt;
&lt;br /&gt;
To setup the design, you require an Arithmetic Combinator, as well as Red and Green wires. &#039;&#039;&#039;Wire all the chests used, to the input of the Arithmetic Combinator&#039;&#039;&#039;. &#039;&#039;&#039;Then write (Logistics Item / -Amount of chests) and as the output as the Logistics Item in the Arithmetic Combinator&#039;&#039;&#039;, this will average the amount of items within the chests. Lastly, &#039;&#039;&#039;wire all the inserters used to the output of the Arithmetic Combinator and have the other color of the wire be wired to the adjacent chest&#039;&#039;&#039;. &#039;&#039;&#039;Have the inserters enabled when Logistics Item &amp;lt; 1&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
A more visual representation as well as questions for the design can be found [https://www.reddit.com/r/factorio/comments/4e03g2/madzuris_smart_loading_train_station_guide/ here].&lt;br /&gt;
&lt;br /&gt;
Explanation of why this works:&lt;br /&gt;
It compares the average amount of total items within the chests and the chest adjacent to the inserter so that it activates when the average number of items is higher than the amount within the chest.&lt;br /&gt;
The reason for why the division denominator is negative is because if the items in the chests are 0, it basically makes it so that it adds 1 to the equation.&lt;br /&gt;
&lt;br /&gt;
== Oil Control ==&lt;br /&gt;
&lt;br /&gt;
== Memory ==&lt;br /&gt;
How to store a constant value for later use, either for a basic counter or for more advanced logic. A decider combinator wired output tied to input and configured greater than zero (for positive values), input -&amp;gt; output will &#039;hold&#039; a value, as long as all other inputs on the network are zero.&lt;br /&gt;
&lt;br /&gt;
Any non-zero input condition will create a basic clock; incrementing the stored value by the sum of all connected input values every cycle. A single pulse of an input will cause a single increment by the pulsed value. Reset to zero occurs whenever the set condition is no longer met, or if a negative pulse equal to the input occurs.&lt;br /&gt;
&lt;br /&gt;
== Basic Clocks ==&lt;br /&gt;
[[File:Timer.png|thumb|right|377px|A basic clock. 30 ticks is the ceiling for Signal 1; which is continuously added.]]&lt;br /&gt;
Clocks are constructed by having the output of a combinator tied back to its own input, such that every cycle advances its own count. Either the arithmetic combinator or the decider combinator can be used.&lt;br /&gt;
&lt;br /&gt;
An arithmetic combinator tied to itself is fun to watch and will happily run-away, but requires additional control logic to reset.&lt;br /&gt;
&lt;br /&gt;
A self-resetting clock requires just a single decider combinator with output wired to input and configured with Less Than (&amp;lt;) and Input -&amp;gt; Output. When a constant combinator is then connected to the input, every cycle it will count up by the value of the Constant Combinator until the set conditional value is reached, then output a zero which will be summed with the constant combinator, and reset the process.&lt;br /&gt;
&lt;br /&gt;
The clock sequence will not include zero, will begin at the value set by the constant combinator, and will include whatever value eventually causes the conditional to be false. An arithmetic combinator can modify the clock sequence but remember its outputs will occur one cycle later than the clock cycle values.&lt;br /&gt;
&lt;br /&gt;
A clock that only counts once can be built using the following setup:&lt;br /&gt;
&lt;br /&gt;
[[File:Onetime_Clock.png|thumb|none|360px|One-time clock. Runs until T=Z+1. Reset via R&amp;gt;0.]]&lt;br /&gt;
&lt;br /&gt;
== Pulse Generators ==&lt;br /&gt;
&lt;br /&gt;
Connecting an additional (=) decider combinator to the output of a basic clock will create a pulse generator, and will pulse a single output every time the clock cycles through the set condition. Any output value can be used, either directly from the clock sequence (input-&amp;gt;output), a 1, or some value on a separate logic channel on the circuit network, such as set by a constant combinator. or by the circuit network.&amp;lt;br /&amp;gt;&lt;br /&gt;
[[File:PulseGen.png|500px]]&lt;br /&gt;
*&#039;&#039;The value 1 can be written as any positive integer, so long as it is within the cap or ceiling of your timer.&#039;&#039;&lt;br /&gt;
*&#039;&#039;As an example from the above timer, this light will pulse every 1st tick after the timer reaches 30 ticks, making it pulse 1/30th of a second, as Factorio updates at 60 times per second.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Counter ==&lt;br /&gt;
A counter is used to count the number of input events, and output the sum of that count. Any pulsing input into a decider combinator configured input -&amp;gt; output and wired between output and input will create a counter, but this input must be zero at all other times or else the combinator will run away like a clock. A pulse generator is normally used to accomplish this. Combining several gating decider isolators set with sequential conditionals, a clock, and a pulse generator to the input of a counter will allow remote polling and counting of each isolator&#039;s contents.&lt;br /&gt;
&lt;br /&gt;
== Logic Gates ==&lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;Unary NOT&#039;&#039;&#039;===&lt;br /&gt;
----&lt;br /&gt;
[[File:NOT.png|415px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;Binary OR&#039;&#039;&#039;===&lt;br /&gt;
----&lt;br /&gt;
[[File:OR.png|300px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 2!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1  || 1&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;*Deprecated: Use the Arithemetic Combinator&#039;s OR option instead.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;Binary NOR&#039;&#039;&#039;===&lt;br /&gt;
----&lt;br /&gt;
[[File:NOR.png|415px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 2!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;Binary XOR&#039;&#039;&#039;===&lt;br /&gt;
----&lt;br /&gt;
[[File:XOR.png|300px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 1!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 ||  0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 ||  1 || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 ||  0 || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 ||  1 || 0&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;*Deprecated: Use the Arithemetic Combinator&#039;s XOR option instead.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;Binary AND&#039;&#039;&#039;===&lt;br /&gt;
----&lt;br /&gt;
[[File:AND.png|530px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 2!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1 || 1&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;*Deprecated: Use the Arithemetic Combinator&#039;s AND option instead.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;Trinary AND&#039;&#039;&#039;===&lt;br /&gt;
----&lt;br /&gt;
[[File:TrinaryAND.png|415px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 2!!Input 3!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0  || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1  || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0  || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1  || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0  || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1  || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0  || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1  || 1  || 1&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;Binary NAND&#039;&#039;&#039;===&lt;br /&gt;
----&lt;br /&gt;
[[File:NAND.png|300px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 2!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;Binary XNOR/XAND&#039;&#039;&#039;===&lt;br /&gt;
----&lt;br /&gt;
[[File:XAND.png|300px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 2!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1  || 1&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Memory Cells ==&lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;Simple Latch&#039;&#039;&#039;===&lt;br /&gt;
&lt;br /&gt;
When looping the combinator to itself, use a different colour of wire from your main inputs or outputs. &lt;br /&gt;
&lt;br /&gt;
[[File:SimpleLatchv2.png|300px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Output 1!!Input 1!!Input 2!! Output 1 (t+1)&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 0 || 1&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0 || 0 || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1 || 0 || 1 &#039;&#039;(2)&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0 || 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1 || 1 || 1 &#039;&#039;(2)&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&#039;&#039;Output 1 is the green wire loop seen in the picture, it carries the value to latch.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Input 1 is Set, while Input 2 is Reset.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;Binary Cell&#039;&#039;&#039;===&lt;br /&gt;
&lt;br /&gt;
RS NOR Latch&lt;br /&gt;
[[File:RS-NOR.png|500px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;Advanced Cell&#039;&#039;&#039;===&lt;br /&gt;
&lt;br /&gt;
Cell for storing a positive value:&lt;br /&gt;
&lt;br /&gt;
[[File:AdvancedMemoryCell.png|500px]]&lt;br /&gt;
&lt;br /&gt;
Connect the desired value as signal 3 on the right side to set the memory cell and connect a negative value as signal 3 to reset the cell.  *Please note the arithmetic combinator&#039;s output should be facing the opposite direction of the decider combinators.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Address Enable Switch&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== See Also ==&lt;br /&gt;
*[http://www.factorioforums.com/forum/viewtopic.php?f=18&amp;amp;t=14556 Combinators 101 (Tutorial)]&lt;br /&gt;
*[[Arithmetic combinator]]&lt;br /&gt;
*[[Constant Combinator]]&lt;br /&gt;
*[[Decider Combinator]]&lt;br /&gt;
*[[Circuit network]]&lt;br /&gt;
*[[Circuit-network_Cookbook]]&lt;br /&gt;
[[Category:Tutorial]]&lt;br /&gt;
[[Category:English page]]&lt;/div&gt;</summary>
		<author><name>My3DS</name></author>
	</entry>
	<entry>
		<id>https://wiki.factorio.com/index.php?title=Tutorial:Combinator_tutorial&amp;diff=136359</id>
		<title>Tutorial:Combinator tutorial</title>
		<link rel="alternate" type="text/html" href="https://wiki.factorio.com/index.php?title=Tutorial:Combinator_tutorial&amp;diff=136359"/>
		<updated>2017-05-01T05:42:57Z</updated>

		<summary type="html">&lt;p&gt;My3DS: /* Simple Latch */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
Combinator logic is achieved by cross-connecting outputs to inputs in such a way to achieve the desired logic. While advanced logic requires a multitude of combinators, some very useful basic logic can be achieved using only a handful of combinators. &#039;&#039;&#039;Combinator logic works because Factorio only updates at 60 times per second, such that combinators analyze their logic in a step, and then sum and/or decide the resulting output values on the next step.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
When logic values are computed by combinators, the outputs are not recognized by the circuit network until the following step. So when a decider combinator is used to detect a certain input condition, it&#039;s output value will not take effect on the circuit network until the next step. &#039;&#039;&#039;This behavior is important to remember and can result in sequencing errors and significant delays when multiple combinators are connected in series.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Circuit wires act like a wire bus in electronics, it carries information in the connected wires, meaning that &#039;&#039;&#039;if there are similar signals on a wire, it will add them automatically, unless if it is a different signal, that means it will be carried in that wire as well, but as a different signal.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
When cross-connecting combinators &#039;&#039;&#039;it&#039;s good practice to use the unused color to cross-connect, this will split the input and output networks and prevent unwanted inputs from accidentally connecting to a larger circuit network.&#039;&#039;&#039; Combinators will sum the red &amp;amp;/or green inputs prior to calculation, so either color can be used when wiring the output back to the input, but in most cases, it is more useful to use the opposing colour of the wire so that it will not interfere with the resulting output and input.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;There is also an example heavy [[Circuit-network_Cookbook|circuit network cookbook]] that you may find helpful to learn and refer to about circuit networks.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Virtual Signals ==&lt;br /&gt;
&lt;br /&gt;
===Everything Wildcard:===&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
This Red Wildcard serves to check all the specifed input signals.&lt;br /&gt;
&lt;br /&gt;
As the Decider Combinator, &amp;lt;br /&amp;gt;&lt;br /&gt;
its input is used to serve if all inputs meets the specified signals or variables. &amp;lt;br /&amp;gt;&lt;br /&gt;
its output is used to serve output every signal. &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Anything Wildcard:===&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
This Green Wildcard serves to check all the specifed input signals.&lt;br /&gt;
&lt;br /&gt;
As the Decider Combinator, &lt;br /&gt;
its input is used to serve if any of its inputs meets the specified signals or variables.&lt;br /&gt;
&lt;br /&gt;
===Each Wildcard:===&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
This Yellow Wildcard serves to check for each the specifed input signals.&lt;br /&gt;
&lt;br /&gt;
As the Decider Combinator, &amp;lt;br /&amp;gt;&lt;br /&gt;
its input is used to serve if any inputs meets the specified signals or variables. &amp;lt;br /&amp;gt;&lt;br /&gt;
its output is used to serve output the each variable. &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As the Arithmetic Combinator, &amp;lt;br /&amp;gt;&lt;br /&gt;
its input is used to serve each input, then the following summations are summed and outputted, with each signal as its own respective signals.&lt;br /&gt;
&lt;br /&gt;
== Input Isolator &amp;amp; Gate ==&lt;br /&gt;
An arithmetic combinator set to (In: Each + 0, Out: Each) can be used to swap wire colors and as an isolator to prevent downstream logic from backfeeding into the circuit network&#039;s inputs.&lt;br /&gt;
&lt;br /&gt;
A decider combinator set to (Out: Everything, Input-&amp;gt; Output) will also function as an isolator as long as the set logic condition is true. This can also selectively pass or &#039;gate&#039; inputs only when desired. This could be used to sequentially poll remote train stations for their chest contents, and include only desired stations.&lt;br /&gt;
&lt;br /&gt;
== Set/Reset Latching Switch ==&lt;br /&gt;
You want something to SET a trigger at some quantity, but then STAY on until that quantity hits some other value, the RESET value. You&#039;ll need one decider combinator and one arithmetic combinator. Two decider combinators and a constant combinator can also be used for more complex multi-channel conditions.&lt;br /&gt;
&lt;br /&gt;
Setup the first decider combinator to the desired set conditional and to output a 1. Then connect the output to the input of an arithmetic combinator, and configure it to multiply by the bias value, the difference between the set and reset values, and wire the arithmetic output to the input of the decider. The arithmetic output channel MUST be set the same as the decider&#039;s input channel. That&#039;s it! Whenever your set conditional is reached, the decider will output a &#039;1&#039;, and the bias of the arithmetic combinator will be applied. This will &#039;hold&#039; the output true until the value goes back below the reset point.&lt;br /&gt;
&lt;br /&gt;
Here&#039;s a more specific example : &lt;br /&gt;
i want the pump to run when petrol reach 2000, and turn off when reach 200.&amp;lt;br&amp;gt;&lt;br /&gt;
only with green wire&amp;lt;br&amp;gt;&lt;br /&gt;
Tank -&amp;gt; in decider&amp;lt;br&amp;gt;&lt;br /&gt;
out decider-&amp;gt; in arithmetic&amp;lt;br&amp;gt;&lt;br /&gt;
out arithmetic -&amp;gt; in decider&amp;lt;br&amp;gt;&lt;br /&gt;
green wire from in decider, to pump&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Pump have the same condition as the decider (Petrol &amp;gt; 2000)&lt;br /&gt;
&lt;br /&gt;
Decider : Petrol &amp;gt; 2000&amp;lt;br&amp;gt;&lt;br /&gt;
out : A = 1&amp;lt;br&amp;gt;&lt;br /&gt;
Arithmetic : A x 1800 (2000 - 200 )&amp;lt;br&amp;gt;&lt;br /&gt;
out : petrol&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:Factorio combinator switch.png|620px]]&lt;br /&gt;
&lt;br /&gt;
== Comparing Outputs ==&lt;br /&gt;
&lt;br /&gt;
== Addressing Outposts ==&lt;br /&gt;
&lt;br /&gt;
== Smart Train Loading ==&lt;br /&gt;
&lt;br /&gt;
Initially designed by [https://www.youtube.com/user/Darkphade MadZuri],&lt;br /&gt;
&lt;br /&gt;
This solves the problem of loading logistics into chests, which tend to be unequal and is slower in the rate of loading logistics into the cargo of trains.&lt;br /&gt;
&lt;br /&gt;
To setup the design, you require an Arithmetic Combinator, as well as Red and Green wires. &#039;&#039;&#039;Wire all the chests used, to the input of the Arithmetic Combinator&#039;&#039;&#039;. &#039;&#039;&#039;Then write (Logistics Item / -Amount of chests) and as the output as the Logistics Item in the Arithmetic Combinator&#039;&#039;&#039;, this will average the amount of items within the chests. Lastly, &#039;&#039;&#039;wire all the inserters used to the output of the Arithmetic Combinator and have the other color of the wire be wired to the adjacent chest&#039;&#039;&#039;. &#039;&#039;&#039;Have the inserters enabled when Logistics Item &amp;lt; 1&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
A more visual representation as well as questions for the design can be found [https://www.reddit.com/r/factorio/comments/4e03g2/madzuris_smart_loading_train_station_guide/ here].&lt;br /&gt;
&lt;br /&gt;
Explanation of why this works:&lt;br /&gt;
It compares the average amount of total items within the chests and the chest adjacent to the inserter so that it activates when the average number of items is higher than the amount within the chest.&lt;br /&gt;
The reason for why the division denominator is negative is because if the items in the chests are 0, it basically makes it so that it adds 1 to the equation.&lt;br /&gt;
&lt;br /&gt;
== Oil Control ==&lt;br /&gt;
&lt;br /&gt;
== Memory ==&lt;br /&gt;
How to store a constant value for later use, either for a basic counter or for more advanced logic. A decider combinator wired output tied to input and configured greater than zero (for positive values), input -&amp;gt; output will &#039;hold&#039; a value, as long as all other inputs on the network are zero.&lt;br /&gt;
&lt;br /&gt;
Any non-zero input condition will create a basic clock; incrementing the stored value by the sum of all connected input values every cycle. A single pulse of an input will cause a single increment by the pulsed value. Reset to zero occurs whenever the set condition is no longer met, or if a negative pulse equal to the input occurs.&lt;br /&gt;
&lt;br /&gt;
== Basic Clocks ==&lt;br /&gt;
Clocks are constructed by having the output of a combinator tied back to its own input, such that every cycle advances its own count. Either the arithmetic combinator or the decider combinator can be used.&lt;br /&gt;
&lt;br /&gt;
An arithmetic combinator tied to itself is fun to watch and will happily run-away, but requires additional control logic to reset.&lt;br /&gt;
&lt;br /&gt;
A self-resetting clock requires just a single decider combinator with output wired to input and configured with Less Than (&amp;lt;) and Input -&amp;gt; Output. When a constant combinator is then connected to the input, every cycle it will count up by the value of the Constant Combinator until the set conditional value is reached, then output a zero which will be summed with the constant combinator, and reset the process.&lt;br /&gt;
&lt;br /&gt;
[[File:Timer.png|500px]]&lt;br /&gt;
&#039;&#039;30 ticks is the ceiling for Signal 1; which is continuously added.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The clock sequence will not include zero, will begin at the value set by the constant combinator, and will include whatever value eventually causes the conditional to be false. An arithmetic combinator can modify the clock sequence but remember its outputs will occur one cycle later than the clock cycle values.&lt;br /&gt;
&lt;br /&gt;
A clock that only counts once can be built using the following setup:&lt;br /&gt;
&lt;br /&gt;
[[File:Onetime_Clock.png|400px]]&lt;br /&gt;
&#039;&#039;Runs until T=Z+1. Reset via R&amp;gt;0.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Pulse Generators ==&lt;br /&gt;
&lt;br /&gt;
Connecting an additional (=) decider combinator to the output of a basic clock will create a pulse generator, and will pulse a single output every time the clock cycles through the set condition. Any output value can be used, either directly from the clock sequence (input-&amp;gt;output), a 1, or some value on a separate logic channel on the circuit network, such as set by a constant combinator. or by the circuit network.&amp;lt;br /&amp;gt;&lt;br /&gt;
[[File:PulseGen.png|500px]]&lt;br /&gt;
*&#039;&#039;The value 1 can be written as any positive integer, so long as it is within the cap or ceiling of your timer.&#039;&#039;&lt;br /&gt;
*&#039;&#039;As an example from the above timer, this light will pulse every 1st tick after the timer reaches 30 ticks, making it pulse 1/30th of a second, as Factorio updates at 60 times per second.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Counter ==&lt;br /&gt;
A counter is used to count the number of input events, and output the sum of that count. Any pulsing input into a decider combinator configured input -&amp;gt; output and wired between output and input will create a counter, but this input must be zero at all other times or else the combinator will run away like a clock. A pulse generator is normally used to accomplish this. Combining several gating decider isolators set with sequential conditionals, a clock, and a pulse generator to the input of a counter will allow remote polling and counting of each isolator&#039;s contents.&lt;br /&gt;
&lt;br /&gt;
== Logic Gates ==&lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;Unary NOT&#039;&#039;&#039;===&lt;br /&gt;
----&lt;br /&gt;
[[File:NOT.png|415px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;Binary OR&#039;&#039;&#039;===&lt;br /&gt;
----&lt;br /&gt;
[[File:OR.png|300px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 2!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1  || 1&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;*Deprecated: Use the Arithemetic Combinator&#039;s OR option instead.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;Binary NOR&#039;&#039;&#039;===&lt;br /&gt;
----&lt;br /&gt;
[[File:NOR.png|415px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 2!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;Binary XOR&#039;&#039;&#039;===&lt;br /&gt;
----&lt;br /&gt;
[[File:XOR.png|300px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 1!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 ||  0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 ||  1 || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 ||  0 || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 ||  1 || 0&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;*Deprecated: Use the Arithemetic Combinator&#039;s XOR option instead.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;Binary AND&#039;&#039;&#039;===&lt;br /&gt;
----&lt;br /&gt;
[[File:AND.png|530px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 2!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1 || 1&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;*Deprecated: Use the Arithemetic Combinator&#039;s AND option instead.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;Trinary AND&#039;&#039;&#039;===&lt;br /&gt;
----&lt;br /&gt;
[[File:TrinaryAND.png|415px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 2!!Input 3!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0  || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1  || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0  || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1  || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0  || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1  || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0  || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1  || 1  || 1&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;Binary NAND&#039;&#039;&#039;===&lt;br /&gt;
----&lt;br /&gt;
[[File:NAND.png|300px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 2!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;Binary XNOR/XAND&#039;&#039;&#039;===&lt;br /&gt;
----&lt;br /&gt;
[[File:XAND.png|300px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 2!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1  || 1&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Memory Cells ==&lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;Simple Latch&#039;&#039;&#039;===&lt;br /&gt;
&lt;br /&gt;
When looping the combinator to itself, use a different colour of wire from your main inputs or outputs. &lt;br /&gt;
&lt;br /&gt;
[[File:SimpleLatchv2.png|300px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Output 1!!Input 1!!Input 2!! Output 1 (t+1)&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 0 || 1&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0 || 0 || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1 || 0 || 1 &#039;&#039;(2)&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0 || 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1 || 1 || 1 &#039;&#039;(2)&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&#039;&#039;Output 1 is the green wire loop seen in the picture, it carries the value to latch.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Input 1 is Set, while Input 2 is Reset.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;Binary Cell&#039;&#039;&#039;===&lt;br /&gt;
&lt;br /&gt;
RS NOR Latch&lt;br /&gt;
[[File:RS-NOR.png|500px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;Advanced Cell&#039;&#039;&#039;===&lt;br /&gt;
&lt;br /&gt;
Cell for storing a positive value:&lt;br /&gt;
&lt;br /&gt;
[[File:AdvancedMemoryCell.png|500px]]&lt;br /&gt;
&lt;br /&gt;
Connect the desired value as signal 3 on the right side to set the memory cell and connect a negative value as signal 3 to reset the cell.  *Please note the arithmetic combinator&#039;s output should be facing the opposite direction of the decider combinators.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Address Enable Switch&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== See Also ==&lt;br /&gt;
*[http://www.factorioforums.com/forum/viewtopic.php?f=18&amp;amp;t=14556 Combinators 101 (Tutorial)]&lt;br /&gt;
*[[Arithmetic combinator]]&lt;br /&gt;
*[[Constant Combinator]]&lt;br /&gt;
*[[Decider Combinator]]&lt;br /&gt;
*[[Circuit network]]&lt;br /&gt;
*[[Circuit-network_Cookbook]]&lt;br /&gt;
[[Category:Tutorial]]&lt;br /&gt;
[[Category:English page]]&lt;/div&gt;</summary>
		<author><name>My3DS</name></author>
	</entry>
	<entry>
		<id>https://wiki.factorio.com/index.php?title=Tutorial:Combinator_tutorial&amp;diff=136358</id>
		<title>Tutorial:Combinator tutorial</title>
		<link rel="alternate" type="text/html" href="https://wiki.factorio.com/index.php?title=Tutorial:Combinator_tutorial&amp;diff=136358"/>
		<updated>2017-05-01T05:42:34Z</updated>

		<summary type="html">&lt;p&gt;My3DS: /* Simple Latch */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
Combinator logic is achieved by cross-connecting outputs to inputs in such a way to achieve the desired logic. While advanced logic requires a multitude of combinators, some very useful basic logic can be achieved using only a handful of combinators. &#039;&#039;&#039;Combinator logic works because Factorio only updates at 60 times per second, such that combinators analyze their logic in a step, and then sum and/or decide the resulting output values on the next step.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
When logic values are computed by combinators, the outputs are not recognized by the circuit network until the following step. So when a decider combinator is used to detect a certain input condition, it&#039;s output value will not take effect on the circuit network until the next step. &#039;&#039;&#039;This behavior is important to remember and can result in sequencing errors and significant delays when multiple combinators are connected in series.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Circuit wires act like a wire bus in electronics, it carries information in the connected wires, meaning that &#039;&#039;&#039;if there are similar signals on a wire, it will add them automatically, unless if it is a different signal, that means it will be carried in that wire as well, but as a different signal.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
When cross-connecting combinators &#039;&#039;&#039;it&#039;s good practice to use the unused color to cross-connect, this will split the input and output networks and prevent unwanted inputs from accidentally connecting to a larger circuit network.&#039;&#039;&#039; Combinators will sum the red &amp;amp;/or green inputs prior to calculation, so either color can be used when wiring the output back to the input, but in most cases, it is more useful to use the opposing colour of the wire so that it will not interfere with the resulting output and input.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;There is also an example heavy [[Circuit-network_Cookbook|circuit network cookbook]] that you may find helpful to learn and refer to about circuit networks.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Virtual Signals ==&lt;br /&gt;
&lt;br /&gt;
===Everything Wildcard:===&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
This Red Wildcard serves to check all the specifed input signals.&lt;br /&gt;
&lt;br /&gt;
As the Decider Combinator, &amp;lt;br /&amp;gt;&lt;br /&gt;
its input is used to serve if all inputs meets the specified signals or variables. &amp;lt;br /&amp;gt;&lt;br /&gt;
its output is used to serve output every signal. &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Anything Wildcard:===&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
This Green Wildcard serves to check all the specifed input signals.&lt;br /&gt;
&lt;br /&gt;
As the Decider Combinator, &lt;br /&gt;
its input is used to serve if any of its inputs meets the specified signals or variables.&lt;br /&gt;
&lt;br /&gt;
===Each Wildcard:===&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
This Yellow Wildcard serves to check for each the specifed input signals.&lt;br /&gt;
&lt;br /&gt;
As the Decider Combinator, &amp;lt;br /&amp;gt;&lt;br /&gt;
its input is used to serve if any inputs meets the specified signals or variables. &amp;lt;br /&amp;gt;&lt;br /&gt;
its output is used to serve output the each variable. &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As the Arithmetic Combinator, &amp;lt;br /&amp;gt;&lt;br /&gt;
its input is used to serve each input, then the following summations are summed and outputted, with each signal as its own respective signals.&lt;br /&gt;
&lt;br /&gt;
== Input Isolator &amp;amp; Gate ==&lt;br /&gt;
An arithmetic combinator set to (In: Each + 0, Out: Each) can be used to swap wire colors and as an isolator to prevent downstream logic from backfeeding into the circuit network&#039;s inputs.&lt;br /&gt;
&lt;br /&gt;
A decider combinator set to (Out: Everything, Input-&amp;gt; Output) will also function as an isolator as long as the set logic condition is true. This can also selectively pass or &#039;gate&#039; inputs only when desired. This could be used to sequentially poll remote train stations for their chest contents, and include only desired stations.&lt;br /&gt;
&lt;br /&gt;
== Set/Reset Latching Switch ==&lt;br /&gt;
You want something to SET a trigger at some quantity, but then STAY on until that quantity hits some other value, the RESET value. You&#039;ll need one decider combinator and one arithmetic combinator. Two decider combinators and a constant combinator can also be used for more complex multi-channel conditions.&lt;br /&gt;
&lt;br /&gt;
Setup the first decider combinator to the desired set conditional and to output a 1. Then connect the output to the input of an arithmetic combinator, and configure it to multiply by the bias value, the difference between the set and reset values, and wire the arithmetic output to the input of the decider. The arithmetic output channel MUST be set the same as the decider&#039;s input channel. That&#039;s it! Whenever your set conditional is reached, the decider will output a &#039;1&#039;, and the bias of the arithmetic combinator will be applied. This will &#039;hold&#039; the output true until the value goes back below the reset point.&lt;br /&gt;
&lt;br /&gt;
Here&#039;s a more specific example : &lt;br /&gt;
i want the pump to run when petrol reach 2000, and turn off when reach 200.&amp;lt;br&amp;gt;&lt;br /&gt;
only with green wire&amp;lt;br&amp;gt;&lt;br /&gt;
Tank -&amp;gt; in decider&amp;lt;br&amp;gt;&lt;br /&gt;
out decider-&amp;gt; in arithmetic&amp;lt;br&amp;gt;&lt;br /&gt;
out arithmetic -&amp;gt; in decider&amp;lt;br&amp;gt;&lt;br /&gt;
green wire from in decider, to pump&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Pump have the same condition as the decider (Petrol &amp;gt; 2000)&lt;br /&gt;
&lt;br /&gt;
Decider : Petrol &amp;gt; 2000&amp;lt;br&amp;gt;&lt;br /&gt;
out : A = 1&amp;lt;br&amp;gt;&lt;br /&gt;
Arithmetic : A x 1800 (2000 - 200 )&amp;lt;br&amp;gt;&lt;br /&gt;
out : petrol&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:Factorio combinator switch.png|620px]]&lt;br /&gt;
&lt;br /&gt;
== Comparing Outputs ==&lt;br /&gt;
&lt;br /&gt;
== Addressing Outposts ==&lt;br /&gt;
&lt;br /&gt;
== Smart Train Loading ==&lt;br /&gt;
&lt;br /&gt;
Initially designed by [https://www.youtube.com/user/Darkphade MadZuri],&lt;br /&gt;
&lt;br /&gt;
This solves the problem of loading logistics into chests, which tend to be unequal and is slower in the rate of loading logistics into the cargo of trains.&lt;br /&gt;
&lt;br /&gt;
To setup the design, you require an Arithmetic Combinator, as well as Red and Green wires. &#039;&#039;&#039;Wire all the chests used, to the input of the Arithmetic Combinator&#039;&#039;&#039;. &#039;&#039;&#039;Then write (Logistics Item / -Amount of chests) and as the output as the Logistics Item in the Arithmetic Combinator&#039;&#039;&#039;, this will average the amount of items within the chests. Lastly, &#039;&#039;&#039;wire all the inserters used to the output of the Arithmetic Combinator and have the other color of the wire be wired to the adjacent chest&#039;&#039;&#039;. &#039;&#039;&#039;Have the inserters enabled when Logistics Item &amp;lt; 1&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
A more visual representation as well as questions for the design can be found [https://www.reddit.com/r/factorio/comments/4e03g2/madzuris_smart_loading_train_station_guide/ here].&lt;br /&gt;
&lt;br /&gt;
Explanation of why this works:&lt;br /&gt;
It compares the average amount of total items within the chests and the chest adjacent to the inserter so that it activates when the average number of items is higher than the amount within the chest.&lt;br /&gt;
The reason for why the division denominator is negative is because if the items in the chests are 0, it basically makes it so that it adds 1 to the equation.&lt;br /&gt;
&lt;br /&gt;
== Oil Control ==&lt;br /&gt;
&lt;br /&gt;
== Memory ==&lt;br /&gt;
How to store a constant value for later use, either for a basic counter or for more advanced logic. A decider combinator wired output tied to input and configured greater than zero (for positive values), input -&amp;gt; output will &#039;hold&#039; a value, as long as all other inputs on the network are zero.&lt;br /&gt;
&lt;br /&gt;
Any non-zero input condition will create a basic clock; incrementing the stored value by the sum of all connected input values every cycle. A single pulse of an input will cause a single increment by the pulsed value. Reset to zero occurs whenever the set condition is no longer met, or if a negative pulse equal to the input occurs.&lt;br /&gt;
&lt;br /&gt;
== Basic Clocks ==&lt;br /&gt;
Clocks are constructed by having the output of a combinator tied back to its own input, such that every cycle advances its own count. Either the arithmetic combinator or the decider combinator can be used.&lt;br /&gt;
&lt;br /&gt;
An arithmetic combinator tied to itself is fun to watch and will happily run-away, but requires additional control logic to reset.&lt;br /&gt;
&lt;br /&gt;
A self-resetting clock requires just a single decider combinator with output wired to input and configured with Less Than (&amp;lt;) and Input -&amp;gt; Output. When a constant combinator is then connected to the input, every cycle it will count up by the value of the Constant Combinator until the set conditional value is reached, then output a zero which will be summed with the constant combinator, and reset the process.&lt;br /&gt;
&lt;br /&gt;
[[File:Timer.png|500px]]&lt;br /&gt;
&#039;&#039;30 ticks is the ceiling for Signal 1; which is continuously added.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The clock sequence will not include zero, will begin at the value set by the constant combinator, and will include whatever value eventually causes the conditional to be false. An arithmetic combinator can modify the clock sequence but remember its outputs will occur one cycle later than the clock cycle values.&lt;br /&gt;
&lt;br /&gt;
A clock that only counts once can be built using the following setup:&lt;br /&gt;
&lt;br /&gt;
[[File:Onetime_Clock.png|400px]]&lt;br /&gt;
&#039;&#039;Runs until T=Z+1. Reset via R&amp;gt;0.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Pulse Generators ==&lt;br /&gt;
&lt;br /&gt;
Connecting an additional (=) decider combinator to the output of a basic clock will create a pulse generator, and will pulse a single output every time the clock cycles through the set condition. Any output value can be used, either directly from the clock sequence (input-&amp;gt;output), a 1, or some value on a separate logic channel on the circuit network, such as set by a constant combinator. or by the circuit network.&amp;lt;br /&amp;gt;&lt;br /&gt;
[[File:PulseGen.png|500px]]&lt;br /&gt;
*&#039;&#039;The value 1 can be written as any positive integer, so long as it is within the cap or ceiling of your timer.&#039;&#039;&lt;br /&gt;
*&#039;&#039;As an example from the above timer, this light will pulse every 1st tick after the timer reaches 30 ticks, making it pulse 1/30th of a second, as Factorio updates at 60 times per second.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Counter ==&lt;br /&gt;
A counter is used to count the number of input events, and output the sum of that count. Any pulsing input into a decider combinator configured input -&amp;gt; output and wired between output and input will create a counter, but this input must be zero at all other times or else the combinator will run away like a clock. A pulse generator is normally used to accomplish this. Combining several gating decider isolators set with sequential conditionals, a clock, and a pulse generator to the input of a counter will allow remote polling and counting of each isolator&#039;s contents.&lt;br /&gt;
&lt;br /&gt;
== Logic Gates ==&lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;Unary NOT&#039;&#039;&#039;===&lt;br /&gt;
----&lt;br /&gt;
[[File:NOT.png|415px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;Binary OR&#039;&#039;&#039;===&lt;br /&gt;
----&lt;br /&gt;
[[File:OR.png|300px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 2!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1  || 1&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;*Deprecated: Use the Arithemetic Combinator&#039;s OR option instead.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;Binary NOR&#039;&#039;&#039;===&lt;br /&gt;
----&lt;br /&gt;
[[File:NOR.png|415px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 2!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;Binary XOR&#039;&#039;&#039;===&lt;br /&gt;
----&lt;br /&gt;
[[File:XOR.png|300px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 1!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 ||  0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 ||  1 || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 ||  0 || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 ||  1 || 0&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;*Deprecated: Use the Arithemetic Combinator&#039;s XOR option instead.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;Binary AND&#039;&#039;&#039;===&lt;br /&gt;
----&lt;br /&gt;
[[File:AND.png|530px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 2!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1 || 1&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;*Deprecated: Use the Arithemetic Combinator&#039;s AND option instead.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;Trinary AND&#039;&#039;&#039;===&lt;br /&gt;
----&lt;br /&gt;
[[File:TrinaryAND.png|415px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 2!!Input 3!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0  || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1  || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0  || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1  || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0  || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1  || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0  || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1  || 1  || 1&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;Binary NAND&#039;&#039;&#039;===&lt;br /&gt;
----&lt;br /&gt;
[[File:NAND.png|300px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 2!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;Binary XNOR/XAND&#039;&#039;&#039;===&lt;br /&gt;
----&lt;br /&gt;
[[File:XAND.png|300px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 2!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1  || 1&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Memory Cells ==&lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;Simple Latch&#039;&#039;&#039;===&lt;br /&gt;
&lt;br /&gt;
When looping the combinator to itself, use a different colour of wire from your main inputs or outputs.&lt;br /&gt;
[[File:SimpleLatchv2.png|300px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Output 1!!Input 1!!Input 2!! Output 1 (t+1)&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 0 || 1&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0 || 0 || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1 || 0 || 1 &#039;&#039;(2)&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0 || 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1 || 1 || 1 &#039;&#039;(2)&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&#039;&#039;Output 1 is the green wire loop seen in the picture, it carries the value to latch.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Input 1 is Set, while Input 2 is Reset.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;Binary Cell&#039;&#039;&#039;===&lt;br /&gt;
&lt;br /&gt;
RS NOR Latch&lt;br /&gt;
[[File:RS-NOR.png|500px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;Advanced Cell&#039;&#039;&#039;===&lt;br /&gt;
&lt;br /&gt;
Cell for storing a positive value:&lt;br /&gt;
&lt;br /&gt;
[[File:AdvancedMemoryCell.png|500px]]&lt;br /&gt;
&lt;br /&gt;
Connect the desired value as signal 3 on the right side to set the memory cell and connect a negative value as signal 3 to reset the cell.  *Please note the arithmetic combinator&#039;s output should be facing the opposite direction of the decider combinators.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Address Enable Switch&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== See Also ==&lt;br /&gt;
*[http://www.factorioforums.com/forum/viewtopic.php?f=18&amp;amp;t=14556 Combinators 101 (Tutorial)]&lt;br /&gt;
*[[Arithmetic combinator]]&lt;br /&gt;
*[[Constant Combinator]]&lt;br /&gt;
*[[Decider Combinator]]&lt;br /&gt;
*[[Circuit network]]&lt;br /&gt;
*[[Circuit-network_Cookbook]]&lt;br /&gt;
[[Category:Tutorial]]&lt;br /&gt;
[[Category:English page]]&lt;/div&gt;</summary>
		<author><name>My3DS</name></author>
	</entry>
	<entry>
		<id>https://wiki.factorio.com/index.php?title=Tutorial:Combinator_tutorial&amp;diff=136083</id>
		<title>Tutorial:Combinator tutorial</title>
		<link rel="alternate" type="text/html" href="https://wiki.factorio.com/index.php?title=Tutorial:Combinator_tutorial&amp;diff=136083"/>
		<updated>2017-04-26T23:07:24Z</updated>

		<summary type="html">&lt;p&gt;My3DS: /* Binary AND */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
Combinator logic is achieved by cross-connecting outputs to inputs in such a way to achieve the desired logic. While advanced logic requires a multitude of combinators, some very useful basic logic can be achieved using only a handful of combinators. &#039;&#039;&#039;Combinator logic works because Factorio only updates at 60 times per second, such that combinators analyze their logic in a step, and then sum and/or decide the resulting output values on the next step.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
When logic values are computed by combinators, the outputs are not recognized by the circuit network until the following step. So when a decider combinator is used to detect a certain input condition, it&#039;s output value will not take effect on the circuit network until the next step. &#039;&#039;&#039;This behavior is important to remember and can result in sequencing errors and significant delays when multiple combinators are connected in series.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Circuit wires act like a wire bus in electronics, it carries information in the connected wires, meaning that &#039;&#039;&#039;if there are similar signals on a wire, it will add them automatically, unless if it is a different signal, that means it will be carried in that wire as well, but as a different signal.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
When cross-connecting combinators &#039;&#039;&#039;it&#039;s good practice to use the unused color to cross-connect, this will split the input and output networks and prevent unwanted inputs from accidentally connecting to a larger circuit network.&#039;&#039;&#039; Combinators will sum the red &amp;amp;/or green inputs prior to calculation, so either color can be used when wiring the output back to the input, but in most cases, it is more useful to use the opposing colour of the wire so that it will not interfere with the resulting output and input.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;There is also an example heavy [[Circuit-network_Cookbook|circuit network cookbook]] that you may find helpful to learn and refer to about circuit networks.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Virtual Signals ==&lt;br /&gt;
&lt;br /&gt;
===Everything Wildcard:===&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
This Red Wildcard serves to check all the specifed input signals.&lt;br /&gt;
&lt;br /&gt;
As the Decider Combinator, &amp;lt;br /&amp;gt;&lt;br /&gt;
its input is used to serve if all inputs meets the specified signals or variables. &amp;lt;br /&amp;gt;&lt;br /&gt;
its output is used to serve output every signal. &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Anything Wildcard:===&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
This Green Wildcard serves to check all the specifed input signals.&lt;br /&gt;
&lt;br /&gt;
As the Decider Combinator, &lt;br /&gt;
its input is used to serve if any of its inputs meets the specified signals or variables.&lt;br /&gt;
&lt;br /&gt;
===Each Wildcard:===&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
This Yellow Wildcard serves to check for each the specifed input signals.&lt;br /&gt;
&lt;br /&gt;
As the Decider Combinator, &amp;lt;br /&amp;gt;&lt;br /&gt;
its input is used to serve if any inputs meets the specified signals or variables. &amp;lt;br /&amp;gt;&lt;br /&gt;
its output is used to serve output the each variable. &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As the Arithmetic Combinator, &amp;lt;br /&amp;gt;&lt;br /&gt;
its input is used to serve each input, then the following summations are summed and outputted, with each signal as its own respective signals.&lt;br /&gt;
&lt;br /&gt;
== Input Isolator &amp;amp; Gate ==&lt;br /&gt;
An arithmetic combinator set to (In: Each + 0, Out: Each) can be used to swap wire colors and as an isolator to prevent downstream logic from backfeeding into the circuit network&#039;s inputs.&lt;br /&gt;
&lt;br /&gt;
A decider combinator set to (Out: Everything, Input-&amp;gt; Output) will also function as an isolator as long as the set logic condition is true. This can also selectively pass or &#039;gate&#039; inputs only when desired. This could be used to sequentially poll remote train stations for their chest contents, and include only desired stations.&lt;br /&gt;
&lt;br /&gt;
== Set/Reset Latching Switch ==&lt;br /&gt;
You want something to SET a trigger at some quantity, but then STAY on until that quantity hits some other value, the RESET value. You&#039;ll need one decider combinator and one arithmetic combinator. Two decider combinators and a constant combinator can also be used for more complex multi-channel conditions.&lt;br /&gt;
&lt;br /&gt;
Setup the first decider combinator to the desired set conditional and to output a 1. Then connect the output to the input of an arithmetic combinator, and configure it to multiply by the bias value, the difference between the set and reset values, and wire the arithmetic output to the input of the decider. The arithmetic output channel MUST be set the same as the decider&#039;s input channel. That&#039;s it! Whenever your set conditional is reached, the decider will output a &#039;1&#039;, and the bias of the arithmetic combinator will be applied. This will &#039;hold&#039; the output true until the value goes back below the reset point.&lt;br /&gt;
&lt;br /&gt;
Here&#039;s a more specific example : &lt;br /&gt;
i want the pump to run when petrol reach 2000, and turn off when reach 200.&amp;lt;br&amp;gt;&lt;br /&gt;
only with green wire&amp;lt;br&amp;gt;&lt;br /&gt;
Tank -&amp;gt; in decider&amp;lt;br&amp;gt;&lt;br /&gt;
out decider-&amp;gt; in arithmetic&amp;lt;br&amp;gt;&lt;br /&gt;
out arithmetic -&amp;gt; in decider&amp;lt;br&amp;gt;&lt;br /&gt;
green wire from in decider, to pump&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Pump have the same condition as the decider (Petrol &amp;gt; 2000)&lt;br /&gt;
&lt;br /&gt;
Decider : Petrol &amp;gt; 2000&amp;lt;br&amp;gt;&lt;br /&gt;
out : A = 1&amp;lt;br&amp;gt;&lt;br /&gt;
Arithmetic : A x 1800 (2000 - 200 )&amp;lt;br&amp;gt;&lt;br /&gt;
out : petrol&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:Factorio combinator switch.png|620px]]&lt;br /&gt;
&lt;br /&gt;
== Comparing Outputs ==&lt;br /&gt;
&lt;br /&gt;
== Addressing Outposts ==&lt;br /&gt;
&lt;br /&gt;
== Smart Train Loading ==&lt;br /&gt;
&lt;br /&gt;
Initially designed by [https://www.youtube.com/user/Darkphade MadZuri],&lt;br /&gt;
&lt;br /&gt;
This solves the problem of loading logistics into chests, which tend to be unequal and is slower in the rate of loading logistics into the cargo of trains.&lt;br /&gt;
&lt;br /&gt;
To setup the design, you require an Arithmetic Combinator, as well as Red and Green wires. &#039;&#039;&#039;Wire all the chests used, to the input of the Arithmetic Combinator&#039;&#039;&#039;. &#039;&#039;&#039;Then write (Logistics Item / -Amount of chests) and as the output as the Logistics Item in the Arithmetic Combinator&#039;&#039;&#039;, this will average the amount of items within the chests. Lastly, &#039;&#039;&#039;wire all the inserters used to the output of the Arithmetic Combinator and have the other color of the wire be wired to the adjacent chest&#039;&#039;&#039;. &#039;&#039;&#039;Have the inserters enabled when Logistics Item &amp;lt; 1&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
A more visual representation as well as questions for the design can be found [https://www.reddit.com/r/factorio/comments/4e03g2/madzuris_smart_loading_train_station_guide/ here].&lt;br /&gt;
&lt;br /&gt;
Explanation of why this works:&lt;br /&gt;
It compares the average amount of total items within the chests and the chest adjacent to the inserter so that it activates when the average number of items is higher than the amount within the chest.&lt;br /&gt;
The reason for why the division denominator is negative is because if the items in the chests are 0, it basically makes it so that it adds 1 to the equation.&lt;br /&gt;
&lt;br /&gt;
== Oil Control ==&lt;br /&gt;
&lt;br /&gt;
== Memory ==&lt;br /&gt;
How to store a constant value for later use, either for a basic counter or for more advanced logic. A decider combinator wired output tied to input and configured greater than zero (for positive values), input -&amp;gt; output will &#039;hold&#039; a value, as long as all other inputs on the network are zero.&lt;br /&gt;
&lt;br /&gt;
Any non-zero input condition will create a basic clock; incrementing the stored value by the sum of all connected input values every cycle. A single pulse of an input will cause a single increment by the pulsed value. Reset to zero occurs whenever the set condition is no longer met, or if a negative pulse equal to the input occurs.&lt;br /&gt;
&lt;br /&gt;
== Basic Clocks ==&lt;br /&gt;
Clocks are constructed by having the output of a combinator tied back to its own input, such that every cycle advances its own count. Either the arithmetic combinator or the decider combinator can be used.&lt;br /&gt;
&lt;br /&gt;
An arithmetic combinator tied to itself is fun to watch and will happily run-away, but requires additional control logic to reset.&lt;br /&gt;
&lt;br /&gt;
A self-resetting clock requires just a single decider combinator with output wired to input and configured with Less Than (&amp;lt;) and Input -&amp;gt; Output. When a constant combinator is then connected to the input, every cycle it will count up by the value of the Constant Combinator until the set conditional value is reached, then output a zero which will be summed with the constant combinator, and reset the process.&lt;br /&gt;
&lt;br /&gt;
[[File:Timer.png|500px]]&lt;br /&gt;
&#039;&#039;30 ticks is the ceiling for Signal 1; which is continuously added.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The clock sequence will not include zero, will begin at the value set by the constant combinator, and will include whatever value eventually causes the conditional to be false. An arithmetic combinator can modify the clock sequence but remember its outputs will occur one cycle later than the clock cycle values.&lt;br /&gt;
&lt;br /&gt;
A clock that only counts once can be built using the following setup:&lt;br /&gt;
&lt;br /&gt;
[[File:Onetime_Clock.png|400px]]&lt;br /&gt;
&#039;&#039;Runs until T=Z+1. Reset via R&amp;gt;0.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Pulse Generators ==&lt;br /&gt;
&lt;br /&gt;
Connecting an additional (=) decider combinator to the output of a basic clock will create a pulse generator, and will pulse a single output every time the clock cycles through the set condition. Any output value can be used, either directly from the clock sequence (input-&amp;gt;output), a 1, or some value on a separate logic channel on the circuit network, such as set by a constant combinator. or by the circuit network.&amp;lt;br /&amp;gt;&lt;br /&gt;
[[File:PulseGen.png|500px]]&lt;br /&gt;
*&#039;&#039;The value 1 can be written as any positive integer, so long as it is within the cap or ceiling of your timer.&#039;&#039;&lt;br /&gt;
*&#039;&#039;As an example from the above timer, this light will pulse every 1st tick after the timer reaches 30 ticks, making it pulse 1/30th of a second, as Factorio updates at 60 times per second.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Counter ==&lt;br /&gt;
A counter is used to count the number of input events, and output the sum of that count. Any pulsing input into a decider combinator configured input -&amp;gt; output and wired between output and input will create a counter, but this input must be zero at all other times or else the combinator will run away like a clock. A pulse generator is normally used to accomplish this. Combining several gating decider isolators set with sequential conditionals, a clock, and a pulse generator to the input of a counter will allow remote polling and counting of each isolator&#039;s contents.&lt;br /&gt;
&lt;br /&gt;
== Logic Gates ==&lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;Unary NOT&#039;&#039;&#039;===&lt;br /&gt;
----&lt;br /&gt;
[[File:NOT.png|415px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;Binary OR&#039;&#039;&#039;===&lt;br /&gt;
----&lt;br /&gt;
[[File:OR.png|300px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 2!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1  || 1&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;*Deprecated: Use the Arithemetic Combinator&#039;s OR option instead.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;Binary NOR&#039;&#039;&#039;===&lt;br /&gt;
----&lt;br /&gt;
[[File:NOR.png|415px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 2!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;Binary XOR&#039;&#039;&#039;===&lt;br /&gt;
----&lt;br /&gt;
[[File:XOR.png|300px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 1!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 ||  0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 ||  1 || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 ||  0 || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 ||  1 || 0&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;*Deprecated: Use the Arithemetic Combinator&#039;s XOR option instead.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;Binary AND&#039;&#039;&#039;===&lt;br /&gt;
----&lt;br /&gt;
[[File:AND.png|530px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 2!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1 || 1&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;*Deprecated: Use the Arithemetic Combinator&#039;s AND option instead.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;Trinary AND&#039;&#039;&#039;===&lt;br /&gt;
----&lt;br /&gt;
[[File:TrinaryAND.png|415px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 2!!Input 3!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0  || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1  || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0  || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1  || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0  || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1  || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0  || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1  || 1  || 1&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;Binary NAND&#039;&#039;&#039;===&lt;br /&gt;
----&lt;br /&gt;
[[File:NAND.png|300px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 2!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;Binary XNOR/XAND&#039;&#039;&#039;===&lt;br /&gt;
----&lt;br /&gt;
[[File:XAND.png|300px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 2!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1  || 1&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Memory Cells ==&lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;Simple Latch&#039;&#039;&#039;===&lt;br /&gt;
&lt;br /&gt;
Have a Decider Combinator connect to itself with its input and output using a different colour of wire, say green wire when your output and input is red wire.&lt;br /&gt;
&lt;br /&gt;
[[File:SimpleLatchv2.png|300px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Output 1!!Input 1!!Input 2!! Output 1 (t+1)&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 0 || 1&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0 || 0 || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1 || 0 || 1 &#039;&#039;(2)&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0 || 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1 || 1 || 1 &#039;&#039;(2)&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&#039;&#039;Output 1 is the green wire loop seen in the picture, it carries the value to latch.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Input 1 is Set, while Input 2 is Reset.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;Binary Cell&#039;&#039;&#039;===&lt;br /&gt;
&lt;br /&gt;
RS NOR Latch&lt;br /&gt;
[[File:RS-NOR.png|500px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;Advanced Cell&#039;&#039;&#039;===&lt;br /&gt;
&lt;br /&gt;
Cell for storing a positive value:&lt;br /&gt;
&lt;br /&gt;
[[File:AdvancedMemoryCell.png|500px]]&lt;br /&gt;
&lt;br /&gt;
Connect the desired value as signal 3 on the right side to set the memory cell and connect a negative value as signal 3 to reset the cell.  *Please note the arithmetic combinator&#039;s output should be facing the opposite direction of the decider combinators.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Address Enable Switch&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== See Also ==&lt;br /&gt;
*[http://www.factorioforums.com/forum/viewtopic.php?f=18&amp;amp;t=14556 Combinators 101 (Tutorial)]&lt;br /&gt;
*[[Arithmetic combinator]]&lt;br /&gt;
*[[Constant Combinator]]&lt;br /&gt;
*[[Decider Combinator]]&lt;br /&gt;
*[[Circuit network]]&lt;br /&gt;
*[[Circuit-network_Cookbook]]&lt;br /&gt;
[[Category:Tutorial]]&lt;br /&gt;
[[Category:English page]]&lt;/div&gt;</summary>
		<author><name>My3DS</name></author>
	</entry>
	<entry>
		<id>https://wiki.factorio.com/index.php?title=Tutorial:Combinator_tutorial&amp;diff=136082</id>
		<title>Tutorial:Combinator tutorial</title>
		<link rel="alternate" type="text/html" href="https://wiki.factorio.com/index.php?title=Tutorial:Combinator_tutorial&amp;diff=136082"/>
		<updated>2017-04-26T23:02:49Z</updated>

		<summary type="html">&lt;p&gt;My3DS: /* Binary XOR */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
Combinator logic is achieved by cross-connecting outputs to inputs in such a way to achieve the desired logic. While advanced logic requires a multitude of combinators, some very useful basic logic can be achieved using only a handful of combinators. &#039;&#039;&#039;Combinator logic works because Factorio only updates at 60 times per second, such that combinators analyze their logic in a step, and then sum and/or decide the resulting output values on the next step.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
When logic values are computed by combinators, the outputs are not recognized by the circuit network until the following step. So when a decider combinator is used to detect a certain input condition, it&#039;s output value will not take effect on the circuit network until the next step. &#039;&#039;&#039;This behavior is important to remember and can result in sequencing errors and significant delays when multiple combinators are connected in series.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Circuit wires act like a wire bus in electronics, it carries information in the connected wires, meaning that &#039;&#039;&#039;if there are similar signals on a wire, it will add them automatically, unless if it is a different signal, that means it will be carried in that wire as well, but as a different signal.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
When cross-connecting combinators &#039;&#039;&#039;it&#039;s good practice to use the unused color to cross-connect, this will split the input and output networks and prevent unwanted inputs from accidentally connecting to a larger circuit network.&#039;&#039;&#039; Combinators will sum the red &amp;amp;/or green inputs prior to calculation, so either color can be used when wiring the output back to the input, but in most cases, it is more useful to use the opposing colour of the wire so that it will not interfere with the resulting output and input.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;There is also an example heavy [[Circuit-network_Cookbook|circuit network cookbook]] that you may find helpful to learn and refer to about circuit networks.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Virtual Signals ==&lt;br /&gt;
&lt;br /&gt;
===Everything Wildcard:===&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
This Red Wildcard serves to check all the specifed input signals.&lt;br /&gt;
&lt;br /&gt;
As the Decider Combinator, &amp;lt;br /&amp;gt;&lt;br /&gt;
its input is used to serve if all inputs meets the specified signals or variables. &amp;lt;br /&amp;gt;&lt;br /&gt;
its output is used to serve output every signal. &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Anything Wildcard:===&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
This Green Wildcard serves to check all the specifed input signals.&lt;br /&gt;
&lt;br /&gt;
As the Decider Combinator, &lt;br /&gt;
its input is used to serve if any of its inputs meets the specified signals or variables.&lt;br /&gt;
&lt;br /&gt;
===Each Wildcard:===&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
This Yellow Wildcard serves to check for each the specifed input signals.&lt;br /&gt;
&lt;br /&gt;
As the Decider Combinator, &amp;lt;br /&amp;gt;&lt;br /&gt;
its input is used to serve if any inputs meets the specified signals or variables. &amp;lt;br /&amp;gt;&lt;br /&gt;
its output is used to serve output the each variable. &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As the Arithmetic Combinator, &amp;lt;br /&amp;gt;&lt;br /&gt;
its input is used to serve each input, then the following summations are summed and outputted, with each signal as its own respective signals.&lt;br /&gt;
&lt;br /&gt;
== Input Isolator &amp;amp; Gate ==&lt;br /&gt;
An arithmetic combinator set to (In: Each + 0, Out: Each) can be used to swap wire colors and as an isolator to prevent downstream logic from backfeeding into the circuit network&#039;s inputs.&lt;br /&gt;
&lt;br /&gt;
A decider combinator set to (Out: Everything, Input-&amp;gt; Output) will also function as an isolator as long as the set logic condition is true. This can also selectively pass or &#039;gate&#039; inputs only when desired. This could be used to sequentially poll remote train stations for their chest contents, and include only desired stations.&lt;br /&gt;
&lt;br /&gt;
== Set/Reset Latching Switch ==&lt;br /&gt;
You want something to SET a trigger at some quantity, but then STAY on until that quantity hits some other value, the RESET value. You&#039;ll need one decider combinator and one arithmetic combinator. Two decider combinators and a constant combinator can also be used for more complex multi-channel conditions.&lt;br /&gt;
&lt;br /&gt;
Setup the first decider combinator to the desired set conditional and to output a 1. Then connect the output to the input of an arithmetic combinator, and configure it to multiply by the bias value, the difference between the set and reset values, and wire the arithmetic output to the input of the decider. The arithmetic output channel MUST be set the same as the decider&#039;s input channel. That&#039;s it! Whenever your set conditional is reached, the decider will output a &#039;1&#039;, and the bias of the arithmetic combinator will be applied. This will &#039;hold&#039; the output true until the value goes back below the reset point.&lt;br /&gt;
&lt;br /&gt;
Here&#039;s a more specific example : &lt;br /&gt;
i want the pump to run when petrol reach 2000, and turn off when reach 200.&amp;lt;br&amp;gt;&lt;br /&gt;
only with green wire&amp;lt;br&amp;gt;&lt;br /&gt;
Tank -&amp;gt; in decider&amp;lt;br&amp;gt;&lt;br /&gt;
out decider-&amp;gt; in arithmetic&amp;lt;br&amp;gt;&lt;br /&gt;
out arithmetic -&amp;gt; in decider&amp;lt;br&amp;gt;&lt;br /&gt;
green wire from in decider, to pump&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Pump have the same condition as the decider (Petrol &amp;gt; 2000)&lt;br /&gt;
&lt;br /&gt;
Decider : Petrol &amp;gt; 2000&amp;lt;br&amp;gt;&lt;br /&gt;
out : A = 1&amp;lt;br&amp;gt;&lt;br /&gt;
Arithmetic : A x 1800 (2000 - 200 )&amp;lt;br&amp;gt;&lt;br /&gt;
out : petrol&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:Factorio combinator switch.png|620px]]&lt;br /&gt;
&lt;br /&gt;
== Comparing Outputs ==&lt;br /&gt;
&lt;br /&gt;
== Addressing Outposts ==&lt;br /&gt;
&lt;br /&gt;
== Smart Train Loading ==&lt;br /&gt;
&lt;br /&gt;
Initially designed by [https://www.youtube.com/user/Darkphade MadZuri],&lt;br /&gt;
&lt;br /&gt;
This solves the problem of loading logistics into chests, which tend to be unequal and is slower in the rate of loading logistics into the cargo of trains.&lt;br /&gt;
&lt;br /&gt;
To setup the design, you require an Arithmetic Combinator, as well as Red and Green wires. &#039;&#039;&#039;Wire all the chests used, to the input of the Arithmetic Combinator&#039;&#039;&#039;. &#039;&#039;&#039;Then write (Logistics Item / -Amount of chests) and as the output as the Logistics Item in the Arithmetic Combinator&#039;&#039;&#039;, this will average the amount of items within the chests. Lastly, &#039;&#039;&#039;wire all the inserters used to the output of the Arithmetic Combinator and have the other color of the wire be wired to the adjacent chest&#039;&#039;&#039;. &#039;&#039;&#039;Have the inserters enabled when Logistics Item &amp;lt; 1&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
A more visual representation as well as questions for the design can be found [https://www.reddit.com/r/factorio/comments/4e03g2/madzuris_smart_loading_train_station_guide/ here].&lt;br /&gt;
&lt;br /&gt;
Explanation of why this works:&lt;br /&gt;
It compares the average amount of total items within the chests and the chest adjacent to the inserter so that it activates when the average number of items is higher than the amount within the chest.&lt;br /&gt;
The reason for why the division denominator is negative is because if the items in the chests are 0, it basically makes it so that it adds 1 to the equation.&lt;br /&gt;
&lt;br /&gt;
== Oil Control ==&lt;br /&gt;
&lt;br /&gt;
== Memory ==&lt;br /&gt;
How to store a constant value for later use, either for a basic counter or for more advanced logic. A decider combinator wired output tied to input and configured greater than zero (for positive values), input -&amp;gt; output will &#039;hold&#039; a value, as long as all other inputs on the network are zero.&lt;br /&gt;
&lt;br /&gt;
Any non-zero input condition will create a basic clock; incrementing the stored value by the sum of all connected input values every cycle. A single pulse of an input will cause a single increment by the pulsed value. Reset to zero occurs whenever the set condition is no longer met, or if a negative pulse equal to the input occurs.&lt;br /&gt;
&lt;br /&gt;
== Basic Clocks ==&lt;br /&gt;
Clocks are constructed by having the output of a combinator tied back to its own input, such that every cycle advances its own count. Either the arithmetic combinator or the decider combinator can be used.&lt;br /&gt;
&lt;br /&gt;
An arithmetic combinator tied to itself is fun to watch and will happily run-away, but requires additional control logic to reset.&lt;br /&gt;
&lt;br /&gt;
A self-resetting clock requires just a single decider combinator with output wired to input and configured with Less Than (&amp;lt;) and Input -&amp;gt; Output. When a constant combinator is then connected to the input, every cycle it will count up by the value of the Constant Combinator until the set conditional value is reached, then output a zero which will be summed with the constant combinator, and reset the process.&lt;br /&gt;
&lt;br /&gt;
[[File:Timer.png|500px]]&lt;br /&gt;
&#039;&#039;30 ticks is the ceiling for Signal 1; which is continuously added.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The clock sequence will not include zero, will begin at the value set by the constant combinator, and will include whatever value eventually causes the conditional to be false. An arithmetic combinator can modify the clock sequence but remember its outputs will occur one cycle later than the clock cycle values.&lt;br /&gt;
&lt;br /&gt;
A clock that only counts once can be built using the following setup:&lt;br /&gt;
&lt;br /&gt;
[[File:Onetime_Clock.png|400px]]&lt;br /&gt;
&#039;&#039;Runs until T=Z+1. Reset via R&amp;gt;0.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Pulse Generators ==&lt;br /&gt;
&lt;br /&gt;
Connecting an additional (=) decider combinator to the output of a basic clock will create a pulse generator, and will pulse a single output every time the clock cycles through the set condition. Any output value can be used, either directly from the clock sequence (input-&amp;gt;output), a 1, or some value on a separate logic channel on the circuit network, such as set by a constant combinator. or by the circuit network.&amp;lt;br /&amp;gt;&lt;br /&gt;
[[File:PulseGen.png|500px]]&lt;br /&gt;
*&#039;&#039;The value 1 can be written as any positive integer, so long as it is within the cap or ceiling of your timer.&#039;&#039;&lt;br /&gt;
*&#039;&#039;As an example from the above timer, this light will pulse every 1st tick after the timer reaches 30 ticks, making it pulse 1/30th of a second, as Factorio updates at 60 times per second.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Counter ==&lt;br /&gt;
A counter is used to count the number of input events, and output the sum of that count. Any pulsing input into a decider combinator configured input -&amp;gt; output and wired between output and input will create a counter, but this input must be zero at all other times or else the combinator will run away like a clock. A pulse generator is normally used to accomplish this. Combining several gating decider isolators set with sequential conditionals, a clock, and a pulse generator to the input of a counter will allow remote polling and counting of each isolator&#039;s contents.&lt;br /&gt;
&lt;br /&gt;
== Logic Gates ==&lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;Unary NOT&#039;&#039;&#039;===&lt;br /&gt;
----&lt;br /&gt;
[[File:NOT.png|415px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;Binary OR&#039;&#039;&#039;===&lt;br /&gt;
----&lt;br /&gt;
[[File:OR.png|300px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 2!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1  || 1&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;*Deprecated: Use the Arithemetic Combinator&#039;s OR option instead.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;Binary NOR&#039;&#039;&#039;===&lt;br /&gt;
----&lt;br /&gt;
[[File:NOR.png|415px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 2!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;Binary XOR&#039;&#039;&#039;===&lt;br /&gt;
----&lt;br /&gt;
[[File:XOR.png|300px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 1!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 ||  0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 ||  1 || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 ||  0 || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 ||  1 || 0&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;*Deprecated: Use the Arithemetic Combinator&#039;s XOR option instead.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;Binary AND&#039;&#039;&#039;===&lt;br /&gt;
----&lt;br /&gt;
[[File:AND.png|530px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 2!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1 || 1&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;Trinary AND&#039;&#039;&#039;===&lt;br /&gt;
----&lt;br /&gt;
[[File:TrinaryAND.png|415px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 2!!Input 3!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0  || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1  || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0  || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1  || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0  || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1  || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0  || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1  || 1  || 1&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;Binary NAND&#039;&#039;&#039;===&lt;br /&gt;
----&lt;br /&gt;
[[File:NAND.png|300px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 2!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;Binary XNOR/XAND&#039;&#039;&#039;===&lt;br /&gt;
----&lt;br /&gt;
[[File:XAND.png|300px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 2!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1  || 1&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Memory Cells ==&lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;Simple Latch&#039;&#039;&#039;===&lt;br /&gt;
&lt;br /&gt;
Have a Decider Combinator connect to itself with its input and output using a different colour of wire, say green wire when your output and input is red wire.&lt;br /&gt;
&lt;br /&gt;
[[File:SimpleLatchv2.png|300px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Output 1!!Input 1!!Input 2!! Output 1 (t+1)&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 0 || 1&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0 || 0 || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1 || 0 || 1 &#039;&#039;(2)&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0 || 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1 || 1 || 1 &#039;&#039;(2)&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&#039;&#039;Output 1 is the green wire loop seen in the picture, it carries the value to latch.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Input 1 is Set, while Input 2 is Reset.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;Binary Cell&#039;&#039;&#039;===&lt;br /&gt;
&lt;br /&gt;
RS NOR Latch&lt;br /&gt;
[[File:RS-NOR.png|500px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;Advanced Cell&#039;&#039;&#039;===&lt;br /&gt;
&lt;br /&gt;
Cell for storing a positive value:&lt;br /&gt;
&lt;br /&gt;
[[File:AdvancedMemoryCell.png|500px]]&lt;br /&gt;
&lt;br /&gt;
Connect the desired value as signal 3 on the right side to set the memory cell and connect a negative value as signal 3 to reset the cell.  *Please note the arithmetic combinator&#039;s output should be facing the opposite direction of the decider combinators.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Address Enable Switch&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== See Also ==&lt;br /&gt;
*[http://www.factorioforums.com/forum/viewtopic.php?f=18&amp;amp;t=14556 Combinators 101 (Tutorial)]&lt;br /&gt;
*[[Arithmetic combinator]]&lt;br /&gt;
*[[Constant Combinator]]&lt;br /&gt;
*[[Decider Combinator]]&lt;br /&gt;
*[[Circuit network]]&lt;br /&gt;
*[[Circuit-network_Cookbook]]&lt;br /&gt;
[[Category:Tutorial]]&lt;br /&gt;
[[Category:English page]]&lt;/div&gt;</summary>
		<author><name>My3DS</name></author>
	</entry>
	<entry>
		<id>https://wiki.factorio.com/index.php?title=Tutorial:Combinator_tutorial&amp;diff=136081</id>
		<title>Tutorial:Combinator tutorial</title>
		<link rel="alternate" type="text/html" href="https://wiki.factorio.com/index.php?title=Tutorial:Combinator_tutorial&amp;diff=136081"/>
		<updated>2017-04-26T23:01:37Z</updated>

		<summary type="html">&lt;p&gt;My3DS: /* Binary OR */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
Combinator logic is achieved by cross-connecting outputs to inputs in such a way to achieve the desired logic. While advanced logic requires a multitude of combinators, some very useful basic logic can be achieved using only a handful of combinators. &#039;&#039;&#039;Combinator logic works because Factorio only updates at 60 times per second, such that combinators analyze their logic in a step, and then sum and/or decide the resulting output values on the next step.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
When logic values are computed by combinators, the outputs are not recognized by the circuit network until the following step. So when a decider combinator is used to detect a certain input condition, it&#039;s output value will not take effect on the circuit network until the next step. &#039;&#039;&#039;This behavior is important to remember and can result in sequencing errors and significant delays when multiple combinators are connected in series.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Circuit wires act like a wire bus in electronics, it carries information in the connected wires, meaning that &#039;&#039;&#039;if there are similar signals on a wire, it will add them automatically, unless if it is a different signal, that means it will be carried in that wire as well, but as a different signal.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
When cross-connecting combinators &#039;&#039;&#039;it&#039;s good practice to use the unused color to cross-connect, this will split the input and output networks and prevent unwanted inputs from accidentally connecting to a larger circuit network.&#039;&#039;&#039; Combinators will sum the red &amp;amp;/or green inputs prior to calculation, so either color can be used when wiring the output back to the input, but in most cases, it is more useful to use the opposing colour of the wire so that it will not interfere with the resulting output and input.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;There is also an example heavy [[Circuit-network_Cookbook|circuit network cookbook]] that you may find helpful to learn and refer to about circuit networks.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Virtual Signals ==&lt;br /&gt;
&lt;br /&gt;
===Everything Wildcard:===&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
This Red Wildcard serves to check all the specifed input signals.&lt;br /&gt;
&lt;br /&gt;
As the Decider Combinator, &amp;lt;br /&amp;gt;&lt;br /&gt;
its input is used to serve if all inputs meets the specified signals or variables. &amp;lt;br /&amp;gt;&lt;br /&gt;
its output is used to serve output every signal. &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Anything Wildcard:===&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
This Green Wildcard serves to check all the specifed input signals.&lt;br /&gt;
&lt;br /&gt;
As the Decider Combinator, &lt;br /&gt;
its input is used to serve if any of its inputs meets the specified signals or variables.&lt;br /&gt;
&lt;br /&gt;
===Each Wildcard:===&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
This Yellow Wildcard serves to check for each the specifed input signals.&lt;br /&gt;
&lt;br /&gt;
As the Decider Combinator, &amp;lt;br /&amp;gt;&lt;br /&gt;
its input is used to serve if any inputs meets the specified signals or variables. &amp;lt;br /&amp;gt;&lt;br /&gt;
its output is used to serve output the each variable. &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As the Arithmetic Combinator, &amp;lt;br /&amp;gt;&lt;br /&gt;
its input is used to serve each input, then the following summations are summed and outputted, with each signal as its own respective signals.&lt;br /&gt;
&lt;br /&gt;
== Input Isolator &amp;amp; Gate ==&lt;br /&gt;
An arithmetic combinator set to (In: Each + 0, Out: Each) can be used to swap wire colors and as an isolator to prevent downstream logic from backfeeding into the circuit network&#039;s inputs.&lt;br /&gt;
&lt;br /&gt;
A decider combinator set to (Out: Everything, Input-&amp;gt; Output) will also function as an isolator as long as the set logic condition is true. This can also selectively pass or &#039;gate&#039; inputs only when desired. This could be used to sequentially poll remote train stations for their chest contents, and include only desired stations.&lt;br /&gt;
&lt;br /&gt;
== Set/Reset Latching Switch ==&lt;br /&gt;
You want something to SET a trigger at some quantity, but then STAY on until that quantity hits some other value, the RESET value. You&#039;ll need one decider combinator and one arithmetic combinator. Two decider combinators and a constant combinator can also be used for more complex multi-channel conditions.&lt;br /&gt;
&lt;br /&gt;
Setup the first decider combinator to the desired set conditional and to output a 1. Then connect the output to the input of an arithmetic combinator, and configure it to multiply by the bias value, the difference between the set and reset values, and wire the arithmetic output to the input of the decider. The arithmetic output channel MUST be set the same as the decider&#039;s input channel. That&#039;s it! Whenever your set conditional is reached, the decider will output a &#039;1&#039;, and the bias of the arithmetic combinator will be applied. This will &#039;hold&#039; the output true until the value goes back below the reset point.&lt;br /&gt;
&lt;br /&gt;
Here&#039;s a more specific example : &lt;br /&gt;
i want the pump to run when petrol reach 2000, and turn off when reach 200.&amp;lt;br&amp;gt;&lt;br /&gt;
only with green wire&amp;lt;br&amp;gt;&lt;br /&gt;
Tank -&amp;gt; in decider&amp;lt;br&amp;gt;&lt;br /&gt;
out decider-&amp;gt; in arithmetic&amp;lt;br&amp;gt;&lt;br /&gt;
out arithmetic -&amp;gt; in decider&amp;lt;br&amp;gt;&lt;br /&gt;
green wire from in decider, to pump&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Pump have the same condition as the decider (Petrol &amp;gt; 2000)&lt;br /&gt;
&lt;br /&gt;
Decider : Petrol &amp;gt; 2000&amp;lt;br&amp;gt;&lt;br /&gt;
out : A = 1&amp;lt;br&amp;gt;&lt;br /&gt;
Arithmetic : A x 1800 (2000 - 200 )&amp;lt;br&amp;gt;&lt;br /&gt;
out : petrol&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:Factorio combinator switch.png|620px]]&lt;br /&gt;
&lt;br /&gt;
== Comparing Outputs ==&lt;br /&gt;
&lt;br /&gt;
== Addressing Outposts ==&lt;br /&gt;
&lt;br /&gt;
== Smart Train Loading ==&lt;br /&gt;
&lt;br /&gt;
Initially designed by [https://www.youtube.com/user/Darkphade MadZuri],&lt;br /&gt;
&lt;br /&gt;
This solves the problem of loading logistics into chests, which tend to be unequal and is slower in the rate of loading logistics into the cargo of trains.&lt;br /&gt;
&lt;br /&gt;
To setup the design, you require an Arithmetic Combinator, as well as Red and Green wires. &#039;&#039;&#039;Wire all the chests used, to the input of the Arithmetic Combinator&#039;&#039;&#039;. &#039;&#039;&#039;Then write (Logistics Item / -Amount of chests) and as the output as the Logistics Item in the Arithmetic Combinator&#039;&#039;&#039;, this will average the amount of items within the chests. Lastly, &#039;&#039;&#039;wire all the inserters used to the output of the Arithmetic Combinator and have the other color of the wire be wired to the adjacent chest&#039;&#039;&#039;. &#039;&#039;&#039;Have the inserters enabled when Logistics Item &amp;lt; 1&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
A more visual representation as well as questions for the design can be found [https://www.reddit.com/r/factorio/comments/4e03g2/madzuris_smart_loading_train_station_guide/ here].&lt;br /&gt;
&lt;br /&gt;
Explanation of why this works:&lt;br /&gt;
It compares the average amount of total items within the chests and the chest adjacent to the inserter so that it activates when the average number of items is higher than the amount within the chest.&lt;br /&gt;
The reason for why the division denominator is negative is because if the items in the chests are 0, it basically makes it so that it adds 1 to the equation.&lt;br /&gt;
&lt;br /&gt;
== Oil Control ==&lt;br /&gt;
&lt;br /&gt;
== Memory ==&lt;br /&gt;
How to store a constant value for later use, either for a basic counter or for more advanced logic. A decider combinator wired output tied to input and configured greater than zero (for positive values), input -&amp;gt; output will &#039;hold&#039; a value, as long as all other inputs on the network are zero.&lt;br /&gt;
&lt;br /&gt;
Any non-zero input condition will create a basic clock; incrementing the stored value by the sum of all connected input values every cycle. A single pulse of an input will cause a single increment by the pulsed value. Reset to zero occurs whenever the set condition is no longer met, or if a negative pulse equal to the input occurs.&lt;br /&gt;
&lt;br /&gt;
== Basic Clocks ==&lt;br /&gt;
Clocks are constructed by having the output of a combinator tied back to its own input, such that every cycle advances its own count. Either the arithmetic combinator or the decider combinator can be used.&lt;br /&gt;
&lt;br /&gt;
An arithmetic combinator tied to itself is fun to watch and will happily run-away, but requires additional control logic to reset.&lt;br /&gt;
&lt;br /&gt;
A self-resetting clock requires just a single decider combinator with output wired to input and configured with Less Than (&amp;lt;) and Input -&amp;gt; Output. When a constant combinator is then connected to the input, every cycle it will count up by the value of the Constant Combinator until the set conditional value is reached, then output a zero which will be summed with the constant combinator, and reset the process.&lt;br /&gt;
&lt;br /&gt;
[[File:Timer.png|500px]]&lt;br /&gt;
&#039;&#039;30 ticks is the ceiling for Signal 1; which is continuously added.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The clock sequence will not include zero, will begin at the value set by the constant combinator, and will include whatever value eventually causes the conditional to be false. An arithmetic combinator can modify the clock sequence but remember its outputs will occur one cycle later than the clock cycle values.&lt;br /&gt;
&lt;br /&gt;
A clock that only counts once can be built using the following setup:&lt;br /&gt;
&lt;br /&gt;
[[File:Onetime_Clock.png|400px]]&lt;br /&gt;
&#039;&#039;Runs until T=Z+1. Reset via R&amp;gt;0.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Pulse Generators ==&lt;br /&gt;
&lt;br /&gt;
Connecting an additional (=) decider combinator to the output of a basic clock will create a pulse generator, and will pulse a single output every time the clock cycles through the set condition. Any output value can be used, either directly from the clock sequence (input-&amp;gt;output), a 1, or some value on a separate logic channel on the circuit network, such as set by a constant combinator. or by the circuit network.&amp;lt;br /&amp;gt;&lt;br /&gt;
[[File:PulseGen.png|500px]]&lt;br /&gt;
*&#039;&#039;The value 1 can be written as any positive integer, so long as it is within the cap or ceiling of your timer.&#039;&#039;&lt;br /&gt;
*&#039;&#039;As an example from the above timer, this light will pulse every 1st tick after the timer reaches 30 ticks, making it pulse 1/30th of a second, as Factorio updates at 60 times per second.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Counter ==&lt;br /&gt;
A counter is used to count the number of input events, and output the sum of that count. Any pulsing input into a decider combinator configured input -&amp;gt; output and wired between output and input will create a counter, but this input must be zero at all other times or else the combinator will run away like a clock. A pulse generator is normally used to accomplish this. Combining several gating decider isolators set with sequential conditionals, a clock, and a pulse generator to the input of a counter will allow remote polling and counting of each isolator&#039;s contents.&lt;br /&gt;
&lt;br /&gt;
== Logic Gates ==&lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;Unary NOT&#039;&#039;&#039;===&lt;br /&gt;
----&lt;br /&gt;
[[File:NOT.png|415px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;Binary OR&#039;&#039;&#039;===&lt;br /&gt;
----&lt;br /&gt;
[[File:OR.png|300px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 2!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1  || 1&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;*Deprecated: Use the Arithemetic Combinator&#039;s OR option instead.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;Binary NOR&#039;&#039;&#039;===&lt;br /&gt;
----&lt;br /&gt;
[[File:NOR.png|415px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 2!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;Binary XOR&#039;&#039;&#039;===&lt;br /&gt;
----&lt;br /&gt;
[[File:XOR.png|300px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 1!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 ||  0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 ||  1 || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 ||  0 || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 ||  1 || 0&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;Binary AND&#039;&#039;&#039;===&lt;br /&gt;
----&lt;br /&gt;
[[File:AND.png|530px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 2!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1 || 1&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;Trinary AND&#039;&#039;&#039;===&lt;br /&gt;
----&lt;br /&gt;
[[File:TrinaryAND.png|415px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 2!!Input 3!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0  || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1  || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0  || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1  || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0  || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1  || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0  || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1  || 1  || 1&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;Binary NAND&#039;&#039;&#039;===&lt;br /&gt;
----&lt;br /&gt;
[[File:NAND.png|300px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 2!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;Binary XNOR/XAND&#039;&#039;&#039;===&lt;br /&gt;
----&lt;br /&gt;
[[File:XAND.png|300px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 2!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1  || 1&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Memory Cells ==&lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;Simple Latch&#039;&#039;&#039;===&lt;br /&gt;
&lt;br /&gt;
Have a Decider Combinator connect to itself with its input and output using a different colour of wire, say green wire when your output and input is red wire.&lt;br /&gt;
&lt;br /&gt;
[[File:SimpleLatchv2.png|300px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Output 1!!Input 1!!Input 2!! Output 1 (t+1)&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 0 || 1&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0 || 0 || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1 || 0 || 1 &#039;&#039;(2)&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0 || 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1 || 1 || 1 &#039;&#039;(2)&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&#039;&#039;Output 1 is the green wire loop seen in the picture, it carries the value to latch.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Input 1 is Set, while Input 2 is Reset.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;Binary Cell&#039;&#039;&#039;===&lt;br /&gt;
&lt;br /&gt;
RS NOR Latch&lt;br /&gt;
[[File:RS-NOR.png|500px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;Advanced Cell&#039;&#039;&#039;===&lt;br /&gt;
&lt;br /&gt;
Cell for storing a positive value:&lt;br /&gt;
&lt;br /&gt;
[[File:AdvancedMemoryCell.png|500px]]&lt;br /&gt;
&lt;br /&gt;
Connect the desired value as signal 3 on the right side to set the memory cell and connect a negative value as signal 3 to reset the cell.  *Please note the arithmetic combinator&#039;s output should be facing the opposite direction of the decider combinators.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Address Enable Switch&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== See Also ==&lt;br /&gt;
*[http://www.factorioforums.com/forum/viewtopic.php?f=18&amp;amp;t=14556 Combinators 101 (Tutorial)]&lt;br /&gt;
*[[Arithmetic combinator]]&lt;br /&gt;
*[[Constant Combinator]]&lt;br /&gt;
*[[Decider Combinator]]&lt;br /&gt;
*[[Circuit network]]&lt;br /&gt;
*[[Circuit-network_Cookbook]]&lt;br /&gt;
[[Category:Tutorial]]&lt;br /&gt;
[[Category:English page]]&lt;/div&gt;</summary>
		<author><name>My3DS</name></author>
	</entry>
	<entry>
		<id>https://wiki.factorio.com/index.php?title=Tutorial:Combinator_tutorial&amp;diff=135475</id>
		<title>Tutorial:Combinator tutorial</title>
		<link rel="alternate" type="text/html" href="https://wiki.factorio.com/index.php?title=Tutorial:Combinator_tutorial&amp;diff=135475"/>
		<updated>2017-04-02T03:32:24Z</updated>

		<summary type="html">&lt;p&gt;My3DS: /* Simple Latch */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
Combinator logic is achieved by cross-connecting outputs to inputs in such a way to achieve the desired logic. While advanced logic requires a multitude of combinators, some very useful basic logic can be achieved using only a handful of combinators. &#039;&#039;&#039;Combinator logic works because Factorio only updates at 60 times per second, such that combinators analyze their logic in a step, and then sum and/or decide the resulting output values on the next step.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
When logic values are computed by combinators, the outputs are not recognized by the circuit network until the following step. So when a decider combinator is used to detect a certain input condition, it&#039;s output value will not take effect on the circuit network until the next step. &#039;&#039;&#039;This behavior is important to remember and can result in sequencing errors and significant delays when multiple combinators are connected in series.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Circuit wires act like a wire bus in electronics, it carries information in the connected wires, meaning that &#039;&#039;&#039;if there are similar signals on a wire, it will add them automatically, unless if it is a different signal, that means it will be carried in that wire as well, but as a different signal.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
When cross-connecting combinators &#039;&#039;&#039;it&#039;s good practice to use the unused color to cross-connect, this will split the input and output networks and prevent unwanted inputs from accidentally connecting to a larger circuit network.&#039;&#039;&#039; Combinators will sum the red &amp;amp;/or green inputs prior to calculation, so either color can be used when wiring the output back to the input, but in most cases, it is more useful to use the opposing colour of the wire so that it will not interfere with the resulting output and input.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;There is also an example heavy [[Circuit-network_Cookbook|circuit network cookbook]] that you may find helpful to learn and refer to about circuit networks.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Virtual Signals ==&lt;br /&gt;
&lt;br /&gt;
===Everything Wildcard:===&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
This Red Wildcard serves to check all the specifed input signals.&lt;br /&gt;
&lt;br /&gt;
As the Decider Combinator, &amp;lt;br /&amp;gt;&lt;br /&gt;
its input is used to serve if all inputs meets the specified signals or variables. &amp;lt;br /&amp;gt;&lt;br /&gt;
its output is used to serve output every signal. &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Anything Wildcard:===&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
This Green Wildcard serves to check all the specifed input signals.&lt;br /&gt;
&lt;br /&gt;
As the Decider Combinator, &lt;br /&gt;
its input is used to serve if any of its inputs meets the specified signals or variables.&lt;br /&gt;
&lt;br /&gt;
===Each Wildcard:===&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
This Yellow Wildcard serves to check for each the specifed input signals.&lt;br /&gt;
&lt;br /&gt;
As the Decider Combinator, &amp;lt;br /&amp;gt;&lt;br /&gt;
its input is used to serve if any inputs meets the specified signals or variables. &amp;lt;br /&amp;gt;&lt;br /&gt;
its output is used to serve output the each variable. &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As the Arithmetic Combinator, &amp;lt;br /&amp;gt;&lt;br /&gt;
its input is used to serve each input, then the following summations are summed and outputted, with each signal as its own respective signals.&lt;br /&gt;
&lt;br /&gt;
== Input Isolator &amp;amp; Gate ==&lt;br /&gt;
An arithmetic combinator set to (In: Each + 0, Out: Each) can be used to swap wire colors and as an isolator to prevent downstream logic from backfeeding into the circuit network&#039;s inputs.&lt;br /&gt;
&lt;br /&gt;
A decider combinator set to (Out: Everything, Input-&amp;gt; Output) will also function as an isolator as long as the set logic condition is true. This can also selectively pass or &#039;gate&#039; inputs only when desired. This could be used to sequentially poll remote train stations for their chest contents, and include only desired stations.&lt;br /&gt;
&lt;br /&gt;
== Set/Reset Latching Switch ==&lt;br /&gt;
You want something to SET a trigger at some quantity, but then STAY on until that quantity hits some other value, the RESET value. You&#039;ll need one decider combinator and one arithmetic combinator. Two decider combinators and a constant combinator can also be used for more complex multi-channel conditions.&lt;br /&gt;
&lt;br /&gt;
Setup the first decider combinator to the desired set conditional and to output a 1. Then connect the output to the input of an arithmetic combinator, and configure it to multiply by the bias value, the difference between the set and reset values, and wire the arithmetic output to the input of the decider. The arithmetic output channel MUST be set the same as the decider&#039;s input channel. That&#039;s it! Whenever your set conditional is reached, the decider will output a &#039;1&#039;, and the bias of the arithmetic combinator will be applied. This will &#039;hold&#039; the output true until the value goes back below the reset point.&lt;br /&gt;
&lt;br /&gt;
Here&#039;s a more specific example : &lt;br /&gt;
i want the pump to run when petrol reach 2000, and turn off when reach 200.&amp;lt;br&amp;gt;&lt;br /&gt;
only with green wire&amp;lt;br&amp;gt;&lt;br /&gt;
Tank -&amp;gt; in decider&amp;lt;br&amp;gt;&lt;br /&gt;
out decider-&amp;gt; in arithmetic&amp;lt;br&amp;gt;&lt;br /&gt;
out arithmetic -&amp;gt; in decider&amp;lt;br&amp;gt;&lt;br /&gt;
green wire from in decider, to pump&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Pump have the same condition as the decider (Petrol &amp;gt; 2000)&lt;br /&gt;
&lt;br /&gt;
Decider : Petrol &amp;gt; 2000&amp;lt;br&amp;gt;&lt;br /&gt;
out : A = 1&amp;lt;br&amp;gt;&lt;br /&gt;
Arithmetic : A x 1800 (2000 - 200 )&amp;lt;br&amp;gt;&lt;br /&gt;
out : petrol&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:Factorio combinator switch.png|620px]]&lt;br /&gt;
&lt;br /&gt;
== Comparing Outputs ==&lt;br /&gt;
&lt;br /&gt;
== Addressing Outposts ==&lt;br /&gt;
&lt;br /&gt;
== Smart Train Loading ==&lt;br /&gt;
&lt;br /&gt;
Initially designed by [https://www.youtube.com/user/Darkphade MadZuri],&lt;br /&gt;
&lt;br /&gt;
This solves the problem of loading logistics into chests, which tend to be unequal and is slower in the rate of loading logistics into the cargo of trains.&lt;br /&gt;
&lt;br /&gt;
To setup the design, you require an Arithmetic Combinator, as well as Red and Green wires. &#039;&#039;&#039;Wire all the chests used, to the input of the Arithmetic Combinator&#039;&#039;&#039;. &#039;&#039;&#039;Then write (Logistics Item / -Amount of chests) and as the output as the Logistics Item in the Arithmetic Combinator&#039;&#039;&#039;, this will average the amount of items within the chests. Lastly, &#039;&#039;&#039;wire all the inserters used to the output of the Arithmetic Combinator and have the other color of the wire be wired to the adjacent chest&#039;&#039;&#039;. &#039;&#039;&#039;Have the inserters enabled when Logistics Item &amp;lt; 1&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
A more visual representation as well as questions for the design can be found [https://www.reddit.com/r/factorio/comments/4e03g2/madzuris_smart_loading_train_station_guide/ here].&lt;br /&gt;
&lt;br /&gt;
Explanation of why this works:&lt;br /&gt;
It compares the average amount of total items within the chests and the chest adjacent to the inserter so that it activates when the average number of items is higher than the amount within the chest.&lt;br /&gt;
The reason for why the division denominator is negative is because if the items in the chests are 0, it basically makes it so that it adds 1 to the equation.&lt;br /&gt;
&lt;br /&gt;
== Oil Control ==&lt;br /&gt;
&lt;br /&gt;
== Memory ==&lt;br /&gt;
How to store a constant value for later use, either for a basic counter or for more advanced logic. A decider combinator wired output tied to input and configured greater than zero (for positive values), input -&amp;gt; output will &#039;hold&#039; a value, as long as all other inputs on the network are zero.&lt;br /&gt;
&lt;br /&gt;
Any non-zero input condition will create a basic clock; incrementing the stored value by the sum of all connected input values every cycle. A single pulse of an input will cause a single increment by the pulsed value. Reset to zero occurs whenever the set condition is no longer met, or if a negative pulse equal to the input occurs.&lt;br /&gt;
&lt;br /&gt;
== Basic Clocks ==&lt;br /&gt;
Clocks are constructed by having the output of a combinator tied back to its own input, such that every cycle advances its own count. Either the arithmetic combinator or the decider combinator can be used.&lt;br /&gt;
&lt;br /&gt;
An arithmetic combinator tied to itself is fun to watch and will happily run-away, but requires additional control logic to reset.&lt;br /&gt;
&lt;br /&gt;
A self-resetting clock requires just a single decider combinator with output wired to input and configured with Less Than (&amp;lt;) and Input -&amp;gt; Output. When a constant combinator is then connected to the input, every cycle it will count up by the value of the Constant Combinator until the set conditional value is reached, then output a zero which will be summed with the constant combinator, and reset the process.&lt;br /&gt;
&lt;br /&gt;
[[File:Timer.png|500px]]&lt;br /&gt;
&#039;&#039;30 ticks is the ceiling for Signal 1; which is continuously added.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The clock sequence will not include zero, will begin at the value set by the constant combinator, and will include whatever value eventually causes the conditional to be false. An arithmetic combinator can modify the clock sequence but remember its outputs will occur one cycle later than the clock cycle values.&lt;br /&gt;
&lt;br /&gt;
A clock that only counts once can be built using the following setup:&lt;br /&gt;
&lt;br /&gt;
[[File:Onetime_Clock.png|400px]]&lt;br /&gt;
&#039;&#039;Runs until T=Z+1. Reset via R&amp;gt;0.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Pulse Generators ==&lt;br /&gt;
&lt;br /&gt;
Connecting an additional (=) decider combinator to the output of a basic clock will create a pulse generator, and will pulse a single output every time the clock cycles through the set condition. Any output value can be used, either directly from the clock sequence (input-&amp;gt;output), a 1, or some value on a separate logic channel on the circuit network, such as set by a constant combinator. or by the circuit network.&amp;lt;br /&amp;gt;&lt;br /&gt;
[[File:PulseGen.png|500px]]&lt;br /&gt;
*&#039;&#039;The value 1 can be written as any positive integer, so long as it is within the cap or ceiling of your timer.&#039;&#039;&lt;br /&gt;
*&#039;&#039;As an example from the above timer, this light will pulse every 1st tick after the timer reaches 30 ticks, making it pulse 1/30th of a second, as Factorio updates at 60 times per second.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Counter ==&lt;br /&gt;
A counter is used to count the number of input events, and output the sum of that count. Any pulsing input into a decider combinator configured input -&amp;gt; output and wired between output and input will create a counter, but this input must be zero at all other times or else the combinator will run away like a clock. A pulse generator is normally used to accomplish this. Combining several gating decider isolators set with sequential conditionals, a clock, and a pulse generator to the input of a counter will allow remote polling and counting of each isolator&#039;s contents.&lt;br /&gt;
&lt;br /&gt;
== Logic Gates ==&lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;Unary NOT&#039;&#039;&#039;===&lt;br /&gt;
----&lt;br /&gt;
[[File:NOT.png|415px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;Binary OR&#039;&#039;&#039;===&lt;br /&gt;
----&lt;br /&gt;
[[File:OR.png|300px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 2!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1  || 1&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;Binary NOR&#039;&#039;&#039;===&lt;br /&gt;
----&lt;br /&gt;
[[File:NOR.png|415px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 2!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;Binary XOR&#039;&#039;&#039;===&lt;br /&gt;
----&lt;br /&gt;
[[File:XOR.png|300px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 1!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 ||  0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 ||  1 || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 ||  0 || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 ||  1 || 0&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;Binary AND&#039;&#039;&#039;===&lt;br /&gt;
----&lt;br /&gt;
[[File:AND.png|530px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 2!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1 || 1&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;Trinary AND&#039;&#039;&#039;===&lt;br /&gt;
----&lt;br /&gt;
[[File:TrinaryAND.png|415px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 2!!Input 3!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0  || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1  || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0  || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1  || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0  || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1  || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0  || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1  || 1  || 1&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;Binary NAND&#039;&#039;&#039;===&lt;br /&gt;
----&lt;br /&gt;
[[File:NAND.png|300px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 2!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;Binary XNOR/XAND&#039;&#039;&#039;===&lt;br /&gt;
----&lt;br /&gt;
[[File:XAND.png|300px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 2!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1  || 1&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Memory Cells ==&lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;Simple Latch&#039;&#039;&#039;===&lt;br /&gt;
&lt;br /&gt;
Have a Decider Combinator connect to itself with its input and output using a different colour of wire, say green wire when your output and input is red wire.&lt;br /&gt;
&lt;br /&gt;
[[File:SimpleLatchv2.png|300px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Output 1!!Input 1!!Input 2!! Output 1 (t+1)&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 0 || 1&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0 || 0 || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1 || 0 || 1 &#039;&#039;(2)&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0 || 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1 || 1 || 1 &#039;&#039;(2)&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&#039;&#039;Output 1 is the green wire loop seen in the picture, it carries the value to latch.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Input 1 is Set, while Input 2 is Reset.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;Binary Cell&#039;&#039;&#039;===&lt;br /&gt;
&lt;br /&gt;
RS NOR Latch&lt;br /&gt;
[[File:RS-NOR.png|500px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;Advanced Cell&#039;&#039;&#039;===&lt;br /&gt;
&lt;br /&gt;
Cell for storing a positive value:&lt;br /&gt;
&lt;br /&gt;
[[File:AdvancedMemoryCell.png|500px]]&lt;br /&gt;
&lt;br /&gt;
Connect the desired value as signal 3 on the right side to set the memory cell and connect a negative value as signal 3 to reset the cell.  *Please note the arithmetic combinator&#039;s output should be facing the opposite direction of the decider combinators.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Address Enable Switch&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== See Also ==&lt;br /&gt;
*[http://www.factorioforums.com/forum/viewtopic.php?f=18&amp;amp;t=14556 Combinators 101 (Tutorial)]&lt;br /&gt;
*[[Arithmetic combinator]]&lt;br /&gt;
*[[Constant Combinator]]&lt;br /&gt;
*[[Decider Combinator]]&lt;br /&gt;
*[[Circuit network]]&lt;br /&gt;
*[[Circuit-network_Cookbook]]&lt;br /&gt;
[[Category:Tutorial]]&lt;br /&gt;
[[Category:English page]]&lt;/div&gt;</summary>
		<author><name>My3DS</name></author>
	</entry>
	<entry>
		<id>https://wiki.factorio.com/index.php?title=Tutorial:Combinator_tutorial&amp;diff=135474</id>
		<title>Tutorial:Combinator tutorial</title>
		<link rel="alternate" type="text/html" href="https://wiki.factorio.com/index.php?title=Tutorial:Combinator_tutorial&amp;diff=135474"/>
		<updated>2017-04-02T03:29:53Z</updated>

		<summary type="html">&lt;p&gt;My3DS: /* Simple Latch */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
Combinator logic is achieved by cross-connecting outputs to inputs in such a way to achieve the desired logic. While advanced logic requires a multitude of combinators, some very useful basic logic can be achieved using only a handful of combinators. &#039;&#039;&#039;Combinator logic works because Factorio only updates at 60 times per second, such that combinators analyze their logic in a step, and then sum and/or decide the resulting output values on the next step.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
When logic values are computed by combinators, the outputs are not recognized by the circuit network until the following step. So when a decider combinator is used to detect a certain input condition, it&#039;s output value will not take effect on the circuit network until the next step. &#039;&#039;&#039;This behavior is important to remember and can result in sequencing errors and significant delays when multiple combinators are connected in series.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Circuit wires act like a wire bus in electronics, it carries information in the connected wires, meaning that &#039;&#039;&#039;if there are similar signals on a wire, it will add them automatically, unless if it is a different signal, that means it will be carried in that wire as well, but as a different signal.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
When cross-connecting combinators &#039;&#039;&#039;it&#039;s good practice to use the unused color to cross-connect, this will split the input and output networks and prevent unwanted inputs from accidentally connecting to a larger circuit network.&#039;&#039;&#039; Combinators will sum the red &amp;amp;/or green inputs prior to calculation, so either color can be used when wiring the output back to the input, but in most cases, it is more useful to use the opposing colour of the wire so that it will not interfere with the resulting output and input.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;There is also an example heavy [[Circuit-network_Cookbook|circuit network cookbook]] that you may find helpful to learn and refer to about circuit networks.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Virtual Signals ==&lt;br /&gt;
&lt;br /&gt;
===Everything Wildcard:===&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
This Red Wildcard serves to check all the specifed input signals.&lt;br /&gt;
&lt;br /&gt;
As the Decider Combinator, &amp;lt;br /&amp;gt;&lt;br /&gt;
its input is used to serve if all inputs meets the specified signals or variables. &amp;lt;br /&amp;gt;&lt;br /&gt;
its output is used to serve output every signal. &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Anything Wildcard:===&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
This Green Wildcard serves to check all the specifed input signals.&lt;br /&gt;
&lt;br /&gt;
As the Decider Combinator, &lt;br /&gt;
its input is used to serve if any of its inputs meets the specified signals or variables.&lt;br /&gt;
&lt;br /&gt;
===Each Wildcard:===&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
This Yellow Wildcard serves to check for each the specifed input signals.&lt;br /&gt;
&lt;br /&gt;
As the Decider Combinator, &amp;lt;br /&amp;gt;&lt;br /&gt;
its input is used to serve if any inputs meets the specified signals or variables. &amp;lt;br /&amp;gt;&lt;br /&gt;
its output is used to serve output the each variable. &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As the Arithmetic Combinator, &amp;lt;br /&amp;gt;&lt;br /&gt;
its input is used to serve each input, then the following summations are summed and outputted, with each signal as its own respective signals.&lt;br /&gt;
&lt;br /&gt;
== Input Isolator &amp;amp; Gate ==&lt;br /&gt;
An arithmetic combinator set to (In: Each + 0, Out: Each) can be used to swap wire colors and as an isolator to prevent downstream logic from backfeeding into the circuit network&#039;s inputs.&lt;br /&gt;
&lt;br /&gt;
A decider combinator set to (Out: Everything, Input-&amp;gt; Output) will also function as an isolator as long as the set logic condition is true. This can also selectively pass or &#039;gate&#039; inputs only when desired. This could be used to sequentially poll remote train stations for their chest contents, and include only desired stations.&lt;br /&gt;
&lt;br /&gt;
== Set/Reset Latching Switch ==&lt;br /&gt;
You want something to SET a trigger at some quantity, but then STAY on until that quantity hits some other value, the RESET value. You&#039;ll need one decider combinator and one arithmetic combinator. Two decider combinators and a constant combinator can also be used for more complex multi-channel conditions.&lt;br /&gt;
&lt;br /&gt;
Setup the first decider combinator to the desired set conditional and to output a 1. Then connect the output to the input of an arithmetic combinator, and configure it to multiply by the bias value, the difference between the set and reset values, and wire the arithmetic output to the input of the decider. The arithmetic output channel MUST be set the same as the decider&#039;s input channel. That&#039;s it! Whenever your set conditional is reached, the decider will output a &#039;1&#039;, and the bias of the arithmetic combinator will be applied. This will &#039;hold&#039; the output true until the value goes back below the reset point.&lt;br /&gt;
&lt;br /&gt;
Here&#039;s a more specific example : &lt;br /&gt;
i want the pump to run when petrol reach 2000, and turn off when reach 200.&amp;lt;br&amp;gt;&lt;br /&gt;
only with green wire&amp;lt;br&amp;gt;&lt;br /&gt;
Tank -&amp;gt; in decider&amp;lt;br&amp;gt;&lt;br /&gt;
out decider-&amp;gt; in arithmetic&amp;lt;br&amp;gt;&lt;br /&gt;
out arithmetic -&amp;gt; in decider&amp;lt;br&amp;gt;&lt;br /&gt;
green wire from in decider, to pump&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Pump have the same condition as the decider (Petrol &amp;gt; 2000)&lt;br /&gt;
&lt;br /&gt;
Decider : Petrol &amp;gt; 2000&amp;lt;br&amp;gt;&lt;br /&gt;
out : A = 1&amp;lt;br&amp;gt;&lt;br /&gt;
Arithmetic : A x 1800 (2000 - 200 )&amp;lt;br&amp;gt;&lt;br /&gt;
out : petrol&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:Factorio combinator switch.png|620px]]&lt;br /&gt;
&lt;br /&gt;
== Comparing Outputs ==&lt;br /&gt;
&lt;br /&gt;
== Addressing Outposts ==&lt;br /&gt;
&lt;br /&gt;
== Smart Train Loading ==&lt;br /&gt;
&lt;br /&gt;
Initially designed by [https://www.youtube.com/user/Darkphade MadZuri],&lt;br /&gt;
&lt;br /&gt;
This solves the problem of loading logistics into chests, which tend to be unequal and is slower in the rate of loading logistics into the cargo of trains.&lt;br /&gt;
&lt;br /&gt;
To setup the design, you require an Arithmetic Combinator, as well as Red and Green wires. &#039;&#039;&#039;Wire all the chests used, to the input of the Arithmetic Combinator&#039;&#039;&#039;. &#039;&#039;&#039;Then write (Logistics Item / -Amount of chests) and as the output as the Logistics Item in the Arithmetic Combinator&#039;&#039;&#039;, this will average the amount of items within the chests. Lastly, &#039;&#039;&#039;wire all the inserters used to the output of the Arithmetic Combinator and have the other color of the wire be wired to the adjacent chest&#039;&#039;&#039;. &#039;&#039;&#039;Have the inserters enabled when Logistics Item &amp;lt; 1&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
A more visual representation as well as questions for the design can be found [https://www.reddit.com/r/factorio/comments/4e03g2/madzuris_smart_loading_train_station_guide/ here].&lt;br /&gt;
&lt;br /&gt;
Explanation of why this works:&lt;br /&gt;
It compares the average amount of total items within the chests and the chest adjacent to the inserter so that it activates when the average number of items is higher than the amount within the chest.&lt;br /&gt;
The reason for why the division denominator is negative is because if the items in the chests are 0, it basically makes it so that it adds 1 to the equation.&lt;br /&gt;
&lt;br /&gt;
== Oil Control ==&lt;br /&gt;
&lt;br /&gt;
== Memory ==&lt;br /&gt;
How to store a constant value for later use, either for a basic counter or for more advanced logic. A decider combinator wired output tied to input and configured greater than zero (for positive values), input -&amp;gt; output will &#039;hold&#039; a value, as long as all other inputs on the network are zero.&lt;br /&gt;
&lt;br /&gt;
Any non-zero input condition will create a basic clock; incrementing the stored value by the sum of all connected input values every cycle. A single pulse of an input will cause a single increment by the pulsed value. Reset to zero occurs whenever the set condition is no longer met, or if a negative pulse equal to the input occurs.&lt;br /&gt;
&lt;br /&gt;
== Basic Clocks ==&lt;br /&gt;
Clocks are constructed by having the output of a combinator tied back to its own input, such that every cycle advances its own count. Either the arithmetic combinator or the decider combinator can be used.&lt;br /&gt;
&lt;br /&gt;
An arithmetic combinator tied to itself is fun to watch and will happily run-away, but requires additional control logic to reset.&lt;br /&gt;
&lt;br /&gt;
A self-resetting clock requires just a single decider combinator with output wired to input and configured with Less Than (&amp;lt;) and Input -&amp;gt; Output. When a constant combinator is then connected to the input, every cycle it will count up by the value of the Constant Combinator until the set conditional value is reached, then output a zero which will be summed with the constant combinator, and reset the process.&lt;br /&gt;
&lt;br /&gt;
[[File:Timer.png|500px]]&lt;br /&gt;
&#039;&#039;30 ticks is the ceiling for Signal 1; which is continuously added.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The clock sequence will not include zero, will begin at the value set by the constant combinator, and will include whatever value eventually causes the conditional to be false. An arithmetic combinator can modify the clock sequence but remember its outputs will occur one cycle later than the clock cycle values.&lt;br /&gt;
&lt;br /&gt;
A clock that only counts once can be built using the following setup:&lt;br /&gt;
&lt;br /&gt;
[[File:Onetime_Clock.png|400px]]&lt;br /&gt;
&#039;&#039;Runs until T=Z+1. Reset via R&amp;gt;0.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Pulse Generators ==&lt;br /&gt;
&lt;br /&gt;
Connecting an additional (=) decider combinator to the output of a basic clock will create a pulse generator, and will pulse a single output every time the clock cycles through the set condition. Any output value can be used, either directly from the clock sequence (input-&amp;gt;output), a 1, or some value on a separate logic channel on the circuit network, such as set by a constant combinator. or by the circuit network.&amp;lt;br /&amp;gt;&lt;br /&gt;
[[File:PulseGen.png|500px]]&lt;br /&gt;
*&#039;&#039;The value 1 can be written as any positive integer, so long as it is within the cap or ceiling of your timer.&#039;&#039;&lt;br /&gt;
*&#039;&#039;As an example from the above timer, this light will pulse every 1st tick after the timer reaches 30 ticks, making it pulse 1/30th of a second, as Factorio updates at 60 times per second.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Counter ==&lt;br /&gt;
A counter is used to count the number of input events, and output the sum of that count. Any pulsing input into a decider combinator configured input -&amp;gt; output and wired between output and input will create a counter, but this input must be zero at all other times or else the combinator will run away like a clock. A pulse generator is normally used to accomplish this. Combining several gating decider isolators set with sequential conditionals, a clock, and a pulse generator to the input of a counter will allow remote polling and counting of each isolator&#039;s contents.&lt;br /&gt;
&lt;br /&gt;
== Logic Gates ==&lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;Unary NOT&#039;&#039;&#039;===&lt;br /&gt;
----&lt;br /&gt;
[[File:NOT.png|415px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;Binary OR&#039;&#039;&#039;===&lt;br /&gt;
----&lt;br /&gt;
[[File:OR.png|300px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 2!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1  || 1&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;Binary NOR&#039;&#039;&#039;===&lt;br /&gt;
----&lt;br /&gt;
[[File:NOR.png|415px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 2!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;Binary XOR&#039;&#039;&#039;===&lt;br /&gt;
----&lt;br /&gt;
[[File:XOR.png|300px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 1!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 ||  0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 ||  1 || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 ||  0 || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 ||  1 || 0&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;Binary AND&#039;&#039;&#039;===&lt;br /&gt;
----&lt;br /&gt;
[[File:AND.png|530px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 2!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1 || 1&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;Trinary AND&#039;&#039;&#039;===&lt;br /&gt;
----&lt;br /&gt;
[[File:TrinaryAND.png|415px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 2!!Input 3!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0  || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1  || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0  || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1  || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0  || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1  || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0  || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1  || 1  || 1&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;Binary NAND&#039;&#039;&#039;===&lt;br /&gt;
----&lt;br /&gt;
[[File:NAND.png|300px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 2!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;Binary XNOR/XAND&#039;&#039;&#039;===&lt;br /&gt;
----&lt;br /&gt;
[[File:XAND.png|300px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 2!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1  || 1&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Memory Cells ==&lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;Simple Latch&#039;&#039;&#039;===&lt;br /&gt;
&lt;br /&gt;
Have a Decider Combinator connect to itself with its input and output using a different colour of wire, say green wire when your output and input is red wire.&lt;br /&gt;
&lt;br /&gt;
[[File:SimpleLatchv2.png|300px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Output 1!!Input 1!!Input 2!! Output 1 (t+1)&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 0 || 1&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0 || 0 || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1 || 0 || 1 &#039;&#039;(2)&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0 || 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1 || 1 || 1 &#039;&#039;(2)&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&#039;&#039;Output 1 is the green wire loop seen in the picture, it carries the value to latch.&#039;&#039;&lt;br /&gt;
&amp;quot;Input 1 is Set, while Input 2 is Reset.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;Binary Cell&#039;&#039;&#039;===&lt;br /&gt;
&lt;br /&gt;
RS NOR Latch&lt;br /&gt;
[[File:RS-NOR.png|500px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;Advanced Cell&#039;&#039;&#039;===&lt;br /&gt;
&lt;br /&gt;
Cell for storing a positive value:&lt;br /&gt;
&lt;br /&gt;
[[File:AdvancedMemoryCell.png|500px]]&lt;br /&gt;
&lt;br /&gt;
Connect the desired value as signal 3 on the right side to set the memory cell and connect a negative value as signal 3 to reset the cell.  *Please note the arithmetic combinator&#039;s output should be facing the opposite direction of the decider combinators.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Address Enable Switch&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== See Also ==&lt;br /&gt;
*[http://www.factorioforums.com/forum/viewtopic.php?f=18&amp;amp;t=14556 Combinators 101 (Tutorial)]&lt;br /&gt;
*[[Arithmetic combinator]]&lt;br /&gt;
*[[Constant Combinator]]&lt;br /&gt;
*[[Decider Combinator]]&lt;br /&gt;
*[[Circuit network]]&lt;br /&gt;
*[[Circuit-network_Cookbook]]&lt;br /&gt;
[[Category:Tutorial]]&lt;br /&gt;
[[Category:English page]]&lt;/div&gt;</summary>
		<author><name>My3DS</name></author>
	</entry>
	<entry>
		<id>https://wiki.factorio.com/index.php?title=Tutorial:Combinator_tutorial&amp;diff=133490</id>
		<title>Tutorial:Combinator tutorial</title>
		<link rel="alternate" type="text/html" href="https://wiki.factorio.com/index.php?title=Tutorial:Combinator_tutorial&amp;diff=133490"/>
		<updated>2016-12-27T10:50:05Z</updated>

		<summary type="html">&lt;p&gt;My3DS: added sub headings to sub headings&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
Combinator logic is achieved by cross-connecting outputs to inputs in such a way to achieve the desired logic. While advanced logic requires a multitude of combinators, some very useful basic logic can be achieved using only a handful of combinators. &#039;&#039;&#039;Combinator logic works because Factorio only updates at 60 times per second, such that combinators analyze their logic in a step, and then sum and/or decide the resulting output values on the next step.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
When logic values are computed by combinators, the outputs are not recognized by the circuit network until the following step. So when a decider combinator is used to detect a certain input condition, it&#039;s output value will not take effect on the circuit network until the next step. &#039;&#039;&#039;This behavior is important to remember and can result in sequencing errors and significant delays when multiple combinators are connected in series.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Circuit wires act like a wire bus in electronics, it carries information in the connected wires, meaning that &#039;&#039;&#039;if there are similar signals on a wire, it will add them automatically, unless if it is a different signal, that means it will be carried in that wire as well, but as a different signal.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
When cross-connecting combinators &#039;&#039;&#039;it&#039;s good practice to use the unused color to cross-connect, this will split the input and output networks and prevent unwanted inputs from accidentally connecting to a larger circuit network.&#039;&#039;&#039; Combinators will sum the red &amp;amp;/or green inputs prior to calculation, so either color can be used when wiring the output back to the input, but in most cases, it is more useful to use the opposing colour of the wire so that it will not interfere with the resulting output and input.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;There is also an example heavy [[Circuit-network_Cookbook|circuit network cookbook]] that you may find helpful to learn and refer to about circuit networks.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Virtual Signals ==&lt;br /&gt;
&lt;br /&gt;
===Everything Wildcard:===&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
This Red Wildcard serves to check all the specifed input signals.&lt;br /&gt;
&lt;br /&gt;
As the Decider Combinator, &amp;lt;br /&amp;gt;&lt;br /&gt;
its input is used to serve if all inputs meets the specified signals or variables. &amp;lt;br /&amp;gt;&lt;br /&gt;
its output is used to serve output every signal. &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Anything Wildcard:===&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
This Green Wildcard serves to check all the specifed input signals.&lt;br /&gt;
&lt;br /&gt;
As the Decider Combinator, &lt;br /&gt;
its input is used to serve if any of its inputs meets the specified signals or variables.&lt;br /&gt;
&lt;br /&gt;
===Each Wildcard:===&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
This Yellow Wildcard serves to check for each the specifed input signals.&lt;br /&gt;
&lt;br /&gt;
As the Decider Combinator, &amp;lt;br /&amp;gt;&lt;br /&gt;
its input is used to serve if any inputs meets the specified signals or variables. &amp;lt;br /&amp;gt;&lt;br /&gt;
its output is used to serve output the each variable. &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As the Arithmetic Combinator, &amp;lt;br /&amp;gt;&lt;br /&gt;
its input is used to serve each input, then the following summations are summed and outputted, with each signal as its own respective signals.&lt;br /&gt;
&lt;br /&gt;
== Input Isolator &amp;amp; Gate ==&lt;br /&gt;
An arithmetic combinator set to (In: Each + 0, Out: Each) can be used to swap wire colors and as an isolator to prevent downstream logic from backfeeding into the circuit network&#039;s inputs.&lt;br /&gt;
&lt;br /&gt;
A decider combinator set to (Out: Everything, Input-&amp;gt; Output) will also function as an isolator as long as the set logic condition is true. This can also selectively pass or &#039;gate&#039; inputs only when desired. This could be used to sequentially poll remote train stations for their chest contents, and include only desired stations.&lt;br /&gt;
&lt;br /&gt;
== Set/Reset Latching Switch ==&lt;br /&gt;
You want something to SET a trigger at some quantity, but then STAY on until that quantity hits some other value, the RESET value. You&#039;ll need one decider combinator and one arithmetic combinator. Two decider combinators and a constant combinator can also be used for more complex multi-channel conditions.&lt;br /&gt;
&lt;br /&gt;
Setup the first decider combinator to the desired set conditional and to output a 1. Then connect the output to the input of an arithmetic combinator, and configure it to multiply by the bias value, the difference between the set and reset values, and wire the arithmetic output to the input of the decider. The arithmetic output channel MUST be set the same as the decider&#039;s input channel. That&#039;s it! Whenever your set conditional is reached, the decider will output a &#039;1&#039;, and the bias of the arithmetic combinator will be applied. This will &#039;hold&#039; the output true until the value goes back below the reset point.&lt;br /&gt;
&lt;br /&gt;
Here&#039;s a more specific example : &lt;br /&gt;
i want the pump to run when petrol reach 2000, and turn off when reach 200.&amp;lt;br&amp;gt;&lt;br /&gt;
only with green wire&amp;lt;br&amp;gt;&lt;br /&gt;
Tank -&amp;gt; in decider&amp;lt;br&amp;gt;&lt;br /&gt;
out decider-&amp;gt; in arithmetic&amp;lt;br&amp;gt;&lt;br /&gt;
out arithmetic -&amp;gt; in decider&amp;lt;br&amp;gt;&lt;br /&gt;
green wire from in decider, to pump&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Pump have the same condition as the decider (Petrol &amp;gt; 2000)&lt;br /&gt;
&lt;br /&gt;
Decider : Petrol &amp;gt; 2000&amp;lt;br&amp;gt;&lt;br /&gt;
out : A = 1&amp;lt;br&amp;gt;&lt;br /&gt;
Arithmetic : A x 1800 (2000 - 200 )&amp;lt;br&amp;gt;&lt;br /&gt;
out : petrol&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:Factorio combinator switch.png|620px]]&lt;br /&gt;
&lt;br /&gt;
== Comparing Outputs ==&lt;br /&gt;
&lt;br /&gt;
== Addressing Outposts ==&lt;br /&gt;
&lt;br /&gt;
== Smart Train Loading ==&lt;br /&gt;
&lt;br /&gt;
Initially designed by [https://www.youtube.com/user/Darkphade MadZuri],&lt;br /&gt;
&lt;br /&gt;
This solves the problem of loading logistics into chests, which tend to be unequal and is slower in the rate of loading logistics into the cargo of trains.&lt;br /&gt;
&lt;br /&gt;
To setup the design, you require an Arithmetic Combinator, as well as Red and Green wires. &#039;&#039;&#039;Wire all the chests used, to the input of the Arithmetic Combinator&#039;&#039;&#039;. &#039;&#039;&#039;Then write (Logistics Item / -Amount of chests) and as the output as the Logistics Item in the Arithmetic Combinator&#039;&#039;&#039;, this will average the amount of items within the chests. Lastly, &#039;&#039;&#039;wire all the inserters used to the output of the Arithmetic Combinator and have the other color of the wire be wired to the adjacent chest&#039;&#039;&#039;. &#039;&#039;&#039;Have the inserters enabled when Logistics Item &amp;lt; 1&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
A more visual representation as well as questions for the design can be found [https://www.reddit.com/r/factorio/comments/4e03g2/madzuris_smart_loading_train_station_guide/ here].&lt;br /&gt;
&lt;br /&gt;
Explanation of why this works:&lt;br /&gt;
It compares the average amount of total items within the chests and the chest adjacent to the inserter so that it activates when the average number of items is higher than the amount within the chest.&lt;br /&gt;
The reason for why the division denominator is negative is because if the items in the chests are 0, it basically makes it so that it adds 1 to the equation.&lt;br /&gt;
&lt;br /&gt;
== Oil Control ==&lt;br /&gt;
&lt;br /&gt;
== Memory ==&lt;br /&gt;
How to store a constant value for later use, either for a basic counter or for more advanced logic. A decider combinator wired output tied to input and configured greater than zero (for positive values), input -&amp;gt; output will &#039;hold&#039; a value, as long as all other inputs on the network are zero.&lt;br /&gt;
&lt;br /&gt;
Any non-zero input condition will create a basic clock; incrementing the stored value by the sum of all connected input values every cycle. A single pulse of an input will cause a single increment by the pulsed value. Reset to zero occurs whenever the set condition is no longer met, or if a negative pulse equal to the input occurs.&lt;br /&gt;
&lt;br /&gt;
== Basic Clocks ==&lt;br /&gt;
Clocks are constructed by having the output of a combinator tied back to its own input, such that every cycle advances its own count. Either the arithmetic combinator or the decider combinator can be used.&lt;br /&gt;
&lt;br /&gt;
An arithmetic combinator tied to itself is fun to watch and will happily run-away, but requires additional control logic to reset.&lt;br /&gt;
&lt;br /&gt;
A self-resetting clock requires just a single decider combinator with output wired to input and configured with Less Than (&amp;lt;) and Input -&amp;gt; Output. When a constant combinator is then connected to the input, every cycle it will count up by the value of the Constant Combinator until the set conditional value is reached, then output a zero which will be summed with the constant combinator, and reset the process.&lt;br /&gt;
&lt;br /&gt;
[[File:Timer.png|500px]]&lt;br /&gt;
&#039;&#039;30 ticks is the ceiling for Signal 1; which is continuously added.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The clock sequence will not include zero, will begin at the value set by the constant combinator, and will include whatever value eventually causes the conditional to be false. An arithmetic combinator can modify the clock sequence but remember its outputs will occur one cycle later than the clock cycle values.&lt;br /&gt;
&lt;br /&gt;
== Pulse Generators ==&lt;br /&gt;
&lt;br /&gt;
Connecting an additional (=) decider combinator to the output of a basic clock will create a pulse generator, and will pulse a single output every time the clock cycles through the set condition. Any output value can be used, either directly from the clock sequence (input-&amp;gt;output), a 1, or some value on a separate logic channel on the circuit network, such as set by a constant combinator. or by the circuit network.&amp;lt;br /&amp;gt;&lt;br /&gt;
[[File:PulseGen.png|500px]]&lt;br /&gt;
*&#039;&#039;The value 1 can be written as any positive integer, so long as it is within the cap or ceiling of your timer.&#039;&#039;&lt;br /&gt;
*&#039;&#039;As an example from the above timer, this light will pulse every 1st tick after the timer reaches 30 ticks, making it pulse 1/30th of a second, as Factorio updates at 60 times per second.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Counter ==&lt;br /&gt;
A counter is used to count the number of input events, and output the sum of that count. Any pulsing input into a decider combinator configured input -&amp;gt; output and wired between output and input will create a counter, but this input must be zero at all other times or else the combinator will run away like a clock. A pulse generator is normally used to accomplish this. Combining several gating decider isolators set with sequential conditionals, a clock, and a pulse generator to the input of a counter will allow remote polling and counting of each isolator&#039;s contents.&lt;br /&gt;
&lt;br /&gt;
== Logic Gates ==&lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;Unary NOT&#039;&#039;&#039;===&lt;br /&gt;
----&lt;br /&gt;
[[File:NOT.png|415px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;Binary OR&#039;&#039;&#039;===&lt;br /&gt;
----&lt;br /&gt;
[[File:OR.png|300px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 2!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1  || 1&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;Binary NOR&#039;&#039;&#039;===&lt;br /&gt;
----&lt;br /&gt;
[[File:NOR.png|415px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 2!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;Binary XOR&#039;&#039;&#039;===&lt;br /&gt;
----&lt;br /&gt;
[[File:XOR.png|300px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 1!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 ||  0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 ||  1 || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 ||  0 || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 ||  1 || 0&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;Binary AND&#039;&#039;&#039;===&lt;br /&gt;
----&lt;br /&gt;
[[File:AND.png|530px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 2!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1 || 1&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;Trinary AND&#039;&#039;&#039;===&lt;br /&gt;
----&lt;br /&gt;
[[File:TrinaryAND.png|415px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 2!!Input 3!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0  || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1  || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0  || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1  || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0  || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1  || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0  || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1  || 1  || 1&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;Binary NAND&#039;&#039;&#039;===&lt;br /&gt;
----&lt;br /&gt;
[[File:NAND.png|300px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 2!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;Binary XNOR/XAND&#039;&#039;&#039;===&lt;br /&gt;
----&lt;br /&gt;
[[File:XAND.png|300px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 2!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1  || 1&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Memory Cells ==&lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;Simple Latch&#039;&#039;&#039;===&lt;br /&gt;
&lt;br /&gt;
Have a Decider Combinator connect to itself with its input and output using a different colour of wire, say green wire when your output and input is red wire.&lt;br /&gt;
&lt;br /&gt;
[[File:SimpleLatchv2.png|300px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Output 1!!Input 1!!Input 2!! Output 1 (t+1)&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 0 || 1&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0 || 0 || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1 || 0 || 1 &#039;&#039;(2)&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0 || 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1 || 1 || 1 &#039;&#039;(2)&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&#039;&#039;Output 1 is the green wire loop seen in the picture, it carries the value to latch.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;Binary Cell&#039;&#039;&#039;===&lt;br /&gt;
&lt;br /&gt;
RS NOR Latch&lt;br /&gt;
[[File:RS-NOR.png|500px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===&#039;&#039;&#039;Advanced Cell&#039;&#039;&#039;===&lt;br /&gt;
&lt;br /&gt;
Cell for storing a positive value:&lt;br /&gt;
&lt;br /&gt;
[[File:AdvancedMemoryCell.png|500px]]&lt;br /&gt;
&lt;br /&gt;
Connect the desired value as signal 3 on the right side to set the memory cell and connect a negative value as signal 3 to reset the cell.  *Please note the arithmetic combinator&#039;s output should be facing the opposite direction of the decider combinators.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Address Enable Switch&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== See Also ==&lt;br /&gt;
*[http://www.factorioforums.com/forum/viewtopic.php?f=18&amp;amp;t=14556 Combinators 101 (Tutorial)]&lt;br /&gt;
*[[Arithmetic combinator]]&lt;br /&gt;
*[[Constant Combinator]]&lt;br /&gt;
*[[Decider Combinator]]&lt;br /&gt;
*[[Circuit network]]&lt;br /&gt;
*[[Circuit-network_Cookbook]]&lt;br /&gt;
[[Category:Tutorial]]&lt;br /&gt;
[[Category:English page]]&lt;/div&gt;</summary>
		<author><name>My3DS</name></author>
	</entry>
	<entry>
		<id>https://wiki.factorio.com/index.php?title=Tutorial:Combinator_tutorial&amp;diff=133489</id>
		<title>Tutorial:Combinator tutorial</title>
		<link rel="alternate" type="text/html" href="https://wiki.factorio.com/index.php?title=Tutorial:Combinator_tutorial&amp;diff=133489"/>
		<updated>2016-12-27T10:46:07Z</updated>

		<summary type="html">&lt;p&gt;My3DS: /* Each Wildcard: */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
Combinator logic is achieved by cross-connecting outputs to inputs in such a way to achieve the desired logic. While advanced logic requires a multitude of combinators, some very useful basic logic can be achieved using only a handful of combinators. &#039;&#039;&#039;Combinator logic works because Factorio only updates at 60 times per second, such that combinators analyze their logic in a step, and then sum and/or decide the resulting output values on the next step.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
When logic values are computed by combinators, the outputs are not recognized by the circuit network until the following step. So when a decider combinator is used to detect a certain input condition, it&#039;s output value will not take effect on the circuit network until the next step. &#039;&#039;&#039;This behavior is important to remember and can result in sequencing errors and significant delays when multiple combinators are connected in series.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Circuit wires act like a wire bus in electronics, it carries information in the connected wires, meaning that &#039;&#039;&#039;if there are similar signals on a wire, it will add them automatically, unless if it is a different signal, that means it will be carried in that wire as well, but as a different signal.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
When cross-connecting combinators &#039;&#039;&#039;it&#039;s good practice to use the unused color to cross-connect, this will split the input and output networks and prevent unwanted inputs from accidentally connecting to a larger circuit network.&#039;&#039;&#039; Combinators will sum the red &amp;amp;/or green inputs prior to calculation, so either color can be used when wiring the output back to the input, but in most cases, it is more useful to use the opposing colour of the wire so that it will not interfere with the resulting output and input.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;There is also an example heavy [[Circuit-network_Cookbook|circuit network cookbook]] that you may find helpful to learn and refer to about circuit networks.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Virtual Signals ==&lt;br /&gt;
&lt;br /&gt;
===Everything Wildcard:===&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
This Red Wildcard serves to check all the specifed input signals.&lt;br /&gt;
&lt;br /&gt;
As the Decider Combinator, &amp;lt;br /&amp;gt;&lt;br /&gt;
its input is used to serve if all inputs meets the specified signals or variables. &amp;lt;br /&amp;gt;&lt;br /&gt;
its output is used to serve output every signal. &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Anything Wildcard:===&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
This Green Wildcard serves to check all the specifed input signals.&lt;br /&gt;
&lt;br /&gt;
As the Decider Combinator, &lt;br /&gt;
its input is used to serve if any of its inputs meets the specified signals or variables.&lt;br /&gt;
&lt;br /&gt;
===Each Wildcard:===&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
This Yellow Wildcard serves to check for each the specifed input signals.&lt;br /&gt;
&lt;br /&gt;
As the Decider Combinator, &amp;lt;br /&amp;gt;&lt;br /&gt;
its input is used to serve if any inputs meets the specified signals or variables. &amp;lt;br /&amp;gt;&lt;br /&gt;
its output is used to serve output the each variable. &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As the Arithmetic Combinator, &amp;lt;br /&amp;gt;&lt;br /&gt;
its input is used to serve each input, then the following summations are summed and outputted, with each signal as its own respective signals.&lt;br /&gt;
&lt;br /&gt;
== Input Isolator &amp;amp; Gate ==&lt;br /&gt;
An arithmetic combinator set to (In: Each + 0, Out: Each) can be used to swap wire colors and as an isolator to prevent downstream logic from backfeeding into the circuit network&#039;s inputs.&lt;br /&gt;
&lt;br /&gt;
A decider combinator set to (Out: Everything, Input-&amp;gt; Output) will also function as an isolator as long as the set logic condition is true. This can also selectively pass or &#039;gate&#039; inputs only when desired. This could be used to sequentially poll remote train stations for their chest contents, and include only desired stations.&lt;br /&gt;
&lt;br /&gt;
== Set/Reset Latching Switch ==&lt;br /&gt;
You want something to SET a trigger at some quantity, but then STAY on until that quantity hits some other value, the RESET value. You&#039;ll need one decider combinator and one arithmetic combinator. Two decider combinators and a constant combinator can also be used for more complex multi-channel conditions.&lt;br /&gt;
&lt;br /&gt;
Setup the first decider combinator to the desired set conditional and to output a 1. Then connect the output to the input of an arithmetic combinator, and configure it to multiply by the bias value, the difference between the set and reset values, and wire the arithmetic output to the input of the decider. The arithmetic output channel MUST be set the same as the decider&#039;s input channel. That&#039;s it! Whenever your set conditional is reached, the decider will output a &#039;1&#039;, and the bias of the arithmetic combinator will be applied. This will &#039;hold&#039; the output true until the value goes back below the reset point.&lt;br /&gt;
&lt;br /&gt;
Here&#039;s a more specific example : &lt;br /&gt;
i want the pump to run when petrol reach 2000, and turn off when reach 200.&amp;lt;br&amp;gt;&lt;br /&gt;
only with green wire&amp;lt;br&amp;gt;&lt;br /&gt;
Tank -&amp;gt; in decider&amp;lt;br&amp;gt;&lt;br /&gt;
out decider-&amp;gt; in arithmetic&amp;lt;br&amp;gt;&lt;br /&gt;
out arithmetic -&amp;gt; in decider&amp;lt;br&amp;gt;&lt;br /&gt;
green wire from in decider, to pump&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Pump have the same condition as the decider (Petrol &amp;gt; 2000)&lt;br /&gt;
&lt;br /&gt;
Decider : Petrol &amp;gt; 2000&amp;lt;br&amp;gt;&lt;br /&gt;
out : A = 1&amp;lt;br&amp;gt;&lt;br /&gt;
Arithmetic : A x 1800 (2000 - 200 )&amp;lt;br&amp;gt;&lt;br /&gt;
out : petrol&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:Factorio combinator switch.png|620px]]&lt;br /&gt;
&lt;br /&gt;
== Comparing Outputs ==&lt;br /&gt;
&lt;br /&gt;
== Addressing Outposts ==&lt;br /&gt;
&lt;br /&gt;
== Smart Train Loading ==&lt;br /&gt;
&lt;br /&gt;
Initially designed by [https://www.youtube.com/user/Darkphade MadZuri],&lt;br /&gt;
&lt;br /&gt;
This solves the problem of loading logistics into chests, which tend to be unequal and is slower in the rate of loading logistics into the cargo of trains.&lt;br /&gt;
&lt;br /&gt;
To setup the design, you require an Arithmetic Combinator, as well as Red and Green wires. &#039;&#039;&#039;Wire all the chests used, to the input of the Arithmetic Combinator&#039;&#039;&#039;. &#039;&#039;&#039;Then write (Logistics Item / -Amount of chests) and as the output as the Logistics Item in the Arithmetic Combinator&#039;&#039;&#039;, this will average the amount of items within the chests. Lastly, &#039;&#039;&#039;wire all the inserters used to the output of the Arithmetic Combinator and have the other color of the wire be wired to the adjacent chest&#039;&#039;&#039;. &#039;&#039;&#039;Have the inserters enabled when Logistics Item &amp;lt; 1&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
A more visual representation as well as questions for the design can be found [https://www.reddit.com/r/factorio/comments/4e03g2/madzuris_smart_loading_train_station_guide/ here].&lt;br /&gt;
&lt;br /&gt;
Explanation of why this works:&lt;br /&gt;
It compares the average amount of total items within the chests and the chest adjacent to the inserter so that it activates when the average number of items is higher than the amount within the chest.&lt;br /&gt;
The reason for why the division denominator is negative is because if the items in the chests are 0, it basically makes it so that it adds 1 to the equation.&lt;br /&gt;
&lt;br /&gt;
== Oil Control ==&lt;br /&gt;
&lt;br /&gt;
== Memory ==&lt;br /&gt;
How to store a constant value for later use, either for a basic counter or for more advanced logic. A decider combinator wired output tied to input and configured greater than zero (for positive values), input -&amp;gt; output will &#039;hold&#039; a value, as long as all other inputs on the network are zero.&lt;br /&gt;
&lt;br /&gt;
Any non-zero input condition will create a basic clock; incrementing the stored value by the sum of all connected input values every cycle. A single pulse of an input will cause a single increment by the pulsed value. Reset to zero occurs whenever the set condition is no longer met, or if a negative pulse equal to the input occurs.&lt;br /&gt;
&lt;br /&gt;
== Basic Clocks ==&lt;br /&gt;
Clocks are constructed by having the output of a combinator tied back to its own input, such that every cycle advances its own count. Either the arithmetic combinator or the decider combinator can be used.&lt;br /&gt;
&lt;br /&gt;
An arithmetic combinator tied to itself is fun to watch and will happily run-away, but requires additional control logic to reset.&lt;br /&gt;
&lt;br /&gt;
A self-resetting clock requires just a single decider combinator with output wired to input and configured with Less Than (&amp;lt;) and Input -&amp;gt; Output. When a constant combinator is then connected to the input, every cycle it will count up by the value of the Constant Combinator until the set conditional value is reached, then output a zero which will be summed with the constant combinator, and reset the process.&lt;br /&gt;
&lt;br /&gt;
[[File:Timer.png|500px]]&lt;br /&gt;
&#039;&#039;30 ticks is the ceiling for Signal 1; which is continuously added.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The clock sequence will not include zero, will begin at the value set by the constant combinator, and will include whatever value eventually causes the conditional to be false. An arithmetic combinator can modify the clock sequence but remember its outputs will occur one cycle later than the clock cycle values.&lt;br /&gt;
&lt;br /&gt;
== Pulse Generators ==&lt;br /&gt;
&lt;br /&gt;
Connecting an additional (=) decider combinator to the output of a basic clock will create a pulse generator, and will pulse a single output every time the clock cycles through the set condition. Any output value can be used, either directly from the clock sequence (input-&amp;gt;output), a 1, or some value on a separate logic channel on the circuit network, such as set by a constant combinator. or by the circuit network.&amp;lt;br /&amp;gt;&lt;br /&gt;
[[File:PulseGen.png|500px]]&lt;br /&gt;
*&#039;&#039;The value 1 can be written as any positive integer, so long as it is within the cap or ceiling of your timer.&#039;&#039;&lt;br /&gt;
*&#039;&#039;As an example from the above timer, this light will pulse every 1st tick after the timer reaches 30 ticks, making it pulse 1/30th of a second, as Factorio updates at 60 times per second.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Counter ==&lt;br /&gt;
A counter is used to count the number of input events, and output the sum of that count. Any pulsing input into a decider combinator configured input -&amp;gt; output and wired between output and input will create a counter, but this input must be zero at all other times or else the combinator will run away like a clock. A pulse generator is normally used to accomplish this. Combining several gating decider isolators set with sequential conditionals, a clock, and a pulse generator to the input of a counter will allow remote polling and counting of each isolator&#039;s contents.&lt;br /&gt;
&lt;br /&gt;
== Logic Gates ==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Unary NOT&#039;&#039;&#039;&lt;br /&gt;
----&lt;br /&gt;
[[File:NOT.png|415px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Binary OR&#039;&#039;&#039;&lt;br /&gt;
----&lt;br /&gt;
[[File:OR.png|300px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 2!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1  || 1&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Binary NOR&#039;&#039;&#039;&lt;br /&gt;
----&lt;br /&gt;
[[File:NOR.png|415px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 2!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Binary XOR&#039;&#039;&#039;&lt;br /&gt;
----&lt;br /&gt;
[[File:XOR.png|300px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 1!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 ||  0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 ||  1 || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 ||  0 || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 ||  1 || 0&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Binary AND&#039;&#039;&#039;&lt;br /&gt;
----&lt;br /&gt;
[[File:AND.png|530px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 2!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1 || 1&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Trinary AND&#039;&#039;&#039;&lt;br /&gt;
----&lt;br /&gt;
[[File:TrinaryAND.png|415px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 2!!Input 3!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0  || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1  || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0  || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1  || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0  || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1  || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0  || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1  || 1  || 1&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Binary NAND&#039;&#039;&#039;&lt;br /&gt;
----&lt;br /&gt;
[[File:NAND.png|300px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 2!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Binary XNOR/XAND&#039;&#039;&#039;&lt;br /&gt;
----&lt;br /&gt;
[[File:XAND.png|300px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 2!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1  || 1&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Memory Cells ==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Simple Latch&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Have a Decider Combinator connect to itself with its input and output using a different colour of wire, say green wire when your output and input is red wire.&lt;br /&gt;
&lt;br /&gt;
[[File:SimpleLatchv2.png|300px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Output 1!!Input 1!!Input 2!! Output 1 (t+1)&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 0 || 1&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0 || 0 || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1 || 0 || 1 &#039;&#039;(2)&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0 || 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1 || 1 || 1 &#039;&#039;(2)&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&#039;&#039;Output 1 is the green wire loop seen in the picture, it carries the value to latch.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Binary Cell&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
RS NOR Latch&lt;br /&gt;
[[File:RS-NOR.png|500px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Advanced Cell&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Cell for storing a positive value:&lt;br /&gt;
&lt;br /&gt;
[[File:AdvancedMemoryCell.png|500px]]&lt;br /&gt;
&lt;br /&gt;
Connect the desired value as signal 3 on the right side to set the memory cell and connect a negative value as signal 3 to reset the cell.  *Please note the arithmetic combinator&#039;s output should be facing the opposite direction of the decider combinators.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Address Enable Switch&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== See Also ==&lt;br /&gt;
*[http://www.factorioforums.com/forum/viewtopic.php?f=18&amp;amp;t=14556 Combinators 101 (Tutorial)]&lt;br /&gt;
*[[Arithmetic combinator]]&lt;br /&gt;
*[[Constant Combinator]]&lt;br /&gt;
*[[Decider Combinator]]&lt;br /&gt;
*[[Circuit network]]&lt;br /&gt;
*[[Circuit-network_Cookbook]]&lt;br /&gt;
[[Category:Tutorial]]&lt;br /&gt;
[[Category:English page]]&lt;/div&gt;</summary>
		<author><name>My3DS</name></author>
	</entry>
	<entry>
		<id>https://wiki.factorio.com/index.php?title=Tutorial:Combinator_tutorial&amp;diff=133488</id>
		<title>Tutorial:Combinator tutorial</title>
		<link rel="alternate" type="text/html" href="https://wiki.factorio.com/index.php?title=Tutorial:Combinator_tutorial&amp;diff=133488"/>
		<updated>2016-12-27T10:42:58Z</updated>

		<summary type="html">&lt;p&gt;My3DS: /* Everything Wildcard: */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
Combinator logic is achieved by cross-connecting outputs to inputs in such a way to achieve the desired logic. While advanced logic requires a multitude of combinators, some very useful basic logic can be achieved using only a handful of combinators. &#039;&#039;&#039;Combinator logic works because Factorio only updates at 60 times per second, such that combinators analyze their logic in a step, and then sum and/or decide the resulting output values on the next step.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
When logic values are computed by combinators, the outputs are not recognized by the circuit network until the following step. So when a decider combinator is used to detect a certain input condition, it&#039;s output value will not take effect on the circuit network until the next step. &#039;&#039;&#039;This behavior is important to remember and can result in sequencing errors and significant delays when multiple combinators are connected in series.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Circuit wires act like a wire bus in electronics, it carries information in the connected wires, meaning that &#039;&#039;&#039;if there are similar signals on a wire, it will add them automatically, unless if it is a different signal, that means it will be carried in that wire as well, but as a different signal.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
When cross-connecting combinators &#039;&#039;&#039;it&#039;s good practice to use the unused color to cross-connect, this will split the input and output networks and prevent unwanted inputs from accidentally connecting to a larger circuit network.&#039;&#039;&#039; Combinators will sum the red &amp;amp;/or green inputs prior to calculation, so either color can be used when wiring the output back to the input, but in most cases, it is more useful to use the opposing colour of the wire so that it will not interfere with the resulting output and input.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;There is also an example heavy [[Circuit-network_Cookbook|circuit network cookbook]] that you may find helpful to learn and refer to about circuit networks.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Virtual Signals ==&lt;br /&gt;
&lt;br /&gt;
===Everything Wildcard:===&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
This Red Wildcard serves to check all the specifed input signals.&lt;br /&gt;
&lt;br /&gt;
As the Decider Combinator, &amp;lt;br /&amp;gt;&lt;br /&gt;
its input is used to serve if all inputs meets the specified signals or variables. &amp;lt;br /&amp;gt;&lt;br /&gt;
its output is used to serve output every signal. &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Anything Wildcard:===&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
This Green Wildcard serves to check all the specifed input signals.&lt;br /&gt;
&lt;br /&gt;
As the Decider Combinator, &lt;br /&gt;
its input is used to serve if any of its inputs meets the specified signals or variables.&lt;br /&gt;
&lt;br /&gt;
===Each Wildcard:===&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
This Yellow Wildcard serves to check for each the specifed input signals.&lt;br /&gt;
&lt;br /&gt;
As the Decider Combinator, &amp;lt;br /&amp;gt;&lt;br /&gt;
its input is used to serve if any inputs meets the specified signals or variables. &amp;lt;br /&amp;gt;&lt;br /&gt;
its output is used to serve output the each variable. &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As the Arithmetic Combinator, &amp;lt;br /&amp;gt;&lt;br /&gt;
its input is used to serve every input, then the following summations are summed and outputted individually.&lt;br /&gt;
&lt;br /&gt;
== Input Isolator &amp;amp; Gate ==&lt;br /&gt;
An arithmetic combinator set to (In: Each + 0, Out: Each) can be used to swap wire colors and as an isolator to prevent downstream logic from backfeeding into the circuit network&#039;s inputs.&lt;br /&gt;
&lt;br /&gt;
A decider combinator set to (Out: Everything, Input-&amp;gt; Output) will also function as an isolator as long as the set logic condition is true. This can also selectively pass or &#039;gate&#039; inputs only when desired. This could be used to sequentially poll remote train stations for their chest contents, and include only desired stations.&lt;br /&gt;
&lt;br /&gt;
== Set/Reset Latching Switch ==&lt;br /&gt;
You want something to SET a trigger at some quantity, but then STAY on until that quantity hits some other value, the RESET value. You&#039;ll need one decider combinator and one arithmetic combinator. Two decider combinators and a constant combinator can also be used for more complex multi-channel conditions.&lt;br /&gt;
&lt;br /&gt;
Setup the first decider combinator to the desired set conditional and to output a 1. Then connect the output to the input of an arithmetic combinator, and configure it to multiply by the bias value, the difference between the set and reset values, and wire the arithmetic output to the input of the decider. The arithmetic output channel MUST be set the same as the decider&#039;s input channel. That&#039;s it! Whenever your set conditional is reached, the decider will output a &#039;1&#039;, and the bias of the arithmetic combinator will be applied. This will &#039;hold&#039; the output true until the value goes back below the reset point.&lt;br /&gt;
&lt;br /&gt;
Here&#039;s a more specific example : &lt;br /&gt;
i want the pump to run when petrol reach 2000, and turn off when reach 200.&amp;lt;br&amp;gt;&lt;br /&gt;
only with green wire&amp;lt;br&amp;gt;&lt;br /&gt;
Tank -&amp;gt; in decider&amp;lt;br&amp;gt;&lt;br /&gt;
out decider-&amp;gt; in arithmetic&amp;lt;br&amp;gt;&lt;br /&gt;
out arithmetic -&amp;gt; in decider&amp;lt;br&amp;gt;&lt;br /&gt;
green wire from in decider, to pump&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Pump have the same condition as the decider (Petrol &amp;gt; 2000)&lt;br /&gt;
&lt;br /&gt;
Decider : Petrol &amp;gt; 2000&amp;lt;br&amp;gt;&lt;br /&gt;
out : A = 1&amp;lt;br&amp;gt;&lt;br /&gt;
Arithmetic : A x 1800 (2000 - 200 )&amp;lt;br&amp;gt;&lt;br /&gt;
out : petrol&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:Factorio combinator switch.png|620px]]&lt;br /&gt;
&lt;br /&gt;
== Comparing Outputs ==&lt;br /&gt;
&lt;br /&gt;
== Addressing Outposts ==&lt;br /&gt;
&lt;br /&gt;
== Smart Train Loading ==&lt;br /&gt;
&lt;br /&gt;
Initially designed by [https://www.youtube.com/user/Darkphade MadZuri],&lt;br /&gt;
&lt;br /&gt;
This solves the problem of loading logistics into chests, which tend to be unequal and is slower in the rate of loading logistics into the cargo of trains.&lt;br /&gt;
&lt;br /&gt;
To setup the design, you require an Arithmetic Combinator, as well as Red and Green wires. &#039;&#039;&#039;Wire all the chests used, to the input of the Arithmetic Combinator&#039;&#039;&#039;. &#039;&#039;&#039;Then write (Logistics Item / -Amount of chests) and as the output as the Logistics Item in the Arithmetic Combinator&#039;&#039;&#039;, this will average the amount of items within the chests. Lastly, &#039;&#039;&#039;wire all the inserters used to the output of the Arithmetic Combinator and have the other color of the wire be wired to the adjacent chest&#039;&#039;&#039;. &#039;&#039;&#039;Have the inserters enabled when Logistics Item &amp;lt; 1&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
A more visual representation as well as questions for the design can be found [https://www.reddit.com/r/factorio/comments/4e03g2/madzuris_smart_loading_train_station_guide/ here].&lt;br /&gt;
&lt;br /&gt;
Explanation of why this works:&lt;br /&gt;
It compares the average amount of total items within the chests and the chest adjacent to the inserter so that it activates when the average number of items is higher than the amount within the chest.&lt;br /&gt;
The reason for why the division denominator is negative is because if the items in the chests are 0, it basically makes it so that it adds 1 to the equation.&lt;br /&gt;
&lt;br /&gt;
== Oil Control ==&lt;br /&gt;
&lt;br /&gt;
== Memory ==&lt;br /&gt;
How to store a constant value for later use, either for a basic counter or for more advanced logic. A decider combinator wired output tied to input and configured greater than zero (for positive values), input -&amp;gt; output will &#039;hold&#039; a value, as long as all other inputs on the network are zero.&lt;br /&gt;
&lt;br /&gt;
Any non-zero input condition will create a basic clock; incrementing the stored value by the sum of all connected input values every cycle. A single pulse of an input will cause a single increment by the pulsed value. Reset to zero occurs whenever the set condition is no longer met, or if a negative pulse equal to the input occurs.&lt;br /&gt;
&lt;br /&gt;
== Basic Clocks ==&lt;br /&gt;
Clocks are constructed by having the output of a combinator tied back to its own input, such that every cycle advances its own count. Either the arithmetic combinator or the decider combinator can be used.&lt;br /&gt;
&lt;br /&gt;
An arithmetic combinator tied to itself is fun to watch and will happily run-away, but requires additional control logic to reset.&lt;br /&gt;
&lt;br /&gt;
A self-resetting clock requires just a single decider combinator with output wired to input and configured with Less Than (&amp;lt;) and Input -&amp;gt; Output. When a constant combinator is then connected to the input, every cycle it will count up by the value of the Constant Combinator until the set conditional value is reached, then output a zero which will be summed with the constant combinator, and reset the process.&lt;br /&gt;
&lt;br /&gt;
[[File:Timer.png|500px]]&lt;br /&gt;
&#039;&#039;30 ticks is the ceiling for Signal 1; which is continuously added.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The clock sequence will not include zero, will begin at the value set by the constant combinator, and will include whatever value eventually causes the conditional to be false. An arithmetic combinator can modify the clock sequence but remember its outputs will occur one cycle later than the clock cycle values.&lt;br /&gt;
&lt;br /&gt;
== Pulse Generators ==&lt;br /&gt;
&lt;br /&gt;
Connecting an additional (=) decider combinator to the output of a basic clock will create a pulse generator, and will pulse a single output every time the clock cycles through the set condition. Any output value can be used, either directly from the clock sequence (input-&amp;gt;output), a 1, or some value on a separate logic channel on the circuit network, such as set by a constant combinator. or by the circuit network.&amp;lt;br /&amp;gt;&lt;br /&gt;
[[File:PulseGen.png|500px]]&lt;br /&gt;
*&#039;&#039;The value 1 can be written as any positive integer, so long as it is within the cap or ceiling of your timer.&#039;&#039;&lt;br /&gt;
*&#039;&#039;As an example from the above timer, this light will pulse every 1st tick after the timer reaches 30 ticks, making it pulse 1/30th of a second, as Factorio updates at 60 times per second.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Counter ==&lt;br /&gt;
A counter is used to count the number of input events, and output the sum of that count. Any pulsing input into a decider combinator configured input -&amp;gt; output and wired between output and input will create a counter, but this input must be zero at all other times or else the combinator will run away like a clock. A pulse generator is normally used to accomplish this. Combining several gating decider isolators set with sequential conditionals, a clock, and a pulse generator to the input of a counter will allow remote polling and counting of each isolator&#039;s contents.&lt;br /&gt;
&lt;br /&gt;
== Logic Gates ==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Unary NOT&#039;&#039;&#039;&lt;br /&gt;
----&lt;br /&gt;
[[File:NOT.png|415px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Binary OR&#039;&#039;&#039;&lt;br /&gt;
----&lt;br /&gt;
[[File:OR.png|300px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 2!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1  || 1&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Binary NOR&#039;&#039;&#039;&lt;br /&gt;
----&lt;br /&gt;
[[File:NOR.png|415px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 2!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Binary XOR&#039;&#039;&#039;&lt;br /&gt;
----&lt;br /&gt;
[[File:XOR.png|300px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 1!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 ||  0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 ||  1 || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 ||  0 || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 ||  1 || 0&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Binary AND&#039;&#039;&#039;&lt;br /&gt;
----&lt;br /&gt;
[[File:AND.png|530px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 2!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1 || 1&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Trinary AND&#039;&#039;&#039;&lt;br /&gt;
----&lt;br /&gt;
[[File:TrinaryAND.png|415px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 2!!Input 3!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0  || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1  || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0  || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1  || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0  || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1  || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0  || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1  || 1  || 1&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Binary NAND&#039;&#039;&#039;&lt;br /&gt;
----&lt;br /&gt;
[[File:NAND.png|300px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 2!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Binary XNOR/XAND&#039;&#039;&#039;&lt;br /&gt;
----&lt;br /&gt;
[[File:XAND.png|300px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 2!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1  || 1&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Memory Cells ==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Simple Latch&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Have a Decider Combinator connect to itself with its input and output using a different colour of wire, say green wire when your output and input is red wire.&lt;br /&gt;
&lt;br /&gt;
[[File:SimpleLatchv2.png|300px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Output 1!!Input 1!!Input 2!! Output 1 (t+1)&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 0 || 1&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0 || 0 || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1 || 0 || 1 &#039;&#039;(2)&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0 || 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1 || 1 || 1 &#039;&#039;(2)&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&#039;&#039;Output 1 is the green wire loop seen in the picture, it carries the value to latch.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Binary Cell&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
RS NOR Latch&lt;br /&gt;
[[File:RS-NOR.png|500px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Advanced Cell&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Cell for storing a positive value:&lt;br /&gt;
&lt;br /&gt;
[[File:AdvancedMemoryCell.png|500px]]&lt;br /&gt;
&lt;br /&gt;
Connect the desired value as signal 3 on the right side to set the memory cell and connect a negative value as signal 3 to reset the cell.  *Please note the arithmetic combinator&#039;s output should be facing the opposite direction of the decider combinators.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Address Enable Switch&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== See Also ==&lt;br /&gt;
*[http://www.factorioforums.com/forum/viewtopic.php?f=18&amp;amp;t=14556 Combinators 101 (Tutorial)]&lt;br /&gt;
*[[Arithmetic combinator]]&lt;br /&gt;
*[[Constant Combinator]]&lt;br /&gt;
*[[Decider Combinator]]&lt;br /&gt;
*[[Circuit network]]&lt;br /&gt;
*[[Circuit-network_Cookbook]]&lt;br /&gt;
[[Category:Tutorial]]&lt;br /&gt;
[[Category:English page]]&lt;/div&gt;</summary>
		<author><name>My3DS</name></author>
	</entry>
	<entry>
		<id>https://wiki.factorio.com/index.php?title=Tutorial:Combinator_tutorial&amp;diff=133487</id>
		<title>Tutorial:Combinator tutorial</title>
		<link rel="alternate" type="text/html" href="https://wiki.factorio.com/index.php?title=Tutorial:Combinator_tutorial&amp;diff=133487"/>
		<updated>2016-12-27T10:42:46Z</updated>

		<summary type="html">&lt;p&gt;My3DS: /* Anything Wildcard: */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
Combinator logic is achieved by cross-connecting outputs to inputs in such a way to achieve the desired logic. While advanced logic requires a multitude of combinators, some very useful basic logic can be achieved using only a handful of combinators. &#039;&#039;&#039;Combinator logic works because Factorio only updates at 60 times per second, such that combinators analyze their logic in a step, and then sum and/or decide the resulting output values on the next step.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
When logic values are computed by combinators, the outputs are not recognized by the circuit network until the following step. So when a decider combinator is used to detect a certain input condition, it&#039;s output value will not take effect on the circuit network until the next step. &#039;&#039;&#039;This behavior is important to remember and can result in sequencing errors and significant delays when multiple combinators are connected in series.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Circuit wires act like a wire bus in electronics, it carries information in the connected wires, meaning that &#039;&#039;&#039;if there are similar signals on a wire, it will add them automatically, unless if it is a different signal, that means it will be carried in that wire as well, but as a different signal.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
When cross-connecting combinators &#039;&#039;&#039;it&#039;s good practice to use the unused color to cross-connect, this will split the input and output networks and prevent unwanted inputs from accidentally connecting to a larger circuit network.&#039;&#039;&#039; Combinators will sum the red &amp;amp;/or green inputs prior to calculation, so either color can be used when wiring the output back to the input, but in most cases, it is more useful to use the opposing colour of the wire so that it will not interfere with the resulting output and input.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;There is also an example heavy [[Circuit-network_Cookbook|circuit network cookbook]] that you may find helpful to learn and refer to about circuit networks.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Virtual Signals ==&lt;br /&gt;
&lt;br /&gt;
===Everything Wildcard:===&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
This Red Wildcard serves to check all the specifed input signals.&lt;br /&gt;
&lt;br /&gt;
As the Decider Combinator, &amp;lt;br /&amp;gt;&lt;br /&gt;
its input is used to serve if all inputs meets the specified signals or variables. &amp;lt;br /&amp;gt;&lt;br /&gt;
its output is used to serve output every signal. &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As the Arithmetic Combinator, &amp;lt;br /&amp;gt;&lt;br /&gt;
its input is used to serve all inputs, then the following summations are summed and outputted as a whole.&lt;br /&gt;
&lt;br /&gt;
===Anything Wildcard:===&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
This Green Wildcard serves to check all the specifed input signals.&lt;br /&gt;
&lt;br /&gt;
As the Decider Combinator, &lt;br /&gt;
its input is used to serve if any of its inputs meets the specified signals or variables.&lt;br /&gt;
&lt;br /&gt;
===Each Wildcard:===&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
This Yellow Wildcard serves to check for each the specifed input signals.&lt;br /&gt;
&lt;br /&gt;
As the Decider Combinator, &amp;lt;br /&amp;gt;&lt;br /&gt;
its input is used to serve if any inputs meets the specified signals or variables. &amp;lt;br /&amp;gt;&lt;br /&gt;
its output is used to serve output the each variable. &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As the Arithmetic Combinator, &amp;lt;br /&amp;gt;&lt;br /&gt;
its input is used to serve every input, then the following summations are summed and outputted individually.&lt;br /&gt;
&lt;br /&gt;
== Input Isolator &amp;amp; Gate ==&lt;br /&gt;
An arithmetic combinator set to (In: Each + 0, Out: Each) can be used to swap wire colors and as an isolator to prevent downstream logic from backfeeding into the circuit network&#039;s inputs.&lt;br /&gt;
&lt;br /&gt;
A decider combinator set to (Out: Everything, Input-&amp;gt; Output) will also function as an isolator as long as the set logic condition is true. This can also selectively pass or &#039;gate&#039; inputs only when desired. This could be used to sequentially poll remote train stations for their chest contents, and include only desired stations.&lt;br /&gt;
&lt;br /&gt;
== Set/Reset Latching Switch ==&lt;br /&gt;
You want something to SET a trigger at some quantity, but then STAY on until that quantity hits some other value, the RESET value. You&#039;ll need one decider combinator and one arithmetic combinator. Two decider combinators and a constant combinator can also be used for more complex multi-channel conditions.&lt;br /&gt;
&lt;br /&gt;
Setup the first decider combinator to the desired set conditional and to output a 1. Then connect the output to the input of an arithmetic combinator, and configure it to multiply by the bias value, the difference between the set and reset values, and wire the arithmetic output to the input of the decider. The arithmetic output channel MUST be set the same as the decider&#039;s input channel. That&#039;s it! Whenever your set conditional is reached, the decider will output a &#039;1&#039;, and the bias of the arithmetic combinator will be applied. This will &#039;hold&#039; the output true until the value goes back below the reset point.&lt;br /&gt;
&lt;br /&gt;
Here&#039;s a more specific example : &lt;br /&gt;
i want the pump to run when petrol reach 2000, and turn off when reach 200.&amp;lt;br&amp;gt;&lt;br /&gt;
only with green wire&amp;lt;br&amp;gt;&lt;br /&gt;
Tank -&amp;gt; in decider&amp;lt;br&amp;gt;&lt;br /&gt;
out decider-&amp;gt; in arithmetic&amp;lt;br&amp;gt;&lt;br /&gt;
out arithmetic -&amp;gt; in decider&amp;lt;br&amp;gt;&lt;br /&gt;
green wire from in decider, to pump&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Pump have the same condition as the decider (Petrol &amp;gt; 2000)&lt;br /&gt;
&lt;br /&gt;
Decider : Petrol &amp;gt; 2000&amp;lt;br&amp;gt;&lt;br /&gt;
out : A = 1&amp;lt;br&amp;gt;&lt;br /&gt;
Arithmetic : A x 1800 (2000 - 200 )&amp;lt;br&amp;gt;&lt;br /&gt;
out : petrol&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:Factorio combinator switch.png|620px]]&lt;br /&gt;
&lt;br /&gt;
== Comparing Outputs ==&lt;br /&gt;
&lt;br /&gt;
== Addressing Outposts ==&lt;br /&gt;
&lt;br /&gt;
== Smart Train Loading ==&lt;br /&gt;
&lt;br /&gt;
Initially designed by [https://www.youtube.com/user/Darkphade MadZuri],&lt;br /&gt;
&lt;br /&gt;
This solves the problem of loading logistics into chests, which tend to be unequal and is slower in the rate of loading logistics into the cargo of trains.&lt;br /&gt;
&lt;br /&gt;
To setup the design, you require an Arithmetic Combinator, as well as Red and Green wires. &#039;&#039;&#039;Wire all the chests used, to the input of the Arithmetic Combinator&#039;&#039;&#039;. &#039;&#039;&#039;Then write (Logistics Item / -Amount of chests) and as the output as the Logistics Item in the Arithmetic Combinator&#039;&#039;&#039;, this will average the amount of items within the chests. Lastly, &#039;&#039;&#039;wire all the inserters used to the output of the Arithmetic Combinator and have the other color of the wire be wired to the adjacent chest&#039;&#039;&#039;. &#039;&#039;&#039;Have the inserters enabled when Logistics Item &amp;lt; 1&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
A more visual representation as well as questions for the design can be found [https://www.reddit.com/r/factorio/comments/4e03g2/madzuris_smart_loading_train_station_guide/ here].&lt;br /&gt;
&lt;br /&gt;
Explanation of why this works:&lt;br /&gt;
It compares the average amount of total items within the chests and the chest adjacent to the inserter so that it activates when the average number of items is higher than the amount within the chest.&lt;br /&gt;
The reason for why the division denominator is negative is because if the items in the chests are 0, it basically makes it so that it adds 1 to the equation.&lt;br /&gt;
&lt;br /&gt;
== Oil Control ==&lt;br /&gt;
&lt;br /&gt;
== Memory ==&lt;br /&gt;
How to store a constant value for later use, either for a basic counter or for more advanced logic. A decider combinator wired output tied to input and configured greater than zero (for positive values), input -&amp;gt; output will &#039;hold&#039; a value, as long as all other inputs on the network are zero.&lt;br /&gt;
&lt;br /&gt;
Any non-zero input condition will create a basic clock; incrementing the stored value by the sum of all connected input values every cycle. A single pulse of an input will cause a single increment by the pulsed value. Reset to zero occurs whenever the set condition is no longer met, or if a negative pulse equal to the input occurs.&lt;br /&gt;
&lt;br /&gt;
== Basic Clocks ==&lt;br /&gt;
Clocks are constructed by having the output of a combinator tied back to its own input, such that every cycle advances its own count. Either the arithmetic combinator or the decider combinator can be used.&lt;br /&gt;
&lt;br /&gt;
An arithmetic combinator tied to itself is fun to watch and will happily run-away, but requires additional control logic to reset.&lt;br /&gt;
&lt;br /&gt;
A self-resetting clock requires just a single decider combinator with output wired to input and configured with Less Than (&amp;lt;) and Input -&amp;gt; Output. When a constant combinator is then connected to the input, every cycle it will count up by the value of the Constant Combinator until the set conditional value is reached, then output a zero which will be summed with the constant combinator, and reset the process.&lt;br /&gt;
&lt;br /&gt;
[[File:Timer.png|500px]]&lt;br /&gt;
&#039;&#039;30 ticks is the ceiling for Signal 1; which is continuously added.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The clock sequence will not include zero, will begin at the value set by the constant combinator, and will include whatever value eventually causes the conditional to be false. An arithmetic combinator can modify the clock sequence but remember its outputs will occur one cycle later than the clock cycle values.&lt;br /&gt;
&lt;br /&gt;
== Pulse Generators ==&lt;br /&gt;
&lt;br /&gt;
Connecting an additional (=) decider combinator to the output of a basic clock will create a pulse generator, and will pulse a single output every time the clock cycles through the set condition. Any output value can be used, either directly from the clock sequence (input-&amp;gt;output), a 1, or some value on a separate logic channel on the circuit network, such as set by a constant combinator. or by the circuit network.&amp;lt;br /&amp;gt;&lt;br /&gt;
[[File:PulseGen.png|500px]]&lt;br /&gt;
*&#039;&#039;The value 1 can be written as any positive integer, so long as it is within the cap or ceiling of your timer.&#039;&#039;&lt;br /&gt;
*&#039;&#039;As an example from the above timer, this light will pulse every 1st tick after the timer reaches 30 ticks, making it pulse 1/30th of a second, as Factorio updates at 60 times per second.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Counter ==&lt;br /&gt;
A counter is used to count the number of input events, and output the sum of that count. Any pulsing input into a decider combinator configured input -&amp;gt; output and wired between output and input will create a counter, but this input must be zero at all other times or else the combinator will run away like a clock. A pulse generator is normally used to accomplish this. Combining several gating decider isolators set with sequential conditionals, a clock, and a pulse generator to the input of a counter will allow remote polling and counting of each isolator&#039;s contents.&lt;br /&gt;
&lt;br /&gt;
== Logic Gates ==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Unary NOT&#039;&#039;&#039;&lt;br /&gt;
----&lt;br /&gt;
[[File:NOT.png|415px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Binary OR&#039;&#039;&#039;&lt;br /&gt;
----&lt;br /&gt;
[[File:OR.png|300px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 2!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1  || 1&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Binary NOR&#039;&#039;&#039;&lt;br /&gt;
----&lt;br /&gt;
[[File:NOR.png|415px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 2!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Binary XOR&#039;&#039;&#039;&lt;br /&gt;
----&lt;br /&gt;
[[File:XOR.png|300px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 1!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 ||  0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 ||  1 || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 ||  0 || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 ||  1 || 0&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Binary AND&#039;&#039;&#039;&lt;br /&gt;
----&lt;br /&gt;
[[File:AND.png|530px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 2!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1 || 1&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Trinary AND&#039;&#039;&#039;&lt;br /&gt;
----&lt;br /&gt;
[[File:TrinaryAND.png|415px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 2!!Input 3!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0  || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1  || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0  || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1  || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0  || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1  || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0  || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1  || 1  || 1&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Binary NAND&#039;&#039;&#039;&lt;br /&gt;
----&lt;br /&gt;
[[File:NAND.png|300px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 2!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Binary XNOR/XAND&#039;&#039;&#039;&lt;br /&gt;
----&lt;br /&gt;
[[File:XAND.png|300px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 2!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1  || 1&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Memory Cells ==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Simple Latch&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Have a Decider Combinator connect to itself with its input and output using a different colour of wire, say green wire when your output and input is red wire.&lt;br /&gt;
&lt;br /&gt;
[[File:SimpleLatchv2.png|300px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Output 1!!Input 1!!Input 2!! Output 1 (t+1)&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 0 || 1&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0 || 0 || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1 || 0 || 1 &#039;&#039;(2)&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0 || 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1 || 1 || 1 &#039;&#039;(2)&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&#039;&#039;Output 1 is the green wire loop seen in the picture, it carries the value to latch.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Binary Cell&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
RS NOR Latch&lt;br /&gt;
[[File:RS-NOR.png|500px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Advanced Cell&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Cell for storing a positive value:&lt;br /&gt;
&lt;br /&gt;
[[File:AdvancedMemoryCell.png|500px]]&lt;br /&gt;
&lt;br /&gt;
Connect the desired value as signal 3 on the right side to set the memory cell and connect a negative value as signal 3 to reset the cell.  *Please note the arithmetic combinator&#039;s output should be facing the opposite direction of the decider combinators.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Address Enable Switch&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== See Also ==&lt;br /&gt;
*[http://www.factorioforums.com/forum/viewtopic.php?f=18&amp;amp;t=14556 Combinators 101 (Tutorial)]&lt;br /&gt;
*[[Arithmetic combinator]]&lt;br /&gt;
*[[Constant Combinator]]&lt;br /&gt;
*[[Decider Combinator]]&lt;br /&gt;
*[[Circuit network]]&lt;br /&gt;
*[[Circuit-network_Cookbook]]&lt;br /&gt;
[[Category:Tutorial]]&lt;br /&gt;
[[Category:English page]]&lt;/div&gt;</summary>
		<author><name>My3DS</name></author>
	</entry>
	<entry>
		<id>https://wiki.factorio.com/index.php?title=Tutorial:Combinator_tutorial&amp;diff=133486</id>
		<title>Tutorial:Combinator tutorial</title>
		<link rel="alternate" type="text/html" href="https://wiki.factorio.com/index.php?title=Tutorial:Combinator_tutorial&amp;diff=133486"/>
		<updated>2016-12-27T10:40:48Z</updated>

		<summary type="html">&lt;p&gt;My3DS: /* Each Wildcard: */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
Combinator logic is achieved by cross-connecting outputs to inputs in such a way to achieve the desired logic. While advanced logic requires a multitude of combinators, some very useful basic logic can be achieved using only a handful of combinators. &#039;&#039;&#039;Combinator logic works because Factorio only updates at 60 times per second, such that combinators analyze their logic in a step, and then sum and/or decide the resulting output values on the next step.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
When logic values are computed by combinators, the outputs are not recognized by the circuit network until the following step. So when a decider combinator is used to detect a certain input condition, it&#039;s output value will not take effect on the circuit network until the next step. &#039;&#039;&#039;This behavior is important to remember and can result in sequencing errors and significant delays when multiple combinators are connected in series.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Circuit wires act like a wire bus in electronics, it carries information in the connected wires, meaning that &#039;&#039;&#039;if there are similar signals on a wire, it will add them automatically, unless if it is a different signal, that means it will be carried in that wire as well, but as a different signal.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
When cross-connecting combinators &#039;&#039;&#039;it&#039;s good practice to use the unused color to cross-connect, this will split the input and output networks and prevent unwanted inputs from accidentally connecting to a larger circuit network.&#039;&#039;&#039; Combinators will sum the red &amp;amp;/or green inputs prior to calculation, so either color can be used when wiring the output back to the input, but in most cases, it is more useful to use the opposing colour of the wire so that it will not interfere with the resulting output and input.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;There is also an example heavy [[Circuit-network_Cookbook|circuit network cookbook]] that you may find helpful to learn and refer to about circuit networks.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Virtual Signals ==&lt;br /&gt;
&lt;br /&gt;
===Everything Wildcard:===&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
This Red Wildcard serves to check all the specifed input signals.&lt;br /&gt;
&lt;br /&gt;
As the Decider Combinator, &amp;lt;br /&amp;gt;&lt;br /&gt;
its input is used to serve if all inputs meets the specified signals or variables. &amp;lt;br /&amp;gt;&lt;br /&gt;
its output is used to serve output every signal. &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As the Arithmetic Combinator, &amp;lt;br /&amp;gt;&lt;br /&gt;
its input is used to serve all inputs, then the following summations are summed and outputted as a whole.&lt;br /&gt;
&lt;br /&gt;
===Anything Wildcard:===&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
This Green Wildcard serves to check all the specifed input signals.&lt;br /&gt;
&lt;br /&gt;
As the Decider Combinator, &lt;br /&gt;
its input is used to serve if any of its inputs meets the specified signals or variables.&lt;br /&gt;
&lt;br /&gt;
As the Arithmetic Combinator, &amp;lt;br /&amp;gt;&lt;br /&gt;
its input is used to serve every input, then the following summations are summed and outputted.&lt;br /&gt;
&lt;br /&gt;
===Each Wildcard:===&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
This Yellow Wildcard serves to check for each the specifed input signals.&lt;br /&gt;
&lt;br /&gt;
As the Decider Combinator, &amp;lt;br /&amp;gt;&lt;br /&gt;
its input is used to serve if any inputs meets the specified signals or variables. &amp;lt;br /&amp;gt;&lt;br /&gt;
its output is used to serve output the each variable. &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As the Arithmetic Combinator, &amp;lt;br /&amp;gt;&lt;br /&gt;
its input is used to serve every input, then the following summations are summed and outputted individually.&lt;br /&gt;
&lt;br /&gt;
== Input Isolator &amp;amp; Gate ==&lt;br /&gt;
An arithmetic combinator set to (In: Each + 0, Out: Each) can be used to swap wire colors and as an isolator to prevent downstream logic from backfeeding into the circuit network&#039;s inputs.&lt;br /&gt;
&lt;br /&gt;
A decider combinator set to (Out: Everything, Input-&amp;gt; Output) will also function as an isolator as long as the set logic condition is true. This can also selectively pass or &#039;gate&#039; inputs only when desired. This could be used to sequentially poll remote train stations for their chest contents, and include only desired stations.&lt;br /&gt;
&lt;br /&gt;
== Set/Reset Latching Switch ==&lt;br /&gt;
You want something to SET a trigger at some quantity, but then STAY on until that quantity hits some other value, the RESET value. You&#039;ll need one decider combinator and one arithmetic combinator. Two decider combinators and a constant combinator can also be used for more complex multi-channel conditions.&lt;br /&gt;
&lt;br /&gt;
Setup the first decider combinator to the desired set conditional and to output a 1. Then connect the output to the input of an arithmetic combinator, and configure it to multiply by the bias value, the difference between the set and reset values, and wire the arithmetic output to the input of the decider. The arithmetic output channel MUST be set the same as the decider&#039;s input channel. That&#039;s it! Whenever your set conditional is reached, the decider will output a &#039;1&#039;, and the bias of the arithmetic combinator will be applied. This will &#039;hold&#039; the output true until the value goes back below the reset point.&lt;br /&gt;
&lt;br /&gt;
Here&#039;s a more specific example : &lt;br /&gt;
i want the pump to run when petrol reach 2000, and turn off when reach 200.&amp;lt;br&amp;gt;&lt;br /&gt;
only with green wire&amp;lt;br&amp;gt;&lt;br /&gt;
Tank -&amp;gt; in decider&amp;lt;br&amp;gt;&lt;br /&gt;
out decider-&amp;gt; in arithmetic&amp;lt;br&amp;gt;&lt;br /&gt;
out arithmetic -&amp;gt; in decider&amp;lt;br&amp;gt;&lt;br /&gt;
green wire from in decider, to pump&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Pump have the same condition as the decider (Petrol &amp;gt; 2000)&lt;br /&gt;
&lt;br /&gt;
Decider : Petrol &amp;gt; 2000&amp;lt;br&amp;gt;&lt;br /&gt;
out : A = 1&amp;lt;br&amp;gt;&lt;br /&gt;
Arithmetic : A x 1800 (2000 - 200 )&amp;lt;br&amp;gt;&lt;br /&gt;
out : petrol&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:Factorio combinator switch.png|620px]]&lt;br /&gt;
&lt;br /&gt;
== Comparing Outputs ==&lt;br /&gt;
&lt;br /&gt;
== Addressing Outposts ==&lt;br /&gt;
&lt;br /&gt;
== Smart Train Loading ==&lt;br /&gt;
&lt;br /&gt;
Initially designed by [https://www.youtube.com/user/Darkphade MadZuri],&lt;br /&gt;
&lt;br /&gt;
This solves the problem of loading logistics into chests, which tend to be unequal and is slower in the rate of loading logistics into the cargo of trains.&lt;br /&gt;
&lt;br /&gt;
To setup the design, you require an Arithmetic Combinator, as well as Red and Green wires. &#039;&#039;&#039;Wire all the chests used, to the input of the Arithmetic Combinator&#039;&#039;&#039;. &#039;&#039;&#039;Then write (Logistics Item / -Amount of chests) and as the output as the Logistics Item in the Arithmetic Combinator&#039;&#039;&#039;, this will average the amount of items within the chests. Lastly, &#039;&#039;&#039;wire all the inserters used to the output of the Arithmetic Combinator and have the other color of the wire be wired to the adjacent chest&#039;&#039;&#039;. &#039;&#039;&#039;Have the inserters enabled when Logistics Item &amp;lt; 1&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
A more visual representation as well as questions for the design can be found [https://www.reddit.com/r/factorio/comments/4e03g2/madzuris_smart_loading_train_station_guide/ here].&lt;br /&gt;
&lt;br /&gt;
Explanation of why this works:&lt;br /&gt;
It compares the average amount of total items within the chests and the chest adjacent to the inserter so that it activates when the average number of items is higher than the amount within the chest.&lt;br /&gt;
The reason for why the division denominator is negative is because if the items in the chests are 0, it basically makes it so that it adds 1 to the equation.&lt;br /&gt;
&lt;br /&gt;
== Oil Control ==&lt;br /&gt;
&lt;br /&gt;
== Memory ==&lt;br /&gt;
How to store a constant value for later use, either for a basic counter or for more advanced logic. A decider combinator wired output tied to input and configured greater than zero (for positive values), input -&amp;gt; output will &#039;hold&#039; a value, as long as all other inputs on the network are zero.&lt;br /&gt;
&lt;br /&gt;
Any non-zero input condition will create a basic clock; incrementing the stored value by the sum of all connected input values every cycle. A single pulse of an input will cause a single increment by the pulsed value. Reset to zero occurs whenever the set condition is no longer met, or if a negative pulse equal to the input occurs.&lt;br /&gt;
&lt;br /&gt;
== Basic Clocks ==&lt;br /&gt;
Clocks are constructed by having the output of a combinator tied back to its own input, such that every cycle advances its own count. Either the arithmetic combinator or the decider combinator can be used.&lt;br /&gt;
&lt;br /&gt;
An arithmetic combinator tied to itself is fun to watch and will happily run-away, but requires additional control logic to reset.&lt;br /&gt;
&lt;br /&gt;
A self-resetting clock requires just a single decider combinator with output wired to input and configured with Less Than (&amp;lt;) and Input -&amp;gt; Output. When a constant combinator is then connected to the input, every cycle it will count up by the value of the Constant Combinator until the set conditional value is reached, then output a zero which will be summed with the constant combinator, and reset the process.&lt;br /&gt;
&lt;br /&gt;
[[File:Timer.png|500px]]&lt;br /&gt;
&#039;&#039;30 ticks is the ceiling for Signal 1; which is continuously added.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The clock sequence will not include zero, will begin at the value set by the constant combinator, and will include whatever value eventually causes the conditional to be false. An arithmetic combinator can modify the clock sequence but remember its outputs will occur one cycle later than the clock cycle values.&lt;br /&gt;
&lt;br /&gt;
== Pulse Generators ==&lt;br /&gt;
&lt;br /&gt;
Connecting an additional (=) decider combinator to the output of a basic clock will create a pulse generator, and will pulse a single output every time the clock cycles through the set condition. Any output value can be used, either directly from the clock sequence (input-&amp;gt;output), a 1, or some value on a separate logic channel on the circuit network, such as set by a constant combinator. or by the circuit network.&amp;lt;br /&amp;gt;&lt;br /&gt;
[[File:PulseGen.png|500px]]&lt;br /&gt;
*&#039;&#039;The value 1 can be written as any positive integer, so long as it is within the cap or ceiling of your timer.&#039;&#039;&lt;br /&gt;
*&#039;&#039;As an example from the above timer, this light will pulse every 1st tick after the timer reaches 30 ticks, making it pulse 1/30th of a second, as Factorio updates at 60 times per second.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Counter ==&lt;br /&gt;
A counter is used to count the number of input events, and output the sum of that count. Any pulsing input into a decider combinator configured input -&amp;gt; output and wired between output and input will create a counter, but this input must be zero at all other times or else the combinator will run away like a clock. A pulse generator is normally used to accomplish this. Combining several gating decider isolators set with sequential conditionals, a clock, and a pulse generator to the input of a counter will allow remote polling and counting of each isolator&#039;s contents.&lt;br /&gt;
&lt;br /&gt;
== Logic Gates ==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Unary NOT&#039;&#039;&#039;&lt;br /&gt;
----&lt;br /&gt;
[[File:NOT.png|415px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Binary OR&#039;&#039;&#039;&lt;br /&gt;
----&lt;br /&gt;
[[File:OR.png|300px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 2!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1  || 1&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Binary NOR&#039;&#039;&#039;&lt;br /&gt;
----&lt;br /&gt;
[[File:NOR.png|415px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 2!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Binary XOR&#039;&#039;&#039;&lt;br /&gt;
----&lt;br /&gt;
[[File:XOR.png|300px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 1!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 ||  0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 ||  1 || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 ||  0 || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 ||  1 || 0&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Binary AND&#039;&#039;&#039;&lt;br /&gt;
----&lt;br /&gt;
[[File:AND.png|530px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 2!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1 || 1&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Trinary AND&#039;&#039;&#039;&lt;br /&gt;
----&lt;br /&gt;
[[File:TrinaryAND.png|415px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 2!!Input 3!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0  || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1  || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0  || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1  || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0  || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1  || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0  || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1  || 1  || 1&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Binary NAND&#039;&#039;&#039;&lt;br /&gt;
----&lt;br /&gt;
[[File:NAND.png|300px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 2!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Binary XNOR/XAND&#039;&#039;&#039;&lt;br /&gt;
----&lt;br /&gt;
[[File:XAND.png|300px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 2!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1  || 1&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Memory Cells ==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Simple Latch&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Have a Decider Combinator connect to itself with its input and output using a different colour of wire, say green wire when your output and input is red wire.&lt;br /&gt;
&lt;br /&gt;
[[File:SimpleLatchv2.png|300px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Output 1!!Input 1!!Input 2!! Output 1 (t+1)&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 0 || 1&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0 || 0 || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1 || 0 || 1 &#039;&#039;(2)&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0 || 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1 || 1 || 1 &#039;&#039;(2)&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&#039;&#039;Output 1 is the green wire loop seen in the picture, it carries the value to latch.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Binary Cell&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
RS NOR Latch&lt;br /&gt;
[[File:RS-NOR.png|500px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Advanced Cell&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Cell for storing a positive value:&lt;br /&gt;
&lt;br /&gt;
[[File:AdvancedMemoryCell.png|500px]]&lt;br /&gt;
&lt;br /&gt;
Connect the desired value as signal 3 on the right side to set the memory cell and connect a negative value as signal 3 to reset the cell.  *Please note the arithmetic combinator&#039;s output should be facing the opposite direction of the decider combinators.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Address Enable Switch&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== See Also ==&lt;br /&gt;
*[http://www.factorioforums.com/forum/viewtopic.php?f=18&amp;amp;t=14556 Combinators 101 (Tutorial)]&lt;br /&gt;
*[[Arithmetic combinator]]&lt;br /&gt;
*[[Constant Combinator]]&lt;br /&gt;
*[[Decider Combinator]]&lt;br /&gt;
*[[Circuit network]]&lt;br /&gt;
*[[Circuit-network_Cookbook]]&lt;br /&gt;
[[Category:Tutorial]]&lt;br /&gt;
[[Category:English page]]&lt;/div&gt;</summary>
		<author><name>My3DS</name></author>
	</entry>
	<entry>
		<id>https://wiki.factorio.com/index.php?title=Tutorial:Combinator_tutorial&amp;diff=133485</id>
		<title>Tutorial:Combinator tutorial</title>
		<link rel="alternate" type="text/html" href="https://wiki.factorio.com/index.php?title=Tutorial:Combinator_tutorial&amp;diff=133485"/>
		<updated>2016-12-27T10:40:32Z</updated>

		<summary type="html">&lt;p&gt;My3DS: /* Anything Wildcard: */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
Combinator logic is achieved by cross-connecting outputs to inputs in such a way to achieve the desired logic. While advanced logic requires a multitude of combinators, some very useful basic logic can be achieved using only a handful of combinators. &#039;&#039;&#039;Combinator logic works because Factorio only updates at 60 times per second, such that combinators analyze their logic in a step, and then sum and/or decide the resulting output values on the next step.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
When logic values are computed by combinators, the outputs are not recognized by the circuit network until the following step. So when a decider combinator is used to detect a certain input condition, it&#039;s output value will not take effect on the circuit network until the next step. &#039;&#039;&#039;This behavior is important to remember and can result in sequencing errors and significant delays when multiple combinators are connected in series.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Circuit wires act like a wire bus in electronics, it carries information in the connected wires, meaning that &#039;&#039;&#039;if there are similar signals on a wire, it will add them automatically, unless if it is a different signal, that means it will be carried in that wire as well, but as a different signal.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
When cross-connecting combinators &#039;&#039;&#039;it&#039;s good practice to use the unused color to cross-connect, this will split the input and output networks and prevent unwanted inputs from accidentally connecting to a larger circuit network.&#039;&#039;&#039; Combinators will sum the red &amp;amp;/or green inputs prior to calculation, so either color can be used when wiring the output back to the input, but in most cases, it is more useful to use the opposing colour of the wire so that it will not interfere with the resulting output and input.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;There is also an example heavy [[Circuit-network_Cookbook|circuit network cookbook]] that you may find helpful to learn and refer to about circuit networks.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Virtual Signals ==&lt;br /&gt;
&lt;br /&gt;
===Everything Wildcard:===&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
This Red Wildcard serves to check all the specifed input signals.&lt;br /&gt;
&lt;br /&gt;
As the Decider Combinator, &amp;lt;br /&amp;gt;&lt;br /&gt;
its input is used to serve if all inputs meets the specified signals or variables. &amp;lt;br /&amp;gt;&lt;br /&gt;
its output is used to serve output every signal. &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As the Arithmetic Combinator, &amp;lt;br /&amp;gt;&lt;br /&gt;
its input is used to serve all inputs, then the following summations are summed and outputted as a whole.&lt;br /&gt;
&lt;br /&gt;
===Anything Wildcard:===&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
This Green Wildcard serves to check all the specifed input signals.&lt;br /&gt;
&lt;br /&gt;
As the Decider Combinator, &lt;br /&gt;
its input is used to serve if any of its inputs meets the specified signals or variables.&lt;br /&gt;
&lt;br /&gt;
As the Arithmetic Combinator, &amp;lt;br /&amp;gt;&lt;br /&gt;
its input is used to serve every input, then the following summations are summed and outputted.&lt;br /&gt;
&lt;br /&gt;
===Each Wildcard:===&lt;br /&gt;
---&lt;br /&gt;
&lt;br /&gt;
This Yellow Wildcard serves to check for each the specifed input signals.&lt;br /&gt;
&lt;br /&gt;
As the Decider Combinator, &amp;lt;br /&amp;gt;&lt;br /&gt;
its input is used to serve if any inputs meets the specified signals or variables. &amp;lt;br /&amp;gt;&lt;br /&gt;
its output is used to serve output the each variable. &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As the Arithmetic Combinator, &amp;lt;br /&amp;gt;&lt;br /&gt;
its input is used to serve every input, then the following summations are summed and outputted individually.&lt;br /&gt;
&lt;br /&gt;
== Input Isolator &amp;amp; Gate ==&lt;br /&gt;
An arithmetic combinator set to (In: Each + 0, Out: Each) can be used to swap wire colors and as an isolator to prevent downstream logic from backfeeding into the circuit network&#039;s inputs.&lt;br /&gt;
&lt;br /&gt;
A decider combinator set to (Out: Everything, Input-&amp;gt; Output) will also function as an isolator as long as the set logic condition is true. This can also selectively pass or &#039;gate&#039; inputs only when desired. This could be used to sequentially poll remote train stations for their chest contents, and include only desired stations.&lt;br /&gt;
&lt;br /&gt;
== Set/Reset Latching Switch ==&lt;br /&gt;
You want something to SET a trigger at some quantity, but then STAY on until that quantity hits some other value, the RESET value. You&#039;ll need one decider combinator and one arithmetic combinator. Two decider combinators and a constant combinator can also be used for more complex multi-channel conditions.&lt;br /&gt;
&lt;br /&gt;
Setup the first decider combinator to the desired set conditional and to output a 1. Then connect the output to the input of an arithmetic combinator, and configure it to multiply by the bias value, the difference between the set and reset values, and wire the arithmetic output to the input of the decider. The arithmetic output channel MUST be set the same as the decider&#039;s input channel. That&#039;s it! Whenever your set conditional is reached, the decider will output a &#039;1&#039;, and the bias of the arithmetic combinator will be applied. This will &#039;hold&#039; the output true until the value goes back below the reset point.&lt;br /&gt;
&lt;br /&gt;
Here&#039;s a more specific example : &lt;br /&gt;
i want the pump to run when petrol reach 2000, and turn off when reach 200.&amp;lt;br&amp;gt;&lt;br /&gt;
only with green wire&amp;lt;br&amp;gt;&lt;br /&gt;
Tank -&amp;gt; in decider&amp;lt;br&amp;gt;&lt;br /&gt;
out decider-&amp;gt; in arithmetic&amp;lt;br&amp;gt;&lt;br /&gt;
out arithmetic -&amp;gt; in decider&amp;lt;br&amp;gt;&lt;br /&gt;
green wire from in decider, to pump&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Pump have the same condition as the decider (Petrol &amp;gt; 2000)&lt;br /&gt;
&lt;br /&gt;
Decider : Petrol &amp;gt; 2000&amp;lt;br&amp;gt;&lt;br /&gt;
out : A = 1&amp;lt;br&amp;gt;&lt;br /&gt;
Arithmetic : A x 1800 (2000 - 200 )&amp;lt;br&amp;gt;&lt;br /&gt;
out : petrol&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:Factorio combinator switch.png|620px]]&lt;br /&gt;
&lt;br /&gt;
== Comparing Outputs ==&lt;br /&gt;
&lt;br /&gt;
== Addressing Outposts ==&lt;br /&gt;
&lt;br /&gt;
== Smart Train Loading ==&lt;br /&gt;
&lt;br /&gt;
Initially designed by [https://www.youtube.com/user/Darkphade MadZuri],&lt;br /&gt;
&lt;br /&gt;
This solves the problem of loading logistics into chests, which tend to be unequal and is slower in the rate of loading logistics into the cargo of trains.&lt;br /&gt;
&lt;br /&gt;
To setup the design, you require an Arithmetic Combinator, as well as Red and Green wires. &#039;&#039;&#039;Wire all the chests used, to the input of the Arithmetic Combinator&#039;&#039;&#039;. &#039;&#039;&#039;Then write (Logistics Item / -Amount of chests) and as the output as the Logistics Item in the Arithmetic Combinator&#039;&#039;&#039;, this will average the amount of items within the chests. Lastly, &#039;&#039;&#039;wire all the inserters used to the output of the Arithmetic Combinator and have the other color of the wire be wired to the adjacent chest&#039;&#039;&#039;. &#039;&#039;&#039;Have the inserters enabled when Logistics Item &amp;lt; 1&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
A more visual representation as well as questions for the design can be found [https://www.reddit.com/r/factorio/comments/4e03g2/madzuris_smart_loading_train_station_guide/ here].&lt;br /&gt;
&lt;br /&gt;
Explanation of why this works:&lt;br /&gt;
It compares the average amount of total items within the chests and the chest adjacent to the inserter so that it activates when the average number of items is higher than the amount within the chest.&lt;br /&gt;
The reason for why the division denominator is negative is because if the items in the chests are 0, it basically makes it so that it adds 1 to the equation.&lt;br /&gt;
&lt;br /&gt;
== Oil Control ==&lt;br /&gt;
&lt;br /&gt;
== Memory ==&lt;br /&gt;
How to store a constant value for later use, either for a basic counter or for more advanced logic. A decider combinator wired output tied to input and configured greater than zero (for positive values), input -&amp;gt; output will &#039;hold&#039; a value, as long as all other inputs on the network are zero.&lt;br /&gt;
&lt;br /&gt;
Any non-zero input condition will create a basic clock; incrementing the stored value by the sum of all connected input values every cycle. A single pulse of an input will cause a single increment by the pulsed value. Reset to zero occurs whenever the set condition is no longer met, or if a negative pulse equal to the input occurs.&lt;br /&gt;
&lt;br /&gt;
== Basic Clocks ==&lt;br /&gt;
Clocks are constructed by having the output of a combinator tied back to its own input, such that every cycle advances its own count. Either the arithmetic combinator or the decider combinator can be used.&lt;br /&gt;
&lt;br /&gt;
An arithmetic combinator tied to itself is fun to watch and will happily run-away, but requires additional control logic to reset.&lt;br /&gt;
&lt;br /&gt;
A self-resetting clock requires just a single decider combinator with output wired to input and configured with Less Than (&amp;lt;) and Input -&amp;gt; Output. When a constant combinator is then connected to the input, every cycle it will count up by the value of the Constant Combinator until the set conditional value is reached, then output a zero which will be summed with the constant combinator, and reset the process.&lt;br /&gt;
&lt;br /&gt;
[[File:Timer.png|500px]]&lt;br /&gt;
&#039;&#039;30 ticks is the ceiling for Signal 1; which is continuously added.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The clock sequence will not include zero, will begin at the value set by the constant combinator, and will include whatever value eventually causes the conditional to be false. An arithmetic combinator can modify the clock sequence but remember its outputs will occur one cycle later than the clock cycle values.&lt;br /&gt;
&lt;br /&gt;
== Pulse Generators ==&lt;br /&gt;
&lt;br /&gt;
Connecting an additional (=) decider combinator to the output of a basic clock will create a pulse generator, and will pulse a single output every time the clock cycles through the set condition. Any output value can be used, either directly from the clock sequence (input-&amp;gt;output), a 1, or some value on a separate logic channel on the circuit network, such as set by a constant combinator. or by the circuit network.&amp;lt;br /&amp;gt;&lt;br /&gt;
[[File:PulseGen.png|500px]]&lt;br /&gt;
*&#039;&#039;The value 1 can be written as any positive integer, so long as it is within the cap or ceiling of your timer.&#039;&#039;&lt;br /&gt;
*&#039;&#039;As an example from the above timer, this light will pulse every 1st tick after the timer reaches 30 ticks, making it pulse 1/30th of a second, as Factorio updates at 60 times per second.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Counter ==&lt;br /&gt;
A counter is used to count the number of input events, and output the sum of that count. Any pulsing input into a decider combinator configured input -&amp;gt; output and wired between output and input will create a counter, but this input must be zero at all other times or else the combinator will run away like a clock. A pulse generator is normally used to accomplish this. Combining several gating decider isolators set with sequential conditionals, a clock, and a pulse generator to the input of a counter will allow remote polling and counting of each isolator&#039;s contents.&lt;br /&gt;
&lt;br /&gt;
== Logic Gates ==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Unary NOT&#039;&#039;&#039;&lt;br /&gt;
----&lt;br /&gt;
[[File:NOT.png|415px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Binary OR&#039;&#039;&#039;&lt;br /&gt;
----&lt;br /&gt;
[[File:OR.png|300px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 2!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1  || 1&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Binary NOR&#039;&#039;&#039;&lt;br /&gt;
----&lt;br /&gt;
[[File:NOR.png|415px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 2!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Binary XOR&#039;&#039;&#039;&lt;br /&gt;
----&lt;br /&gt;
[[File:XOR.png|300px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 1!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 ||  0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 ||  1 || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 ||  0 || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 ||  1 || 0&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Binary AND&#039;&#039;&#039;&lt;br /&gt;
----&lt;br /&gt;
[[File:AND.png|530px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 2!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1 || 1&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Trinary AND&#039;&#039;&#039;&lt;br /&gt;
----&lt;br /&gt;
[[File:TrinaryAND.png|415px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 2!!Input 3!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0  || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1  || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0  || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1  || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0  || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1  || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0  || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1  || 1  || 1&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Binary NAND&#039;&#039;&#039;&lt;br /&gt;
----&lt;br /&gt;
[[File:NAND.png|300px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 2!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Binary XNOR/XAND&#039;&#039;&#039;&lt;br /&gt;
----&lt;br /&gt;
[[File:XAND.png|300px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 2!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1  || 1&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Memory Cells ==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Simple Latch&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Have a Decider Combinator connect to itself with its input and output using a different colour of wire, say green wire when your output and input is red wire.&lt;br /&gt;
&lt;br /&gt;
[[File:SimpleLatchv2.png|300px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Output 1!!Input 1!!Input 2!! Output 1 (t+1)&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 0 || 1&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0 || 0 || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1 || 0 || 1 &#039;&#039;(2)&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0 || 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1 || 1 || 1 &#039;&#039;(2)&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&#039;&#039;Output 1 is the green wire loop seen in the picture, it carries the value to latch.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Binary Cell&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
RS NOR Latch&lt;br /&gt;
[[File:RS-NOR.png|500px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Advanced Cell&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Cell for storing a positive value:&lt;br /&gt;
&lt;br /&gt;
[[File:AdvancedMemoryCell.png|500px]]&lt;br /&gt;
&lt;br /&gt;
Connect the desired value as signal 3 on the right side to set the memory cell and connect a negative value as signal 3 to reset the cell.  *Please note the arithmetic combinator&#039;s output should be facing the opposite direction of the decider combinators.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Address Enable Switch&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== See Also ==&lt;br /&gt;
*[http://www.factorioforums.com/forum/viewtopic.php?f=18&amp;amp;t=14556 Combinators 101 (Tutorial)]&lt;br /&gt;
*[[Arithmetic combinator]]&lt;br /&gt;
*[[Constant Combinator]]&lt;br /&gt;
*[[Decider Combinator]]&lt;br /&gt;
*[[Circuit network]]&lt;br /&gt;
*[[Circuit-network_Cookbook]]&lt;br /&gt;
[[Category:Tutorial]]&lt;br /&gt;
[[Category:English page]]&lt;/div&gt;</summary>
		<author><name>My3DS</name></author>
	</entry>
	<entry>
		<id>https://wiki.factorio.com/index.php?title=Tutorial:Combinator_tutorial&amp;diff=133484</id>
		<title>Tutorial:Combinator tutorial</title>
		<link rel="alternate" type="text/html" href="https://wiki.factorio.com/index.php?title=Tutorial:Combinator_tutorial&amp;diff=133484"/>
		<updated>2016-12-27T10:40:22Z</updated>

		<summary type="html">&lt;p&gt;My3DS: /* Everything Wildcard: */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
Combinator logic is achieved by cross-connecting outputs to inputs in such a way to achieve the desired logic. While advanced logic requires a multitude of combinators, some very useful basic logic can be achieved using only a handful of combinators. &#039;&#039;&#039;Combinator logic works because Factorio only updates at 60 times per second, such that combinators analyze their logic in a step, and then sum and/or decide the resulting output values on the next step.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
When logic values are computed by combinators, the outputs are not recognized by the circuit network until the following step. So when a decider combinator is used to detect a certain input condition, it&#039;s output value will not take effect on the circuit network until the next step. &#039;&#039;&#039;This behavior is important to remember and can result in sequencing errors and significant delays when multiple combinators are connected in series.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Circuit wires act like a wire bus in electronics, it carries information in the connected wires, meaning that &#039;&#039;&#039;if there are similar signals on a wire, it will add them automatically, unless if it is a different signal, that means it will be carried in that wire as well, but as a different signal.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
When cross-connecting combinators &#039;&#039;&#039;it&#039;s good practice to use the unused color to cross-connect, this will split the input and output networks and prevent unwanted inputs from accidentally connecting to a larger circuit network.&#039;&#039;&#039; Combinators will sum the red &amp;amp;/or green inputs prior to calculation, so either color can be used when wiring the output back to the input, but in most cases, it is more useful to use the opposing colour of the wire so that it will not interfere with the resulting output and input.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;There is also an example heavy [[Circuit-network_Cookbook|circuit network cookbook]] that you may find helpful to learn and refer to about circuit networks.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Virtual Signals ==&lt;br /&gt;
&lt;br /&gt;
===Everything Wildcard:===&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
This Red Wildcard serves to check all the specifed input signals.&lt;br /&gt;
&lt;br /&gt;
As the Decider Combinator, &amp;lt;br /&amp;gt;&lt;br /&gt;
its input is used to serve if all inputs meets the specified signals or variables. &amp;lt;br /&amp;gt;&lt;br /&gt;
its output is used to serve output every signal. &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As the Arithmetic Combinator, &amp;lt;br /&amp;gt;&lt;br /&gt;
its input is used to serve all inputs, then the following summations are summed and outputted as a whole.&lt;br /&gt;
&lt;br /&gt;
===Anything Wildcard:===&lt;br /&gt;
---&lt;br /&gt;
&lt;br /&gt;
This Green Wildcard serves to check all the specifed input signals.&lt;br /&gt;
&lt;br /&gt;
As the Decider Combinator, &lt;br /&gt;
its input is used to serve if any of its inputs meets the specified signals or variables.&lt;br /&gt;
&lt;br /&gt;
As the Arithmetic Combinator, &amp;lt;br /&amp;gt;&lt;br /&gt;
its input is used to serve every input, then the following summations are summed and outputted.&lt;br /&gt;
&lt;br /&gt;
===Each Wildcard:===&lt;br /&gt;
---&lt;br /&gt;
&lt;br /&gt;
This Yellow Wildcard serves to check for each the specifed input signals.&lt;br /&gt;
&lt;br /&gt;
As the Decider Combinator, &amp;lt;br /&amp;gt;&lt;br /&gt;
its input is used to serve if any inputs meets the specified signals or variables. &amp;lt;br /&amp;gt;&lt;br /&gt;
its output is used to serve output the each variable. &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As the Arithmetic Combinator, &amp;lt;br /&amp;gt;&lt;br /&gt;
its input is used to serve every input, then the following summations are summed and outputted individually.&lt;br /&gt;
&lt;br /&gt;
== Input Isolator &amp;amp; Gate ==&lt;br /&gt;
An arithmetic combinator set to (In: Each + 0, Out: Each) can be used to swap wire colors and as an isolator to prevent downstream logic from backfeeding into the circuit network&#039;s inputs.&lt;br /&gt;
&lt;br /&gt;
A decider combinator set to (Out: Everything, Input-&amp;gt; Output) will also function as an isolator as long as the set logic condition is true. This can also selectively pass or &#039;gate&#039; inputs only when desired. This could be used to sequentially poll remote train stations for their chest contents, and include only desired stations.&lt;br /&gt;
&lt;br /&gt;
== Set/Reset Latching Switch ==&lt;br /&gt;
You want something to SET a trigger at some quantity, but then STAY on until that quantity hits some other value, the RESET value. You&#039;ll need one decider combinator and one arithmetic combinator. Two decider combinators and a constant combinator can also be used for more complex multi-channel conditions.&lt;br /&gt;
&lt;br /&gt;
Setup the first decider combinator to the desired set conditional and to output a 1. Then connect the output to the input of an arithmetic combinator, and configure it to multiply by the bias value, the difference between the set and reset values, and wire the arithmetic output to the input of the decider. The arithmetic output channel MUST be set the same as the decider&#039;s input channel. That&#039;s it! Whenever your set conditional is reached, the decider will output a &#039;1&#039;, and the bias of the arithmetic combinator will be applied. This will &#039;hold&#039; the output true until the value goes back below the reset point.&lt;br /&gt;
&lt;br /&gt;
Here&#039;s a more specific example : &lt;br /&gt;
i want the pump to run when petrol reach 2000, and turn off when reach 200.&amp;lt;br&amp;gt;&lt;br /&gt;
only with green wire&amp;lt;br&amp;gt;&lt;br /&gt;
Tank -&amp;gt; in decider&amp;lt;br&amp;gt;&lt;br /&gt;
out decider-&amp;gt; in arithmetic&amp;lt;br&amp;gt;&lt;br /&gt;
out arithmetic -&amp;gt; in decider&amp;lt;br&amp;gt;&lt;br /&gt;
green wire from in decider, to pump&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Pump have the same condition as the decider (Petrol &amp;gt; 2000)&lt;br /&gt;
&lt;br /&gt;
Decider : Petrol &amp;gt; 2000&amp;lt;br&amp;gt;&lt;br /&gt;
out : A = 1&amp;lt;br&amp;gt;&lt;br /&gt;
Arithmetic : A x 1800 (2000 - 200 )&amp;lt;br&amp;gt;&lt;br /&gt;
out : petrol&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:Factorio combinator switch.png|620px]]&lt;br /&gt;
&lt;br /&gt;
== Comparing Outputs ==&lt;br /&gt;
&lt;br /&gt;
== Addressing Outposts ==&lt;br /&gt;
&lt;br /&gt;
== Smart Train Loading ==&lt;br /&gt;
&lt;br /&gt;
Initially designed by [https://www.youtube.com/user/Darkphade MadZuri],&lt;br /&gt;
&lt;br /&gt;
This solves the problem of loading logistics into chests, which tend to be unequal and is slower in the rate of loading logistics into the cargo of trains.&lt;br /&gt;
&lt;br /&gt;
To setup the design, you require an Arithmetic Combinator, as well as Red and Green wires. &#039;&#039;&#039;Wire all the chests used, to the input of the Arithmetic Combinator&#039;&#039;&#039;. &#039;&#039;&#039;Then write (Logistics Item / -Amount of chests) and as the output as the Logistics Item in the Arithmetic Combinator&#039;&#039;&#039;, this will average the amount of items within the chests. Lastly, &#039;&#039;&#039;wire all the inserters used to the output of the Arithmetic Combinator and have the other color of the wire be wired to the adjacent chest&#039;&#039;&#039;. &#039;&#039;&#039;Have the inserters enabled when Logistics Item &amp;lt; 1&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
A more visual representation as well as questions for the design can be found [https://www.reddit.com/r/factorio/comments/4e03g2/madzuris_smart_loading_train_station_guide/ here].&lt;br /&gt;
&lt;br /&gt;
Explanation of why this works:&lt;br /&gt;
It compares the average amount of total items within the chests and the chest adjacent to the inserter so that it activates when the average number of items is higher than the amount within the chest.&lt;br /&gt;
The reason for why the division denominator is negative is because if the items in the chests are 0, it basically makes it so that it adds 1 to the equation.&lt;br /&gt;
&lt;br /&gt;
== Oil Control ==&lt;br /&gt;
&lt;br /&gt;
== Memory ==&lt;br /&gt;
How to store a constant value for later use, either for a basic counter or for more advanced logic. A decider combinator wired output tied to input and configured greater than zero (for positive values), input -&amp;gt; output will &#039;hold&#039; a value, as long as all other inputs on the network are zero.&lt;br /&gt;
&lt;br /&gt;
Any non-zero input condition will create a basic clock; incrementing the stored value by the sum of all connected input values every cycle. A single pulse of an input will cause a single increment by the pulsed value. Reset to zero occurs whenever the set condition is no longer met, or if a negative pulse equal to the input occurs.&lt;br /&gt;
&lt;br /&gt;
== Basic Clocks ==&lt;br /&gt;
Clocks are constructed by having the output of a combinator tied back to its own input, such that every cycle advances its own count. Either the arithmetic combinator or the decider combinator can be used.&lt;br /&gt;
&lt;br /&gt;
An arithmetic combinator tied to itself is fun to watch and will happily run-away, but requires additional control logic to reset.&lt;br /&gt;
&lt;br /&gt;
A self-resetting clock requires just a single decider combinator with output wired to input and configured with Less Than (&amp;lt;) and Input -&amp;gt; Output. When a constant combinator is then connected to the input, every cycle it will count up by the value of the Constant Combinator until the set conditional value is reached, then output a zero which will be summed with the constant combinator, and reset the process.&lt;br /&gt;
&lt;br /&gt;
[[File:Timer.png|500px]]&lt;br /&gt;
&#039;&#039;30 ticks is the ceiling for Signal 1; which is continuously added.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The clock sequence will not include zero, will begin at the value set by the constant combinator, and will include whatever value eventually causes the conditional to be false. An arithmetic combinator can modify the clock sequence but remember its outputs will occur one cycle later than the clock cycle values.&lt;br /&gt;
&lt;br /&gt;
== Pulse Generators ==&lt;br /&gt;
&lt;br /&gt;
Connecting an additional (=) decider combinator to the output of a basic clock will create a pulse generator, and will pulse a single output every time the clock cycles through the set condition. Any output value can be used, either directly from the clock sequence (input-&amp;gt;output), a 1, or some value on a separate logic channel on the circuit network, such as set by a constant combinator. or by the circuit network.&amp;lt;br /&amp;gt;&lt;br /&gt;
[[File:PulseGen.png|500px]]&lt;br /&gt;
*&#039;&#039;The value 1 can be written as any positive integer, so long as it is within the cap or ceiling of your timer.&#039;&#039;&lt;br /&gt;
*&#039;&#039;As an example from the above timer, this light will pulse every 1st tick after the timer reaches 30 ticks, making it pulse 1/30th of a second, as Factorio updates at 60 times per second.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Counter ==&lt;br /&gt;
A counter is used to count the number of input events, and output the sum of that count. Any pulsing input into a decider combinator configured input -&amp;gt; output and wired between output and input will create a counter, but this input must be zero at all other times or else the combinator will run away like a clock. A pulse generator is normally used to accomplish this. Combining several gating decider isolators set with sequential conditionals, a clock, and a pulse generator to the input of a counter will allow remote polling and counting of each isolator&#039;s contents.&lt;br /&gt;
&lt;br /&gt;
== Logic Gates ==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Unary NOT&#039;&#039;&#039;&lt;br /&gt;
----&lt;br /&gt;
[[File:NOT.png|415px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Binary OR&#039;&#039;&#039;&lt;br /&gt;
----&lt;br /&gt;
[[File:OR.png|300px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 2!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1  || 1&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Binary NOR&#039;&#039;&#039;&lt;br /&gt;
----&lt;br /&gt;
[[File:NOR.png|415px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 2!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Binary XOR&#039;&#039;&#039;&lt;br /&gt;
----&lt;br /&gt;
[[File:XOR.png|300px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 1!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 ||  0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 ||  1 || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 ||  0 || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 ||  1 || 0&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Binary AND&#039;&#039;&#039;&lt;br /&gt;
----&lt;br /&gt;
[[File:AND.png|530px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 2!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1 || 1&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Trinary AND&#039;&#039;&#039;&lt;br /&gt;
----&lt;br /&gt;
[[File:TrinaryAND.png|415px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 2!!Input 3!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0  || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1  || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0  || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1  || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0  || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1  || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0  || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1  || 1  || 1&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Binary NAND&#039;&#039;&#039;&lt;br /&gt;
----&lt;br /&gt;
[[File:NAND.png|300px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 2!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Binary XNOR/XAND&#039;&#039;&#039;&lt;br /&gt;
----&lt;br /&gt;
[[File:XAND.png|300px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 2!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1  || 1&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Memory Cells ==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Simple Latch&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Have a Decider Combinator connect to itself with its input and output using a different colour of wire, say green wire when your output and input is red wire.&lt;br /&gt;
&lt;br /&gt;
[[File:SimpleLatchv2.png|300px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Output 1!!Input 1!!Input 2!! Output 1 (t+1)&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 0 || 1&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0 || 0 || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1 || 0 || 1 &#039;&#039;(2)&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0 || 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1 || 1 || 1 &#039;&#039;(2)&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&#039;&#039;Output 1 is the green wire loop seen in the picture, it carries the value to latch.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Binary Cell&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
RS NOR Latch&lt;br /&gt;
[[File:RS-NOR.png|500px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Advanced Cell&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Cell for storing a positive value:&lt;br /&gt;
&lt;br /&gt;
[[File:AdvancedMemoryCell.png|500px]]&lt;br /&gt;
&lt;br /&gt;
Connect the desired value as signal 3 on the right side to set the memory cell and connect a negative value as signal 3 to reset the cell.  *Please note the arithmetic combinator&#039;s output should be facing the opposite direction of the decider combinators.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Address Enable Switch&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== See Also ==&lt;br /&gt;
*[http://www.factorioforums.com/forum/viewtopic.php?f=18&amp;amp;t=14556 Combinators 101 (Tutorial)]&lt;br /&gt;
*[[Arithmetic combinator]]&lt;br /&gt;
*[[Constant Combinator]]&lt;br /&gt;
*[[Decider Combinator]]&lt;br /&gt;
*[[Circuit network]]&lt;br /&gt;
*[[Circuit-network_Cookbook]]&lt;br /&gt;
[[Category:Tutorial]]&lt;br /&gt;
[[Category:English page]]&lt;/div&gt;</summary>
		<author><name>My3DS</name></author>
	</entry>
	<entry>
		<id>https://wiki.factorio.com/index.php?title=Tutorial:Combinator_tutorial&amp;diff=133483</id>
		<title>Tutorial:Combinator tutorial</title>
		<link rel="alternate" type="text/html" href="https://wiki.factorio.com/index.php?title=Tutorial:Combinator_tutorial&amp;diff=133483"/>
		<updated>2016-12-27T10:40:03Z</updated>

		<summary type="html">&lt;p&gt;My3DS: /* Everything Wildcard: */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
Combinator logic is achieved by cross-connecting outputs to inputs in such a way to achieve the desired logic. While advanced logic requires a multitude of combinators, some very useful basic logic can be achieved using only a handful of combinators. &#039;&#039;&#039;Combinator logic works because Factorio only updates at 60 times per second, such that combinators analyze their logic in a step, and then sum and/or decide the resulting output values on the next step.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
When logic values are computed by combinators, the outputs are not recognized by the circuit network until the following step. So when a decider combinator is used to detect a certain input condition, it&#039;s output value will not take effect on the circuit network until the next step. &#039;&#039;&#039;This behavior is important to remember and can result in sequencing errors and significant delays when multiple combinators are connected in series.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Circuit wires act like a wire bus in electronics, it carries information in the connected wires, meaning that &#039;&#039;&#039;if there are similar signals on a wire, it will add them automatically, unless if it is a different signal, that means it will be carried in that wire as well, but as a different signal.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
When cross-connecting combinators &#039;&#039;&#039;it&#039;s good practice to use the unused color to cross-connect, this will split the input and output networks and prevent unwanted inputs from accidentally connecting to a larger circuit network.&#039;&#039;&#039; Combinators will sum the red &amp;amp;/or green inputs prior to calculation, so either color can be used when wiring the output back to the input, but in most cases, it is more useful to use the opposing colour of the wire so that it will not interfere with the resulting output and input.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;There is also an example heavy [[Circuit-network_Cookbook|circuit network cookbook]] that you may find helpful to learn and refer to about circuit networks.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Virtual Signals ==&lt;br /&gt;
&lt;br /&gt;
===Everything Wildcard:===&lt;br /&gt;
---&lt;br /&gt;
&lt;br /&gt;
This Red Wildcard serves to check all the specifed input signals.&lt;br /&gt;
&lt;br /&gt;
As the Decider Combinator, &amp;lt;br /&amp;gt;&lt;br /&gt;
its input is used to serve if all inputs meets the specified signals or variables. &amp;lt;br /&amp;gt;&lt;br /&gt;
its output is used to serve output every signal. &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As the Arithmetic Combinator, &amp;lt;br /&amp;gt;&lt;br /&gt;
its input is used to serve all inputs, then the following summations are summed and outputted as a whole.&lt;br /&gt;
&lt;br /&gt;
===Anything Wildcard:===&lt;br /&gt;
---&lt;br /&gt;
&lt;br /&gt;
This Green Wildcard serves to check all the specifed input signals.&lt;br /&gt;
&lt;br /&gt;
As the Decider Combinator, &lt;br /&gt;
its input is used to serve if any of its inputs meets the specified signals or variables.&lt;br /&gt;
&lt;br /&gt;
As the Arithmetic Combinator, &amp;lt;br /&amp;gt;&lt;br /&gt;
its input is used to serve every input, then the following summations are summed and outputted.&lt;br /&gt;
&lt;br /&gt;
===Each Wildcard:===&lt;br /&gt;
---&lt;br /&gt;
&lt;br /&gt;
This Yellow Wildcard serves to check for each the specifed input signals.&lt;br /&gt;
&lt;br /&gt;
As the Decider Combinator, &amp;lt;br /&amp;gt;&lt;br /&gt;
its input is used to serve if any inputs meets the specified signals or variables. &amp;lt;br /&amp;gt;&lt;br /&gt;
its output is used to serve output the each variable. &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As the Arithmetic Combinator, &amp;lt;br /&amp;gt;&lt;br /&gt;
its input is used to serve every input, then the following summations are summed and outputted individually.&lt;br /&gt;
&lt;br /&gt;
== Input Isolator &amp;amp; Gate ==&lt;br /&gt;
An arithmetic combinator set to (In: Each + 0, Out: Each) can be used to swap wire colors and as an isolator to prevent downstream logic from backfeeding into the circuit network&#039;s inputs.&lt;br /&gt;
&lt;br /&gt;
A decider combinator set to (Out: Everything, Input-&amp;gt; Output) will also function as an isolator as long as the set logic condition is true. This can also selectively pass or &#039;gate&#039; inputs only when desired. This could be used to sequentially poll remote train stations for their chest contents, and include only desired stations.&lt;br /&gt;
&lt;br /&gt;
== Set/Reset Latching Switch ==&lt;br /&gt;
You want something to SET a trigger at some quantity, but then STAY on until that quantity hits some other value, the RESET value. You&#039;ll need one decider combinator and one arithmetic combinator. Two decider combinators and a constant combinator can also be used for more complex multi-channel conditions.&lt;br /&gt;
&lt;br /&gt;
Setup the first decider combinator to the desired set conditional and to output a 1. Then connect the output to the input of an arithmetic combinator, and configure it to multiply by the bias value, the difference between the set and reset values, and wire the arithmetic output to the input of the decider. The arithmetic output channel MUST be set the same as the decider&#039;s input channel. That&#039;s it! Whenever your set conditional is reached, the decider will output a &#039;1&#039;, and the bias of the arithmetic combinator will be applied. This will &#039;hold&#039; the output true until the value goes back below the reset point.&lt;br /&gt;
&lt;br /&gt;
Here&#039;s a more specific example : &lt;br /&gt;
i want the pump to run when petrol reach 2000, and turn off when reach 200.&amp;lt;br&amp;gt;&lt;br /&gt;
only with green wire&amp;lt;br&amp;gt;&lt;br /&gt;
Tank -&amp;gt; in decider&amp;lt;br&amp;gt;&lt;br /&gt;
out decider-&amp;gt; in arithmetic&amp;lt;br&amp;gt;&lt;br /&gt;
out arithmetic -&amp;gt; in decider&amp;lt;br&amp;gt;&lt;br /&gt;
green wire from in decider, to pump&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Pump have the same condition as the decider (Petrol &amp;gt; 2000)&lt;br /&gt;
&lt;br /&gt;
Decider : Petrol &amp;gt; 2000&amp;lt;br&amp;gt;&lt;br /&gt;
out : A = 1&amp;lt;br&amp;gt;&lt;br /&gt;
Arithmetic : A x 1800 (2000 - 200 )&amp;lt;br&amp;gt;&lt;br /&gt;
out : petrol&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:Factorio combinator switch.png|620px]]&lt;br /&gt;
&lt;br /&gt;
== Comparing Outputs ==&lt;br /&gt;
&lt;br /&gt;
== Addressing Outposts ==&lt;br /&gt;
&lt;br /&gt;
== Smart Train Loading ==&lt;br /&gt;
&lt;br /&gt;
Initially designed by [https://www.youtube.com/user/Darkphade MadZuri],&lt;br /&gt;
&lt;br /&gt;
This solves the problem of loading logistics into chests, which tend to be unequal and is slower in the rate of loading logistics into the cargo of trains.&lt;br /&gt;
&lt;br /&gt;
To setup the design, you require an Arithmetic Combinator, as well as Red and Green wires. &#039;&#039;&#039;Wire all the chests used, to the input of the Arithmetic Combinator&#039;&#039;&#039;. &#039;&#039;&#039;Then write (Logistics Item / -Amount of chests) and as the output as the Logistics Item in the Arithmetic Combinator&#039;&#039;&#039;, this will average the amount of items within the chests. Lastly, &#039;&#039;&#039;wire all the inserters used to the output of the Arithmetic Combinator and have the other color of the wire be wired to the adjacent chest&#039;&#039;&#039;. &#039;&#039;&#039;Have the inserters enabled when Logistics Item &amp;lt; 1&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
A more visual representation as well as questions for the design can be found [https://www.reddit.com/r/factorio/comments/4e03g2/madzuris_smart_loading_train_station_guide/ here].&lt;br /&gt;
&lt;br /&gt;
Explanation of why this works:&lt;br /&gt;
It compares the average amount of total items within the chests and the chest adjacent to the inserter so that it activates when the average number of items is higher than the amount within the chest.&lt;br /&gt;
The reason for why the division denominator is negative is because if the items in the chests are 0, it basically makes it so that it adds 1 to the equation.&lt;br /&gt;
&lt;br /&gt;
== Oil Control ==&lt;br /&gt;
&lt;br /&gt;
== Memory ==&lt;br /&gt;
How to store a constant value for later use, either for a basic counter or for more advanced logic. A decider combinator wired output tied to input and configured greater than zero (for positive values), input -&amp;gt; output will &#039;hold&#039; a value, as long as all other inputs on the network are zero.&lt;br /&gt;
&lt;br /&gt;
Any non-zero input condition will create a basic clock; incrementing the stored value by the sum of all connected input values every cycle. A single pulse of an input will cause a single increment by the pulsed value. Reset to zero occurs whenever the set condition is no longer met, or if a negative pulse equal to the input occurs.&lt;br /&gt;
&lt;br /&gt;
== Basic Clocks ==&lt;br /&gt;
Clocks are constructed by having the output of a combinator tied back to its own input, such that every cycle advances its own count. Either the arithmetic combinator or the decider combinator can be used.&lt;br /&gt;
&lt;br /&gt;
An arithmetic combinator tied to itself is fun to watch and will happily run-away, but requires additional control logic to reset.&lt;br /&gt;
&lt;br /&gt;
A self-resetting clock requires just a single decider combinator with output wired to input and configured with Less Than (&amp;lt;) and Input -&amp;gt; Output. When a constant combinator is then connected to the input, every cycle it will count up by the value of the Constant Combinator until the set conditional value is reached, then output a zero which will be summed with the constant combinator, and reset the process.&lt;br /&gt;
&lt;br /&gt;
[[File:Timer.png|500px]]&lt;br /&gt;
&#039;&#039;30 ticks is the ceiling for Signal 1; which is continuously added.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The clock sequence will not include zero, will begin at the value set by the constant combinator, and will include whatever value eventually causes the conditional to be false. An arithmetic combinator can modify the clock sequence but remember its outputs will occur one cycle later than the clock cycle values.&lt;br /&gt;
&lt;br /&gt;
== Pulse Generators ==&lt;br /&gt;
&lt;br /&gt;
Connecting an additional (=) decider combinator to the output of a basic clock will create a pulse generator, and will pulse a single output every time the clock cycles through the set condition. Any output value can be used, either directly from the clock sequence (input-&amp;gt;output), a 1, or some value on a separate logic channel on the circuit network, such as set by a constant combinator. or by the circuit network.&amp;lt;br /&amp;gt;&lt;br /&gt;
[[File:PulseGen.png|500px]]&lt;br /&gt;
*&#039;&#039;The value 1 can be written as any positive integer, so long as it is within the cap or ceiling of your timer.&#039;&#039;&lt;br /&gt;
*&#039;&#039;As an example from the above timer, this light will pulse every 1st tick after the timer reaches 30 ticks, making it pulse 1/30th of a second, as Factorio updates at 60 times per second.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Counter ==&lt;br /&gt;
A counter is used to count the number of input events, and output the sum of that count. Any pulsing input into a decider combinator configured input -&amp;gt; output and wired between output and input will create a counter, but this input must be zero at all other times or else the combinator will run away like a clock. A pulse generator is normally used to accomplish this. Combining several gating decider isolators set with sequential conditionals, a clock, and a pulse generator to the input of a counter will allow remote polling and counting of each isolator&#039;s contents.&lt;br /&gt;
&lt;br /&gt;
== Logic Gates ==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Unary NOT&#039;&#039;&#039;&lt;br /&gt;
----&lt;br /&gt;
[[File:NOT.png|415px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Binary OR&#039;&#039;&#039;&lt;br /&gt;
----&lt;br /&gt;
[[File:OR.png|300px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 2!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1  || 1&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Binary NOR&#039;&#039;&#039;&lt;br /&gt;
----&lt;br /&gt;
[[File:NOR.png|415px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 2!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Binary XOR&#039;&#039;&#039;&lt;br /&gt;
----&lt;br /&gt;
[[File:XOR.png|300px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 1!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 ||  0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 ||  1 || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 ||  0 || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 ||  1 || 0&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Binary AND&#039;&#039;&#039;&lt;br /&gt;
----&lt;br /&gt;
[[File:AND.png|530px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 2!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1 || 1&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Trinary AND&#039;&#039;&#039;&lt;br /&gt;
----&lt;br /&gt;
[[File:TrinaryAND.png|415px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 2!!Input 3!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0  || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1  || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0  || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1  || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0  || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1  || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0  || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1  || 1  || 1&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Binary NAND&#039;&#039;&#039;&lt;br /&gt;
----&lt;br /&gt;
[[File:NAND.png|300px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 2!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Binary XNOR/XAND&#039;&#039;&#039;&lt;br /&gt;
----&lt;br /&gt;
[[File:XAND.png|300px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 2!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1  || 1&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Memory Cells ==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Simple Latch&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Have a Decider Combinator connect to itself with its input and output using a different colour of wire, say green wire when your output and input is red wire.&lt;br /&gt;
&lt;br /&gt;
[[File:SimpleLatchv2.png|300px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Output 1!!Input 1!!Input 2!! Output 1 (t+1)&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 0 || 1&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0 || 0 || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1 || 0 || 1 &#039;&#039;(2)&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0 || 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1 || 1 || 1 &#039;&#039;(2)&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&#039;&#039;Output 1 is the green wire loop seen in the picture, it carries the value to latch.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Binary Cell&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
RS NOR Latch&lt;br /&gt;
[[File:RS-NOR.png|500px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Advanced Cell&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Cell for storing a positive value:&lt;br /&gt;
&lt;br /&gt;
[[File:AdvancedMemoryCell.png|500px]]&lt;br /&gt;
&lt;br /&gt;
Connect the desired value as signal 3 on the right side to set the memory cell and connect a negative value as signal 3 to reset the cell.  *Please note the arithmetic combinator&#039;s output should be facing the opposite direction of the decider combinators.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Address Enable Switch&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== See Also ==&lt;br /&gt;
*[http://www.factorioforums.com/forum/viewtopic.php?f=18&amp;amp;t=14556 Combinators 101 (Tutorial)]&lt;br /&gt;
*[[Arithmetic combinator]]&lt;br /&gt;
*[[Constant Combinator]]&lt;br /&gt;
*[[Decider Combinator]]&lt;br /&gt;
*[[Circuit network]]&lt;br /&gt;
*[[Circuit-network_Cookbook]]&lt;br /&gt;
[[Category:Tutorial]]&lt;br /&gt;
[[Category:English page]]&lt;/div&gt;</summary>
		<author><name>My3DS</name></author>
	</entry>
	<entry>
		<id>https://wiki.factorio.com/index.php?title=Tutorial:Combinator_tutorial&amp;diff=133482</id>
		<title>Tutorial:Combinator tutorial</title>
		<link rel="alternate" type="text/html" href="https://wiki.factorio.com/index.php?title=Tutorial:Combinator_tutorial&amp;diff=133482"/>
		<updated>2016-12-27T10:39:09Z</updated>

		<summary type="html">&lt;p&gt;My3DS: /* Anything Wildcard: */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
Combinator logic is achieved by cross-connecting outputs to inputs in such a way to achieve the desired logic. While advanced logic requires a multitude of combinators, some very useful basic logic can be achieved using only a handful of combinators. &#039;&#039;&#039;Combinator logic works because Factorio only updates at 60 times per second, such that combinators analyze their logic in a step, and then sum and/or decide the resulting output values on the next step.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
When logic values are computed by combinators, the outputs are not recognized by the circuit network until the following step. So when a decider combinator is used to detect a certain input condition, it&#039;s output value will not take effect on the circuit network until the next step. &#039;&#039;&#039;This behavior is important to remember and can result in sequencing errors and significant delays when multiple combinators are connected in series.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Circuit wires act like a wire bus in electronics, it carries information in the connected wires, meaning that &#039;&#039;&#039;if there are similar signals on a wire, it will add them automatically, unless if it is a different signal, that means it will be carried in that wire as well, but as a different signal.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
When cross-connecting combinators &#039;&#039;&#039;it&#039;s good practice to use the unused color to cross-connect, this will split the input and output networks and prevent unwanted inputs from accidentally connecting to a larger circuit network.&#039;&#039;&#039; Combinators will sum the red &amp;amp;/or green inputs prior to calculation, so either color can be used when wiring the output back to the input, but in most cases, it is more useful to use the opposing colour of the wire so that it will not interfere with the resulting output and input.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;There is also an example heavy [[Circuit-network_Cookbook|circuit network cookbook]] that you may find helpful to learn and refer to about circuit networks.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Virtual Signals ==&lt;br /&gt;
&lt;br /&gt;
===Everything Wildcard:===&lt;br /&gt;
---&lt;br /&gt;
&lt;br /&gt;
This Red Wildcard serves to check all the specifed input signals.&lt;br /&gt;
&lt;br /&gt;
As the Decider Combinator, &amp;lt;br /&amp;gt;&lt;br /&gt;
its input is used to serve if all inputs meets the specified signals or variables. &amp;lt;br /&amp;gt;&lt;br /&gt;
its output is used to serve output everything. &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Anything Wildcard:===&lt;br /&gt;
---&lt;br /&gt;
&lt;br /&gt;
This Green Wildcard serves to check all the specifed input signals.&lt;br /&gt;
&lt;br /&gt;
As the Decider Combinator, &lt;br /&gt;
its input is used to serve if any of its inputs meets the specified signals or variables.&lt;br /&gt;
&lt;br /&gt;
As the Arithmetic Combinator, &amp;lt;br /&amp;gt;&lt;br /&gt;
its input is used to serve every input, then the following summations are summed and outputted.&lt;br /&gt;
&lt;br /&gt;
===Each Wildcard:===&lt;br /&gt;
---&lt;br /&gt;
&lt;br /&gt;
This Yellow Wildcard serves to check for each the specifed input signals.&lt;br /&gt;
&lt;br /&gt;
As the Decider Combinator, &amp;lt;br /&amp;gt;&lt;br /&gt;
its input is used to serve if any inputs meets the specified signals or variables. &amp;lt;br /&amp;gt;&lt;br /&gt;
its output is used to serve output the each variable. &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As the Arithmetic Combinator, &amp;lt;br /&amp;gt;&lt;br /&gt;
its input is used to serve every input, then the following summations are summed and outputted individually.&lt;br /&gt;
&lt;br /&gt;
== Input Isolator &amp;amp; Gate ==&lt;br /&gt;
An arithmetic combinator set to (In: Each + 0, Out: Each) can be used to swap wire colors and as an isolator to prevent downstream logic from backfeeding into the circuit network&#039;s inputs.&lt;br /&gt;
&lt;br /&gt;
A decider combinator set to (Out: Everything, Input-&amp;gt; Output) will also function as an isolator as long as the set logic condition is true. This can also selectively pass or &#039;gate&#039; inputs only when desired. This could be used to sequentially poll remote train stations for their chest contents, and include only desired stations.&lt;br /&gt;
&lt;br /&gt;
== Set/Reset Latching Switch ==&lt;br /&gt;
You want something to SET a trigger at some quantity, but then STAY on until that quantity hits some other value, the RESET value. You&#039;ll need one decider combinator and one arithmetic combinator. Two decider combinators and a constant combinator can also be used for more complex multi-channel conditions.&lt;br /&gt;
&lt;br /&gt;
Setup the first decider combinator to the desired set conditional and to output a 1. Then connect the output to the input of an arithmetic combinator, and configure it to multiply by the bias value, the difference between the set and reset values, and wire the arithmetic output to the input of the decider. The arithmetic output channel MUST be set the same as the decider&#039;s input channel. That&#039;s it! Whenever your set conditional is reached, the decider will output a &#039;1&#039;, and the bias of the arithmetic combinator will be applied. This will &#039;hold&#039; the output true until the value goes back below the reset point.&lt;br /&gt;
&lt;br /&gt;
Here&#039;s a more specific example : &lt;br /&gt;
i want the pump to run when petrol reach 2000, and turn off when reach 200.&amp;lt;br&amp;gt;&lt;br /&gt;
only with green wire&amp;lt;br&amp;gt;&lt;br /&gt;
Tank -&amp;gt; in decider&amp;lt;br&amp;gt;&lt;br /&gt;
out decider-&amp;gt; in arithmetic&amp;lt;br&amp;gt;&lt;br /&gt;
out arithmetic -&amp;gt; in decider&amp;lt;br&amp;gt;&lt;br /&gt;
green wire from in decider, to pump&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Pump have the same condition as the decider (Petrol &amp;gt; 2000)&lt;br /&gt;
&lt;br /&gt;
Decider : Petrol &amp;gt; 2000&amp;lt;br&amp;gt;&lt;br /&gt;
out : A = 1&amp;lt;br&amp;gt;&lt;br /&gt;
Arithmetic : A x 1800 (2000 - 200 )&amp;lt;br&amp;gt;&lt;br /&gt;
out : petrol&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:Factorio combinator switch.png|620px]]&lt;br /&gt;
&lt;br /&gt;
== Comparing Outputs ==&lt;br /&gt;
&lt;br /&gt;
== Addressing Outposts ==&lt;br /&gt;
&lt;br /&gt;
== Smart Train Loading ==&lt;br /&gt;
&lt;br /&gt;
Initially designed by [https://www.youtube.com/user/Darkphade MadZuri],&lt;br /&gt;
&lt;br /&gt;
This solves the problem of loading logistics into chests, which tend to be unequal and is slower in the rate of loading logistics into the cargo of trains.&lt;br /&gt;
&lt;br /&gt;
To setup the design, you require an Arithmetic Combinator, as well as Red and Green wires. &#039;&#039;&#039;Wire all the chests used, to the input of the Arithmetic Combinator&#039;&#039;&#039;. &#039;&#039;&#039;Then write (Logistics Item / -Amount of chests) and as the output as the Logistics Item in the Arithmetic Combinator&#039;&#039;&#039;, this will average the amount of items within the chests. Lastly, &#039;&#039;&#039;wire all the inserters used to the output of the Arithmetic Combinator and have the other color of the wire be wired to the adjacent chest&#039;&#039;&#039;. &#039;&#039;&#039;Have the inserters enabled when Logistics Item &amp;lt; 1&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
A more visual representation as well as questions for the design can be found [https://www.reddit.com/r/factorio/comments/4e03g2/madzuris_smart_loading_train_station_guide/ here].&lt;br /&gt;
&lt;br /&gt;
Explanation of why this works:&lt;br /&gt;
It compares the average amount of total items within the chests and the chest adjacent to the inserter so that it activates when the average number of items is higher than the amount within the chest.&lt;br /&gt;
The reason for why the division denominator is negative is because if the items in the chests are 0, it basically makes it so that it adds 1 to the equation.&lt;br /&gt;
&lt;br /&gt;
== Oil Control ==&lt;br /&gt;
&lt;br /&gt;
== Memory ==&lt;br /&gt;
How to store a constant value for later use, either for a basic counter or for more advanced logic. A decider combinator wired output tied to input and configured greater than zero (for positive values), input -&amp;gt; output will &#039;hold&#039; a value, as long as all other inputs on the network are zero.&lt;br /&gt;
&lt;br /&gt;
Any non-zero input condition will create a basic clock; incrementing the stored value by the sum of all connected input values every cycle. A single pulse of an input will cause a single increment by the pulsed value. Reset to zero occurs whenever the set condition is no longer met, or if a negative pulse equal to the input occurs.&lt;br /&gt;
&lt;br /&gt;
== Basic Clocks ==&lt;br /&gt;
Clocks are constructed by having the output of a combinator tied back to its own input, such that every cycle advances its own count. Either the arithmetic combinator or the decider combinator can be used.&lt;br /&gt;
&lt;br /&gt;
An arithmetic combinator tied to itself is fun to watch and will happily run-away, but requires additional control logic to reset.&lt;br /&gt;
&lt;br /&gt;
A self-resetting clock requires just a single decider combinator with output wired to input and configured with Less Than (&amp;lt;) and Input -&amp;gt; Output. When a constant combinator is then connected to the input, every cycle it will count up by the value of the Constant Combinator until the set conditional value is reached, then output a zero which will be summed with the constant combinator, and reset the process.&lt;br /&gt;
&lt;br /&gt;
[[File:Timer.png|500px]]&lt;br /&gt;
&#039;&#039;30 ticks is the ceiling for Signal 1; which is continuously added.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The clock sequence will not include zero, will begin at the value set by the constant combinator, and will include whatever value eventually causes the conditional to be false. An arithmetic combinator can modify the clock sequence but remember its outputs will occur one cycle later than the clock cycle values.&lt;br /&gt;
&lt;br /&gt;
== Pulse Generators ==&lt;br /&gt;
&lt;br /&gt;
Connecting an additional (=) decider combinator to the output of a basic clock will create a pulse generator, and will pulse a single output every time the clock cycles through the set condition. Any output value can be used, either directly from the clock sequence (input-&amp;gt;output), a 1, or some value on a separate logic channel on the circuit network, such as set by a constant combinator. or by the circuit network.&amp;lt;br /&amp;gt;&lt;br /&gt;
[[File:PulseGen.png|500px]]&lt;br /&gt;
*&#039;&#039;The value 1 can be written as any positive integer, so long as it is within the cap or ceiling of your timer.&#039;&#039;&lt;br /&gt;
*&#039;&#039;As an example from the above timer, this light will pulse every 1st tick after the timer reaches 30 ticks, making it pulse 1/30th of a second, as Factorio updates at 60 times per second.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Counter ==&lt;br /&gt;
A counter is used to count the number of input events, and output the sum of that count. Any pulsing input into a decider combinator configured input -&amp;gt; output and wired between output and input will create a counter, but this input must be zero at all other times or else the combinator will run away like a clock. A pulse generator is normally used to accomplish this. Combining several gating decider isolators set with sequential conditionals, a clock, and a pulse generator to the input of a counter will allow remote polling and counting of each isolator&#039;s contents.&lt;br /&gt;
&lt;br /&gt;
== Logic Gates ==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Unary NOT&#039;&#039;&#039;&lt;br /&gt;
----&lt;br /&gt;
[[File:NOT.png|415px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Binary OR&#039;&#039;&#039;&lt;br /&gt;
----&lt;br /&gt;
[[File:OR.png|300px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 2!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1  || 1&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Binary NOR&#039;&#039;&#039;&lt;br /&gt;
----&lt;br /&gt;
[[File:NOR.png|415px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 2!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Binary XOR&#039;&#039;&#039;&lt;br /&gt;
----&lt;br /&gt;
[[File:XOR.png|300px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 1!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 ||  0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 ||  1 || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 ||  0 || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 ||  1 || 0&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Binary AND&#039;&#039;&#039;&lt;br /&gt;
----&lt;br /&gt;
[[File:AND.png|530px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 2!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1 || 1&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Trinary AND&#039;&#039;&#039;&lt;br /&gt;
----&lt;br /&gt;
[[File:TrinaryAND.png|415px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 2!!Input 3!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0  || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1  || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0  || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1  || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0  || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1  || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0  || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1  || 1  || 1&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Binary NAND&#039;&#039;&#039;&lt;br /&gt;
----&lt;br /&gt;
[[File:NAND.png|300px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 2!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Binary XNOR/XAND&#039;&#039;&#039;&lt;br /&gt;
----&lt;br /&gt;
[[File:XAND.png|300px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 2!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1  || 1&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Memory Cells ==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Simple Latch&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Have a Decider Combinator connect to itself with its input and output using a different colour of wire, say green wire when your output and input is red wire.&lt;br /&gt;
&lt;br /&gt;
[[File:SimpleLatchv2.png|300px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Output 1!!Input 1!!Input 2!! Output 1 (t+1)&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 0 || 1&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0 || 0 || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1 || 0 || 1 &#039;&#039;(2)&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0 || 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1 || 1 || 1 &#039;&#039;(2)&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&#039;&#039;Output 1 is the green wire loop seen in the picture, it carries the value to latch.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Binary Cell&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
RS NOR Latch&lt;br /&gt;
[[File:RS-NOR.png|500px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Advanced Cell&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Cell for storing a positive value:&lt;br /&gt;
&lt;br /&gt;
[[File:AdvancedMemoryCell.png|500px]]&lt;br /&gt;
&lt;br /&gt;
Connect the desired value as signal 3 on the right side to set the memory cell and connect a negative value as signal 3 to reset the cell.  *Please note the arithmetic combinator&#039;s output should be facing the opposite direction of the decider combinators.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Address Enable Switch&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== See Also ==&lt;br /&gt;
*[http://www.factorioforums.com/forum/viewtopic.php?f=18&amp;amp;t=14556 Combinators 101 (Tutorial)]&lt;br /&gt;
*[[Arithmetic combinator]]&lt;br /&gt;
*[[Constant Combinator]]&lt;br /&gt;
*[[Decider Combinator]]&lt;br /&gt;
*[[Circuit network]]&lt;br /&gt;
*[[Circuit-network_Cookbook]]&lt;br /&gt;
[[Category:Tutorial]]&lt;br /&gt;
[[Category:English page]]&lt;/div&gt;</summary>
		<author><name>My3DS</name></author>
	</entry>
	<entry>
		<id>https://wiki.factorio.com/index.php?title=Tutorial:Combinator_tutorial&amp;diff=133481</id>
		<title>Tutorial:Combinator tutorial</title>
		<link rel="alternate" type="text/html" href="https://wiki.factorio.com/index.php?title=Tutorial:Combinator_tutorial&amp;diff=133481"/>
		<updated>2016-12-27T10:37:47Z</updated>

		<summary type="html">&lt;p&gt;My3DS: /* Each Wildcard: */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
Combinator logic is achieved by cross-connecting outputs to inputs in such a way to achieve the desired logic. While advanced logic requires a multitude of combinators, some very useful basic logic can be achieved using only a handful of combinators. &#039;&#039;&#039;Combinator logic works because Factorio only updates at 60 times per second, such that combinators analyze their logic in a step, and then sum and/or decide the resulting output values on the next step.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
When logic values are computed by combinators, the outputs are not recognized by the circuit network until the following step. So when a decider combinator is used to detect a certain input condition, it&#039;s output value will not take effect on the circuit network until the next step. &#039;&#039;&#039;This behavior is important to remember and can result in sequencing errors and significant delays when multiple combinators are connected in series.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Circuit wires act like a wire bus in electronics, it carries information in the connected wires, meaning that &#039;&#039;&#039;if there are similar signals on a wire, it will add them automatically, unless if it is a different signal, that means it will be carried in that wire as well, but as a different signal.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
When cross-connecting combinators &#039;&#039;&#039;it&#039;s good practice to use the unused color to cross-connect, this will split the input and output networks and prevent unwanted inputs from accidentally connecting to a larger circuit network.&#039;&#039;&#039; Combinators will sum the red &amp;amp;/or green inputs prior to calculation, so either color can be used when wiring the output back to the input, but in most cases, it is more useful to use the opposing colour of the wire so that it will not interfere with the resulting output and input.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;There is also an example heavy [[Circuit-network_Cookbook|circuit network cookbook]] that you may find helpful to learn and refer to about circuit networks.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Virtual Signals ==&lt;br /&gt;
&lt;br /&gt;
===Everything Wildcard:===&lt;br /&gt;
---&lt;br /&gt;
&lt;br /&gt;
This Red Wildcard serves to check all the specifed input signals.&lt;br /&gt;
&lt;br /&gt;
As the Decider Combinator, &amp;lt;br /&amp;gt;&lt;br /&gt;
its input is used to serve if all inputs meets the specified signals or variables. &amp;lt;br /&amp;gt;&lt;br /&gt;
its output is used to serve output everything. &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Anything Wildcard:===&lt;br /&gt;
---&lt;br /&gt;
&lt;br /&gt;
This Green Wildcard serves to check all the specifed input signals.&lt;br /&gt;
&lt;br /&gt;
As the Decider Combinator, &lt;br /&gt;
its input is used to serve if any of its inputs meets the specified signals or variables.&lt;br /&gt;
&lt;br /&gt;
===Each Wildcard:===&lt;br /&gt;
---&lt;br /&gt;
&lt;br /&gt;
This Yellow Wildcard serves to check for each the specifed input signals.&lt;br /&gt;
&lt;br /&gt;
As the Decider Combinator, &amp;lt;br /&amp;gt;&lt;br /&gt;
its input is used to serve if any inputs meets the specified signals or variables. &amp;lt;br /&amp;gt;&lt;br /&gt;
its output is used to serve output the each variable. &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As the Arithmetic Combinator, &amp;lt;br /&amp;gt;&lt;br /&gt;
its input is used to serve every input, then the following summations are summed and outputted individually.&lt;br /&gt;
&lt;br /&gt;
== Input Isolator &amp;amp; Gate ==&lt;br /&gt;
An arithmetic combinator set to (In: Each + 0, Out: Each) can be used to swap wire colors and as an isolator to prevent downstream logic from backfeeding into the circuit network&#039;s inputs.&lt;br /&gt;
&lt;br /&gt;
A decider combinator set to (Out: Everything, Input-&amp;gt; Output) will also function as an isolator as long as the set logic condition is true. This can also selectively pass or &#039;gate&#039; inputs only when desired. This could be used to sequentially poll remote train stations for their chest contents, and include only desired stations.&lt;br /&gt;
&lt;br /&gt;
== Set/Reset Latching Switch ==&lt;br /&gt;
You want something to SET a trigger at some quantity, but then STAY on until that quantity hits some other value, the RESET value. You&#039;ll need one decider combinator and one arithmetic combinator. Two decider combinators and a constant combinator can also be used for more complex multi-channel conditions.&lt;br /&gt;
&lt;br /&gt;
Setup the first decider combinator to the desired set conditional and to output a 1. Then connect the output to the input of an arithmetic combinator, and configure it to multiply by the bias value, the difference between the set and reset values, and wire the arithmetic output to the input of the decider. The arithmetic output channel MUST be set the same as the decider&#039;s input channel. That&#039;s it! Whenever your set conditional is reached, the decider will output a &#039;1&#039;, and the bias of the arithmetic combinator will be applied. This will &#039;hold&#039; the output true until the value goes back below the reset point.&lt;br /&gt;
&lt;br /&gt;
Here&#039;s a more specific example : &lt;br /&gt;
i want the pump to run when petrol reach 2000, and turn off when reach 200.&amp;lt;br&amp;gt;&lt;br /&gt;
only with green wire&amp;lt;br&amp;gt;&lt;br /&gt;
Tank -&amp;gt; in decider&amp;lt;br&amp;gt;&lt;br /&gt;
out decider-&amp;gt; in arithmetic&amp;lt;br&amp;gt;&lt;br /&gt;
out arithmetic -&amp;gt; in decider&amp;lt;br&amp;gt;&lt;br /&gt;
green wire from in decider, to pump&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Pump have the same condition as the decider (Petrol &amp;gt; 2000)&lt;br /&gt;
&lt;br /&gt;
Decider : Petrol &amp;gt; 2000&amp;lt;br&amp;gt;&lt;br /&gt;
out : A = 1&amp;lt;br&amp;gt;&lt;br /&gt;
Arithmetic : A x 1800 (2000 - 200 )&amp;lt;br&amp;gt;&lt;br /&gt;
out : petrol&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:Factorio combinator switch.png|620px]]&lt;br /&gt;
&lt;br /&gt;
== Comparing Outputs ==&lt;br /&gt;
&lt;br /&gt;
== Addressing Outposts ==&lt;br /&gt;
&lt;br /&gt;
== Smart Train Loading ==&lt;br /&gt;
&lt;br /&gt;
Initially designed by [https://www.youtube.com/user/Darkphade MadZuri],&lt;br /&gt;
&lt;br /&gt;
This solves the problem of loading logistics into chests, which tend to be unequal and is slower in the rate of loading logistics into the cargo of trains.&lt;br /&gt;
&lt;br /&gt;
To setup the design, you require an Arithmetic Combinator, as well as Red and Green wires. &#039;&#039;&#039;Wire all the chests used, to the input of the Arithmetic Combinator&#039;&#039;&#039;. &#039;&#039;&#039;Then write (Logistics Item / -Amount of chests) and as the output as the Logistics Item in the Arithmetic Combinator&#039;&#039;&#039;, this will average the amount of items within the chests. Lastly, &#039;&#039;&#039;wire all the inserters used to the output of the Arithmetic Combinator and have the other color of the wire be wired to the adjacent chest&#039;&#039;&#039;. &#039;&#039;&#039;Have the inserters enabled when Logistics Item &amp;lt; 1&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
A more visual representation as well as questions for the design can be found [https://www.reddit.com/r/factorio/comments/4e03g2/madzuris_smart_loading_train_station_guide/ here].&lt;br /&gt;
&lt;br /&gt;
Explanation of why this works:&lt;br /&gt;
It compares the average amount of total items within the chests and the chest adjacent to the inserter so that it activates when the average number of items is higher than the amount within the chest.&lt;br /&gt;
The reason for why the division denominator is negative is because if the items in the chests are 0, it basically makes it so that it adds 1 to the equation.&lt;br /&gt;
&lt;br /&gt;
== Oil Control ==&lt;br /&gt;
&lt;br /&gt;
== Memory ==&lt;br /&gt;
How to store a constant value for later use, either for a basic counter or for more advanced logic. A decider combinator wired output tied to input and configured greater than zero (for positive values), input -&amp;gt; output will &#039;hold&#039; a value, as long as all other inputs on the network are zero.&lt;br /&gt;
&lt;br /&gt;
Any non-zero input condition will create a basic clock; incrementing the stored value by the sum of all connected input values every cycle. A single pulse of an input will cause a single increment by the pulsed value. Reset to zero occurs whenever the set condition is no longer met, or if a negative pulse equal to the input occurs.&lt;br /&gt;
&lt;br /&gt;
== Basic Clocks ==&lt;br /&gt;
Clocks are constructed by having the output of a combinator tied back to its own input, such that every cycle advances its own count. Either the arithmetic combinator or the decider combinator can be used.&lt;br /&gt;
&lt;br /&gt;
An arithmetic combinator tied to itself is fun to watch and will happily run-away, but requires additional control logic to reset.&lt;br /&gt;
&lt;br /&gt;
A self-resetting clock requires just a single decider combinator with output wired to input and configured with Less Than (&amp;lt;) and Input -&amp;gt; Output. When a constant combinator is then connected to the input, every cycle it will count up by the value of the Constant Combinator until the set conditional value is reached, then output a zero which will be summed with the constant combinator, and reset the process.&lt;br /&gt;
&lt;br /&gt;
[[File:Timer.png|500px]]&lt;br /&gt;
&#039;&#039;30 ticks is the ceiling for Signal 1; which is continuously added.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The clock sequence will not include zero, will begin at the value set by the constant combinator, and will include whatever value eventually causes the conditional to be false. An arithmetic combinator can modify the clock sequence but remember its outputs will occur one cycle later than the clock cycle values.&lt;br /&gt;
&lt;br /&gt;
== Pulse Generators ==&lt;br /&gt;
&lt;br /&gt;
Connecting an additional (=) decider combinator to the output of a basic clock will create a pulse generator, and will pulse a single output every time the clock cycles through the set condition. Any output value can be used, either directly from the clock sequence (input-&amp;gt;output), a 1, or some value on a separate logic channel on the circuit network, such as set by a constant combinator. or by the circuit network.&amp;lt;br /&amp;gt;&lt;br /&gt;
[[File:PulseGen.png|500px]]&lt;br /&gt;
*&#039;&#039;The value 1 can be written as any positive integer, so long as it is within the cap or ceiling of your timer.&#039;&#039;&lt;br /&gt;
*&#039;&#039;As an example from the above timer, this light will pulse every 1st tick after the timer reaches 30 ticks, making it pulse 1/30th of a second, as Factorio updates at 60 times per second.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Counter ==&lt;br /&gt;
A counter is used to count the number of input events, and output the sum of that count. Any pulsing input into a decider combinator configured input -&amp;gt; output and wired between output and input will create a counter, but this input must be zero at all other times or else the combinator will run away like a clock. A pulse generator is normally used to accomplish this. Combining several gating decider isolators set with sequential conditionals, a clock, and a pulse generator to the input of a counter will allow remote polling and counting of each isolator&#039;s contents.&lt;br /&gt;
&lt;br /&gt;
== Logic Gates ==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Unary NOT&#039;&#039;&#039;&lt;br /&gt;
----&lt;br /&gt;
[[File:NOT.png|415px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Binary OR&#039;&#039;&#039;&lt;br /&gt;
----&lt;br /&gt;
[[File:OR.png|300px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 2!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1  || 1&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Binary NOR&#039;&#039;&#039;&lt;br /&gt;
----&lt;br /&gt;
[[File:NOR.png|415px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 2!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Binary XOR&#039;&#039;&#039;&lt;br /&gt;
----&lt;br /&gt;
[[File:XOR.png|300px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 1!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 ||  0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 ||  1 || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 ||  0 || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 ||  1 || 0&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Binary AND&#039;&#039;&#039;&lt;br /&gt;
----&lt;br /&gt;
[[File:AND.png|530px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 2!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1 || 1&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Trinary AND&#039;&#039;&#039;&lt;br /&gt;
----&lt;br /&gt;
[[File:TrinaryAND.png|415px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 2!!Input 3!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0  || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1  || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0  || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1  || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0  || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1  || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0  || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1  || 1  || 1&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Binary NAND&#039;&#039;&#039;&lt;br /&gt;
----&lt;br /&gt;
[[File:NAND.png|300px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 2!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Binary XNOR/XAND&#039;&#039;&#039;&lt;br /&gt;
----&lt;br /&gt;
[[File:XAND.png|300px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 2!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1  || 1&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Memory Cells ==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Simple Latch&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Have a Decider Combinator connect to itself with its input and output using a different colour of wire, say green wire when your output and input is red wire.&lt;br /&gt;
&lt;br /&gt;
[[File:SimpleLatchv2.png|300px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Output 1!!Input 1!!Input 2!! Output 1 (t+1)&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 0 || 1&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0 || 0 || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1 || 0 || 1 &#039;&#039;(2)&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0 || 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1 || 1 || 1 &#039;&#039;(2)&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&#039;&#039;Output 1 is the green wire loop seen in the picture, it carries the value to latch.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Binary Cell&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
RS NOR Latch&lt;br /&gt;
[[File:RS-NOR.png|500px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Advanced Cell&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Cell for storing a positive value:&lt;br /&gt;
&lt;br /&gt;
[[File:AdvancedMemoryCell.png|500px]]&lt;br /&gt;
&lt;br /&gt;
Connect the desired value as signal 3 on the right side to set the memory cell and connect a negative value as signal 3 to reset the cell.  *Please note the arithmetic combinator&#039;s output should be facing the opposite direction of the decider combinators.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Address Enable Switch&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== See Also ==&lt;br /&gt;
*[http://www.factorioforums.com/forum/viewtopic.php?f=18&amp;amp;t=14556 Combinators 101 (Tutorial)]&lt;br /&gt;
*[[Arithmetic combinator]]&lt;br /&gt;
*[[Constant Combinator]]&lt;br /&gt;
*[[Decider Combinator]]&lt;br /&gt;
*[[Circuit network]]&lt;br /&gt;
*[[Circuit-network_Cookbook]]&lt;br /&gt;
[[Category:Tutorial]]&lt;br /&gt;
[[Category:English page]]&lt;/div&gt;</summary>
		<author><name>My3DS</name></author>
	</entry>
	<entry>
		<id>https://wiki.factorio.com/index.php?title=Tutorial:Combinator_tutorial&amp;diff=133480</id>
		<title>Tutorial:Combinator tutorial</title>
		<link rel="alternate" type="text/html" href="https://wiki.factorio.com/index.php?title=Tutorial:Combinator_tutorial&amp;diff=133480"/>
		<updated>2016-12-27T10:33:53Z</updated>

		<summary type="html">&lt;p&gt;My3DS: /* Each Wildcard: */ added info&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
Combinator logic is achieved by cross-connecting outputs to inputs in such a way to achieve the desired logic. While advanced logic requires a multitude of combinators, some very useful basic logic can be achieved using only a handful of combinators. &#039;&#039;&#039;Combinator logic works because Factorio only updates at 60 times per second, such that combinators analyze their logic in a step, and then sum and/or decide the resulting output values on the next step.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
When logic values are computed by combinators, the outputs are not recognized by the circuit network until the following step. So when a decider combinator is used to detect a certain input condition, it&#039;s output value will not take effect on the circuit network until the next step. &#039;&#039;&#039;This behavior is important to remember and can result in sequencing errors and significant delays when multiple combinators are connected in series.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Circuit wires act like a wire bus in electronics, it carries information in the connected wires, meaning that &#039;&#039;&#039;if there are similar signals on a wire, it will add them automatically, unless if it is a different signal, that means it will be carried in that wire as well, but as a different signal.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
When cross-connecting combinators &#039;&#039;&#039;it&#039;s good practice to use the unused color to cross-connect, this will split the input and output networks and prevent unwanted inputs from accidentally connecting to a larger circuit network.&#039;&#039;&#039; Combinators will sum the red &amp;amp;/or green inputs prior to calculation, so either color can be used when wiring the output back to the input, but in most cases, it is more useful to use the opposing colour of the wire so that it will not interfere with the resulting output and input.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;There is also an example heavy [[Circuit-network_Cookbook|circuit network cookbook]] that you may find helpful to learn and refer to about circuit networks.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Virtual Signals ==&lt;br /&gt;
&lt;br /&gt;
===Everything Wildcard:===&lt;br /&gt;
---&lt;br /&gt;
&lt;br /&gt;
This Red Wildcard serves to check all the specifed input signals.&lt;br /&gt;
&lt;br /&gt;
As the Decider Combinator, &amp;lt;br /&amp;gt;&lt;br /&gt;
its input is used to serve if all inputs meets the specified signals or variables. &amp;lt;br /&amp;gt;&lt;br /&gt;
its output is used to serve output everything. &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Anything Wildcard:===&lt;br /&gt;
---&lt;br /&gt;
&lt;br /&gt;
This Green Wildcard serves to check all the specifed input signals.&lt;br /&gt;
&lt;br /&gt;
As the Decider Combinator, &lt;br /&gt;
its input is used to serve if any of its inputs meets the specified signals or variables.&lt;br /&gt;
&lt;br /&gt;
===Each Wildcard:===&lt;br /&gt;
---&lt;br /&gt;
&lt;br /&gt;
This Yellow Wildcard serves to check for each the specifed input signals.&lt;br /&gt;
&lt;br /&gt;
As the Decider Combinator, &lt;br /&gt;
its input is used to serve if any inputs meets the specified signals or variables.&lt;br /&gt;
its output is used to serve output the each variable.&lt;br /&gt;
&lt;br /&gt;
== Input Isolator &amp;amp; Gate ==&lt;br /&gt;
An arithmetic combinator set to (In: Each + 0, Out: Each) can be used to swap wire colors and as an isolator to prevent downstream logic from backfeeding into the circuit network&#039;s inputs.&lt;br /&gt;
&lt;br /&gt;
A decider combinator set to (Out: Everything, Input-&amp;gt; Output) will also function as an isolator as long as the set logic condition is true. This can also selectively pass or &#039;gate&#039; inputs only when desired. This could be used to sequentially poll remote train stations for their chest contents, and include only desired stations.&lt;br /&gt;
&lt;br /&gt;
== Set/Reset Latching Switch ==&lt;br /&gt;
You want something to SET a trigger at some quantity, but then STAY on until that quantity hits some other value, the RESET value. You&#039;ll need one decider combinator and one arithmetic combinator. Two decider combinators and a constant combinator can also be used for more complex multi-channel conditions.&lt;br /&gt;
&lt;br /&gt;
Setup the first decider combinator to the desired set conditional and to output a 1. Then connect the output to the input of an arithmetic combinator, and configure it to multiply by the bias value, the difference between the set and reset values, and wire the arithmetic output to the input of the decider. The arithmetic output channel MUST be set the same as the decider&#039;s input channel. That&#039;s it! Whenever your set conditional is reached, the decider will output a &#039;1&#039;, and the bias of the arithmetic combinator will be applied. This will &#039;hold&#039; the output true until the value goes back below the reset point.&lt;br /&gt;
&lt;br /&gt;
Here&#039;s a more specific example : &lt;br /&gt;
i want the pump to run when petrol reach 2000, and turn off when reach 200.&amp;lt;br&amp;gt;&lt;br /&gt;
only with green wire&amp;lt;br&amp;gt;&lt;br /&gt;
Tank -&amp;gt; in decider&amp;lt;br&amp;gt;&lt;br /&gt;
out decider-&amp;gt; in arithmetic&amp;lt;br&amp;gt;&lt;br /&gt;
out arithmetic -&amp;gt; in decider&amp;lt;br&amp;gt;&lt;br /&gt;
green wire from in decider, to pump&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Pump have the same condition as the decider (Petrol &amp;gt; 2000)&lt;br /&gt;
&lt;br /&gt;
Decider : Petrol &amp;gt; 2000&amp;lt;br&amp;gt;&lt;br /&gt;
out : A = 1&amp;lt;br&amp;gt;&lt;br /&gt;
Arithmetic : A x 1800 (2000 - 200 )&amp;lt;br&amp;gt;&lt;br /&gt;
out : petrol&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:Factorio combinator switch.png|620px]]&lt;br /&gt;
&lt;br /&gt;
== Comparing Outputs ==&lt;br /&gt;
&lt;br /&gt;
== Addressing Outposts ==&lt;br /&gt;
&lt;br /&gt;
== Smart Train Loading ==&lt;br /&gt;
&lt;br /&gt;
Initially designed by [https://www.youtube.com/user/Darkphade MadZuri],&lt;br /&gt;
&lt;br /&gt;
This solves the problem of loading logistics into chests, which tend to be unequal and is slower in the rate of loading logistics into the cargo of trains.&lt;br /&gt;
&lt;br /&gt;
To setup the design, you require an Arithmetic Combinator, as well as Red and Green wires. &#039;&#039;&#039;Wire all the chests used, to the input of the Arithmetic Combinator&#039;&#039;&#039;. &#039;&#039;&#039;Then write (Logistics Item / -Amount of chests) and as the output as the Logistics Item in the Arithmetic Combinator&#039;&#039;&#039;, this will average the amount of items within the chests. Lastly, &#039;&#039;&#039;wire all the inserters used to the output of the Arithmetic Combinator and have the other color of the wire be wired to the adjacent chest&#039;&#039;&#039;. &#039;&#039;&#039;Have the inserters enabled when Logistics Item &amp;lt; 1&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
A more visual representation as well as questions for the design can be found [https://www.reddit.com/r/factorio/comments/4e03g2/madzuris_smart_loading_train_station_guide/ here].&lt;br /&gt;
&lt;br /&gt;
Explanation of why this works:&lt;br /&gt;
It compares the average amount of total items within the chests and the chest adjacent to the inserter so that it activates when the average number of items is higher than the amount within the chest.&lt;br /&gt;
The reason for why the division denominator is negative is because if the items in the chests are 0, it basically makes it so that it adds 1 to the equation.&lt;br /&gt;
&lt;br /&gt;
== Oil Control ==&lt;br /&gt;
&lt;br /&gt;
== Memory ==&lt;br /&gt;
How to store a constant value for later use, either for a basic counter or for more advanced logic. A decider combinator wired output tied to input and configured greater than zero (for positive values), input -&amp;gt; output will &#039;hold&#039; a value, as long as all other inputs on the network are zero.&lt;br /&gt;
&lt;br /&gt;
Any non-zero input condition will create a basic clock; incrementing the stored value by the sum of all connected input values every cycle. A single pulse of an input will cause a single increment by the pulsed value. Reset to zero occurs whenever the set condition is no longer met, or if a negative pulse equal to the input occurs.&lt;br /&gt;
&lt;br /&gt;
== Basic Clocks ==&lt;br /&gt;
Clocks are constructed by having the output of a combinator tied back to its own input, such that every cycle advances its own count. Either the arithmetic combinator or the decider combinator can be used.&lt;br /&gt;
&lt;br /&gt;
An arithmetic combinator tied to itself is fun to watch and will happily run-away, but requires additional control logic to reset.&lt;br /&gt;
&lt;br /&gt;
A self-resetting clock requires just a single decider combinator with output wired to input and configured with Less Than (&amp;lt;) and Input -&amp;gt; Output. When a constant combinator is then connected to the input, every cycle it will count up by the value of the Constant Combinator until the set conditional value is reached, then output a zero which will be summed with the constant combinator, and reset the process.&lt;br /&gt;
&lt;br /&gt;
[[File:Timer.png|500px]]&lt;br /&gt;
&#039;&#039;30 ticks is the ceiling for Signal 1; which is continuously added.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The clock sequence will not include zero, will begin at the value set by the constant combinator, and will include whatever value eventually causes the conditional to be false. An arithmetic combinator can modify the clock sequence but remember its outputs will occur one cycle later than the clock cycle values.&lt;br /&gt;
&lt;br /&gt;
== Pulse Generators ==&lt;br /&gt;
&lt;br /&gt;
Connecting an additional (=) decider combinator to the output of a basic clock will create a pulse generator, and will pulse a single output every time the clock cycles through the set condition. Any output value can be used, either directly from the clock sequence (input-&amp;gt;output), a 1, or some value on a separate logic channel on the circuit network, such as set by a constant combinator. or by the circuit network.&amp;lt;br /&amp;gt;&lt;br /&gt;
[[File:PulseGen.png|500px]]&lt;br /&gt;
*&#039;&#039;The value 1 can be written as any positive integer, so long as it is within the cap or ceiling of your timer.&#039;&#039;&lt;br /&gt;
*&#039;&#039;As an example from the above timer, this light will pulse every 1st tick after the timer reaches 30 ticks, making it pulse 1/30th of a second, as Factorio updates at 60 times per second.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Counter ==&lt;br /&gt;
A counter is used to count the number of input events, and output the sum of that count. Any pulsing input into a decider combinator configured input -&amp;gt; output and wired between output and input will create a counter, but this input must be zero at all other times or else the combinator will run away like a clock. A pulse generator is normally used to accomplish this. Combining several gating decider isolators set with sequential conditionals, a clock, and a pulse generator to the input of a counter will allow remote polling and counting of each isolator&#039;s contents.&lt;br /&gt;
&lt;br /&gt;
== Logic Gates ==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Unary NOT&#039;&#039;&#039;&lt;br /&gt;
----&lt;br /&gt;
[[File:NOT.png|415px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Binary OR&#039;&#039;&#039;&lt;br /&gt;
----&lt;br /&gt;
[[File:OR.png|300px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 2!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1  || 1&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Binary NOR&#039;&#039;&#039;&lt;br /&gt;
----&lt;br /&gt;
[[File:NOR.png|415px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 2!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Binary XOR&#039;&#039;&#039;&lt;br /&gt;
----&lt;br /&gt;
[[File:XOR.png|300px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 1!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 ||  0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 ||  1 || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 ||  0 || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 ||  1 || 0&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Binary AND&#039;&#039;&#039;&lt;br /&gt;
----&lt;br /&gt;
[[File:AND.png|530px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 2!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1 || 1&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Trinary AND&#039;&#039;&#039;&lt;br /&gt;
----&lt;br /&gt;
[[File:TrinaryAND.png|415px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 2!!Input 3!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0  || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1  || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0  || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1  || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0  || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1  || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0  || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1  || 1  || 1&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Binary NAND&#039;&#039;&#039;&lt;br /&gt;
----&lt;br /&gt;
[[File:NAND.png|300px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 2!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Binary XNOR/XAND&#039;&#039;&#039;&lt;br /&gt;
----&lt;br /&gt;
[[File:XAND.png|300px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 2!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1  || 1&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Memory Cells ==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Simple Latch&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Have a Decider Combinator connect to itself with its input and output using a different colour of wire, say green wire when your output and input is red wire.&lt;br /&gt;
&lt;br /&gt;
[[File:SimpleLatchv2.png|300px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Output 1!!Input 1!!Input 2!! Output 1 (t+1)&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 0 || 1&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0 || 0 || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1 || 0 || 1 &#039;&#039;(2)&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0 || 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1 || 1 || 1 &#039;&#039;(2)&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&#039;&#039;Output 1 is the green wire loop seen in the picture, it carries the value to latch.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Binary Cell&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
RS NOR Latch&lt;br /&gt;
[[File:RS-NOR.png|500px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Advanced Cell&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Cell for storing a positive value:&lt;br /&gt;
&lt;br /&gt;
[[File:AdvancedMemoryCell.png|500px]]&lt;br /&gt;
&lt;br /&gt;
Connect the desired value as signal 3 on the right side to set the memory cell and connect a negative value as signal 3 to reset the cell.  *Please note the arithmetic combinator&#039;s output should be facing the opposite direction of the decider combinators.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Address Enable Switch&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== See Also ==&lt;br /&gt;
*[http://www.factorioforums.com/forum/viewtopic.php?f=18&amp;amp;t=14556 Combinators 101 (Tutorial)]&lt;br /&gt;
*[[Arithmetic combinator]]&lt;br /&gt;
*[[Constant Combinator]]&lt;br /&gt;
*[[Decider Combinator]]&lt;br /&gt;
*[[Circuit network]]&lt;br /&gt;
*[[Circuit-network_Cookbook]]&lt;br /&gt;
[[Category:Tutorial]]&lt;br /&gt;
[[Category:English page]]&lt;/div&gt;</summary>
		<author><name>My3DS</name></author>
	</entry>
	<entry>
		<id>https://wiki.factorio.com/index.php?title=Tutorial:Combinator_tutorial&amp;diff=133479</id>
		<title>Tutorial:Combinator tutorial</title>
		<link rel="alternate" type="text/html" href="https://wiki.factorio.com/index.php?title=Tutorial:Combinator_tutorial&amp;diff=133479"/>
		<updated>2016-12-27T10:32:25Z</updated>

		<summary type="html">&lt;p&gt;My3DS: /* Anything Wildcard: */ added info&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
Combinator logic is achieved by cross-connecting outputs to inputs in such a way to achieve the desired logic. While advanced logic requires a multitude of combinators, some very useful basic logic can be achieved using only a handful of combinators. &#039;&#039;&#039;Combinator logic works because Factorio only updates at 60 times per second, such that combinators analyze their logic in a step, and then sum and/or decide the resulting output values on the next step.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
When logic values are computed by combinators, the outputs are not recognized by the circuit network until the following step. So when a decider combinator is used to detect a certain input condition, it&#039;s output value will not take effect on the circuit network until the next step. &#039;&#039;&#039;This behavior is important to remember and can result in sequencing errors and significant delays when multiple combinators are connected in series.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Circuit wires act like a wire bus in electronics, it carries information in the connected wires, meaning that &#039;&#039;&#039;if there are similar signals on a wire, it will add them automatically, unless if it is a different signal, that means it will be carried in that wire as well, but as a different signal.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
When cross-connecting combinators &#039;&#039;&#039;it&#039;s good practice to use the unused color to cross-connect, this will split the input and output networks and prevent unwanted inputs from accidentally connecting to a larger circuit network.&#039;&#039;&#039; Combinators will sum the red &amp;amp;/or green inputs prior to calculation, so either color can be used when wiring the output back to the input, but in most cases, it is more useful to use the opposing colour of the wire so that it will not interfere with the resulting output and input.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;There is also an example heavy [[Circuit-network_Cookbook|circuit network cookbook]] that you may find helpful to learn and refer to about circuit networks.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Virtual Signals ==&lt;br /&gt;
&lt;br /&gt;
===Everything Wildcard:===&lt;br /&gt;
---&lt;br /&gt;
&lt;br /&gt;
This Red Wildcard serves to check all the specifed input signals.&lt;br /&gt;
&lt;br /&gt;
As the Decider Combinator, &amp;lt;br /&amp;gt;&lt;br /&gt;
its input is used to serve if all inputs meets the specified signals or variables. &amp;lt;br /&amp;gt;&lt;br /&gt;
its output is used to serve output everything. &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Anything Wildcard:===&lt;br /&gt;
---&lt;br /&gt;
&lt;br /&gt;
This Green Wildcard serves to check all the specifed input signals.&lt;br /&gt;
&lt;br /&gt;
As the Decider Combinator, &lt;br /&gt;
its input is used to serve if any of its inputs meets the specified signals or variables.&lt;br /&gt;
&lt;br /&gt;
===Each Wildcard:===&lt;br /&gt;
---&lt;br /&gt;
&lt;br /&gt;
== Input Isolator &amp;amp; Gate ==&lt;br /&gt;
An arithmetic combinator set to (In: Each + 0, Out: Each) can be used to swap wire colors and as an isolator to prevent downstream logic from backfeeding into the circuit network&#039;s inputs.&lt;br /&gt;
&lt;br /&gt;
A decider combinator set to (Out: Everything, Input-&amp;gt; Output) will also function as an isolator as long as the set logic condition is true. This can also selectively pass or &#039;gate&#039; inputs only when desired. This could be used to sequentially poll remote train stations for their chest contents, and include only desired stations.&lt;br /&gt;
&lt;br /&gt;
== Set/Reset Latching Switch ==&lt;br /&gt;
You want something to SET a trigger at some quantity, but then STAY on until that quantity hits some other value, the RESET value. You&#039;ll need one decider combinator and one arithmetic combinator. Two decider combinators and a constant combinator can also be used for more complex multi-channel conditions.&lt;br /&gt;
&lt;br /&gt;
Setup the first decider combinator to the desired set conditional and to output a 1. Then connect the output to the input of an arithmetic combinator, and configure it to multiply by the bias value, the difference between the set and reset values, and wire the arithmetic output to the input of the decider. The arithmetic output channel MUST be set the same as the decider&#039;s input channel. That&#039;s it! Whenever your set conditional is reached, the decider will output a &#039;1&#039;, and the bias of the arithmetic combinator will be applied. This will &#039;hold&#039; the output true until the value goes back below the reset point.&lt;br /&gt;
&lt;br /&gt;
Here&#039;s a more specific example : &lt;br /&gt;
i want the pump to run when petrol reach 2000, and turn off when reach 200.&amp;lt;br&amp;gt;&lt;br /&gt;
only with green wire&amp;lt;br&amp;gt;&lt;br /&gt;
Tank -&amp;gt; in decider&amp;lt;br&amp;gt;&lt;br /&gt;
out decider-&amp;gt; in arithmetic&amp;lt;br&amp;gt;&lt;br /&gt;
out arithmetic -&amp;gt; in decider&amp;lt;br&amp;gt;&lt;br /&gt;
green wire from in decider, to pump&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Pump have the same condition as the decider (Petrol &amp;gt; 2000)&lt;br /&gt;
&lt;br /&gt;
Decider : Petrol &amp;gt; 2000&amp;lt;br&amp;gt;&lt;br /&gt;
out : A = 1&amp;lt;br&amp;gt;&lt;br /&gt;
Arithmetic : A x 1800 (2000 - 200 )&amp;lt;br&amp;gt;&lt;br /&gt;
out : petrol&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:Factorio combinator switch.png|620px]]&lt;br /&gt;
&lt;br /&gt;
== Comparing Outputs ==&lt;br /&gt;
&lt;br /&gt;
== Addressing Outposts ==&lt;br /&gt;
&lt;br /&gt;
== Smart Train Loading ==&lt;br /&gt;
&lt;br /&gt;
Initially designed by [https://www.youtube.com/user/Darkphade MadZuri],&lt;br /&gt;
&lt;br /&gt;
This solves the problem of loading logistics into chests, which tend to be unequal and is slower in the rate of loading logistics into the cargo of trains.&lt;br /&gt;
&lt;br /&gt;
To setup the design, you require an Arithmetic Combinator, as well as Red and Green wires. &#039;&#039;&#039;Wire all the chests used, to the input of the Arithmetic Combinator&#039;&#039;&#039;. &#039;&#039;&#039;Then write (Logistics Item / -Amount of chests) and as the output as the Logistics Item in the Arithmetic Combinator&#039;&#039;&#039;, this will average the amount of items within the chests. Lastly, &#039;&#039;&#039;wire all the inserters used to the output of the Arithmetic Combinator and have the other color of the wire be wired to the adjacent chest&#039;&#039;&#039;. &#039;&#039;&#039;Have the inserters enabled when Logistics Item &amp;lt; 1&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
A more visual representation as well as questions for the design can be found [https://www.reddit.com/r/factorio/comments/4e03g2/madzuris_smart_loading_train_station_guide/ here].&lt;br /&gt;
&lt;br /&gt;
Explanation of why this works:&lt;br /&gt;
It compares the average amount of total items within the chests and the chest adjacent to the inserter so that it activates when the average number of items is higher than the amount within the chest.&lt;br /&gt;
The reason for why the division denominator is negative is because if the items in the chests are 0, it basically makes it so that it adds 1 to the equation.&lt;br /&gt;
&lt;br /&gt;
== Oil Control ==&lt;br /&gt;
&lt;br /&gt;
== Memory ==&lt;br /&gt;
How to store a constant value for later use, either for a basic counter or for more advanced logic. A decider combinator wired output tied to input and configured greater than zero (for positive values), input -&amp;gt; output will &#039;hold&#039; a value, as long as all other inputs on the network are zero.&lt;br /&gt;
&lt;br /&gt;
Any non-zero input condition will create a basic clock; incrementing the stored value by the sum of all connected input values every cycle. A single pulse of an input will cause a single increment by the pulsed value. Reset to zero occurs whenever the set condition is no longer met, or if a negative pulse equal to the input occurs.&lt;br /&gt;
&lt;br /&gt;
== Basic Clocks ==&lt;br /&gt;
Clocks are constructed by having the output of a combinator tied back to its own input, such that every cycle advances its own count. Either the arithmetic combinator or the decider combinator can be used.&lt;br /&gt;
&lt;br /&gt;
An arithmetic combinator tied to itself is fun to watch and will happily run-away, but requires additional control logic to reset.&lt;br /&gt;
&lt;br /&gt;
A self-resetting clock requires just a single decider combinator with output wired to input and configured with Less Than (&amp;lt;) and Input -&amp;gt; Output. When a constant combinator is then connected to the input, every cycle it will count up by the value of the Constant Combinator until the set conditional value is reached, then output a zero which will be summed with the constant combinator, and reset the process.&lt;br /&gt;
&lt;br /&gt;
[[File:Timer.png|500px]]&lt;br /&gt;
&#039;&#039;30 ticks is the ceiling for Signal 1; which is continuously added.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The clock sequence will not include zero, will begin at the value set by the constant combinator, and will include whatever value eventually causes the conditional to be false. An arithmetic combinator can modify the clock sequence but remember its outputs will occur one cycle later than the clock cycle values.&lt;br /&gt;
&lt;br /&gt;
== Pulse Generators ==&lt;br /&gt;
&lt;br /&gt;
Connecting an additional (=) decider combinator to the output of a basic clock will create a pulse generator, and will pulse a single output every time the clock cycles through the set condition. Any output value can be used, either directly from the clock sequence (input-&amp;gt;output), a 1, or some value on a separate logic channel on the circuit network, such as set by a constant combinator. or by the circuit network.&amp;lt;br /&amp;gt;&lt;br /&gt;
[[File:PulseGen.png|500px]]&lt;br /&gt;
*&#039;&#039;The value 1 can be written as any positive integer, so long as it is within the cap or ceiling of your timer.&#039;&#039;&lt;br /&gt;
*&#039;&#039;As an example from the above timer, this light will pulse every 1st tick after the timer reaches 30 ticks, making it pulse 1/30th of a second, as Factorio updates at 60 times per second.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Counter ==&lt;br /&gt;
A counter is used to count the number of input events, and output the sum of that count. Any pulsing input into a decider combinator configured input -&amp;gt; output and wired between output and input will create a counter, but this input must be zero at all other times or else the combinator will run away like a clock. A pulse generator is normally used to accomplish this. Combining several gating decider isolators set with sequential conditionals, a clock, and a pulse generator to the input of a counter will allow remote polling and counting of each isolator&#039;s contents.&lt;br /&gt;
&lt;br /&gt;
== Logic Gates ==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Unary NOT&#039;&#039;&#039;&lt;br /&gt;
----&lt;br /&gt;
[[File:NOT.png|415px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Binary OR&#039;&#039;&#039;&lt;br /&gt;
----&lt;br /&gt;
[[File:OR.png|300px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 2!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1  || 1&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Binary NOR&#039;&#039;&#039;&lt;br /&gt;
----&lt;br /&gt;
[[File:NOR.png|415px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 2!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Binary XOR&#039;&#039;&#039;&lt;br /&gt;
----&lt;br /&gt;
[[File:XOR.png|300px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 1!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 ||  0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 ||  1 || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 ||  0 || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 ||  1 || 0&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Binary AND&#039;&#039;&#039;&lt;br /&gt;
----&lt;br /&gt;
[[File:AND.png|530px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 2!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1 || 1&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Trinary AND&#039;&#039;&#039;&lt;br /&gt;
----&lt;br /&gt;
[[File:TrinaryAND.png|415px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 2!!Input 3!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0  || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1  || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0  || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1  || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0  || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1  || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0  || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1  || 1  || 1&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Binary NAND&#039;&#039;&#039;&lt;br /&gt;
----&lt;br /&gt;
[[File:NAND.png|300px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 2!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Binary XNOR/XAND&#039;&#039;&#039;&lt;br /&gt;
----&lt;br /&gt;
[[File:XAND.png|300px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 2!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1  || 1&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Memory Cells ==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Simple Latch&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Have a Decider Combinator connect to itself with its input and output using a different colour of wire, say green wire when your output and input is red wire.&lt;br /&gt;
&lt;br /&gt;
[[File:SimpleLatchv2.png|300px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Output 1!!Input 1!!Input 2!! Output 1 (t+1)&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 0 || 1&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0 || 0 || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1 || 0 || 1 &#039;&#039;(2)&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0 || 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1 || 1 || 1 &#039;&#039;(2)&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&#039;&#039;Output 1 is the green wire loop seen in the picture, it carries the value to latch.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Binary Cell&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
RS NOR Latch&lt;br /&gt;
[[File:RS-NOR.png|500px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Advanced Cell&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Cell for storing a positive value:&lt;br /&gt;
&lt;br /&gt;
[[File:AdvancedMemoryCell.png|500px]]&lt;br /&gt;
&lt;br /&gt;
Connect the desired value as signal 3 on the right side to set the memory cell and connect a negative value as signal 3 to reset the cell.  *Please note the arithmetic combinator&#039;s output should be facing the opposite direction of the decider combinators.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Address Enable Switch&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== See Also ==&lt;br /&gt;
*[http://www.factorioforums.com/forum/viewtopic.php?f=18&amp;amp;t=14556 Combinators 101 (Tutorial)]&lt;br /&gt;
*[[Arithmetic combinator]]&lt;br /&gt;
*[[Constant Combinator]]&lt;br /&gt;
*[[Decider Combinator]]&lt;br /&gt;
*[[Circuit network]]&lt;br /&gt;
*[[Circuit-network_Cookbook]]&lt;br /&gt;
[[Category:Tutorial]]&lt;br /&gt;
[[Category:English page]]&lt;/div&gt;</summary>
		<author><name>My3DS</name></author>
	</entry>
	<entry>
		<id>https://wiki.factorio.com/index.php?title=Tutorial:Combinator_tutorial&amp;diff=133478</id>
		<title>Tutorial:Combinator tutorial</title>
		<link rel="alternate" type="text/html" href="https://wiki.factorio.com/index.php?title=Tutorial:Combinator_tutorial&amp;diff=133478"/>
		<updated>2016-12-27T10:31:26Z</updated>

		<summary type="html">&lt;p&gt;My3DS: /* Everything Wildcard: */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
Combinator logic is achieved by cross-connecting outputs to inputs in such a way to achieve the desired logic. While advanced logic requires a multitude of combinators, some very useful basic logic can be achieved using only a handful of combinators. &#039;&#039;&#039;Combinator logic works because Factorio only updates at 60 times per second, such that combinators analyze their logic in a step, and then sum and/or decide the resulting output values on the next step.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
When logic values are computed by combinators, the outputs are not recognized by the circuit network until the following step. So when a decider combinator is used to detect a certain input condition, it&#039;s output value will not take effect on the circuit network until the next step. &#039;&#039;&#039;This behavior is important to remember and can result in sequencing errors and significant delays when multiple combinators are connected in series.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Circuit wires act like a wire bus in electronics, it carries information in the connected wires, meaning that &#039;&#039;&#039;if there are similar signals on a wire, it will add them automatically, unless if it is a different signal, that means it will be carried in that wire as well, but as a different signal.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
When cross-connecting combinators &#039;&#039;&#039;it&#039;s good practice to use the unused color to cross-connect, this will split the input and output networks and prevent unwanted inputs from accidentally connecting to a larger circuit network.&#039;&#039;&#039; Combinators will sum the red &amp;amp;/or green inputs prior to calculation, so either color can be used when wiring the output back to the input, but in most cases, it is more useful to use the opposing colour of the wire so that it will not interfere with the resulting output and input.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;There is also an example heavy [[Circuit-network_Cookbook|circuit network cookbook]] that you may find helpful to learn and refer to about circuit networks.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Virtual Signals ==&lt;br /&gt;
&lt;br /&gt;
===Everything Wildcard:===&lt;br /&gt;
---&lt;br /&gt;
&lt;br /&gt;
This Red Wildcard serves to check all the specifed input signals.&lt;br /&gt;
&lt;br /&gt;
As the Decider Combinator, &amp;lt;br /&amp;gt;&lt;br /&gt;
its input is used to serve if all inputs meets the specified signals or variables. &amp;lt;br /&amp;gt;&lt;br /&gt;
its output is used to serve output everything. &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Anything Wildcard:===&lt;br /&gt;
---&lt;br /&gt;
&lt;br /&gt;
===Each Wildcard:===&lt;br /&gt;
---&lt;br /&gt;
&lt;br /&gt;
== Input Isolator &amp;amp; Gate ==&lt;br /&gt;
An arithmetic combinator set to (In: Each + 0, Out: Each) can be used to swap wire colors and as an isolator to prevent downstream logic from backfeeding into the circuit network&#039;s inputs.&lt;br /&gt;
&lt;br /&gt;
A decider combinator set to (Out: Everything, Input-&amp;gt; Output) will also function as an isolator as long as the set logic condition is true. This can also selectively pass or &#039;gate&#039; inputs only when desired. This could be used to sequentially poll remote train stations for their chest contents, and include only desired stations.&lt;br /&gt;
&lt;br /&gt;
== Set/Reset Latching Switch ==&lt;br /&gt;
You want something to SET a trigger at some quantity, but then STAY on until that quantity hits some other value, the RESET value. You&#039;ll need one decider combinator and one arithmetic combinator. Two decider combinators and a constant combinator can also be used for more complex multi-channel conditions.&lt;br /&gt;
&lt;br /&gt;
Setup the first decider combinator to the desired set conditional and to output a 1. Then connect the output to the input of an arithmetic combinator, and configure it to multiply by the bias value, the difference between the set and reset values, and wire the arithmetic output to the input of the decider. The arithmetic output channel MUST be set the same as the decider&#039;s input channel. That&#039;s it! Whenever your set conditional is reached, the decider will output a &#039;1&#039;, and the bias of the arithmetic combinator will be applied. This will &#039;hold&#039; the output true until the value goes back below the reset point.&lt;br /&gt;
&lt;br /&gt;
Here&#039;s a more specific example : &lt;br /&gt;
i want the pump to run when petrol reach 2000, and turn off when reach 200.&amp;lt;br&amp;gt;&lt;br /&gt;
only with green wire&amp;lt;br&amp;gt;&lt;br /&gt;
Tank -&amp;gt; in decider&amp;lt;br&amp;gt;&lt;br /&gt;
out decider-&amp;gt; in arithmetic&amp;lt;br&amp;gt;&lt;br /&gt;
out arithmetic -&amp;gt; in decider&amp;lt;br&amp;gt;&lt;br /&gt;
green wire from in decider, to pump&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Pump have the same condition as the decider (Petrol &amp;gt; 2000)&lt;br /&gt;
&lt;br /&gt;
Decider : Petrol &amp;gt; 2000&amp;lt;br&amp;gt;&lt;br /&gt;
out : A = 1&amp;lt;br&amp;gt;&lt;br /&gt;
Arithmetic : A x 1800 (2000 - 200 )&amp;lt;br&amp;gt;&lt;br /&gt;
out : petrol&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:Factorio combinator switch.png|620px]]&lt;br /&gt;
&lt;br /&gt;
== Comparing Outputs ==&lt;br /&gt;
&lt;br /&gt;
== Addressing Outposts ==&lt;br /&gt;
&lt;br /&gt;
== Smart Train Loading ==&lt;br /&gt;
&lt;br /&gt;
Initially designed by [https://www.youtube.com/user/Darkphade MadZuri],&lt;br /&gt;
&lt;br /&gt;
This solves the problem of loading logistics into chests, which tend to be unequal and is slower in the rate of loading logistics into the cargo of trains.&lt;br /&gt;
&lt;br /&gt;
To setup the design, you require an Arithmetic Combinator, as well as Red and Green wires. &#039;&#039;&#039;Wire all the chests used, to the input of the Arithmetic Combinator&#039;&#039;&#039;. &#039;&#039;&#039;Then write (Logistics Item / -Amount of chests) and as the output as the Logistics Item in the Arithmetic Combinator&#039;&#039;&#039;, this will average the amount of items within the chests. Lastly, &#039;&#039;&#039;wire all the inserters used to the output of the Arithmetic Combinator and have the other color of the wire be wired to the adjacent chest&#039;&#039;&#039;. &#039;&#039;&#039;Have the inserters enabled when Logistics Item &amp;lt; 1&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
A more visual representation as well as questions for the design can be found [https://www.reddit.com/r/factorio/comments/4e03g2/madzuris_smart_loading_train_station_guide/ here].&lt;br /&gt;
&lt;br /&gt;
Explanation of why this works:&lt;br /&gt;
It compares the average amount of total items within the chests and the chest adjacent to the inserter so that it activates when the average number of items is higher than the amount within the chest.&lt;br /&gt;
The reason for why the division denominator is negative is because if the items in the chests are 0, it basically makes it so that it adds 1 to the equation.&lt;br /&gt;
&lt;br /&gt;
== Oil Control ==&lt;br /&gt;
&lt;br /&gt;
== Memory ==&lt;br /&gt;
How to store a constant value for later use, either for a basic counter or for more advanced logic. A decider combinator wired output tied to input and configured greater than zero (for positive values), input -&amp;gt; output will &#039;hold&#039; a value, as long as all other inputs on the network are zero.&lt;br /&gt;
&lt;br /&gt;
Any non-zero input condition will create a basic clock; incrementing the stored value by the sum of all connected input values every cycle. A single pulse of an input will cause a single increment by the pulsed value. Reset to zero occurs whenever the set condition is no longer met, or if a negative pulse equal to the input occurs.&lt;br /&gt;
&lt;br /&gt;
== Basic Clocks ==&lt;br /&gt;
Clocks are constructed by having the output of a combinator tied back to its own input, such that every cycle advances its own count. Either the arithmetic combinator or the decider combinator can be used.&lt;br /&gt;
&lt;br /&gt;
An arithmetic combinator tied to itself is fun to watch and will happily run-away, but requires additional control logic to reset.&lt;br /&gt;
&lt;br /&gt;
A self-resetting clock requires just a single decider combinator with output wired to input and configured with Less Than (&amp;lt;) and Input -&amp;gt; Output. When a constant combinator is then connected to the input, every cycle it will count up by the value of the Constant Combinator until the set conditional value is reached, then output a zero which will be summed with the constant combinator, and reset the process.&lt;br /&gt;
&lt;br /&gt;
[[File:Timer.png|500px]]&lt;br /&gt;
&#039;&#039;30 ticks is the ceiling for Signal 1; which is continuously added.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The clock sequence will not include zero, will begin at the value set by the constant combinator, and will include whatever value eventually causes the conditional to be false. An arithmetic combinator can modify the clock sequence but remember its outputs will occur one cycle later than the clock cycle values.&lt;br /&gt;
&lt;br /&gt;
== Pulse Generators ==&lt;br /&gt;
&lt;br /&gt;
Connecting an additional (=) decider combinator to the output of a basic clock will create a pulse generator, and will pulse a single output every time the clock cycles through the set condition. Any output value can be used, either directly from the clock sequence (input-&amp;gt;output), a 1, or some value on a separate logic channel on the circuit network, such as set by a constant combinator. or by the circuit network.&amp;lt;br /&amp;gt;&lt;br /&gt;
[[File:PulseGen.png|500px]]&lt;br /&gt;
*&#039;&#039;The value 1 can be written as any positive integer, so long as it is within the cap or ceiling of your timer.&#039;&#039;&lt;br /&gt;
*&#039;&#039;As an example from the above timer, this light will pulse every 1st tick after the timer reaches 30 ticks, making it pulse 1/30th of a second, as Factorio updates at 60 times per second.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Counter ==&lt;br /&gt;
A counter is used to count the number of input events, and output the sum of that count. Any pulsing input into a decider combinator configured input -&amp;gt; output and wired between output and input will create a counter, but this input must be zero at all other times or else the combinator will run away like a clock. A pulse generator is normally used to accomplish this. Combining several gating decider isolators set with sequential conditionals, a clock, and a pulse generator to the input of a counter will allow remote polling and counting of each isolator&#039;s contents.&lt;br /&gt;
&lt;br /&gt;
== Logic Gates ==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Unary NOT&#039;&#039;&#039;&lt;br /&gt;
----&lt;br /&gt;
[[File:NOT.png|415px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Binary OR&#039;&#039;&#039;&lt;br /&gt;
----&lt;br /&gt;
[[File:OR.png|300px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 2!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1  || 1&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Binary NOR&#039;&#039;&#039;&lt;br /&gt;
----&lt;br /&gt;
[[File:NOR.png|415px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 2!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Binary XOR&#039;&#039;&#039;&lt;br /&gt;
----&lt;br /&gt;
[[File:XOR.png|300px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 1!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 ||  0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 ||  1 || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 ||  0 || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 ||  1 || 0&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Binary AND&#039;&#039;&#039;&lt;br /&gt;
----&lt;br /&gt;
[[File:AND.png|530px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 2!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1 || 1&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Trinary AND&#039;&#039;&#039;&lt;br /&gt;
----&lt;br /&gt;
[[File:TrinaryAND.png|415px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 2!!Input 3!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0  || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1  || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0  || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1  || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0  || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1  || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0  || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1  || 1  || 1&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Binary NAND&#039;&#039;&#039;&lt;br /&gt;
----&lt;br /&gt;
[[File:NAND.png|300px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 2!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Binary XNOR/XAND&#039;&#039;&#039;&lt;br /&gt;
----&lt;br /&gt;
[[File:XAND.png|300px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 2!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1  || 1&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Memory Cells ==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Simple Latch&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Have a Decider Combinator connect to itself with its input and output using a different colour of wire, say green wire when your output and input is red wire.&lt;br /&gt;
&lt;br /&gt;
[[File:SimpleLatchv2.png|300px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Output 1!!Input 1!!Input 2!! Output 1 (t+1)&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 0 || 1&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0 || 0 || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1 || 0 || 1 &#039;&#039;(2)&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0 || 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1 || 1 || 1 &#039;&#039;(2)&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&#039;&#039;Output 1 is the green wire loop seen in the picture, it carries the value to latch.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Binary Cell&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
RS NOR Latch&lt;br /&gt;
[[File:RS-NOR.png|500px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Advanced Cell&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Cell for storing a positive value:&lt;br /&gt;
&lt;br /&gt;
[[File:AdvancedMemoryCell.png|500px]]&lt;br /&gt;
&lt;br /&gt;
Connect the desired value as signal 3 on the right side to set the memory cell and connect a negative value as signal 3 to reset the cell.  *Please note the arithmetic combinator&#039;s output should be facing the opposite direction of the decider combinators.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Address Enable Switch&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== See Also ==&lt;br /&gt;
*[http://www.factorioforums.com/forum/viewtopic.php?f=18&amp;amp;t=14556 Combinators 101 (Tutorial)]&lt;br /&gt;
*[[Arithmetic combinator]]&lt;br /&gt;
*[[Constant Combinator]]&lt;br /&gt;
*[[Decider Combinator]]&lt;br /&gt;
*[[Circuit network]]&lt;br /&gt;
*[[Circuit-network_Cookbook]]&lt;br /&gt;
[[Category:Tutorial]]&lt;br /&gt;
[[Category:English page]]&lt;/div&gt;</summary>
		<author><name>My3DS</name></author>
	</entry>
	<entry>
		<id>https://wiki.factorio.com/index.php?title=Tutorial:Combinator_tutorial&amp;diff=133477</id>
		<title>Tutorial:Combinator tutorial</title>
		<link rel="alternate" type="text/html" href="https://wiki.factorio.com/index.php?title=Tutorial:Combinator_tutorial&amp;diff=133477"/>
		<updated>2016-12-27T10:30:13Z</updated>

		<summary type="html">&lt;p&gt;My3DS: /* Each Wildcard: */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
Combinator logic is achieved by cross-connecting outputs to inputs in such a way to achieve the desired logic. While advanced logic requires a multitude of combinators, some very useful basic logic can be achieved using only a handful of combinators. &#039;&#039;&#039;Combinator logic works because Factorio only updates at 60 times per second, such that combinators analyze their logic in a step, and then sum and/or decide the resulting output values on the next step.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
When logic values are computed by combinators, the outputs are not recognized by the circuit network until the following step. So when a decider combinator is used to detect a certain input condition, it&#039;s output value will not take effect on the circuit network until the next step. &#039;&#039;&#039;This behavior is important to remember and can result in sequencing errors and significant delays when multiple combinators are connected in series.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Circuit wires act like a wire bus in electronics, it carries information in the connected wires, meaning that &#039;&#039;&#039;if there are similar signals on a wire, it will add them automatically, unless if it is a different signal, that means it will be carried in that wire as well, but as a different signal.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
When cross-connecting combinators &#039;&#039;&#039;it&#039;s good practice to use the unused color to cross-connect, this will split the input and output networks and prevent unwanted inputs from accidentally connecting to a larger circuit network.&#039;&#039;&#039; Combinators will sum the red &amp;amp;/or green inputs prior to calculation, so either color can be used when wiring the output back to the input, but in most cases, it is more useful to use the opposing colour of the wire so that it will not interfere with the resulting output and input.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;There is also an example heavy [[Circuit-network_Cookbook|circuit network cookbook]] that you may find helpful to learn and refer to about circuit networks.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Virtual Signals ==&lt;br /&gt;
&lt;br /&gt;
===Everything Wildcard:===&lt;br /&gt;
---&lt;br /&gt;
&lt;br /&gt;
This Red Wildcard serves to check all the specifed input signals.&lt;br /&gt;
&lt;br /&gt;
As the Decider Combinator,&lt;br /&gt;
its input is used to serve if all inputs meets the specified signals or variables.&lt;br /&gt;
its output is used to serve output everything.&lt;br /&gt;
&lt;br /&gt;
===Anything Wildcard:===&lt;br /&gt;
---&lt;br /&gt;
&lt;br /&gt;
===Each Wildcard:===&lt;br /&gt;
---&lt;br /&gt;
&lt;br /&gt;
== Input Isolator &amp;amp; Gate ==&lt;br /&gt;
An arithmetic combinator set to (In: Each + 0, Out: Each) can be used to swap wire colors and as an isolator to prevent downstream logic from backfeeding into the circuit network&#039;s inputs.&lt;br /&gt;
&lt;br /&gt;
A decider combinator set to (Out: Everything, Input-&amp;gt; Output) will also function as an isolator as long as the set logic condition is true. This can also selectively pass or &#039;gate&#039; inputs only when desired. This could be used to sequentially poll remote train stations for their chest contents, and include only desired stations.&lt;br /&gt;
&lt;br /&gt;
== Set/Reset Latching Switch ==&lt;br /&gt;
You want something to SET a trigger at some quantity, but then STAY on until that quantity hits some other value, the RESET value. You&#039;ll need one decider combinator and one arithmetic combinator. Two decider combinators and a constant combinator can also be used for more complex multi-channel conditions.&lt;br /&gt;
&lt;br /&gt;
Setup the first decider combinator to the desired set conditional and to output a 1. Then connect the output to the input of an arithmetic combinator, and configure it to multiply by the bias value, the difference between the set and reset values, and wire the arithmetic output to the input of the decider. The arithmetic output channel MUST be set the same as the decider&#039;s input channel. That&#039;s it! Whenever your set conditional is reached, the decider will output a &#039;1&#039;, and the bias of the arithmetic combinator will be applied. This will &#039;hold&#039; the output true until the value goes back below the reset point.&lt;br /&gt;
&lt;br /&gt;
Here&#039;s a more specific example : &lt;br /&gt;
i want the pump to run when petrol reach 2000, and turn off when reach 200.&amp;lt;br&amp;gt;&lt;br /&gt;
only with green wire&amp;lt;br&amp;gt;&lt;br /&gt;
Tank -&amp;gt; in decider&amp;lt;br&amp;gt;&lt;br /&gt;
out decider-&amp;gt; in arithmetic&amp;lt;br&amp;gt;&lt;br /&gt;
out arithmetic -&amp;gt; in decider&amp;lt;br&amp;gt;&lt;br /&gt;
green wire from in decider, to pump&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Pump have the same condition as the decider (Petrol &amp;gt; 2000)&lt;br /&gt;
&lt;br /&gt;
Decider : Petrol &amp;gt; 2000&amp;lt;br&amp;gt;&lt;br /&gt;
out : A = 1&amp;lt;br&amp;gt;&lt;br /&gt;
Arithmetic : A x 1800 (2000 - 200 )&amp;lt;br&amp;gt;&lt;br /&gt;
out : petrol&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:Factorio combinator switch.png|620px]]&lt;br /&gt;
&lt;br /&gt;
== Comparing Outputs ==&lt;br /&gt;
&lt;br /&gt;
== Addressing Outposts ==&lt;br /&gt;
&lt;br /&gt;
== Smart Train Loading ==&lt;br /&gt;
&lt;br /&gt;
Initially designed by [https://www.youtube.com/user/Darkphade MadZuri],&lt;br /&gt;
&lt;br /&gt;
This solves the problem of loading logistics into chests, which tend to be unequal and is slower in the rate of loading logistics into the cargo of trains.&lt;br /&gt;
&lt;br /&gt;
To setup the design, you require an Arithmetic Combinator, as well as Red and Green wires. &#039;&#039;&#039;Wire all the chests used, to the input of the Arithmetic Combinator&#039;&#039;&#039;. &#039;&#039;&#039;Then write (Logistics Item / -Amount of chests) and as the output as the Logistics Item in the Arithmetic Combinator&#039;&#039;&#039;, this will average the amount of items within the chests. Lastly, &#039;&#039;&#039;wire all the inserters used to the output of the Arithmetic Combinator and have the other color of the wire be wired to the adjacent chest&#039;&#039;&#039;. &#039;&#039;&#039;Have the inserters enabled when Logistics Item &amp;lt; 1&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
A more visual representation as well as questions for the design can be found [https://www.reddit.com/r/factorio/comments/4e03g2/madzuris_smart_loading_train_station_guide/ here].&lt;br /&gt;
&lt;br /&gt;
Explanation of why this works:&lt;br /&gt;
It compares the average amount of total items within the chests and the chest adjacent to the inserter so that it activates when the average number of items is higher than the amount within the chest.&lt;br /&gt;
The reason for why the division denominator is negative is because if the items in the chests are 0, it basically makes it so that it adds 1 to the equation.&lt;br /&gt;
&lt;br /&gt;
== Oil Control ==&lt;br /&gt;
&lt;br /&gt;
== Memory ==&lt;br /&gt;
How to store a constant value for later use, either for a basic counter or for more advanced logic. A decider combinator wired output tied to input and configured greater than zero (for positive values), input -&amp;gt; output will &#039;hold&#039; a value, as long as all other inputs on the network are zero.&lt;br /&gt;
&lt;br /&gt;
Any non-zero input condition will create a basic clock; incrementing the stored value by the sum of all connected input values every cycle. A single pulse of an input will cause a single increment by the pulsed value. Reset to zero occurs whenever the set condition is no longer met, or if a negative pulse equal to the input occurs.&lt;br /&gt;
&lt;br /&gt;
== Basic Clocks ==&lt;br /&gt;
Clocks are constructed by having the output of a combinator tied back to its own input, such that every cycle advances its own count. Either the arithmetic combinator or the decider combinator can be used.&lt;br /&gt;
&lt;br /&gt;
An arithmetic combinator tied to itself is fun to watch and will happily run-away, but requires additional control logic to reset.&lt;br /&gt;
&lt;br /&gt;
A self-resetting clock requires just a single decider combinator with output wired to input and configured with Less Than (&amp;lt;) and Input -&amp;gt; Output. When a constant combinator is then connected to the input, every cycle it will count up by the value of the Constant Combinator until the set conditional value is reached, then output a zero which will be summed with the constant combinator, and reset the process.&lt;br /&gt;
&lt;br /&gt;
[[File:Timer.png|500px]]&lt;br /&gt;
&#039;&#039;30 ticks is the ceiling for Signal 1; which is continuously added.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The clock sequence will not include zero, will begin at the value set by the constant combinator, and will include whatever value eventually causes the conditional to be false. An arithmetic combinator can modify the clock sequence but remember its outputs will occur one cycle later than the clock cycle values.&lt;br /&gt;
&lt;br /&gt;
== Pulse Generators ==&lt;br /&gt;
&lt;br /&gt;
Connecting an additional (=) decider combinator to the output of a basic clock will create a pulse generator, and will pulse a single output every time the clock cycles through the set condition. Any output value can be used, either directly from the clock sequence (input-&amp;gt;output), a 1, or some value on a separate logic channel on the circuit network, such as set by a constant combinator. or by the circuit network.&amp;lt;br /&amp;gt;&lt;br /&gt;
[[File:PulseGen.png|500px]]&lt;br /&gt;
*&#039;&#039;The value 1 can be written as any positive integer, so long as it is within the cap or ceiling of your timer.&#039;&#039;&lt;br /&gt;
*&#039;&#039;As an example from the above timer, this light will pulse every 1st tick after the timer reaches 30 ticks, making it pulse 1/30th of a second, as Factorio updates at 60 times per second.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Counter ==&lt;br /&gt;
A counter is used to count the number of input events, and output the sum of that count. Any pulsing input into a decider combinator configured input -&amp;gt; output and wired between output and input will create a counter, but this input must be zero at all other times or else the combinator will run away like a clock. A pulse generator is normally used to accomplish this. Combining several gating decider isolators set with sequential conditionals, a clock, and a pulse generator to the input of a counter will allow remote polling and counting of each isolator&#039;s contents.&lt;br /&gt;
&lt;br /&gt;
== Logic Gates ==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Unary NOT&#039;&#039;&#039;&lt;br /&gt;
----&lt;br /&gt;
[[File:NOT.png|415px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Binary OR&#039;&#039;&#039;&lt;br /&gt;
----&lt;br /&gt;
[[File:OR.png|300px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 2!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1  || 1&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Binary NOR&#039;&#039;&#039;&lt;br /&gt;
----&lt;br /&gt;
[[File:NOR.png|415px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 2!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Binary XOR&#039;&#039;&#039;&lt;br /&gt;
----&lt;br /&gt;
[[File:XOR.png|300px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 1!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 ||  0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 ||  1 || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 ||  0 || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 ||  1 || 0&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Binary AND&#039;&#039;&#039;&lt;br /&gt;
----&lt;br /&gt;
[[File:AND.png|530px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 2!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1 || 1&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Trinary AND&#039;&#039;&#039;&lt;br /&gt;
----&lt;br /&gt;
[[File:TrinaryAND.png|415px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 2!!Input 3!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0  || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1  || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0  || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1  || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0  || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1  || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0  || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1  || 1  || 1&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Binary NAND&#039;&#039;&#039;&lt;br /&gt;
----&lt;br /&gt;
[[File:NAND.png|300px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 2!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Binary XNOR/XAND&#039;&#039;&#039;&lt;br /&gt;
----&lt;br /&gt;
[[File:XAND.png|300px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 2!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1  || 1&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Memory Cells ==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Simple Latch&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Have a Decider Combinator connect to itself with its input and output using a different colour of wire, say green wire when your output and input is red wire.&lt;br /&gt;
&lt;br /&gt;
[[File:SimpleLatchv2.png|300px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Output 1!!Input 1!!Input 2!! Output 1 (t+1)&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 0 || 1&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0 || 0 || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1 || 0 || 1 &#039;&#039;(2)&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0 || 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1 || 1 || 1 &#039;&#039;(2)&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&#039;&#039;Output 1 is the green wire loop seen in the picture, it carries the value to latch.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Binary Cell&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
RS NOR Latch&lt;br /&gt;
[[File:RS-NOR.png|500px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Advanced Cell&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Cell for storing a positive value:&lt;br /&gt;
&lt;br /&gt;
[[File:AdvancedMemoryCell.png|500px]]&lt;br /&gt;
&lt;br /&gt;
Connect the desired value as signal 3 on the right side to set the memory cell and connect a negative value as signal 3 to reset the cell.  *Please note the arithmetic combinator&#039;s output should be facing the opposite direction of the decider combinators.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Address Enable Switch&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== See Also ==&lt;br /&gt;
*[http://www.factorioforums.com/forum/viewtopic.php?f=18&amp;amp;t=14556 Combinators 101 (Tutorial)]&lt;br /&gt;
*[[Arithmetic combinator]]&lt;br /&gt;
*[[Constant Combinator]]&lt;br /&gt;
*[[Decider Combinator]]&lt;br /&gt;
*[[Circuit network]]&lt;br /&gt;
*[[Circuit-network_Cookbook]]&lt;br /&gt;
[[Category:Tutorial]]&lt;br /&gt;
[[Category:English page]]&lt;/div&gt;</summary>
		<author><name>My3DS</name></author>
	</entry>
	<entry>
		<id>https://wiki.factorio.com/index.php?title=Tutorial:Combinator_tutorial&amp;diff=133476</id>
		<title>Tutorial:Combinator tutorial</title>
		<link rel="alternate" type="text/html" href="https://wiki.factorio.com/index.php?title=Tutorial:Combinator_tutorial&amp;diff=133476"/>
		<updated>2016-12-27T10:29:56Z</updated>

		<summary type="html">&lt;p&gt;My3DS: /* Anything Wildcard: */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
Combinator logic is achieved by cross-connecting outputs to inputs in such a way to achieve the desired logic. While advanced logic requires a multitude of combinators, some very useful basic logic can be achieved using only a handful of combinators. &#039;&#039;&#039;Combinator logic works because Factorio only updates at 60 times per second, such that combinators analyze their logic in a step, and then sum and/or decide the resulting output values on the next step.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
When logic values are computed by combinators, the outputs are not recognized by the circuit network until the following step. So when a decider combinator is used to detect a certain input condition, it&#039;s output value will not take effect on the circuit network until the next step. &#039;&#039;&#039;This behavior is important to remember and can result in sequencing errors and significant delays when multiple combinators are connected in series.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Circuit wires act like a wire bus in electronics, it carries information in the connected wires, meaning that &#039;&#039;&#039;if there are similar signals on a wire, it will add them automatically, unless if it is a different signal, that means it will be carried in that wire as well, but as a different signal.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
When cross-connecting combinators &#039;&#039;&#039;it&#039;s good practice to use the unused color to cross-connect, this will split the input and output networks and prevent unwanted inputs from accidentally connecting to a larger circuit network.&#039;&#039;&#039; Combinators will sum the red &amp;amp;/or green inputs prior to calculation, so either color can be used when wiring the output back to the input, but in most cases, it is more useful to use the opposing colour of the wire so that it will not interfere with the resulting output and input.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;There is also an example heavy [[Circuit-network_Cookbook|circuit network cookbook]] that you may find helpful to learn and refer to about circuit networks.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Virtual Signals ==&lt;br /&gt;
&lt;br /&gt;
===Everything Wildcard:===&lt;br /&gt;
---&lt;br /&gt;
&lt;br /&gt;
This Red Wildcard serves to check all the specifed input signals.&lt;br /&gt;
&lt;br /&gt;
As the Decider Combinator,&lt;br /&gt;
its input is used to serve if all inputs meets the specified signals or variables.&lt;br /&gt;
its output is used to serve output everything.&lt;br /&gt;
&lt;br /&gt;
===Anything Wildcard:===&lt;br /&gt;
---&lt;br /&gt;
&lt;br /&gt;
=Each Wildcard:=&lt;br /&gt;
---&lt;br /&gt;
&lt;br /&gt;
== Input Isolator &amp;amp; Gate ==&lt;br /&gt;
An arithmetic combinator set to (In: Each + 0, Out: Each) can be used to swap wire colors and as an isolator to prevent downstream logic from backfeeding into the circuit network&#039;s inputs.&lt;br /&gt;
&lt;br /&gt;
A decider combinator set to (Out: Everything, Input-&amp;gt; Output) will also function as an isolator as long as the set logic condition is true. This can also selectively pass or &#039;gate&#039; inputs only when desired. This could be used to sequentially poll remote train stations for their chest contents, and include only desired stations.&lt;br /&gt;
&lt;br /&gt;
== Set/Reset Latching Switch ==&lt;br /&gt;
You want something to SET a trigger at some quantity, but then STAY on until that quantity hits some other value, the RESET value. You&#039;ll need one decider combinator and one arithmetic combinator. Two decider combinators and a constant combinator can also be used for more complex multi-channel conditions.&lt;br /&gt;
&lt;br /&gt;
Setup the first decider combinator to the desired set conditional and to output a 1. Then connect the output to the input of an arithmetic combinator, and configure it to multiply by the bias value, the difference between the set and reset values, and wire the arithmetic output to the input of the decider. The arithmetic output channel MUST be set the same as the decider&#039;s input channel. That&#039;s it! Whenever your set conditional is reached, the decider will output a &#039;1&#039;, and the bias of the arithmetic combinator will be applied. This will &#039;hold&#039; the output true until the value goes back below the reset point.&lt;br /&gt;
&lt;br /&gt;
Here&#039;s a more specific example : &lt;br /&gt;
i want the pump to run when petrol reach 2000, and turn off when reach 200.&amp;lt;br&amp;gt;&lt;br /&gt;
only with green wire&amp;lt;br&amp;gt;&lt;br /&gt;
Tank -&amp;gt; in decider&amp;lt;br&amp;gt;&lt;br /&gt;
out decider-&amp;gt; in arithmetic&amp;lt;br&amp;gt;&lt;br /&gt;
out arithmetic -&amp;gt; in decider&amp;lt;br&amp;gt;&lt;br /&gt;
green wire from in decider, to pump&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Pump have the same condition as the decider (Petrol &amp;gt; 2000)&lt;br /&gt;
&lt;br /&gt;
Decider : Petrol &amp;gt; 2000&amp;lt;br&amp;gt;&lt;br /&gt;
out : A = 1&amp;lt;br&amp;gt;&lt;br /&gt;
Arithmetic : A x 1800 (2000 - 200 )&amp;lt;br&amp;gt;&lt;br /&gt;
out : petrol&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:Factorio combinator switch.png|620px]]&lt;br /&gt;
&lt;br /&gt;
== Comparing Outputs ==&lt;br /&gt;
&lt;br /&gt;
== Addressing Outposts ==&lt;br /&gt;
&lt;br /&gt;
== Smart Train Loading ==&lt;br /&gt;
&lt;br /&gt;
Initially designed by [https://www.youtube.com/user/Darkphade MadZuri],&lt;br /&gt;
&lt;br /&gt;
This solves the problem of loading logistics into chests, which tend to be unequal and is slower in the rate of loading logistics into the cargo of trains.&lt;br /&gt;
&lt;br /&gt;
To setup the design, you require an Arithmetic Combinator, as well as Red and Green wires. &#039;&#039;&#039;Wire all the chests used, to the input of the Arithmetic Combinator&#039;&#039;&#039;. &#039;&#039;&#039;Then write (Logistics Item / -Amount of chests) and as the output as the Logistics Item in the Arithmetic Combinator&#039;&#039;&#039;, this will average the amount of items within the chests. Lastly, &#039;&#039;&#039;wire all the inserters used to the output of the Arithmetic Combinator and have the other color of the wire be wired to the adjacent chest&#039;&#039;&#039;. &#039;&#039;&#039;Have the inserters enabled when Logistics Item &amp;lt; 1&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
A more visual representation as well as questions for the design can be found [https://www.reddit.com/r/factorio/comments/4e03g2/madzuris_smart_loading_train_station_guide/ here].&lt;br /&gt;
&lt;br /&gt;
Explanation of why this works:&lt;br /&gt;
It compares the average amount of total items within the chests and the chest adjacent to the inserter so that it activates when the average number of items is higher than the amount within the chest.&lt;br /&gt;
The reason for why the division denominator is negative is because if the items in the chests are 0, it basically makes it so that it adds 1 to the equation.&lt;br /&gt;
&lt;br /&gt;
== Oil Control ==&lt;br /&gt;
&lt;br /&gt;
== Memory ==&lt;br /&gt;
How to store a constant value for later use, either for a basic counter or for more advanced logic. A decider combinator wired output tied to input and configured greater than zero (for positive values), input -&amp;gt; output will &#039;hold&#039; a value, as long as all other inputs on the network are zero.&lt;br /&gt;
&lt;br /&gt;
Any non-zero input condition will create a basic clock; incrementing the stored value by the sum of all connected input values every cycle. A single pulse of an input will cause a single increment by the pulsed value. Reset to zero occurs whenever the set condition is no longer met, or if a negative pulse equal to the input occurs.&lt;br /&gt;
&lt;br /&gt;
== Basic Clocks ==&lt;br /&gt;
Clocks are constructed by having the output of a combinator tied back to its own input, such that every cycle advances its own count. Either the arithmetic combinator or the decider combinator can be used.&lt;br /&gt;
&lt;br /&gt;
An arithmetic combinator tied to itself is fun to watch and will happily run-away, but requires additional control logic to reset.&lt;br /&gt;
&lt;br /&gt;
A self-resetting clock requires just a single decider combinator with output wired to input and configured with Less Than (&amp;lt;) and Input -&amp;gt; Output. When a constant combinator is then connected to the input, every cycle it will count up by the value of the Constant Combinator until the set conditional value is reached, then output a zero which will be summed with the constant combinator, and reset the process.&lt;br /&gt;
&lt;br /&gt;
[[File:Timer.png|500px]]&lt;br /&gt;
&#039;&#039;30 ticks is the ceiling for Signal 1; which is continuously added.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The clock sequence will not include zero, will begin at the value set by the constant combinator, and will include whatever value eventually causes the conditional to be false. An arithmetic combinator can modify the clock sequence but remember its outputs will occur one cycle later than the clock cycle values.&lt;br /&gt;
&lt;br /&gt;
== Pulse Generators ==&lt;br /&gt;
&lt;br /&gt;
Connecting an additional (=) decider combinator to the output of a basic clock will create a pulse generator, and will pulse a single output every time the clock cycles through the set condition. Any output value can be used, either directly from the clock sequence (input-&amp;gt;output), a 1, or some value on a separate logic channel on the circuit network, such as set by a constant combinator. or by the circuit network.&amp;lt;br /&amp;gt;&lt;br /&gt;
[[File:PulseGen.png|500px]]&lt;br /&gt;
*&#039;&#039;The value 1 can be written as any positive integer, so long as it is within the cap or ceiling of your timer.&#039;&#039;&lt;br /&gt;
*&#039;&#039;As an example from the above timer, this light will pulse every 1st tick after the timer reaches 30 ticks, making it pulse 1/30th of a second, as Factorio updates at 60 times per second.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Counter ==&lt;br /&gt;
A counter is used to count the number of input events, and output the sum of that count. Any pulsing input into a decider combinator configured input -&amp;gt; output and wired between output and input will create a counter, but this input must be zero at all other times or else the combinator will run away like a clock. A pulse generator is normally used to accomplish this. Combining several gating decider isolators set with sequential conditionals, a clock, and a pulse generator to the input of a counter will allow remote polling and counting of each isolator&#039;s contents.&lt;br /&gt;
&lt;br /&gt;
== Logic Gates ==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Unary NOT&#039;&#039;&#039;&lt;br /&gt;
----&lt;br /&gt;
[[File:NOT.png|415px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Binary OR&#039;&#039;&#039;&lt;br /&gt;
----&lt;br /&gt;
[[File:OR.png|300px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 2!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1  || 1&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Binary NOR&#039;&#039;&#039;&lt;br /&gt;
----&lt;br /&gt;
[[File:NOR.png|415px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 2!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Binary XOR&#039;&#039;&#039;&lt;br /&gt;
----&lt;br /&gt;
[[File:XOR.png|300px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 1!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 ||  0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 ||  1 || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 ||  0 || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 ||  1 || 0&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Binary AND&#039;&#039;&#039;&lt;br /&gt;
----&lt;br /&gt;
[[File:AND.png|530px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 2!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1 || 1&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Trinary AND&#039;&#039;&#039;&lt;br /&gt;
----&lt;br /&gt;
[[File:TrinaryAND.png|415px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 2!!Input 3!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0  || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1  || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0  || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1  || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0  || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1  || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0  || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1  || 1  || 1&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Binary NAND&#039;&#039;&#039;&lt;br /&gt;
----&lt;br /&gt;
[[File:NAND.png|300px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 2!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Binary XNOR/XAND&#039;&#039;&#039;&lt;br /&gt;
----&lt;br /&gt;
[[File:XAND.png|300px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 2!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1  || 1&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Memory Cells ==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Simple Latch&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Have a Decider Combinator connect to itself with its input and output using a different colour of wire, say green wire when your output and input is red wire.&lt;br /&gt;
&lt;br /&gt;
[[File:SimpleLatchv2.png|300px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Output 1!!Input 1!!Input 2!! Output 1 (t+1)&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 0 || 1&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0 || 0 || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1 || 0 || 1 &#039;&#039;(2)&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0 || 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1 || 1 || 1 &#039;&#039;(2)&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&#039;&#039;Output 1 is the green wire loop seen in the picture, it carries the value to latch.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Binary Cell&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
RS NOR Latch&lt;br /&gt;
[[File:RS-NOR.png|500px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Advanced Cell&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Cell for storing a positive value:&lt;br /&gt;
&lt;br /&gt;
[[File:AdvancedMemoryCell.png|500px]]&lt;br /&gt;
&lt;br /&gt;
Connect the desired value as signal 3 on the right side to set the memory cell and connect a negative value as signal 3 to reset the cell.  *Please note the arithmetic combinator&#039;s output should be facing the opposite direction of the decider combinators.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Address Enable Switch&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== See Also ==&lt;br /&gt;
*[http://www.factorioforums.com/forum/viewtopic.php?f=18&amp;amp;t=14556 Combinators 101 (Tutorial)]&lt;br /&gt;
*[[Arithmetic combinator]]&lt;br /&gt;
*[[Constant Combinator]]&lt;br /&gt;
*[[Decider Combinator]]&lt;br /&gt;
*[[Circuit network]]&lt;br /&gt;
*[[Circuit-network_Cookbook]]&lt;br /&gt;
[[Category:Tutorial]]&lt;br /&gt;
[[Category:English page]]&lt;/div&gt;</summary>
		<author><name>My3DS</name></author>
	</entry>
	<entry>
		<id>https://wiki.factorio.com/index.php?title=Tutorial:Combinator_tutorial&amp;diff=133475</id>
		<title>Tutorial:Combinator tutorial</title>
		<link rel="alternate" type="text/html" href="https://wiki.factorio.com/index.php?title=Tutorial:Combinator_tutorial&amp;diff=133475"/>
		<updated>2016-12-27T10:28:34Z</updated>

		<summary type="html">&lt;p&gt;My3DS: /* Everything Wildcard: */ Added info&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
Combinator logic is achieved by cross-connecting outputs to inputs in such a way to achieve the desired logic. While advanced logic requires a multitude of combinators, some very useful basic logic can be achieved using only a handful of combinators. &#039;&#039;&#039;Combinator logic works because Factorio only updates at 60 times per second, such that combinators analyze their logic in a step, and then sum and/or decide the resulting output values on the next step.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
When logic values are computed by combinators, the outputs are not recognized by the circuit network until the following step. So when a decider combinator is used to detect a certain input condition, it&#039;s output value will not take effect on the circuit network until the next step. &#039;&#039;&#039;This behavior is important to remember and can result in sequencing errors and significant delays when multiple combinators are connected in series.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Circuit wires act like a wire bus in electronics, it carries information in the connected wires, meaning that &#039;&#039;&#039;if there are similar signals on a wire, it will add them automatically, unless if it is a different signal, that means it will be carried in that wire as well, but as a different signal.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
When cross-connecting combinators &#039;&#039;&#039;it&#039;s good practice to use the unused color to cross-connect, this will split the input and output networks and prevent unwanted inputs from accidentally connecting to a larger circuit network.&#039;&#039;&#039; Combinators will sum the red &amp;amp;/or green inputs prior to calculation, so either color can be used when wiring the output back to the input, but in most cases, it is more useful to use the opposing colour of the wire so that it will not interfere with the resulting output and input.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;There is also an example heavy [[Circuit-network_Cookbook|circuit network cookbook]] that you may find helpful to learn and refer to about circuit networks.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Virtual Signals ==&lt;br /&gt;
&lt;br /&gt;
===Everything Wildcard:===&lt;br /&gt;
---&lt;br /&gt;
&lt;br /&gt;
This Red Wildcard serves to check all the specifed input signals.&lt;br /&gt;
&lt;br /&gt;
As the Decider Combinator,&lt;br /&gt;
its input is used to serve if all inputs meets the specified signals or variables.&lt;br /&gt;
its output is used to serve output everything.&lt;br /&gt;
&lt;br /&gt;
=Anything Wildcard:=&lt;br /&gt;
---&lt;br /&gt;
&lt;br /&gt;
=Each Wildcard:=&lt;br /&gt;
---&lt;br /&gt;
&lt;br /&gt;
== Input Isolator &amp;amp; Gate ==&lt;br /&gt;
An arithmetic combinator set to (In: Each + 0, Out: Each) can be used to swap wire colors and as an isolator to prevent downstream logic from backfeeding into the circuit network&#039;s inputs.&lt;br /&gt;
&lt;br /&gt;
A decider combinator set to (Out: Everything, Input-&amp;gt; Output) will also function as an isolator as long as the set logic condition is true. This can also selectively pass or &#039;gate&#039; inputs only when desired. This could be used to sequentially poll remote train stations for their chest contents, and include only desired stations.&lt;br /&gt;
&lt;br /&gt;
== Set/Reset Latching Switch ==&lt;br /&gt;
You want something to SET a trigger at some quantity, but then STAY on until that quantity hits some other value, the RESET value. You&#039;ll need one decider combinator and one arithmetic combinator. Two decider combinators and a constant combinator can also be used for more complex multi-channel conditions.&lt;br /&gt;
&lt;br /&gt;
Setup the first decider combinator to the desired set conditional and to output a 1. Then connect the output to the input of an arithmetic combinator, and configure it to multiply by the bias value, the difference between the set and reset values, and wire the arithmetic output to the input of the decider. The arithmetic output channel MUST be set the same as the decider&#039;s input channel. That&#039;s it! Whenever your set conditional is reached, the decider will output a &#039;1&#039;, and the bias of the arithmetic combinator will be applied. This will &#039;hold&#039; the output true until the value goes back below the reset point.&lt;br /&gt;
&lt;br /&gt;
Here&#039;s a more specific example : &lt;br /&gt;
i want the pump to run when petrol reach 2000, and turn off when reach 200.&amp;lt;br&amp;gt;&lt;br /&gt;
only with green wire&amp;lt;br&amp;gt;&lt;br /&gt;
Tank -&amp;gt; in decider&amp;lt;br&amp;gt;&lt;br /&gt;
out decider-&amp;gt; in arithmetic&amp;lt;br&amp;gt;&lt;br /&gt;
out arithmetic -&amp;gt; in decider&amp;lt;br&amp;gt;&lt;br /&gt;
green wire from in decider, to pump&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Pump have the same condition as the decider (Petrol &amp;gt; 2000)&lt;br /&gt;
&lt;br /&gt;
Decider : Petrol &amp;gt; 2000&amp;lt;br&amp;gt;&lt;br /&gt;
out : A = 1&amp;lt;br&amp;gt;&lt;br /&gt;
Arithmetic : A x 1800 (2000 - 200 )&amp;lt;br&amp;gt;&lt;br /&gt;
out : petrol&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:Factorio combinator switch.png|620px]]&lt;br /&gt;
&lt;br /&gt;
== Comparing Outputs ==&lt;br /&gt;
&lt;br /&gt;
== Addressing Outposts ==&lt;br /&gt;
&lt;br /&gt;
== Smart Train Loading ==&lt;br /&gt;
&lt;br /&gt;
Initially designed by [https://www.youtube.com/user/Darkphade MadZuri],&lt;br /&gt;
&lt;br /&gt;
This solves the problem of loading logistics into chests, which tend to be unequal and is slower in the rate of loading logistics into the cargo of trains.&lt;br /&gt;
&lt;br /&gt;
To setup the design, you require an Arithmetic Combinator, as well as Red and Green wires. &#039;&#039;&#039;Wire all the chests used, to the input of the Arithmetic Combinator&#039;&#039;&#039;. &#039;&#039;&#039;Then write (Logistics Item / -Amount of chests) and as the output as the Logistics Item in the Arithmetic Combinator&#039;&#039;&#039;, this will average the amount of items within the chests. Lastly, &#039;&#039;&#039;wire all the inserters used to the output of the Arithmetic Combinator and have the other color of the wire be wired to the adjacent chest&#039;&#039;&#039;. &#039;&#039;&#039;Have the inserters enabled when Logistics Item &amp;lt; 1&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
A more visual representation as well as questions for the design can be found [https://www.reddit.com/r/factorio/comments/4e03g2/madzuris_smart_loading_train_station_guide/ here].&lt;br /&gt;
&lt;br /&gt;
Explanation of why this works:&lt;br /&gt;
It compares the average amount of total items within the chests and the chest adjacent to the inserter so that it activates when the average number of items is higher than the amount within the chest.&lt;br /&gt;
The reason for why the division denominator is negative is because if the items in the chests are 0, it basically makes it so that it adds 1 to the equation.&lt;br /&gt;
&lt;br /&gt;
== Oil Control ==&lt;br /&gt;
&lt;br /&gt;
== Memory ==&lt;br /&gt;
How to store a constant value for later use, either for a basic counter or for more advanced logic. A decider combinator wired output tied to input and configured greater than zero (for positive values), input -&amp;gt; output will &#039;hold&#039; a value, as long as all other inputs on the network are zero.&lt;br /&gt;
&lt;br /&gt;
Any non-zero input condition will create a basic clock; incrementing the stored value by the sum of all connected input values every cycle. A single pulse of an input will cause a single increment by the pulsed value. Reset to zero occurs whenever the set condition is no longer met, or if a negative pulse equal to the input occurs.&lt;br /&gt;
&lt;br /&gt;
== Basic Clocks ==&lt;br /&gt;
Clocks are constructed by having the output of a combinator tied back to its own input, such that every cycle advances its own count. Either the arithmetic combinator or the decider combinator can be used.&lt;br /&gt;
&lt;br /&gt;
An arithmetic combinator tied to itself is fun to watch and will happily run-away, but requires additional control logic to reset.&lt;br /&gt;
&lt;br /&gt;
A self-resetting clock requires just a single decider combinator with output wired to input and configured with Less Than (&amp;lt;) and Input -&amp;gt; Output. When a constant combinator is then connected to the input, every cycle it will count up by the value of the Constant Combinator until the set conditional value is reached, then output a zero which will be summed with the constant combinator, and reset the process.&lt;br /&gt;
&lt;br /&gt;
[[File:Timer.png|500px]]&lt;br /&gt;
&#039;&#039;30 ticks is the ceiling for Signal 1; which is continuously added.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The clock sequence will not include zero, will begin at the value set by the constant combinator, and will include whatever value eventually causes the conditional to be false. An arithmetic combinator can modify the clock sequence but remember its outputs will occur one cycle later than the clock cycle values.&lt;br /&gt;
&lt;br /&gt;
== Pulse Generators ==&lt;br /&gt;
&lt;br /&gt;
Connecting an additional (=) decider combinator to the output of a basic clock will create a pulse generator, and will pulse a single output every time the clock cycles through the set condition. Any output value can be used, either directly from the clock sequence (input-&amp;gt;output), a 1, or some value on a separate logic channel on the circuit network, such as set by a constant combinator. or by the circuit network.&amp;lt;br /&amp;gt;&lt;br /&gt;
[[File:PulseGen.png|500px]]&lt;br /&gt;
*&#039;&#039;The value 1 can be written as any positive integer, so long as it is within the cap or ceiling of your timer.&#039;&#039;&lt;br /&gt;
*&#039;&#039;As an example from the above timer, this light will pulse every 1st tick after the timer reaches 30 ticks, making it pulse 1/30th of a second, as Factorio updates at 60 times per second.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Counter ==&lt;br /&gt;
A counter is used to count the number of input events, and output the sum of that count. Any pulsing input into a decider combinator configured input -&amp;gt; output and wired between output and input will create a counter, but this input must be zero at all other times or else the combinator will run away like a clock. A pulse generator is normally used to accomplish this. Combining several gating decider isolators set with sequential conditionals, a clock, and a pulse generator to the input of a counter will allow remote polling and counting of each isolator&#039;s contents.&lt;br /&gt;
&lt;br /&gt;
== Logic Gates ==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Unary NOT&#039;&#039;&#039;&lt;br /&gt;
----&lt;br /&gt;
[[File:NOT.png|415px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Binary OR&#039;&#039;&#039;&lt;br /&gt;
----&lt;br /&gt;
[[File:OR.png|300px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 2!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1  || 1&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Binary NOR&#039;&#039;&#039;&lt;br /&gt;
----&lt;br /&gt;
[[File:NOR.png|415px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 2!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Binary XOR&#039;&#039;&#039;&lt;br /&gt;
----&lt;br /&gt;
[[File:XOR.png|300px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 1!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 ||  0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 ||  1 || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 ||  0 || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 ||  1 || 0&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Binary AND&#039;&#039;&#039;&lt;br /&gt;
----&lt;br /&gt;
[[File:AND.png|530px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 2!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1 || 1&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Trinary AND&#039;&#039;&#039;&lt;br /&gt;
----&lt;br /&gt;
[[File:TrinaryAND.png|415px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 2!!Input 3!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0  || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1  || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0  || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1  || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0  || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1  || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0  || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1  || 1  || 1&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Binary NAND&#039;&#039;&#039;&lt;br /&gt;
----&lt;br /&gt;
[[File:NAND.png|300px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 2!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Binary XNOR/XAND&#039;&#039;&#039;&lt;br /&gt;
----&lt;br /&gt;
[[File:XAND.png|300px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 2!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1  || 1&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Memory Cells ==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Simple Latch&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Have a Decider Combinator connect to itself with its input and output using a different colour of wire, say green wire when your output and input is red wire.&lt;br /&gt;
&lt;br /&gt;
[[File:SimpleLatchv2.png|300px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Output 1!!Input 1!!Input 2!! Output 1 (t+1)&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 0 || 1&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0 || 0 || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1 || 0 || 1 &#039;&#039;(2)&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0 || 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1 || 1 || 1 &#039;&#039;(2)&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&#039;&#039;Output 1 is the green wire loop seen in the picture, it carries the value to latch.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Binary Cell&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
RS NOR Latch&lt;br /&gt;
[[File:RS-NOR.png|500px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Advanced Cell&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Cell for storing a positive value:&lt;br /&gt;
&lt;br /&gt;
[[File:AdvancedMemoryCell.png|500px]]&lt;br /&gt;
&lt;br /&gt;
Connect the desired value as signal 3 on the right side to set the memory cell and connect a negative value as signal 3 to reset the cell.  *Please note the arithmetic combinator&#039;s output should be facing the opposite direction of the decider combinators.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Address Enable Switch&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== See Also ==&lt;br /&gt;
*[http://www.factorioforums.com/forum/viewtopic.php?f=18&amp;amp;t=14556 Combinators 101 (Tutorial)]&lt;br /&gt;
*[[Arithmetic combinator]]&lt;br /&gt;
*[[Constant Combinator]]&lt;br /&gt;
*[[Decider Combinator]]&lt;br /&gt;
*[[Circuit network]]&lt;br /&gt;
*[[Circuit-network_Cookbook]]&lt;br /&gt;
[[Category:Tutorial]]&lt;br /&gt;
[[Category:English page]]&lt;/div&gt;</summary>
		<author><name>My3DS</name></author>
	</entry>
	<entry>
		<id>https://wiki.factorio.com/index.php?title=Tutorial:Combinator_tutorial&amp;diff=133474</id>
		<title>Tutorial:Combinator tutorial</title>
		<link rel="alternate" type="text/html" href="https://wiki.factorio.com/index.php?title=Tutorial:Combinator_tutorial&amp;diff=133474"/>
		<updated>2016-12-27T10:22:59Z</updated>

		<summary type="html">&lt;p&gt;My3DS: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
Combinator logic is achieved by cross-connecting outputs to inputs in such a way to achieve the desired logic. While advanced logic requires a multitude of combinators, some very useful basic logic can be achieved using only a handful of combinators. &#039;&#039;&#039;Combinator logic works because Factorio only updates at 60 times per second, such that combinators analyze their logic in a step, and then sum and/or decide the resulting output values on the next step.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
When logic values are computed by combinators, the outputs are not recognized by the circuit network until the following step. So when a decider combinator is used to detect a certain input condition, it&#039;s output value will not take effect on the circuit network until the next step. &#039;&#039;&#039;This behavior is important to remember and can result in sequencing errors and significant delays when multiple combinators are connected in series.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Circuit wires act like a wire bus in electronics, it carries information in the connected wires, meaning that &#039;&#039;&#039;if there are similar signals on a wire, it will add them automatically, unless if it is a different signal, that means it will be carried in that wire as well, but as a different signal.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
When cross-connecting combinators &#039;&#039;&#039;it&#039;s good practice to use the unused color to cross-connect, this will split the input and output networks and prevent unwanted inputs from accidentally connecting to a larger circuit network.&#039;&#039;&#039; Combinators will sum the red &amp;amp;/or green inputs prior to calculation, so either color can be used when wiring the output back to the input, but in most cases, it is more useful to use the opposing colour of the wire so that it will not interfere with the resulting output and input.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;There is also an example heavy [[Circuit-network_Cookbook|circuit network cookbook]] that you may find helpful to learn and refer to about circuit networks.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Virtual Signals ==&lt;br /&gt;
&lt;br /&gt;
=Everything Wildcard:=&lt;br /&gt;
---&lt;br /&gt;
&lt;br /&gt;
=Anything Wildcard:=&lt;br /&gt;
---&lt;br /&gt;
&lt;br /&gt;
=Each Wildcard:=&lt;br /&gt;
---&lt;br /&gt;
&lt;br /&gt;
== Input Isolator &amp;amp; Gate ==&lt;br /&gt;
An arithmetic combinator set to (In: Each + 0, Out: Each) can be used to swap wire colors and as an isolator to prevent downstream logic from backfeeding into the circuit network&#039;s inputs.&lt;br /&gt;
&lt;br /&gt;
A decider combinator set to (Out: Everything, Input-&amp;gt; Output) will also function as an isolator as long as the set logic condition is true. This can also selectively pass or &#039;gate&#039; inputs only when desired. This could be used to sequentially poll remote train stations for their chest contents, and include only desired stations.&lt;br /&gt;
&lt;br /&gt;
== Set/Reset Latching Switch ==&lt;br /&gt;
You want something to SET a trigger at some quantity, but then STAY on until that quantity hits some other value, the RESET value. You&#039;ll need one decider combinator and one arithmetic combinator. Two decider combinators and a constant combinator can also be used for more complex multi-channel conditions.&lt;br /&gt;
&lt;br /&gt;
Setup the first decider combinator to the desired set conditional and to output a 1. Then connect the output to the input of an arithmetic combinator, and configure it to multiply by the bias value, the difference between the set and reset values, and wire the arithmetic output to the input of the decider. The arithmetic output channel MUST be set the same as the decider&#039;s input channel. That&#039;s it! Whenever your set conditional is reached, the decider will output a &#039;1&#039;, and the bias of the arithmetic combinator will be applied. This will &#039;hold&#039; the output true until the value goes back below the reset point.&lt;br /&gt;
&lt;br /&gt;
Here&#039;s a more specific example : &lt;br /&gt;
i want the pump to run when petrol reach 2000, and turn off when reach 200.&amp;lt;br&amp;gt;&lt;br /&gt;
only with green wire&amp;lt;br&amp;gt;&lt;br /&gt;
Tank -&amp;gt; in decider&amp;lt;br&amp;gt;&lt;br /&gt;
out decider-&amp;gt; in arithmetic&amp;lt;br&amp;gt;&lt;br /&gt;
out arithmetic -&amp;gt; in decider&amp;lt;br&amp;gt;&lt;br /&gt;
green wire from in decider, to pump&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Pump have the same condition as the decider (Petrol &amp;gt; 2000)&lt;br /&gt;
&lt;br /&gt;
Decider : Petrol &amp;gt; 2000&amp;lt;br&amp;gt;&lt;br /&gt;
out : A = 1&amp;lt;br&amp;gt;&lt;br /&gt;
Arithmetic : A x 1800 (2000 - 200 )&amp;lt;br&amp;gt;&lt;br /&gt;
out : petrol&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:Factorio combinator switch.png|620px]]&lt;br /&gt;
&lt;br /&gt;
== Comparing Outputs ==&lt;br /&gt;
&lt;br /&gt;
== Addressing Outposts ==&lt;br /&gt;
&lt;br /&gt;
== Smart Train Loading ==&lt;br /&gt;
&lt;br /&gt;
Initially designed by [https://www.youtube.com/user/Darkphade MadZuri],&lt;br /&gt;
&lt;br /&gt;
This solves the problem of loading logistics into chests, which tend to be unequal and is slower in the rate of loading logistics into the cargo of trains.&lt;br /&gt;
&lt;br /&gt;
To setup the design, you require an Arithmetic Combinator, as well as Red and Green wires. &#039;&#039;&#039;Wire all the chests used, to the input of the Arithmetic Combinator&#039;&#039;&#039;. &#039;&#039;&#039;Then write (Logistics Item / -Amount of chests) and as the output as the Logistics Item in the Arithmetic Combinator&#039;&#039;&#039;, this will average the amount of items within the chests. Lastly, &#039;&#039;&#039;wire all the inserters used to the output of the Arithmetic Combinator and have the other color of the wire be wired to the adjacent chest&#039;&#039;&#039;. &#039;&#039;&#039;Have the inserters enabled when Logistics Item &amp;lt; 1&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
A more visual representation as well as questions for the design can be found [https://www.reddit.com/r/factorio/comments/4e03g2/madzuris_smart_loading_train_station_guide/ here].&lt;br /&gt;
&lt;br /&gt;
Explanation of why this works:&lt;br /&gt;
It compares the average amount of total items within the chests and the chest adjacent to the inserter so that it activates when the average number of items is higher than the amount within the chest.&lt;br /&gt;
The reason for why the division denominator is negative is because if the items in the chests are 0, it basically makes it so that it adds 1 to the equation.&lt;br /&gt;
&lt;br /&gt;
== Oil Control ==&lt;br /&gt;
&lt;br /&gt;
== Memory ==&lt;br /&gt;
How to store a constant value for later use, either for a basic counter or for more advanced logic. A decider combinator wired output tied to input and configured greater than zero (for positive values), input -&amp;gt; output will &#039;hold&#039; a value, as long as all other inputs on the network are zero.&lt;br /&gt;
&lt;br /&gt;
Any non-zero input condition will create a basic clock; incrementing the stored value by the sum of all connected input values every cycle. A single pulse of an input will cause a single increment by the pulsed value. Reset to zero occurs whenever the set condition is no longer met, or if a negative pulse equal to the input occurs.&lt;br /&gt;
&lt;br /&gt;
== Basic Clocks ==&lt;br /&gt;
Clocks are constructed by having the output of a combinator tied back to its own input, such that every cycle advances its own count. Either the arithmetic combinator or the decider combinator can be used.&lt;br /&gt;
&lt;br /&gt;
An arithmetic combinator tied to itself is fun to watch and will happily run-away, but requires additional control logic to reset.&lt;br /&gt;
&lt;br /&gt;
A self-resetting clock requires just a single decider combinator with output wired to input and configured with Less Than (&amp;lt;) and Input -&amp;gt; Output. When a constant combinator is then connected to the input, every cycle it will count up by the value of the Constant Combinator until the set conditional value is reached, then output a zero which will be summed with the constant combinator, and reset the process.&lt;br /&gt;
&lt;br /&gt;
[[File:Timer.png|500px]]&lt;br /&gt;
&#039;&#039;30 ticks is the ceiling for Signal 1; which is continuously added.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The clock sequence will not include zero, will begin at the value set by the constant combinator, and will include whatever value eventually causes the conditional to be false. An arithmetic combinator can modify the clock sequence but remember its outputs will occur one cycle later than the clock cycle values.&lt;br /&gt;
&lt;br /&gt;
== Pulse Generators ==&lt;br /&gt;
&lt;br /&gt;
Connecting an additional (=) decider combinator to the output of a basic clock will create a pulse generator, and will pulse a single output every time the clock cycles through the set condition. Any output value can be used, either directly from the clock sequence (input-&amp;gt;output), a 1, or some value on a separate logic channel on the circuit network, such as set by a constant combinator. or by the circuit network.&amp;lt;br /&amp;gt;&lt;br /&gt;
[[File:PulseGen.png|500px]]&lt;br /&gt;
*&#039;&#039;The value 1 can be written as any positive integer, so long as it is within the cap or ceiling of your timer.&#039;&#039;&lt;br /&gt;
*&#039;&#039;As an example from the above timer, this light will pulse every 1st tick after the timer reaches 30 ticks, making it pulse 1/30th of a second, as Factorio updates at 60 times per second.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Counter ==&lt;br /&gt;
A counter is used to count the number of input events, and output the sum of that count. Any pulsing input into a decider combinator configured input -&amp;gt; output and wired between output and input will create a counter, but this input must be zero at all other times or else the combinator will run away like a clock. A pulse generator is normally used to accomplish this. Combining several gating decider isolators set with sequential conditionals, a clock, and a pulse generator to the input of a counter will allow remote polling and counting of each isolator&#039;s contents.&lt;br /&gt;
&lt;br /&gt;
== Logic Gates ==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Unary NOT&#039;&#039;&#039;&lt;br /&gt;
----&lt;br /&gt;
[[File:NOT.png|415px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Binary OR&#039;&#039;&#039;&lt;br /&gt;
----&lt;br /&gt;
[[File:OR.png|300px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 2!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1  || 1&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Binary NOR&#039;&#039;&#039;&lt;br /&gt;
----&lt;br /&gt;
[[File:NOR.png|415px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 2!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Binary XOR&#039;&#039;&#039;&lt;br /&gt;
----&lt;br /&gt;
[[File:XOR.png|300px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 1!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 ||  0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 ||  1 || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 ||  0 || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 ||  1 || 0&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Binary AND&#039;&#039;&#039;&lt;br /&gt;
----&lt;br /&gt;
[[File:AND.png|530px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 2!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1 || 1&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Trinary AND&#039;&#039;&#039;&lt;br /&gt;
----&lt;br /&gt;
[[File:TrinaryAND.png|415px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 2!!Input 3!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0  || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1  || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0  || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1  || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0  || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1  || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0  || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1  || 1  || 1&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Binary NAND&#039;&#039;&#039;&lt;br /&gt;
----&lt;br /&gt;
[[File:NAND.png|300px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 2!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Binary XNOR/XAND&#039;&#039;&#039;&lt;br /&gt;
----&lt;br /&gt;
[[File:XAND.png|300px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 2!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1  || 1&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Memory Cells ==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Simple Latch&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Have a Decider Combinator connect to itself with its input and output using a different colour of wire, say green wire when your output and input is red wire.&lt;br /&gt;
&lt;br /&gt;
[[File:SimpleLatchv2.png|300px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Output 1!!Input 1!!Input 2!! Output 1 (t+1)&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 0 || 1&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0 || 0 || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1 || 0 || 1 &#039;&#039;(2)&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0 || 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1 || 1 || 1 &#039;&#039;(2)&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&#039;&#039;Output 1 is the green wire loop seen in the picture, it carries the value to latch.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Binary Cell&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
RS NOR Latch&lt;br /&gt;
[[File:RS-NOR.png|500px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Advanced Cell&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Cell for storing a positive value:&lt;br /&gt;
&lt;br /&gt;
[[File:AdvancedMemoryCell.png|500px]]&lt;br /&gt;
&lt;br /&gt;
Connect the desired value as signal 3 on the right side to set the memory cell and connect a negative value as signal 3 to reset the cell.  *Please note the arithmetic combinator&#039;s output should be facing the opposite direction of the decider combinators.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Address Enable Switch&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== See Also ==&lt;br /&gt;
*[http://www.factorioforums.com/forum/viewtopic.php?f=18&amp;amp;t=14556 Combinators 101 (Tutorial)]&lt;br /&gt;
*[[Arithmetic combinator]]&lt;br /&gt;
*[[Constant Combinator]]&lt;br /&gt;
*[[Decider Combinator]]&lt;br /&gt;
*[[Circuit network]]&lt;br /&gt;
*[[Circuit-network_Cookbook]]&lt;br /&gt;
[[Category:Tutorial]]&lt;br /&gt;
[[Category:English page]]&lt;/div&gt;</summary>
		<author><name>My3DS</name></author>
	</entry>
	<entry>
		<id>https://wiki.factorio.com/index.php?title=News&amp;diff=133408</id>
		<title>News</title>
		<link rel="alternate" type="text/html" href="https://wiki.factorio.com/index.php?title=News&amp;diff=133408"/>
		<updated>2016-12-12T00:52:22Z</updated>

		<summary type="html">&lt;p&gt;My3DS: added fff 168&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;!-- CURRENT NEWS - PLEASE ARCHIVE BELOW &lt;br /&gt;
     Only maximal 10 news should be new, the rest should be archived...&lt;br /&gt;
&lt;br /&gt;
if it doesn&#039;t show up on the main page visit: &lt;br /&gt;
http://www.factorioforums.com/wiki/index.php?title=Main_Page&amp;amp;action=purge&lt;br /&gt;
&lt;br /&gt;
Or, edit and save the page without making any changes. &lt;br /&gt;
--&amp;gt;&lt;br /&gt;
== Latest ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;toccolours mw-collapsible mw-collapsed&amp;quot; style=&amp;quot;width:600px&amp;quot;&amp;gt;&lt;br /&gt;
What should be in the news and what not?&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible-content&amp;quot;&amp;gt;The Factorio News in this wiki should be that kind of news, which - viewed from some future (for example in a year) - will be still relevant information. Examples:&lt;br /&gt;
&lt;br /&gt;
* Good: A player has made an interesting tweak in building a factory, which never has been seen before.&lt;br /&gt;
* Bad: Some youtuber has made his 100th Let&#039;s play about Factorio.&lt;br /&gt;
* Good: The developers announce Greenlight Campaign of Factorio&lt;br /&gt;
* Bad: There is a serious bug in MacOS-Version and you need to update to the current.&lt;br /&gt;
&amp;lt;/div&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;If you miss some news here, you can add it yourself (this is a wiki, you know).&lt;br /&gt;
&amp;lt;onlyinclude&amp;gt;&lt;br /&gt;
&amp;lt;!-- vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv --&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;column-count:2;-moz-column-count:2;-webkit-column-count:2&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Dec 09 FFF #168: [https://forums.factorio.com/viewtopic.php?f=38&amp;amp;t=38435 Nightvision Nightmare].&lt;br /&gt;
* Dec 02 FFF #167: [https://forums.factorio.com/viewtopic.php?f=38&amp;amp;t=38181 Reactors Operational].&lt;br /&gt;
* Nov 25 FFF #166: [https://forums.factorio.com/viewtopic.php?f=38&amp;amp;t=37734 Combat Revisit].&lt;br /&gt;
* Nov 18 FFF #165: [https://forums.factorio.com/viewtopic.php?f=38&amp;amp;t=37423 Death by a thousand cuts].&lt;br /&gt;
* Nov 11 FFF #164: [https://forums.factorio.com/viewtopic.php?f=38&amp;amp;t=37008 Nuclear power].&lt;br /&gt;
* Nov 04 FFF #163: [https://forums.factorio.com/viewtopic.php?f=38&amp;amp;t=35693 New rails &amp;amp; New problems].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&amp;lt;includeonly&amp;gt;&#039;&#039;&#039;[[News#Archive|Older news...]]&#039;&#039;&#039;&amp;lt;/includeonly&amp;gt;&amp;lt;/onlyinclude&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- ARCHIVED NEWS (not included on main page) --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Archive ==&lt;br /&gt;
&#039;&#039;Archived news doesn&#039;t appear on the main page.&lt;br /&gt;
&lt;br /&gt;
===2016===&lt;br /&gt;
&lt;br /&gt;
====October====&lt;br /&gt;
&lt;br /&gt;
* Oct 28 FFF #162: [https://forums.factorio.com/viewtopic.php?f=38&amp;amp;t=35370 Theme Art Again].&lt;br /&gt;
* Oct 21 FFF #161: [https://forums.factorio.com/viewtopic.php?f=38&amp;amp;t=34922 Infinite Research and Blueprint Library].&lt;br /&gt;
* Oct 14 FFF #160: [https://forums.factorio.com/viewtopic.php?f=38&amp;amp;t=34319 Playtesting].&lt;br /&gt;
* Oct 07 FFF #159: [https://forums.factorio.com/viewtopic.php?f=38&amp;amp;t=33913 Research revolution].&lt;br /&gt;
&lt;br /&gt;
====September====&lt;br /&gt;
&lt;br /&gt;
* Sep 30 FFF #158: [https://forums.factorio.com/viewtopic.php?f=38&amp;amp;t=33590 The end of the 32 bit era].&lt;br /&gt;
* Sep 23 FFF #157: [https://forums.factorio.com/viewtopic.php?f=38&amp;amp;t=33274 We are able to eat paper, but we don&#039;t do it].&lt;br /&gt;
* Sep 16 FFF #156: [https://forums.factorio.com/viewtopic.php?f=38&amp;amp;t=32783 Massive Multiplayer].&lt;br /&gt;
* Sep 09 FFF #155: [https://forums.factorio.com/viewtopic.php?f=38&amp;amp;t=32406 Settling into fall].&lt;br /&gt;
* Sep 02 FFF #154: [https://forums.factorio.com/viewtopic.php?f=38&amp;amp;t=32053 Challenge us].&lt;br /&gt;
&lt;br /&gt;
====August====&lt;br /&gt;
&lt;br /&gt;
* Aug 26 FFF #153: [https://forums.factorio.com/viewtopic.php?f=38&amp;amp;t=31591 0.13 Stable, 0.14 Experimental].&lt;br /&gt;
* Aug 19 FFF #152: [https://forums.factorio.com/viewtopic.php?f=38&amp;amp;t=31223 Team production challenge].&lt;br /&gt;
* Aug 12 FFF #151: [https://forums.factorio.com/viewtopic.php?f=38&amp;amp;t=30854 The plans for 0.14].&lt;br /&gt;
* Aug 05 FFF #150: [https://forums.factorio.com/viewtopic.php?t=30521 New Terrain Experiments].&lt;br /&gt;
&lt;br /&gt;
====July====&lt;br /&gt;
&lt;br /&gt;
* Jul 30 FFF #149: [https://forums.factorio.com/viewtopic.php?f=38&amp;amp;t=30085 Deep down in multiplayer].&lt;br /&gt;
* Jul 22 FFF #148: [https://forums.factorio.com/viewtopic.php?f=38&amp;amp;t=29599 Optimizations for 0.14].&lt;br /&gt;
* Jul 15 FFF #147: [https://forums.factorio.com/viewtopic.php?f=38&amp;amp;t=29095 Multiplayer rewrite].&lt;br /&gt;
* Jul 08 FFF #146: [https://forums.factorio.com/viewtopic.php?f=38&amp;amp;t=28574 The GFX workflow].&lt;br /&gt;
* Jul 01 FFF #145: [https://forums.factorio.com/viewtopic.php?f=38&amp;amp;t=27854 0.13 experimental is out].&lt;br /&gt;
&lt;br /&gt;
====June====&lt;br /&gt;
&lt;br /&gt;
* Jun 24 FFF #144: [https://forums.factorio.com/viewtopic.php?f=38&amp;amp;t=27008 The gfx report].&lt;br /&gt;
* Jun 17 FFF #143: [https://forums.factorio.com/viewtopic.php?f=38&amp;amp;t=26831 Nat Punching Again].&lt;br /&gt;
* Jun 10 FFF #142: [https://forums.factorio.com/viewtopic.php?f=38&amp;amp;t=26518 Playtesting].&lt;br /&gt;
* Jun 03 FFF #141: [https://forums.factorio.com/viewtopic.php?f=38&amp;amp;t=26086 Mod Portal].&lt;br /&gt;
&lt;br /&gt;
====May====&lt;br /&gt;
&lt;br /&gt;
* May 27 FFF #140: [https://forums.factorio.com/viewtopic.php?f=38&amp;amp;t=25793 Soon].&lt;br /&gt;
* May 20 FFF #139: [https://forums.factorio.com/viewtopic.php?f=38&amp;amp;t=25530 Wrapping up multiplayer].&lt;br /&gt;
* May 13 FFF #138: [https://forums.factorio.com/viewtopic.php?f=38&amp;amp;t=25267 Better Circuit Network III].&lt;br /&gt;
* May 06 FFF #137: [https://forums.factorio.com/viewtopic.php?f=38&amp;amp;t=24985 The release scarecrow].&lt;br /&gt;
&lt;br /&gt;
====April====&lt;br /&gt;
&lt;br /&gt;
* Apr 29 FFF #136: [https://forums.factorio.com/viewtopic.php?f=38&amp;amp;t=24658 Map Transfers].&lt;br /&gt;
* Apr 22 FFF #135: [https://forums.factorio.com/viewtopic.php?f=38&amp;amp;t=24089 Getting Organized].&lt;br /&gt;
* Apr 15 FFF #134: [https://forums.factorio.com/viewtopic.php?f=38&amp;amp;t=23717 Signal placement indicator].&lt;br /&gt;
* Apr 08 FFF #133: [https://forums.factorio.com/viewtopic.php?f=38&amp;amp;t=23343 The train struggle].&lt;br /&gt;
* Apr 01 FFF #132: [https://forums.factorio.com/viewtopic.php?f=38&amp;amp;t=22924 Side Project].&lt;br /&gt;
&lt;br /&gt;
====March====&lt;br /&gt;
&lt;br /&gt;
* Mar 25 FFF #131: [https://forums.factorio.com/viewtopic.php?f=38&amp;amp;t=22249 Roadmap shuffle].&lt;br /&gt;
* Mar 18 FFF #130: [https://forums.factorio.com/viewtopic.php?f=38&amp;amp;t=21783 Steam release side effects].&lt;br /&gt;
* Mar 11 FFF #129: [https://forums.factorio.com/viewtopic.php?f=38&amp;amp;t=21311 The late game].&lt;br /&gt;
* Mar 04 FFF #128: [https://forums.factorio.com/viewtopic.php?f=38&amp;amp;t=20847 Back down to earth].&lt;br /&gt;
&lt;br /&gt;
====February====&lt;br /&gt;
&lt;br /&gt;
* Feb 26 FFF #127: [https://forums.factorio.com/viewtopic.php?f=38&amp;amp;t=20522 Steam Status III: Thank You].&lt;br /&gt;
* Feb 25 Factorio gets released on [http://store.steampowered.com/app/427520 Steam]!&lt;br /&gt;
* Feb 19 FFF #126: [http://www.factorioforums.com/forum/viewtopic.php?f=38&amp;amp;t=20258 Steam Status II and Trains Stuff].&lt;br /&gt;
* Feb 12 FFF #125: [http://www.factorioforums.com/forum/viewtopic.php?f=38&amp;amp;t=20070 Achievements].&lt;br /&gt;
* Feb 05 FFF #124: [http://www.factorioforums.com/forum/viewtopic.php?f=38&amp;amp;t=19824 Steam Status I].&lt;br /&gt;
&lt;br /&gt;
====January====&lt;br /&gt;
&lt;br /&gt;
* Jan 29 FFF #123: [http://www.factorioforums.com/forum/viewtopic.php?f=38&amp;amp;t=19602 Better circuit network (Part 2)].&lt;br /&gt;
* Jan 22 FFF #122: [http://www.factorioforums.com/forum/viewtopic.php?f=38&amp;amp;t=19409 Better circuit network (Part 1)].&lt;br /&gt;
* Jan 15 FFF #121: [http://www.factorioforums.com/forum/viewtopic.php?f=38&amp;amp;t=19210 Path Finder Optimisation II].&lt;br /&gt;
* Jan 08 FFF #120: [http://www.factorioforums.com/forum/viewtopic.php?f=38&amp;amp;t=19020 Spidertron].&lt;br /&gt;
* Jan 01 FFF #119: [http://www.factorioforums.com/forum/viewtopic.php?f=38&amp;amp;t=18843 Happy 2016].&lt;br /&gt;
&lt;br /&gt;
===2015===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;[[News/2015|Archived news from 2015]]&lt;br /&gt;
&lt;br /&gt;
===2014===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;[[News/2014|Archived news from 2014]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;noinclude&amp;gt;&lt;br /&gt;
{{Languages}}&lt;br /&gt;
[[Category:Info templates|{{PAGENAME}}]]&lt;br /&gt;
[[Category:Main page templates|news]]&lt;br /&gt;
&amp;lt;/noinclude&amp;gt;&lt;/div&gt;</summary>
		<author><name>My3DS</name></author>
	</entry>
	<entry>
		<id>https://wiki.factorio.com/index.php?title=Tutorial:Combinator_tutorial&amp;diff=133322</id>
		<title>Tutorial:Combinator tutorial</title>
		<link rel="alternate" type="text/html" href="https://wiki.factorio.com/index.php?title=Tutorial:Combinator_tutorial&amp;diff=133322"/>
		<updated>2016-12-05T02:08:18Z</updated>

		<summary type="html">&lt;p&gt;My3DS: /* Logic Gates */ made trinary AND&amp;#039;s table a little bit better&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
Combinator logic is achieved by cross-connecting outputs to inputs in such a way to achieve the desired logic. While advanced logic requires a multitude of combinators, some very useful basic logic can be achieved using only a handful of combinators. &#039;&#039;&#039;Combinator logic works because Factorio only updates at 60 times per second, such that combinators analyze their logic in a step, and then sum and/or decide the resulting output values on the next step.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
When logic values are computed by combinators, the outputs are not recognized by the circuit network until the following step. So when a decider combinator is used to detect a certain input condition, it&#039;s output value will not take effect on the circuit network until the next step. &#039;&#039;&#039;This behavior is important to remember and can result in sequencing errors and significant delays when multiple combinators are connected in series.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Circuit wires act like a wire bus in electronics, it carries information in the connected wires, meaning that &#039;&#039;&#039;if there are similar signals on a wire, it will add them automatically, unless if it is a different signal, that means it will be carried in that wire as well, but as a different signal.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
When cross-connecting combinators &#039;&#039;&#039;it&#039;s good practice to use the unused color to cross-connect, this will split the input and output networks and prevent unwanted inputs from accidentally connecting to a larger circuit network.&#039;&#039;&#039; Combinators will sum the red &amp;amp;/or green inputs prior to calculation, so either color can be used when wiring the output back to the input, but in most cases, it is more useful to use the opposing colour of the wire so that it will not interfere with the resulting output and input.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;There is also an example heavy [[Circuit-network_Cookbook|circuit network cookbook]] that you may find helpful to learn and refer to about circuit networks.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Input Isolator &amp;amp; Gate ==&lt;br /&gt;
An arithmetic combinator set to (In: Each + 0, Out: Each) can be used to swap wire colors and as an isolator to prevent downstream logic from backfeeding into the circuit network&#039;s inputs.&lt;br /&gt;
&lt;br /&gt;
A decider combinator set to (Out: Everything, Input-&amp;gt; Output) will also function as an isolator as long as the set logic condition is true. This can also selectively pass or &#039;gate&#039; inputs only when desired. This could be used to sequentially poll remote train stations for their chest contents, and include only desired stations.&lt;br /&gt;
&lt;br /&gt;
== Set/Reset Latching Switch ==&lt;br /&gt;
You want something to SET a trigger at some quantity, but then STAY on until that quantity hits some other value, the RESET value. You&#039;ll need one decider combinator and one arithmetic combinator. Two decider combinators and a constant combinator can also be used for more complex multi-channel conditions.&lt;br /&gt;
&lt;br /&gt;
Setup the first decider combinator to the desired set conditional and to output a 1. Then connect the output to the input of an arithmetic combinator, and configure it to multiply by the bias value, the difference between the set and reset values, and wire the arithmetic output to the input of the decider. The arithmetic output channel MUST be set the same as the decider&#039;s input channel. That&#039;s it! Whenever your set conditional is reached, the decider will output a &#039;1&#039;, and the bias of the arithmetic combinator will be applied. This will &#039;hold&#039; the output true until the value goes back below the reset point.&lt;br /&gt;
&lt;br /&gt;
Here&#039;s a more specific example : &lt;br /&gt;
i want the pump to run when petrol reach 2000, and turn off when reach 200.&amp;lt;br&amp;gt;&lt;br /&gt;
only with green wire&amp;lt;br&amp;gt;&lt;br /&gt;
Tank -&amp;gt; in decider&amp;lt;br&amp;gt;&lt;br /&gt;
out decider-&amp;gt; in arithmetic&amp;lt;br&amp;gt;&lt;br /&gt;
out arithmetic -&amp;gt; in decider&amp;lt;br&amp;gt;&lt;br /&gt;
green wire from in decider, to pump&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Pump have the same condition as the decider (Petrol &amp;gt; 2000)&lt;br /&gt;
&lt;br /&gt;
Decider : Petrol &amp;gt; 2000&amp;lt;br&amp;gt;&lt;br /&gt;
out : A = 1&amp;lt;br&amp;gt;&lt;br /&gt;
Arithmetic : A x 1800 (2000 - 200 )&amp;lt;br&amp;gt;&lt;br /&gt;
out : petrol&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:Factorio combinator switch.png|620px]]&lt;br /&gt;
&lt;br /&gt;
== Comparing Outputs ==&lt;br /&gt;
&lt;br /&gt;
== Addressing Outposts ==&lt;br /&gt;
&lt;br /&gt;
== Smart Train Loading ==&lt;br /&gt;
&lt;br /&gt;
Initially designed by [https://www.youtube.com/user/Darkphade MadZuri],&lt;br /&gt;
&lt;br /&gt;
This solves the problem of loading logistics into chests, which tend to be unequal and is slower in the rate of loading logistics into the cargo of trains.&lt;br /&gt;
&lt;br /&gt;
To setup the design, you require an Arithmetic Combinator, as well as Red and Green wires. &#039;&#039;&#039;Wire all the chests used, to the input of the Arithmetic Combinator&#039;&#039;&#039;. &#039;&#039;&#039;Then write (Logistics Item / -Amount of chests) and as the output as the Logistics Item in the Arithmetic Combinator&#039;&#039;&#039;, this will average the amount of items within the chests. Lastly, &#039;&#039;&#039;wire all the inserters used to the output of the Arithmetic Combinator and have the other color of the wire be wired to the adjacent chest&#039;&#039;&#039;. &#039;&#039;&#039;Have the inserters enabled when Logistics Item &amp;lt; 1&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
A more visual representation as well as questions for the design can be found [https://www.reddit.com/r/factorio/comments/4e03g2/madzuris_smart_loading_train_station_guide/ here].&lt;br /&gt;
&lt;br /&gt;
Explanation of why this works:&lt;br /&gt;
It compares the average amount of total items within the chests and the chest adjacent to the inserter so that it activates when the average number of items is higher than the amount within the chest.&lt;br /&gt;
The reason for why the division denominator is negative is because if the items in the chests are 0, it basically makes it so that it adds 1 to the equation.&lt;br /&gt;
&lt;br /&gt;
== Oil Control ==&lt;br /&gt;
&lt;br /&gt;
== Memory ==&lt;br /&gt;
How to store a constant value for later use, either for a basic counter or for more advanced logic. A decider combinator wired output tied to input and configured greater than zero (for positive values), input -&amp;gt; output will &#039;hold&#039; a value, as long as all other inputs on the network are zero.&lt;br /&gt;
&lt;br /&gt;
Any non-zero input condition will create a basic clock; incrementing the stored value by the sum of all connected input values every cycle. A single pulse of an input will cause a single increment by the pulsed value. Reset to zero occurs whenever the set condition is no longer met, or if a negative pulse equal to the input occurs.&lt;br /&gt;
&lt;br /&gt;
== Basic Clocks ==&lt;br /&gt;
Clocks are constructed by having the output of a combinator tied back to its own input, such that every cycle advances its own count. Either the arithmetic combinator or the decider combinator can be used.&lt;br /&gt;
&lt;br /&gt;
An arithmetic combinator tied to itself is fun to watch and will happily run-away, but requires additional control logic to reset.&lt;br /&gt;
&lt;br /&gt;
A self-resetting clock requires just a single decider combinator with output wired to input and configured with Less Than (&amp;lt;) and Input -&amp;gt; Output. When a constant combinator is then connected to the input, every cycle it will count up by the value of the Constant Combinator until the set conditional value is reached, then output a zero which will be summed with the constant combinator, and reset the process.&lt;br /&gt;
&lt;br /&gt;
[[File:Timer.png|500px]]&lt;br /&gt;
&#039;&#039;30 ticks is the ceiling for Signal 1; which is continuously added.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The clock sequence will not include zero, will begin at the value set by the constant combinator, and will include whatever value eventually causes the conditional to be false. An arithmetic combinator can modify the clock sequence but remember its outputs will occur one cycle later than the clock cycle values.&lt;br /&gt;
&lt;br /&gt;
== Pulse Generators ==&lt;br /&gt;
&lt;br /&gt;
Connecting an additional (=) decider combinator to the output of a basic clock will create a pulse generator, and will pulse a single output every time the clock cycles through the set condition. Any output value can be used, either directly from the clock sequence (input-&amp;gt;output), a 1, or some value on a separate logic channel on the circuit network, such as set by a constant combinator. or by the circuit network.&amp;lt;br /&amp;gt;&lt;br /&gt;
[[File:PulseGen.png|500px]]&lt;br /&gt;
*&#039;&#039;The value 1 can be written as any positive integer, so long as it is within the cap or ceiling of your timer.&#039;&#039;&lt;br /&gt;
*&#039;&#039;As an example from the above timer, this light will pulse every 1st tick after the timer reaches 30 ticks, making it pulse 1/30th of a second, as Factorio updates at 60 times per second.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Counter ==&lt;br /&gt;
A counter is used to count the number of input events, and output the sum of that count. Any pulsing input into a decider combinator configured input -&amp;gt; output and wired between output and input will create a counter, but this input must be zero at all other times or else the combinator will run away like a clock. A pulse generator is normally used to accomplish this. Combining several gating decider isolators set with sequential conditionals, a clock, and a pulse generator to the input of a counter will allow remote polling and counting of each isolator&#039;s contents.&lt;br /&gt;
&lt;br /&gt;
== Logic Gates ==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Unary NOT&#039;&#039;&#039;&lt;br /&gt;
----&lt;br /&gt;
[[File:NOT.png|415px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Binary OR&#039;&#039;&#039;&lt;br /&gt;
----&lt;br /&gt;
[[File:OR.png|300px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 2!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1  || 1&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Binary NOR&#039;&#039;&#039;&lt;br /&gt;
----&lt;br /&gt;
[[File:NOR.png|415px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 2!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Binary XOR&#039;&#039;&#039;&lt;br /&gt;
----&lt;br /&gt;
[[File:XOR.png|300px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 1!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 ||  0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 ||  1 || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 ||  0 || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 ||  1 || 0&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Binary AND&#039;&#039;&#039;&lt;br /&gt;
----&lt;br /&gt;
[[File:AND.png|530px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 2!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1 || 1&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Trinary AND&#039;&#039;&#039;&lt;br /&gt;
----&lt;br /&gt;
[[File:TrinaryAND.png|415px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 2!!Input 3!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0  || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1  || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0  || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1  || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0  || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1  || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0  || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1  || 1  || 1&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Binary NAND&#039;&#039;&#039;&lt;br /&gt;
----&lt;br /&gt;
[[File:NAND.png|300px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 2!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Binary XNOR/XAND&#039;&#039;&#039;&lt;br /&gt;
----&lt;br /&gt;
[[File:XAND.png|300px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 2!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1  || 1&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Memory Cells ==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Simple Latch&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Have a Decider Combinator connect to itself with its input and output using a different colour of wire, say green wire when your output and input is red wire.&lt;br /&gt;
&lt;br /&gt;
[[File:SimpleLatchv2.png|300px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Output 1!!Input 1!!Input 2!! Output 1 (t+1)&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 0 || 1&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0 || 0 || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1 || 0 || 1 &#039;&#039;(2)&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0 || 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1 || 1 || 1 &#039;&#039;(2)&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&#039;&#039;Output 1 is the green wire loop seen in the picture, it carries the value to latch.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Binary Cell&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
RS NOR Latch&lt;br /&gt;
[[File:RS-NOR.png|500px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Advanced Cell&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Cell for storing a positive value:&lt;br /&gt;
&lt;br /&gt;
[[File:AdvancedMemoryCell.png|500px]]&lt;br /&gt;
&lt;br /&gt;
Connect the desired value as signal 3 on the right side to set the memory cell and connect a negative value as signal 3 to reset the cell.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Address Enable Switch&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== See Also ==&lt;br /&gt;
*[http://www.factorioforums.com/forum/viewtopic.php?f=18&amp;amp;t=14556 Combinators 101 (Tutorial)]&lt;br /&gt;
*[[Arithmetic combinator]]&lt;br /&gt;
*[[Constant Combinator]]&lt;br /&gt;
*[[Decider Combinator]]&lt;br /&gt;
*[[Circuit network]]&lt;br /&gt;
*[[Circuit-network_Cookbook]]&lt;br /&gt;
[[Category:Tutorial]]&lt;br /&gt;
[[Category:English page]]&lt;/div&gt;</summary>
		<author><name>My3DS</name></author>
	</entry>
	<entry>
		<id>https://wiki.factorio.com/index.php?title=Tutorial:Combinator_tutorial&amp;diff=133321</id>
		<title>Tutorial:Combinator tutorial</title>
		<link rel="alternate" type="text/html" href="https://wiki.factorio.com/index.php?title=Tutorial:Combinator_tutorial&amp;diff=133321"/>
		<updated>2016-12-05T00:56:44Z</updated>

		<summary type="html">&lt;p&gt;My3DS: /* Pulse Generators */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
Combinator logic is achieved by cross-connecting outputs to inputs in such a way to achieve the desired logic. While advanced logic requires a multitude of combinators, some very useful basic logic can be achieved using only a handful of combinators. &#039;&#039;&#039;Combinator logic works because Factorio only updates at 60 times per second, such that combinators analyze their logic in a step, and then sum and/or decide the resulting output values on the next step.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
When logic values are computed by combinators, the outputs are not recognized by the circuit network until the following step. So when a decider combinator is used to detect a certain input condition, it&#039;s output value will not take effect on the circuit network until the next step. &#039;&#039;&#039;This behavior is important to remember and can result in sequencing errors and significant delays when multiple combinators are connected in series.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Circuit wires act like a wire bus in electronics, it carries information in the connected wires, meaning that &#039;&#039;&#039;if there are similar signals on a wire, it will add them automatically, unless if it is a different signal, that means it will be carried in that wire as well, but as a different signal.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
When cross-connecting combinators &#039;&#039;&#039;it&#039;s good practice to use the unused color to cross-connect, this will split the input and output networks and prevent unwanted inputs from accidentally connecting to a larger circuit network.&#039;&#039;&#039; Combinators will sum the red &amp;amp;/or green inputs prior to calculation, so either color can be used when wiring the output back to the input, but in most cases, it is more useful to use the opposing colour of the wire so that it will not interfere with the resulting output and input.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;There is also an example heavy [[Circuit-network_Cookbook|circuit network cookbook]] that you may find helpful to learn and refer to about circuit networks.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Input Isolator &amp;amp; Gate ==&lt;br /&gt;
An arithmetic combinator set to (In: Each + 0, Out: Each) can be used to swap wire colors and as an isolator to prevent downstream logic from backfeeding into the circuit network&#039;s inputs.&lt;br /&gt;
&lt;br /&gt;
A decider combinator set to (Out: Everything, Input-&amp;gt; Output) will also function as an isolator as long as the set logic condition is true. This can also selectively pass or &#039;gate&#039; inputs only when desired. This could be used to sequentially poll remote train stations for their chest contents, and include only desired stations.&lt;br /&gt;
&lt;br /&gt;
== Set/Reset Latching Switch ==&lt;br /&gt;
You want something to SET a trigger at some quantity, but then STAY on until that quantity hits some other value, the RESET value. You&#039;ll need one decider combinator and one arithmetic combinator. Two decider combinators and a constant combinator can also be used for more complex multi-channel conditions.&lt;br /&gt;
&lt;br /&gt;
Setup the first decider combinator to the desired set conditional and to output a 1. Then connect the output to the input of an arithmetic combinator, and configure it to multiply by the bias value, the difference between the set and reset values, and wire the arithmetic output to the input of the decider. The arithmetic output channel MUST be set the same as the decider&#039;s input channel. That&#039;s it! Whenever your set conditional is reached, the decider will output a &#039;1&#039;, and the bias of the arithmetic combinator will be applied. This will &#039;hold&#039; the output true until the value goes back below the reset point.&lt;br /&gt;
&lt;br /&gt;
Here&#039;s a more specific example : &lt;br /&gt;
i want the pump to run when petrol reach 2000, and turn off when reach 200.&amp;lt;br&amp;gt;&lt;br /&gt;
only with green wire&amp;lt;br&amp;gt;&lt;br /&gt;
Tank -&amp;gt; in decider&amp;lt;br&amp;gt;&lt;br /&gt;
out decider-&amp;gt; in arithmetic&amp;lt;br&amp;gt;&lt;br /&gt;
out arithmetic -&amp;gt; in decider&amp;lt;br&amp;gt;&lt;br /&gt;
green wire from in decider, to pump&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Pump have the same condition as the decider (Petrol &amp;gt; 2000)&lt;br /&gt;
&lt;br /&gt;
Decider : Petrol &amp;gt; 2000&amp;lt;br&amp;gt;&lt;br /&gt;
out : A = 1&amp;lt;br&amp;gt;&lt;br /&gt;
Arithmetic : A x 1800 (2000 - 200 )&amp;lt;br&amp;gt;&lt;br /&gt;
out : petrol&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:Factorio combinator switch.png|620px]]&lt;br /&gt;
&lt;br /&gt;
== Comparing Outputs ==&lt;br /&gt;
&lt;br /&gt;
== Addressing Outposts ==&lt;br /&gt;
&lt;br /&gt;
== Smart Train Loading ==&lt;br /&gt;
&lt;br /&gt;
Initially designed by [https://www.youtube.com/user/Darkphade MadZuri],&lt;br /&gt;
&lt;br /&gt;
This solves the problem of loading logistics into chests, which tend to be unequal and is slower in the rate of loading logistics into the cargo of trains.&lt;br /&gt;
&lt;br /&gt;
To setup the design, you require an Arithmetic Combinator, as well as Red and Green wires. &#039;&#039;&#039;Wire all the chests used, to the input of the Arithmetic Combinator&#039;&#039;&#039;. &#039;&#039;&#039;Then write (Logistics Item / -Amount of chests) and as the output as the Logistics Item in the Arithmetic Combinator&#039;&#039;&#039;, this will average the amount of items within the chests. Lastly, &#039;&#039;&#039;wire all the inserters used to the output of the Arithmetic Combinator and have the other color of the wire be wired to the adjacent chest&#039;&#039;&#039;. &#039;&#039;&#039;Have the inserters enabled when Logistics Item &amp;lt; 1&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
A more visual representation as well as questions for the design can be found [https://www.reddit.com/r/factorio/comments/4e03g2/madzuris_smart_loading_train_station_guide/ here].&lt;br /&gt;
&lt;br /&gt;
Explanation of why this works:&lt;br /&gt;
It compares the average amount of total items within the chests and the chest adjacent to the inserter so that it activates when the average number of items is higher than the amount within the chest.&lt;br /&gt;
The reason for why the division denominator is negative is because if the items in the chests are 0, it basically makes it so that it adds 1 to the equation.&lt;br /&gt;
&lt;br /&gt;
== Oil Control ==&lt;br /&gt;
&lt;br /&gt;
== Memory ==&lt;br /&gt;
How to store a constant value for later use, either for a basic counter or for more advanced logic. A decider combinator wired output tied to input and configured greater than zero (for positive values), input -&amp;gt; output will &#039;hold&#039; a value, as long as all other inputs on the network are zero.&lt;br /&gt;
&lt;br /&gt;
Any non-zero input condition will create a basic clock; incrementing the stored value by the sum of all connected input values every cycle. A single pulse of an input will cause a single increment by the pulsed value. Reset to zero occurs whenever the set condition is no longer met, or if a negative pulse equal to the input occurs.&lt;br /&gt;
&lt;br /&gt;
== Basic Clocks ==&lt;br /&gt;
Clocks are constructed by having the output of a combinator tied back to its own input, such that every cycle advances its own count. Either the arithmetic combinator or the decider combinator can be used.&lt;br /&gt;
&lt;br /&gt;
An arithmetic combinator tied to itself is fun to watch and will happily run-away, but requires additional control logic to reset.&lt;br /&gt;
&lt;br /&gt;
A self-resetting clock requires just a single decider combinator with output wired to input and configured with Less Than (&amp;lt;) and Input -&amp;gt; Output. When a constant combinator is then connected to the input, every cycle it will count up by the value of the Constant Combinator until the set conditional value is reached, then output a zero which will be summed with the constant combinator, and reset the process.&lt;br /&gt;
&lt;br /&gt;
[[File:Timer.png|500px]]&lt;br /&gt;
&#039;&#039;30 ticks is the ceiling for Signal 1; which is continuously added.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The clock sequence will not include zero, will begin at the value set by the constant combinator, and will include whatever value eventually causes the conditional to be false. An arithmetic combinator can modify the clock sequence but remember its outputs will occur one cycle later than the clock cycle values.&lt;br /&gt;
&lt;br /&gt;
== Pulse Generators ==&lt;br /&gt;
&lt;br /&gt;
Connecting an additional (=) decider combinator to the output of a basic clock will create a pulse generator, and will pulse a single output every time the clock cycles through the set condition. Any output value can be used, either directly from the clock sequence (input-&amp;gt;output), a 1, or some value on a separate logic channel on the circuit network, such as set by a constant combinator. or by the circuit network.&amp;lt;br /&amp;gt;&lt;br /&gt;
[[File:PulseGen.png|500px]]&lt;br /&gt;
*&#039;&#039;The value 1 can be written as any positive integer, so long as it is within the cap or ceiling of your timer.&#039;&#039;&lt;br /&gt;
*&#039;&#039;As an example from the above timer, this light will pulse every 1st tick after the timer reaches 30 ticks, making it pulse 1/30th of a second, as Factorio updates at 60 times per second.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Counter ==&lt;br /&gt;
A counter is used to count the number of input events, and output the sum of that count. Any pulsing input into a decider combinator configured input -&amp;gt; output and wired between output and input will create a counter, but this input must be zero at all other times or else the combinator will run away like a clock. A pulse generator is normally used to accomplish this. Combining several gating decider isolators set with sequential conditionals, a clock, and a pulse generator to the input of a counter will allow remote polling and counting of each isolator&#039;s contents.&lt;br /&gt;
&lt;br /&gt;
== Logic Gates ==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Unary NOT&#039;&#039;&#039;&lt;br /&gt;
----&lt;br /&gt;
[[File:NOT.png|415px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Binary OR&#039;&#039;&#039;&lt;br /&gt;
----&lt;br /&gt;
[[File:OR.png|300px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 2!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1  || 1&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Binary NOR&#039;&#039;&#039;&lt;br /&gt;
----&lt;br /&gt;
[[File:NOR.png|415px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 2!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Binary XOR&#039;&#039;&#039;&lt;br /&gt;
----&lt;br /&gt;
[[File:XOR.png|300px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 1!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 ||  0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 ||  1 || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 ||  0 || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 ||  1 || 0&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Binary AND&#039;&#039;&#039;&lt;br /&gt;
----&lt;br /&gt;
[[File:AND.png|530px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 2!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1 || 1&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Trinary AND&#039;&#039;&#039;&lt;br /&gt;
----&lt;br /&gt;
[[File:TrinaryAND.png|415px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 2!!Input 3!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0  || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1  || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0  || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1  || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0  || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1  || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0  || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1  || 1  || 1&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Binary NAND&#039;&#039;&#039;&lt;br /&gt;
----&lt;br /&gt;
[[File:NAND.png|300px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 2!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Binary XNOR/XAND&#039;&#039;&#039;&lt;br /&gt;
----&lt;br /&gt;
[[File:XAND.png|300px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 2!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1  || 1&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Memory Cells ==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Simple Latch&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Have a Decider Combinator connect to itself with its input and output using a different colour of wire, say green wire when your output and input is red wire.&lt;br /&gt;
&lt;br /&gt;
[[File:SimpleLatchv2.png|300px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Output 1!!Input 1!!Input 2!! Output 1 (t+1)&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 0 || 1&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0 || 0 || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1 || 0 || 1 &#039;&#039;(2)&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0 || 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1 || 1 || 1 &#039;&#039;(2)&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&#039;&#039;Output 1 is the green wire loop seen in the picture, it carries the value to latch.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Binary Cell&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
RS NOR Latch&lt;br /&gt;
[[File:RS-NOR.png|500px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Advanced Cell&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Cell for storing a positive value:&lt;br /&gt;
&lt;br /&gt;
[[File:AdvancedMemoryCell.png|500px]]&lt;br /&gt;
&lt;br /&gt;
Connect the desired value as signal 3 on the right side to set the memory cell and connect a negative value as signal 3 to reset the cell.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Address Enable Switch&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== See Also ==&lt;br /&gt;
*[http://www.factorioforums.com/forum/viewtopic.php?f=18&amp;amp;t=14556 Combinators 101 (Tutorial)]&lt;br /&gt;
*[[Arithmetic combinator]]&lt;br /&gt;
*[[Constant Combinator]]&lt;br /&gt;
*[[Decider Combinator]]&lt;br /&gt;
*[[Circuit network]]&lt;br /&gt;
*[[Circuit-network_Cookbook]]&lt;br /&gt;
[[Category:Tutorial]]&lt;br /&gt;
[[Category:English page]]&lt;/div&gt;</summary>
		<author><name>My3DS</name></author>
	</entry>
	<entry>
		<id>https://wiki.factorio.com/index.php?title=Tutorial:Combinator_tutorial&amp;diff=133320</id>
		<title>Tutorial:Combinator tutorial</title>
		<link rel="alternate" type="text/html" href="https://wiki.factorio.com/index.php?title=Tutorial:Combinator_tutorial&amp;diff=133320"/>
		<updated>2016-12-05T00:55:51Z</updated>

		<summary type="html">&lt;p&gt;My3DS: /* Pulse Generators */ added annotations&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
Combinator logic is achieved by cross-connecting outputs to inputs in such a way to achieve the desired logic. While advanced logic requires a multitude of combinators, some very useful basic logic can be achieved using only a handful of combinators. &#039;&#039;&#039;Combinator logic works because Factorio only updates at 60 times per second, such that combinators analyze their logic in a step, and then sum and/or decide the resulting output values on the next step.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
When logic values are computed by combinators, the outputs are not recognized by the circuit network until the following step. So when a decider combinator is used to detect a certain input condition, it&#039;s output value will not take effect on the circuit network until the next step. &#039;&#039;&#039;This behavior is important to remember and can result in sequencing errors and significant delays when multiple combinators are connected in series.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Circuit wires act like a wire bus in electronics, it carries information in the connected wires, meaning that &#039;&#039;&#039;if there are similar signals on a wire, it will add them automatically, unless if it is a different signal, that means it will be carried in that wire as well, but as a different signal.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
When cross-connecting combinators &#039;&#039;&#039;it&#039;s good practice to use the unused color to cross-connect, this will split the input and output networks and prevent unwanted inputs from accidentally connecting to a larger circuit network.&#039;&#039;&#039; Combinators will sum the red &amp;amp;/or green inputs prior to calculation, so either color can be used when wiring the output back to the input, but in most cases, it is more useful to use the opposing colour of the wire so that it will not interfere with the resulting output and input.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;There is also an example heavy [[Circuit-network_Cookbook|circuit network cookbook]] that you may find helpful to learn and refer to about circuit networks.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Input Isolator &amp;amp; Gate ==&lt;br /&gt;
An arithmetic combinator set to (In: Each + 0, Out: Each) can be used to swap wire colors and as an isolator to prevent downstream logic from backfeeding into the circuit network&#039;s inputs.&lt;br /&gt;
&lt;br /&gt;
A decider combinator set to (Out: Everything, Input-&amp;gt; Output) will also function as an isolator as long as the set logic condition is true. This can also selectively pass or &#039;gate&#039; inputs only when desired. This could be used to sequentially poll remote train stations for their chest contents, and include only desired stations.&lt;br /&gt;
&lt;br /&gt;
== Set/Reset Latching Switch ==&lt;br /&gt;
You want something to SET a trigger at some quantity, but then STAY on until that quantity hits some other value, the RESET value. You&#039;ll need one decider combinator and one arithmetic combinator. Two decider combinators and a constant combinator can also be used for more complex multi-channel conditions.&lt;br /&gt;
&lt;br /&gt;
Setup the first decider combinator to the desired set conditional and to output a 1. Then connect the output to the input of an arithmetic combinator, and configure it to multiply by the bias value, the difference between the set and reset values, and wire the arithmetic output to the input of the decider. The arithmetic output channel MUST be set the same as the decider&#039;s input channel. That&#039;s it! Whenever your set conditional is reached, the decider will output a &#039;1&#039;, and the bias of the arithmetic combinator will be applied. This will &#039;hold&#039; the output true until the value goes back below the reset point.&lt;br /&gt;
&lt;br /&gt;
Here&#039;s a more specific example : &lt;br /&gt;
i want the pump to run when petrol reach 2000, and turn off when reach 200.&amp;lt;br&amp;gt;&lt;br /&gt;
only with green wire&amp;lt;br&amp;gt;&lt;br /&gt;
Tank -&amp;gt; in decider&amp;lt;br&amp;gt;&lt;br /&gt;
out decider-&amp;gt; in arithmetic&amp;lt;br&amp;gt;&lt;br /&gt;
out arithmetic -&amp;gt; in decider&amp;lt;br&amp;gt;&lt;br /&gt;
green wire from in decider, to pump&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Pump have the same condition as the decider (Petrol &amp;gt; 2000)&lt;br /&gt;
&lt;br /&gt;
Decider : Petrol &amp;gt; 2000&amp;lt;br&amp;gt;&lt;br /&gt;
out : A = 1&amp;lt;br&amp;gt;&lt;br /&gt;
Arithmetic : A x 1800 (2000 - 200 )&amp;lt;br&amp;gt;&lt;br /&gt;
out : petrol&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:Factorio combinator switch.png|620px]]&lt;br /&gt;
&lt;br /&gt;
== Comparing Outputs ==&lt;br /&gt;
&lt;br /&gt;
== Addressing Outposts ==&lt;br /&gt;
&lt;br /&gt;
== Smart Train Loading ==&lt;br /&gt;
&lt;br /&gt;
Initially designed by [https://www.youtube.com/user/Darkphade MadZuri],&lt;br /&gt;
&lt;br /&gt;
This solves the problem of loading logistics into chests, which tend to be unequal and is slower in the rate of loading logistics into the cargo of trains.&lt;br /&gt;
&lt;br /&gt;
To setup the design, you require an Arithmetic Combinator, as well as Red and Green wires. &#039;&#039;&#039;Wire all the chests used, to the input of the Arithmetic Combinator&#039;&#039;&#039;. &#039;&#039;&#039;Then write (Logistics Item / -Amount of chests) and as the output as the Logistics Item in the Arithmetic Combinator&#039;&#039;&#039;, this will average the amount of items within the chests. Lastly, &#039;&#039;&#039;wire all the inserters used to the output of the Arithmetic Combinator and have the other color of the wire be wired to the adjacent chest&#039;&#039;&#039;. &#039;&#039;&#039;Have the inserters enabled when Logistics Item &amp;lt; 1&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
A more visual representation as well as questions for the design can be found [https://www.reddit.com/r/factorio/comments/4e03g2/madzuris_smart_loading_train_station_guide/ here].&lt;br /&gt;
&lt;br /&gt;
Explanation of why this works:&lt;br /&gt;
It compares the average amount of total items within the chests and the chest adjacent to the inserter so that it activates when the average number of items is higher than the amount within the chest.&lt;br /&gt;
The reason for why the division denominator is negative is because if the items in the chests are 0, it basically makes it so that it adds 1 to the equation.&lt;br /&gt;
&lt;br /&gt;
== Oil Control ==&lt;br /&gt;
&lt;br /&gt;
== Memory ==&lt;br /&gt;
How to store a constant value for later use, either for a basic counter or for more advanced logic. A decider combinator wired output tied to input and configured greater than zero (for positive values), input -&amp;gt; output will &#039;hold&#039; a value, as long as all other inputs on the network are zero.&lt;br /&gt;
&lt;br /&gt;
Any non-zero input condition will create a basic clock; incrementing the stored value by the sum of all connected input values every cycle. A single pulse of an input will cause a single increment by the pulsed value. Reset to zero occurs whenever the set condition is no longer met, or if a negative pulse equal to the input occurs.&lt;br /&gt;
&lt;br /&gt;
== Basic Clocks ==&lt;br /&gt;
Clocks are constructed by having the output of a combinator tied back to its own input, such that every cycle advances its own count. Either the arithmetic combinator or the decider combinator can be used.&lt;br /&gt;
&lt;br /&gt;
An arithmetic combinator tied to itself is fun to watch and will happily run-away, but requires additional control logic to reset.&lt;br /&gt;
&lt;br /&gt;
A self-resetting clock requires just a single decider combinator with output wired to input and configured with Less Than (&amp;lt;) and Input -&amp;gt; Output. When a constant combinator is then connected to the input, every cycle it will count up by the value of the Constant Combinator until the set conditional value is reached, then output a zero which will be summed with the constant combinator, and reset the process.&lt;br /&gt;
&lt;br /&gt;
[[File:Timer.png|500px]]&lt;br /&gt;
&#039;&#039;30 ticks is the ceiling for Signal 1; which is continuously added.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The clock sequence will not include zero, will begin at the value set by the constant combinator, and will include whatever value eventually causes the conditional to be false. An arithmetic combinator can modify the clock sequence but remember its outputs will occur one cycle later than the clock cycle values.&lt;br /&gt;
&lt;br /&gt;
== Pulse Generators ==&lt;br /&gt;
&lt;br /&gt;
Connecting an additional (=) decider combinator to the output of a basic clock will create a pulse generator, and will pulse a single output every time the clock cycles through the set condition. Any output value can be used, either directly from the clock sequence (input-&amp;gt;output), a 1, or some value on a separate logic channel on the circuit network, such as set by a constant combinator. or by the circuit network.&amp;lt;br /&amp;gt;&lt;br /&gt;
[[File:PulseGen.png|500px]]&lt;br /&gt;
&#039;&#039;The value 1 can be written as any positive integer, so long as it is within the cap or ceiling of your timer.&#039;&#039;&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;As an example from the above timer, this light will pulse every 1st tick after the timer reaches 30 ticks, making it pulse 1/30th of a second, as Factorio updates at 60 times per second.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Counter ==&lt;br /&gt;
A counter is used to count the number of input events, and output the sum of that count. Any pulsing input into a decider combinator configured input -&amp;gt; output and wired between output and input will create a counter, but this input must be zero at all other times or else the combinator will run away like a clock. A pulse generator is normally used to accomplish this. Combining several gating decider isolators set with sequential conditionals, a clock, and a pulse generator to the input of a counter will allow remote polling and counting of each isolator&#039;s contents.&lt;br /&gt;
&lt;br /&gt;
== Logic Gates ==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Unary NOT&#039;&#039;&#039;&lt;br /&gt;
----&lt;br /&gt;
[[File:NOT.png|415px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Binary OR&#039;&#039;&#039;&lt;br /&gt;
----&lt;br /&gt;
[[File:OR.png|300px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 2!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1  || 1&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Binary NOR&#039;&#039;&#039;&lt;br /&gt;
----&lt;br /&gt;
[[File:NOR.png|415px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 2!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Binary XOR&#039;&#039;&#039;&lt;br /&gt;
----&lt;br /&gt;
[[File:XOR.png|300px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 1!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 ||  0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 ||  1 || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 ||  0 || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 ||  1 || 0&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Binary AND&#039;&#039;&#039;&lt;br /&gt;
----&lt;br /&gt;
[[File:AND.png|530px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 2!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1 || 1&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Trinary AND&#039;&#039;&#039;&lt;br /&gt;
----&lt;br /&gt;
[[File:TrinaryAND.png|415px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 2!!Input 3!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0  || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1  || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0  || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1  || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0  || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1  || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0  || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1  || 1  || 1&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Binary NAND&#039;&#039;&#039;&lt;br /&gt;
----&lt;br /&gt;
[[File:NAND.png|300px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 2!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Binary XNOR/XAND&#039;&#039;&#039;&lt;br /&gt;
----&lt;br /&gt;
[[File:XAND.png|300px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 2!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1  || 1&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Memory Cells ==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Simple Latch&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Have a Decider Combinator connect to itself with its input and output using a different colour of wire, say green wire when your output and input is red wire.&lt;br /&gt;
&lt;br /&gt;
[[File:SimpleLatchv2.png|300px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Output 1!!Input 1!!Input 2!! Output 1 (t+1)&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 0 || 1&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0 || 0 || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1 || 0 || 1 &#039;&#039;(2)&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0 || 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1 || 1 || 1 &#039;&#039;(2)&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&#039;&#039;Output 1 is the green wire loop seen in the picture, it carries the value to latch.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Binary Cell&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
RS NOR Latch&lt;br /&gt;
[[File:RS-NOR.png|500px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Advanced Cell&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Cell for storing a positive value:&lt;br /&gt;
&lt;br /&gt;
[[File:AdvancedMemoryCell.png|500px]]&lt;br /&gt;
&lt;br /&gt;
Connect the desired value as signal 3 on the right side to set the memory cell and connect a negative value as signal 3 to reset the cell.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Address Enable Switch&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== See Also ==&lt;br /&gt;
*[http://www.factorioforums.com/forum/viewtopic.php?f=18&amp;amp;t=14556 Combinators 101 (Tutorial)]&lt;br /&gt;
*[[Arithmetic combinator]]&lt;br /&gt;
*[[Constant Combinator]]&lt;br /&gt;
*[[Decider Combinator]]&lt;br /&gt;
*[[Circuit network]]&lt;br /&gt;
*[[Circuit-network_Cookbook]]&lt;br /&gt;
[[Category:Tutorial]]&lt;br /&gt;
[[Category:English page]]&lt;/div&gt;</summary>
		<author><name>My3DS</name></author>
	</entry>
	<entry>
		<id>https://wiki.factorio.com/index.php?title=File:PulseGen.png&amp;diff=133319</id>
		<title>File:PulseGen.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.factorio.com/index.php?title=File:PulseGen.png&amp;diff=133319"/>
		<updated>2016-12-05T00:49:47Z</updated>

		<summary type="html">&lt;p&gt;My3DS: My3DS uploaded a new version of File:PulseGen.png&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>My3DS</name></author>
	</entry>
	<entry>
		<id>https://wiki.factorio.com/index.php?title=Tutorial:Combinator_tutorial&amp;diff=133318</id>
		<title>Tutorial:Combinator tutorial</title>
		<link rel="alternate" type="text/html" href="https://wiki.factorio.com/index.php?title=Tutorial:Combinator_tutorial&amp;diff=133318"/>
		<updated>2016-12-05T00:46:52Z</updated>

		<summary type="html">&lt;p&gt;My3DS: /* Basic Clocks */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
Combinator logic is achieved by cross-connecting outputs to inputs in such a way to achieve the desired logic. While advanced logic requires a multitude of combinators, some very useful basic logic can be achieved using only a handful of combinators. &#039;&#039;&#039;Combinator logic works because Factorio only updates at 60 times per second, such that combinators analyze their logic in a step, and then sum and/or decide the resulting output values on the next step.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
When logic values are computed by combinators, the outputs are not recognized by the circuit network until the following step. So when a decider combinator is used to detect a certain input condition, it&#039;s output value will not take effect on the circuit network until the next step. &#039;&#039;&#039;This behavior is important to remember and can result in sequencing errors and significant delays when multiple combinators are connected in series.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Circuit wires act like a wire bus in electronics, it carries information in the connected wires, meaning that &#039;&#039;&#039;if there are similar signals on a wire, it will add them automatically, unless if it is a different signal, that means it will be carried in that wire as well, but as a different signal.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
When cross-connecting combinators &#039;&#039;&#039;it&#039;s good practice to use the unused color to cross-connect, this will split the input and output networks and prevent unwanted inputs from accidentally connecting to a larger circuit network.&#039;&#039;&#039; Combinators will sum the red &amp;amp;/or green inputs prior to calculation, so either color can be used when wiring the output back to the input, but in most cases, it is more useful to use the opposing colour of the wire so that it will not interfere with the resulting output and input.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;There is also an example heavy [[Circuit-network_Cookbook|circuit network cookbook]] that you may find helpful to learn and refer to about circuit networks.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Input Isolator &amp;amp; Gate ==&lt;br /&gt;
An arithmetic combinator set to (In: Each + 0, Out: Each) can be used to swap wire colors and as an isolator to prevent downstream logic from backfeeding into the circuit network&#039;s inputs.&lt;br /&gt;
&lt;br /&gt;
A decider combinator set to (Out: Everything, Input-&amp;gt; Output) will also function as an isolator as long as the set logic condition is true. This can also selectively pass or &#039;gate&#039; inputs only when desired. This could be used to sequentially poll remote train stations for their chest contents, and include only desired stations.&lt;br /&gt;
&lt;br /&gt;
== Set/Reset Latching Switch ==&lt;br /&gt;
You want something to SET a trigger at some quantity, but then STAY on until that quantity hits some other value, the RESET value. You&#039;ll need one decider combinator and one arithmetic combinator. Two decider combinators and a constant combinator can also be used for more complex multi-channel conditions.&lt;br /&gt;
&lt;br /&gt;
Setup the first decider combinator to the desired set conditional and to output a 1. Then connect the output to the input of an arithmetic combinator, and configure it to multiply by the bias value, the difference between the set and reset values, and wire the arithmetic output to the input of the decider. The arithmetic output channel MUST be set the same as the decider&#039;s input channel. That&#039;s it! Whenever your set conditional is reached, the decider will output a &#039;1&#039;, and the bias of the arithmetic combinator will be applied. This will &#039;hold&#039; the output true until the value goes back below the reset point.&lt;br /&gt;
&lt;br /&gt;
Here&#039;s a more specific example : &lt;br /&gt;
i want the pump to run when petrol reach 2000, and turn off when reach 200.&amp;lt;br&amp;gt;&lt;br /&gt;
only with green wire&amp;lt;br&amp;gt;&lt;br /&gt;
Tank -&amp;gt; in decider&amp;lt;br&amp;gt;&lt;br /&gt;
out decider-&amp;gt; in arithmetic&amp;lt;br&amp;gt;&lt;br /&gt;
out arithmetic -&amp;gt; in decider&amp;lt;br&amp;gt;&lt;br /&gt;
green wire from in decider, to pump&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Pump have the same condition as the decider (Petrol &amp;gt; 2000)&lt;br /&gt;
&lt;br /&gt;
Decider : Petrol &amp;gt; 2000&amp;lt;br&amp;gt;&lt;br /&gt;
out : A = 1&amp;lt;br&amp;gt;&lt;br /&gt;
Arithmetic : A x 1800 (2000 - 200 )&amp;lt;br&amp;gt;&lt;br /&gt;
out : petrol&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:Factorio combinator switch.png|620px]]&lt;br /&gt;
&lt;br /&gt;
== Comparing Outputs ==&lt;br /&gt;
&lt;br /&gt;
== Addressing Outposts ==&lt;br /&gt;
&lt;br /&gt;
== Smart Train Loading ==&lt;br /&gt;
&lt;br /&gt;
Initially designed by [https://www.youtube.com/user/Darkphade MadZuri],&lt;br /&gt;
&lt;br /&gt;
This solves the problem of loading logistics into chests, which tend to be unequal and is slower in the rate of loading logistics into the cargo of trains.&lt;br /&gt;
&lt;br /&gt;
To setup the design, you require an Arithmetic Combinator, as well as Red and Green wires. &#039;&#039;&#039;Wire all the chests used, to the input of the Arithmetic Combinator&#039;&#039;&#039;. &#039;&#039;&#039;Then write (Logistics Item / -Amount of chests) and as the output as the Logistics Item in the Arithmetic Combinator&#039;&#039;&#039;, this will average the amount of items within the chests. Lastly, &#039;&#039;&#039;wire all the inserters used to the output of the Arithmetic Combinator and have the other color of the wire be wired to the adjacent chest&#039;&#039;&#039;. &#039;&#039;&#039;Have the inserters enabled when Logistics Item &amp;lt; 1&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
A more visual representation as well as questions for the design can be found [https://www.reddit.com/r/factorio/comments/4e03g2/madzuris_smart_loading_train_station_guide/ here].&lt;br /&gt;
&lt;br /&gt;
Explanation of why this works:&lt;br /&gt;
It compares the average amount of total items within the chests and the chest adjacent to the inserter so that it activates when the average number of items is higher than the amount within the chest.&lt;br /&gt;
The reason for why the division denominator is negative is because if the items in the chests are 0, it basically makes it so that it adds 1 to the equation.&lt;br /&gt;
&lt;br /&gt;
== Oil Control ==&lt;br /&gt;
&lt;br /&gt;
== Memory ==&lt;br /&gt;
How to store a constant value for later use, either for a basic counter or for more advanced logic. A decider combinator wired output tied to input and configured greater than zero (for positive values), input -&amp;gt; output will &#039;hold&#039; a value, as long as all other inputs on the network are zero.&lt;br /&gt;
&lt;br /&gt;
Any non-zero input condition will create a basic clock; incrementing the stored value by the sum of all connected input values every cycle. A single pulse of an input will cause a single increment by the pulsed value. Reset to zero occurs whenever the set condition is no longer met, or if a negative pulse equal to the input occurs.&lt;br /&gt;
&lt;br /&gt;
== Basic Clocks ==&lt;br /&gt;
Clocks are constructed by having the output of a combinator tied back to its own input, such that every cycle advances its own count. Either the arithmetic combinator or the decider combinator can be used.&lt;br /&gt;
&lt;br /&gt;
An arithmetic combinator tied to itself is fun to watch and will happily run-away, but requires additional control logic to reset.&lt;br /&gt;
&lt;br /&gt;
A self-resetting clock requires just a single decider combinator with output wired to input and configured with Less Than (&amp;lt;) and Input -&amp;gt; Output. When a constant combinator is then connected to the input, every cycle it will count up by the value of the Constant Combinator until the set conditional value is reached, then output a zero which will be summed with the constant combinator, and reset the process.&lt;br /&gt;
&lt;br /&gt;
[[File:Timer.png|500px]]&lt;br /&gt;
&#039;&#039;30 ticks is the ceiling for Signal 1; which is continuously added.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The clock sequence will not include zero, will begin at the value set by the constant combinator, and will include whatever value eventually causes the conditional to be false. An arithmetic combinator can modify the clock sequence but remember its outputs will occur one cycle later than the clock cycle values.&lt;br /&gt;
&lt;br /&gt;
== Pulse Generators ==&lt;br /&gt;
&lt;br /&gt;
Connecting an additional (=) decider combinator to the output of a basic clock will create a pulse generator, and will pulse a single output every time the clock cycles through the set condition. Any output value can be used, either directly from the clock sequence (input-&amp;gt;output), a 1, or some value on a separate logic channel on the circuit network, such as set by a constant combinator. or by the circuit network.&amp;lt;br /&amp;gt;&lt;br /&gt;
[[File:PulseGen.png|500px]]&lt;br /&gt;
&#039;&#039;The value 0 can be written as any positive integer, so long as it is within the cap or ceiling of your timer.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Counter ==&lt;br /&gt;
A counter is used to count the number of input events, and output the sum of that count. Any pulsing input into a decider combinator configured input -&amp;gt; output and wired between output and input will create a counter, but this input must be zero at all other times or else the combinator will run away like a clock. A pulse generator is normally used to accomplish this. Combining several gating decider isolators set with sequential conditionals, a clock, and a pulse generator to the input of a counter will allow remote polling and counting of each isolator&#039;s contents.&lt;br /&gt;
&lt;br /&gt;
== Logic Gates ==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Unary NOT&#039;&#039;&#039;&lt;br /&gt;
----&lt;br /&gt;
[[File:NOT.png|415px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Binary OR&#039;&#039;&#039;&lt;br /&gt;
----&lt;br /&gt;
[[File:OR.png|300px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 2!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1  || 1&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Binary NOR&#039;&#039;&#039;&lt;br /&gt;
----&lt;br /&gt;
[[File:NOR.png|415px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 2!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Binary XOR&#039;&#039;&#039;&lt;br /&gt;
----&lt;br /&gt;
[[File:XOR.png|300px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 1!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 ||  0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 ||  1 || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 ||  0 || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 ||  1 || 0&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Binary AND&#039;&#039;&#039;&lt;br /&gt;
----&lt;br /&gt;
[[File:AND.png|530px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 2!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1 || 1&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Trinary AND&#039;&#039;&#039;&lt;br /&gt;
----&lt;br /&gt;
[[File:TrinaryAND.png|415px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 2!!Input 3!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0  || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1  || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0  || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1  || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0  || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1  || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0  || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1  || 1  || 1&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Binary NAND&#039;&#039;&#039;&lt;br /&gt;
----&lt;br /&gt;
[[File:NAND.png|300px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 2!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Binary XNOR/XAND&#039;&#039;&#039;&lt;br /&gt;
----&lt;br /&gt;
[[File:XAND.png|300px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 2!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1  || 1&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Memory Cells ==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Simple Latch&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Have a Decider Combinator connect to itself with its input and output using a different colour of wire, say green wire when your output and input is red wire.&lt;br /&gt;
&lt;br /&gt;
[[File:SimpleLatchv2.png|300px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Output 1!!Input 1!!Input 2!! Output 1 (t+1)&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 0 || 1&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0 || 0 || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1 || 0 || 1 &#039;&#039;(2)&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0 || 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1 || 1 || 1 &#039;&#039;(2)&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&#039;&#039;Output 1 is the green wire loop seen in the picture, it carries the value to latch.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Binary Cell&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
RS NOR Latch&lt;br /&gt;
[[File:RS-NOR.png|500px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Advanced Cell&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Cell for storing a positive value:&lt;br /&gt;
&lt;br /&gt;
[[File:AdvancedMemoryCell.png|500px]]&lt;br /&gt;
&lt;br /&gt;
Connect the desired value as signal 3 on the right side to set the memory cell and connect a negative value as signal 3 to reset the cell.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Address Enable Switch&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== See Also ==&lt;br /&gt;
*[http://www.factorioforums.com/forum/viewtopic.php?f=18&amp;amp;t=14556 Combinators 101 (Tutorial)]&lt;br /&gt;
*[[Arithmetic combinator]]&lt;br /&gt;
*[[Constant Combinator]]&lt;br /&gt;
*[[Decider Combinator]]&lt;br /&gt;
*[[Circuit network]]&lt;br /&gt;
*[[Circuit-network_Cookbook]]&lt;br /&gt;
[[Category:Tutorial]]&lt;br /&gt;
[[Category:English page]]&lt;/div&gt;</summary>
		<author><name>My3DS</name></author>
	</entry>
	<entry>
		<id>https://wiki.factorio.com/index.php?title=File:Timer.png&amp;diff=133317</id>
		<title>File:Timer.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.factorio.com/index.php?title=File:Timer.png&amp;diff=133317"/>
		<updated>2016-12-05T00:45:54Z</updated>

		<summary type="html">&lt;p&gt;My3DS: My3DS uploaded a new version of File:Timer.png&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>My3DS</name></author>
	</entry>
	<entry>
		<id>https://wiki.factorio.com/index.php?title=Tutorial:Combinator_tutorial&amp;diff=133269</id>
		<title>Tutorial:Combinator tutorial</title>
		<link rel="alternate" type="text/html" href="https://wiki.factorio.com/index.php?title=Tutorial:Combinator_tutorial&amp;diff=133269"/>
		<updated>2016-12-04T00:46:27Z</updated>

		<summary type="html">&lt;p&gt;My3DS: /* Pulse Generators */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
Combinator logic is achieved by cross-connecting outputs to inputs in such a way to achieve the desired logic. While advanced logic requires a multitude of combinators, some very useful basic logic can be achieved using only a handful of combinators. &#039;&#039;&#039;Combinator logic works because Factorio only updates at 60 times per second, such that combinators analyze their logic in a step, and then sum and/or decide the resulting output values on the next step.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
When logic values are computed by combinators, the outputs are not recognized by the circuit network until the following step. So when a decider combinator is used to detect a certain input condition, it&#039;s output value will not take effect on the circuit network until the next step. &#039;&#039;&#039;This behavior is important to remember and can result in sequencing errors and significant delays when multiple combinators are connected in series.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Circuit wires act like a wire bus in electronics, it carries information in the connected wires, meaning that &#039;&#039;&#039;if there are similar signals on a wire, it will add them automatically, unless if it is a different signal, that means it will be carried in that wire as well, but as a different signal.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
When cross-connecting combinators &#039;&#039;&#039;it&#039;s good practice to use the unused color to cross-connect, this will split the input and output networks and prevent unwanted inputs from accidentally connecting to a larger circuit network.&#039;&#039;&#039; Combinators will sum the red &amp;amp;/or green inputs prior to calculation, so either color can be used when wiring the output back to the input, but in most cases, it is more useful to use the opposing colour of the wire so that it will not interfere with the resulting output and input.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;There is also an example heavy [[Circuit-network_Cookbook|circuit network cookbook]] that you may find helpful to learn and refer to about circuit networks.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Input Isolator &amp;amp; Gate ==&lt;br /&gt;
An arithmetic combinator set to (In: Each + 0, Out: Each) can be used to swap wire colors and as an isolator to prevent downstream logic from backfeeding into the circuit network&#039;s inputs.&lt;br /&gt;
&lt;br /&gt;
A decider combinator set to (Out: Everything, Input-&amp;gt; Output) will also function as an isolator as long as the set logic condition is true. This can also selectively pass or &#039;gate&#039; inputs only when desired. This could be used to sequentially poll remote train stations for their chest contents, and include only desired stations.&lt;br /&gt;
&lt;br /&gt;
== Set/Reset Latching Switch ==&lt;br /&gt;
You want something to SET a trigger at some quantity, but then STAY on until that quantity hits some other value, the RESET value. You&#039;ll need one decider combinator and one arithmetic combinator. Two decider combinators and a constant combinator can also be used for more complex multi-channel conditions.&lt;br /&gt;
&lt;br /&gt;
Setup the first decider combinator to the desired set conditional and to output a 1. Then connect the output to the input of an arithmetic combinator, and configure it to multiply by the bias value, the difference between the set and reset values, and wire the arithmetic output to the input of the decider. The arithmetic output channel MUST be set the same as the decider&#039;s input channel. That&#039;s it! Whenever your set conditional is reached, the decider will output a &#039;1&#039;, and the bias of the arithmetic combinator will be applied. This will &#039;hold&#039; the output true until the value goes back below the reset point.&lt;br /&gt;
&lt;br /&gt;
Here&#039;s a more specific example : &lt;br /&gt;
i want the pump to run when petrol reach 2000, and turn off when reach 200.&amp;lt;br&amp;gt;&lt;br /&gt;
only with green wire&amp;lt;br&amp;gt;&lt;br /&gt;
Tank -&amp;gt; in decider&amp;lt;br&amp;gt;&lt;br /&gt;
out decider-&amp;gt; in arithmetic&amp;lt;br&amp;gt;&lt;br /&gt;
out arithmetic -&amp;gt; in decider&amp;lt;br&amp;gt;&lt;br /&gt;
green wire from in decider, to pump&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Pump have the same condition as the decider (Petrol &amp;gt; 2000)&lt;br /&gt;
&lt;br /&gt;
Decider : Petrol &amp;gt; 2000&amp;lt;br&amp;gt;&lt;br /&gt;
out : A = 1&amp;lt;br&amp;gt;&lt;br /&gt;
Arithmetic : A x 1800 (2000 - 200 )&amp;lt;br&amp;gt;&lt;br /&gt;
out : petrol&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:Factorio combinator switch.png|620px]]&lt;br /&gt;
&lt;br /&gt;
== Comparing Outputs ==&lt;br /&gt;
&lt;br /&gt;
== Addressing Outposts ==&lt;br /&gt;
&lt;br /&gt;
== Smart Train Loading ==&lt;br /&gt;
&lt;br /&gt;
Initially designed by [https://www.youtube.com/user/Darkphade MadZuri],&lt;br /&gt;
&lt;br /&gt;
This solves the problem of loading logistics into chests, which tend to be unequal and is slower in the rate of loading logistics into the cargo of trains.&lt;br /&gt;
&lt;br /&gt;
To setup the design, you require an Arithmetic Combinator, as well as Red and Green wires. &#039;&#039;&#039;Wire all the chests used, to the input of the Arithmetic Combinator&#039;&#039;&#039;. &#039;&#039;&#039;Then write (Logistics Item / -Amount of chests) and as the output as the Logistics Item in the Arithmetic Combinator&#039;&#039;&#039;, this will average the amount of items within the chests. Lastly, &#039;&#039;&#039;wire all the inserters used to the output of the Arithmetic Combinator and have the other color of the wire be wired to the adjacent chest&#039;&#039;&#039;. &#039;&#039;&#039;Have the inserters enabled when Logistics Item &amp;lt; 1&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
A more visual representation as well as questions for the design can be found [https://www.reddit.com/r/factorio/comments/4e03g2/madzuris_smart_loading_train_station_guide/ here].&lt;br /&gt;
&lt;br /&gt;
Explanation of why this works:&lt;br /&gt;
It compares the average amount of total items within the chests and the chest adjacent to the inserter so that it activates when the average number of items is higher than the amount within the chest.&lt;br /&gt;
The reason for why the division denominator is negative is because if the items in the chests are 0, it basically makes it so that it adds 1 to the equation.&lt;br /&gt;
&lt;br /&gt;
== Oil Control ==&lt;br /&gt;
&lt;br /&gt;
== Memory ==&lt;br /&gt;
How to store a constant value for later use, either for a basic counter or for more advanced logic. A decider combinator wired output tied to input and configured greater than zero (for positive values), input -&amp;gt; output will &#039;hold&#039; a value, as long as all other inputs on the network are zero.&lt;br /&gt;
&lt;br /&gt;
Any non-zero input condition will create a basic clock; incrementing the stored value by the sum of all connected input values every cycle. A single pulse of an input will cause a single increment by the pulsed value. Reset to zero occurs whenever the set condition is no longer met, or if a negative pulse equal to the input occurs.&lt;br /&gt;
&lt;br /&gt;
== Basic Clocks ==&lt;br /&gt;
Clocks are constructed by having the output of a combinator tied back to its own input, such that every cycle advances its own count. Either the arithmetic combinator or the decider combinator can be used.&lt;br /&gt;
&lt;br /&gt;
An arithmetic combinator tied to itself is fun to watch and will happily run-away, but requires additional control logic to reset.&lt;br /&gt;
&lt;br /&gt;
A self-resetting clock requires just a single decider combinator with output wired to input and configured with Less Than (&amp;lt;) and Input -&amp;gt; Output. When a constant combinator is then connected to the input, every cycle it will count up by the value of the Constant Combinator until the set conditional value is reached, then output a zero which will be summed with the constant combinator, and reset the process.&lt;br /&gt;
&lt;br /&gt;
[[File:Timer.png|500px]]&lt;br /&gt;
&#039;&#039;Signal 0 is the ceiling for Signal 1; which is continuously added.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The clock sequence will not include zero, will begin at the value set by the constant combinator, and will include whatever value eventually causes the conditional to be false. An arithmetic combinator can modify the clock sequence but remember its outputs will occur one cycle later than the clock cycle values.&lt;br /&gt;
&lt;br /&gt;
== Pulse Generators ==&lt;br /&gt;
&lt;br /&gt;
Connecting an additional (=) decider combinator to the output of a basic clock will create a pulse generator, and will pulse a single output every time the clock cycles through the set condition. Any output value can be used, either directly from the clock sequence (input-&amp;gt;output), a 1, or some value on a separate logic channel on the circuit network, such as set by a constant combinator. or by the circuit network.&amp;lt;br /&amp;gt;&lt;br /&gt;
[[File:PulseGen.png|500px]]&lt;br /&gt;
&#039;&#039;The value 0 can be written as any positive integer, so long as it is within the cap or ceiling of your timer.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Counter ==&lt;br /&gt;
A counter is used to count the number of input events, and output the sum of that count. Any pulsing input into a decider combinator configured input -&amp;gt; output and wired between output and input will create a counter, but this input must be zero at all other times or else the combinator will run away like a clock. A pulse generator is normally used to accomplish this. Combining several gating decider isolators set with sequential conditionals, a clock, and a pulse generator to the input of a counter will allow remote polling and counting of each isolator&#039;s contents.&lt;br /&gt;
&lt;br /&gt;
== Logic Gates ==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Unary NOT&#039;&#039;&#039;&lt;br /&gt;
----&lt;br /&gt;
[[File:NOT.png|415px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Binary OR&#039;&#039;&#039;&lt;br /&gt;
----&lt;br /&gt;
[[File:OR.png|300px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 2!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1  || 1&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Binary NOR&#039;&#039;&#039;&lt;br /&gt;
----&lt;br /&gt;
[[File:NOR.png|415px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 2!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Binary XOR&#039;&#039;&#039;&lt;br /&gt;
----&lt;br /&gt;
[[File:XOR.png|300px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 1!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 ||  0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 ||  1 || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 ||  0 || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 ||  1 || 0&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Binary AND&#039;&#039;&#039;&lt;br /&gt;
----&lt;br /&gt;
[[File:AND.png|530px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 2!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1 || 1&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Trinary AND&#039;&#039;&#039;&lt;br /&gt;
----&lt;br /&gt;
[[File:TrinaryAND.png|415px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 2!!Input 3!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0  || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1  || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0  || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1  || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0  || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1  || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0  || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1  || 1  || 1&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Binary NAND&#039;&#039;&#039;&lt;br /&gt;
----&lt;br /&gt;
[[File:NAND.png|300px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 2!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Binary XNOR/XAND&#039;&#039;&#039;&lt;br /&gt;
----&lt;br /&gt;
[[File:XAND.png|300px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Input 1!!Input 2!!Output&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0  || 1&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0  || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1  || 1&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Memory Cells ==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Simple Latch&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Have a Decider Combinator connect to itself with its input and output using a different colour of wire, say green wire when your output and input is red wire.&lt;br /&gt;
&lt;br /&gt;
[[File:SimpleLatchv2.png|300px]]&lt;br /&gt;
&lt;br /&gt;
Truth Table:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Output 1!!Input 1!!Input 2!! Output 1 (t+1)&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 0 || 1&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0 || 0 || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1 || 0 || 1 &#039;&#039;(2)&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0 || 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1 || 1 || 1 &#039;&#039;(2)&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|} &lt;br /&gt;
&#039;&#039;Output 1 is the green wire loop seen in the picture, it carries the value to latch.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Binary Cell&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
RS NOR Latch&lt;br /&gt;
[[File:RS-NOR.png|500px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Advanced Cell&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Cell for storing a positive value:&lt;br /&gt;
&lt;br /&gt;
[[File:AdvancedMemoryCell.png|500px]]&lt;br /&gt;
&lt;br /&gt;
Connect the desired value as signal 3 on the right side to set the memory cell and connect a negative value as signal 3 to reset the cell.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Address Enable Switch&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== See Also ==&lt;br /&gt;
*[http://www.factorioforums.com/forum/viewtopic.php?f=18&amp;amp;t=14556 Combinators 101 (Tutorial)]&lt;br /&gt;
*[[Arithmetic combinator]]&lt;br /&gt;
*[[Constant Combinator]]&lt;br /&gt;
*[[Decider Combinator]]&lt;br /&gt;
*[[Circuit network]]&lt;br /&gt;
*[[Circuit-network_Cookbook]]&lt;br /&gt;
[[Category:Tutorial]]&lt;br /&gt;
[[Category:English page]]&lt;/div&gt;</summary>
		<author><name>My3DS</name></author>
	</entry>
</feed>