<?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=Ndh</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=Ndh"/>
	<link rel="alternate" type="text/html" href="https://wiki.factorio.com/Special:Contributions/Ndh"/>
	<updated>2026-06-02T03:09:28Z</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=199431</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=199431"/>
		<updated>2024-08-28T19:26:50Z</updated>

		<summary type="html">&lt;p&gt;Ndh: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&#039;&#039;This is an &#039;&#039;&#039;advanced&#039;&#039;&#039; tutorial. Beginners should refer to the [[Tutorial:Circuit network cookbook]] for examples and the [[Circuit network]] page for an overview over the circuit network. This tutorial assumes a basic understanding of circuits and covers more advanced topics like SR latches, memory cells and clocks.&#039;&#039;&lt;br /&gt;
&lt;br /&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. Combinator logic works because Factorio only updates at &#039;&#039;&#039;60 times per second&#039;&#039;&#039;. Logically, each update tick is separated into two steps. In the first step, all combinators first read the input from the connected network(s), perform their computations. This produces an output value for every combinator. The tick update concludes with the second step, where the values of each network will be updated as the sum of all connected values.&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, its 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; they carry information in the connected wires, meaning that if there are similar signals on a wire it will add them automatically. If the signal is different, it will be carried in that wire as well, but as a different signal.&lt;br /&gt;
&lt;br /&gt;
When cross-connecting combinators, it is 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. Combinators will sum the red and green inputs prior to calculation, so either color can be used when wiring the output back to the input. In most cases however, it is more useful to use the opposing color of the wire so that it will not interfere with the resulting output and input.&lt;br /&gt;
&lt;br /&gt;
When trying to understand combinators, your best friend is the in-game editor. You can pause the game and, with the &amp;quot;Tick once&amp;quot; keybinding, inspect nodes and networks as they go through different states.&lt;br /&gt;
&lt;br /&gt;
== Virtual signals ==&lt;br /&gt;
&lt;br /&gt;
[[File:Virtual Signals dialog box.png|thumb|right|Virtual Signals available for use in the circuit network]]&lt;br /&gt;
&lt;br /&gt;
In addition to the standard item signals, Factorio&#039;s circuit network also includes a set of signals that do not represent any particular game item. Instead, these virtual signals serve as user-definable channels for the circuit network; they hold whatever meaning the user wants them to. There are currently 48 virtual signals that can be sent over the circuit network:&lt;br /&gt;
&lt;br /&gt;
* The 36 alphanumeric characters (A-Z, 0-9)&lt;br /&gt;
* Nine colors: red, green, blue, yellow, magenta, cyan, white, grey, and black&lt;br /&gt;
* Three icons: a check mark, an informational letter &#039;i&#039;, and a small, white dot&lt;br /&gt;
&lt;br /&gt;
=== Logic signals ===&lt;br /&gt;
&lt;br /&gt;
There are three additional virtual signals known as &#039;&#039;logic signals&#039;&#039;. Unlike other signals, they cannot be sent over the circuit network; instead, they apply additional logic to combinators that modify their behavior. Specifically, these logic symbols act as wildcards, which are special signals that represent &#039;&#039;&#039;zero or more&#039;&#039;&#039; arbitrary signals instead of representing a single discrete signal.  Factorio&#039;s circuit network implements three types of wildcards.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;span style=&amp;quot;color:#FF6666&amp;quot;&amp;gt;Everything wildcard&amp;lt;/span&amp;gt; [[File:Signal_everything.png|left|20px]] ====&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;Everything&#039;&#039; wildcard is used with decider combinators. Its exact behavior depends on whether it is used as an input or an output:&lt;br /&gt;
* &#039;&#039;&#039;Input&#039;&#039;&#039;: Returns true if &#039;&#039;all&#039;&#039; input signals pass the condition, or if there are &#039;&#039;no&#039;&#039; input signals, otherwise it returns false.&lt;br /&gt;
* &#039;&#039;&#039;Output&#039;&#039;&#039;: Returns &#039;&#039;all&#039;&#039; non-zero input signals.&lt;br /&gt;
&lt;br /&gt;
When used as an input, the &#039;&#039;everything&#039;&#039; wildcard can be thought of as a logical AND, or a [[:Wikipedia:universal quantification|universal quantifier]]. When used as an output, it acts as an &#039;echo&#039; or &#039;dump&#039; of input signals.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039;: Can be used as an output as long as the input is not an &#039;&#039;each&#039;&#039; wildcard.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;span style=&amp;quot;color:#99FF99&amp;quot;&amp;gt;Anything wildcard&amp;lt;/span&amp;gt; [[File:Signal_anything.png|left|20px]] ====&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;Anything&#039;&#039; wildcard is also used with decider combinators.&lt;br /&gt;
&lt;br /&gt;
Given &#039;&#039;&#039;at least one&#039;&#039;&#039; input signal, it returns true if &#039;&#039;any&#039;&#039; input signal passes the condition. If no signal passes the condition, or there are no input signals, then it returns false. From this behavior, the &#039;&#039;anything&#039;&#039; wildcard can be thought of as a logical OR, or an [[:Wikipedia:existential quantification|existential quantifier]].&lt;br /&gt;
&lt;br /&gt;
When used in both the input and output of a decider combinator, &#039;&#039;anything&#039;&#039; will return one of the signals that matched.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;span style=&amp;quot;color:#FFFF99&amp;quot;&amp;gt;Each wildcard&amp;lt;/span&amp;gt; [[File:Signal_each.png|left|20px]] ====&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;Each&#039;&#039; wildcard is used with both decider combinators and [[arithmetic combinator]]s, and behaves somewhat uniquely compared to the previous two. Generally speaking, it performs a combinator action on each signal &#039;&#039;&#039;individually&#039;&#039;&#039;, with the exact action depending on how it is used, and the type of combinator it is used in. It can be used as an input, and it can be used as an output, but &#039;&#039;only when it is used as input as well&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
In a &#039;&#039;&#039;decider combinator&#039;&#039;&#039;, when used as an input, the &#039;&#039;each&#039;&#039; wildcard individually compares each input signal against the combinator condition, returning each signal that passes the condition. The manner that the &#039;&#039;each&#039;&#039; wildcard returns signals when used as input depends on whether or not it is also used as output:&lt;br /&gt;
* &#039;&#039;&#039;Input only&#039;&#039;&#039;: Sums each input signal that passed the condition, and depending on output settings returns either a count of the passed signals or a summation of their values as the desired output signal.&lt;br /&gt;
* &#039;&#039;&#039;Input and Output&#039;&#039;&#039;: Returns each signal that passed the condition, their values depending on the output settings.&lt;br /&gt;
&lt;br /&gt;
In an &#039;&#039;&#039;arithmetic combinator&#039;&#039;&#039;, the designated arithmetic operation is applied individually to each input signal, and similar to the decider combinator, the signal that is returned depends on whether or not the &#039;&#039;each&#039;&#039; wildcard is used as output:&lt;br /&gt;
* &#039;&#039;&#039;Input only&#039;&#039;&#039;: The result of each operation on the input signals is summed and returned as the desired output signal.&lt;br /&gt;
* &#039;&#039;&#039;Input and Output&#039;&#039;&#039;: Each input signal is returned with the result of the specified operation applied to it.&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;Each&#039;&#039; wildcard is therefore notably more complex than the other two wildcards, but offers a good deal of power in exchange for its complexity.&lt;br /&gt;
&lt;br /&gt;
== Input insulator &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 insulator 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 insulator 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, which is 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.&amp;lt;br&amp;gt;&lt;br /&gt;
Whenever the 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;
In this specific example, the pump runs when light oil reaches 20000, and turns off when it reaches 5000:&lt;br /&gt;
&lt;br /&gt;
[[File:SR_latch.png|600px]]&lt;br /&gt;
&lt;br /&gt;
A similar backup steam power example with detailed configuration and explanation can be found here:&amp;lt;br&amp;gt;[[Tutorial:Circuit_network_cookbook#RS_latch_-_single_decider_version|RS latch - single decider version]]&lt;br /&gt;
&lt;br /&gt;
== Basic memory ==&lt;br /&gt;
A decider combinator can be used to store values, either for a counter or for more advanced logic (see below). The decider combinator is configured with&lt;br /&gt;
* input and output connected to the same network (typically each other),&lt;br /&gt;
* condition set to a signal &amp;gt; 0 for positive values or ≠ 0 to store both positive and negative values,&lt;br /&gt;
* output set to the input count of a specific input signal or [*].&lt;br /&gt;
As long as all inputs on the network are zero, it will hold the previously set value.&lt;br /&gt;
&lt;br /&gt;
Remember the two step update process from above? If the network has value [X]=5, the combinator will read this value from the network as its input, determine that it is &amp;gt; 0. It will then set the output to the input, which is [X]=5. In the next step, the value of the network will be computed, which is the sum of all the connected outputs, which is [X]=5, again.&lt;br /&gt;
&lt;br /&gt;
A non-zero input held over time, e. g. the output of a constant combinator, will create a basic runaway clock. The stored value will be incremented by the sum of all connected input values every cycle. So e. g. with a constant combinator that produces [A]=1 connected to the memory, the network will store the value 1 in the first tick, 2 in the second, etc., incrementing 60 times per second.&lt;br /&gt;
{{BlueprintString|bp-string=0eNqlU11rwzAM/C96TkuStWvqh8F+xyghH2orSOygyGWh5L/PjkcJJetW9hKQLd2d7pwrlI3FjkkLqCtQZXQP6uMKPZ100fgzGToEBSTYQgS6aH1VY0U18qoybUm6EMMwRkC6xk9QyRj9CuCJpNCyjJCOhwhQCwlh0DMVQ65tWyI7iodAEXSmd7NGe36Ht9sk620EA6jVNsvWW8fk5oRNk5d4Li7khlznkRpB/sGAC7FYd3JjDh2rd5jQrHcwiWcmHAKLxsor6T1U4j8nRtTzpah2G7te4sqSTKWfHr2Nd3unjxJYWPtu6Zo4qAmECxZ8w+burqab7iNxL/mfLcEL8iBn0qfgTUgIVOyLtit4kqvgzU0aK539B3Y35JP5+ZFNm5N2YKCELY7P2J/MvF6II53CTJ9Lzz3h6c2r2T8WgZPfhwCyZLPbp7vsdR+/xJtx/AJNbzZ8}}&lt;br /&gt;
&lt;br /&gt;
Again, how does this work in detail? The network will start without any values set. As soon as the constant combinator becomes active, it will produce [A]=1, and the decider combinator will produce 0 because no value is set yet. Step 2: The network will be set to the sum of all output, so [A]=1. In the next update tick, the constant combinator produces [A]=1 again, but now the decider sees [A]=1, so it would also output [A]=1. Step 2: The network is set to the sum, which is [A]=2. And so on.&lt;br /&gt;
&lt;br /&gt;
Typically a constant combinator producing 1 will be used, but of course it could output other values, including negative values.&lt;br /&gt;
A negative values would decrease the stored value in the example below.&lt;br /&gt;
If the decider combinator uses &amp;gt; 0 as the condition, only positive values will be allowed, so the value will stop decreasing if 0 is reached.&lt;br /&gt;
If the condition is ≠ 0, negative values will also be allowed.&lt;br /&gt;
&lt;br /&gt;
A single pulse of an input will cause a single increment by the pulsed value, creating a counter. In the following blueprint, place one item on the belt. Every time it is scanned by the connected belt, a pulse is generated that increments the stored value.&lt;br /&gt;
{{BlueprintString|bp-string=0eNqllMGO4jAMQP/F5zAqpaXQw/7IahWljQFLbVIlLtoK5d83aXdZEJ3DMBeQU+fFenZyg6YbcXBkGOobUGuNh/rnDTydjerSGk8DQg3E2IMAo/oUsVPGD9bxpsGOIQggo/E31NvwSwAaJiZcSHMwSTP2DbqY8BlDwGB93GZNOjWiqqL8KAVMUG/KQ/ZRhiBeaPl7tG2kCdDksF1S8hX27gvs/XOlT+xCQNTKznaywYu6knVpX0uuHYklGtV0KDX59A/1SXUexf2zQ6XlRRktEySWGK2yGx8y/q0vqb3VEZKF+VCz1ODTedv0c3aI5rEtpKEu/7NSGFsY1lwX7/l4cV2ssMs7W2NLGt2mtX1DRnGUtcI/fmo7X7f9F5tkabo7OZHzLF9m/UqOx7hyL2rJ2OAV3cQXMmdY/HpW6eJkKegH5eZya/gRd9qRh/Eb7GGKtY6G5cnZXpKJsKXx4Sut3T24Xml1HlstIP/uZOzfuoXVcf1OV2/N2Ux7moR9eormZ6t+eOUERNF+GZXDtqiOeXXYH7NdVoTwB9igtjA=}}&lt;br /&gt;
&lt;br /&gt;
A stored value is cleared if the condition is no longer met, which makes the decider clear its output. This only works if the value is also not output elsewhere in the network. A stored value can also be reset to zero if a negative pulse equal to the input occurs. The latter can also happen while other inputs are still connected.&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;
With a single decider combinator, a self-resetting clock can be built. Wire output to input and configure with Less Than (&amp;lt;) with a specific number, and Input -&amp;gt; Output. When a constant combinator is then connected to the input, every cycle it will count up by the output of the constant combinator until the number is reached. The decider will then clear its output, only the constant combinator will contribute to the value in the network, which resets the clock.&lt;br /&gt;
&lt;br /&gt;
This means that the clock sequence will not include zero. It will begin at the value set in the constant combinator. Furthermore, it will include the number value that causes the conditional to become false. An arithmetic combinator can modify the clock sequence, but remember that 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. The clock can get reset by enabling and disabling the constant combinator that outputs [R].&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;
{{BlueprintString|bp-string=0eNq1VdtugzAM/Rc/p1Wh9BZtPzHtaVOFKLidJUhQSKpVFf8+B6oK9QrT9oJI4hzb5xzDETa5w9KQsiCPQKlWFcjPI1S0U0nu9+yhRJBAFgsQoJLCrzJMKUMzSnWxIZVYbaAWQCrDb5BBLZ4C+EQ2UfY2QlivBaCyZAnbeprFIVau2KDhFI8qEVDqiq9q5dMz3GI2E3AAOZqtgvGM02RkMG0D5sLXYo3O4w1+JXtiAL51go35LGugKr+7JVPZ+Kq1PRnreOdcVBsxevctVegx+l/68Je4mzIxTTcSXjhGO1u6oalTXR64A6dsvDW6iEkxBshtkldYN+dKtTw03QX+YTDrEk68ijiSTOrINstGnJ1BVJeBfMKoYT+YgINr75QLacOHHrmh7WI8WN0t5RbNHac/Ecb5UQmWk47d13e4vElS0I+G6VAawjMNy9V/0vDWpaFLAr9Xsc/W+msAJT2dEf1y6K/5CP9x6E/8tJqBnFwM8+sfD7M1bsgsB31nedoR4PZH4MGoX3tcDFDeO8n/LGTn5yRgz05txVsG0WIVLpbz1WQ6ier6B+n0TYg=}}&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;
== Edge detectors ==&lt;br /&gt;
&lt;br /&gt;
The computation delay of combinators can be used to generate a one-tick pulse when a signal changes, e. g. from 0 to 1.&lt;br /&gt;
&lt;br /&gt;
Connect an output of a combinator with red to the input, and with green to the output of an arithmetic combinator that multiplies by -1. When the red circuit changes a signal from 0 to 1, the arco gets input 1, but the output is still 0. So the green circuit has value 1 for this one tick. In the next tick, the arco is updates, so the output switches to -1. The green circuit now has two inputs that cancel each other out. The same happens if the red input signal changes from 1 to 0, but in this case the green circuit becomes -1 for one tick.&lt;br /&gt;
&lt;br /&gt;
If you&#039;re only interested in generating a pulse if the signal changes from 0 to 1, a decider combinator set to &amp;gt;0 can be used to filter out the negative pulses. This mechanic can e. g. be used to count the numbers of trains that enter a station.&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;
== Memory cells ==&lt;br /&gt;
&lt;br /&gt;
=== Simple latch ===&lt;br /&gt;
&lt;br /&gt;
When looping the combinator to itself, use a different color of wire from your main inputs or outputs. &lt;br /&gt;
&lt;br /&gt;
[[File:SimpleLatchv2.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;
!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;
=== Positive cell ===&lt;br /&gt;
&lt;br /&gt;
Cell for storing a positive value, with reset support:&lt;br /&gt;
&lt;br /&gt;
[[File:AdvancedMemoryCell.png|500px]]&lt;br /&gt;
&lt;br /&gt;
Connect the desired value as signal I on the right side to set the memory cell and connect a negative value as signal I to reset the cell.&lt;br /&gt;
&lt;br /&gt;
* The output of the memory cell is 2 mutually exclusive signals.&lt;br /&gt;
** In case input signal I &amp;gt; 0 then signal I is passed to the other side.&lt;br /&gt;
** In case input signal I is interrupted, then signal M is passed instead as a memory of previous input value.&lt;br /&gt;
* When input signal I is interrupted, it takes 2 ticks to switch to memory signal M.&lt;br /&gt;
* In case input I signal lasts only one tick then memory cell starts to cycle between the 2 previous values, tick by tick. Indefinitely.&lt;br /&gt;
* Switching is seamless, e.g. there are no ticks with empty signal.&lt;br /&gt;
&lt;br /&gt;
=== Positives and negatives cell ===&lt;br /&gt;
&lt;br /&gt;
This cell can store negatives or positives. Reset is done on a dedicated line. Additionally, a 1-tick burst is handled properly. [https://forums.factorio.com/viewtopic.php?f=193&amp;amp;t=60330&amp;amp;p=362377#p362377 Forum post].&lt;br /&gt;
&lt;br /&gt;
* The output M (memory) is the last non-zero input I (Input).&lt;br /&gt;
* A non zero R (reset) signal sets the output to zero.&lt;br /&gt;
* 1-tick bursts of R or I are handled properly.&lt;br /&gt;
* Negatives are handled properly.&lt;br /&gt;
&lt;br /&gt;
[[File:Memory_cell_with_negatives.png|500px]]&lt;br /&gt;
&lt;br /&gt;
== Multiplier and Dictionaries/Arrays ==&lt;br /&gt;
[[File:combinatorMultiplierDetailed.png|left|500px]]&lt;br /&gt;
* Multiplying two signals together is simple and requires only a single combinator, however multiplying a set of signals is more complicated.&lt;br /&gt;
* A proof is shown below for the equation and why it works.&lt;br /&gt;
* A dictionary is a system that allows a value on a specific signal to be accessed. For example, A can contain many signals (either from a constant combinator or memory cell) and B can contain 1 of a specific signal (such as blue signal). What remains is the blue-signal value from A. This is because all the other signals are multiplied by 0.&lt;br /&gt;
* Arrays are similar to dictionaries, but instead of using a signal as a key, we use a number. Constant combinators are placed mapping each signal to a unique number (such as 1 yellow belt, 2 red belt, 3 blue belt, 4 burner inserter, etc). Then, use a combinator of &amp;quot;each = index OUTPUT 1 of each&amp;quot; and plug that in as the input to a dictionary.{{clear}}&lt;br /&gt;
[[File:combinatorMultiplierMath.png|left|500px]]&lt;br /&gt;
&lt;br /&gt;
    ((A+B)^2 - (A-B)^2)/4 = AB&lt;br /&gt;
    (A+B)^2 - (A-B)^2 = 4AB&lt;br /&gt;
    (A^2 + 2AB + B^2) - (A^2 - 2AB + B^2) = 4AB&lt;br /&gt;
    4AB = 4AB&lt;br /&gt;
&lt;br /&gt;
{{clear}}&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;
* [[Tutorial:Circuit network cookbook]]&lt;br /&gt;
* [[Circuit network]]&lt;br /&gt;
* [[Arithmetic combinator]]&lt;br /&gt;
* [[Constant combinator]]&lt;br /&gt;
* [[Decider combinator]]&lt;/div&gt;</summary>
		<author><name>Ndh</name></author>
	</entry>
	<entry>
		<id>https://wiki.factorio.com/index.php?title=Tutorial:Circuit_network_cookbook&amp;diff=199430</id>
		<title>Tutorial:Circuit network cookbook</title>
		<link rel="alternate" type="text/html" href="https://wiki.factorio.com/index.php?title=Tutorial:Circuit_network_cookbook&amp;diff=199430"/>
		<updated>2024-08-28T18:55:57Z</updated>

		<summary type="html">&lt;p&gt;Ndh: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&#039;&#039;This is a &#039;&#039;&#039;beginners&#039;&#039;&#039; tutorial. See also the [[Circuit network]] page for an overview over the circuit network and the [[Tutorial:Combinator tutorial]] for an advanced tutorial.&#039;&#039;&lt;br /&gt;
{{Languages}}&lt;br /&gt;
&lt;br /&gt;
== Foreword == &lt;br /&gt;
This page provides examples of simple circuit network designs and some not so simple designs that others can use, combine and modify. They are designed to be as easy to understand as possible.  To see the settings of combinators without opening them, the option &amp;quot;Show combinator settings in &amp;quot;Alt-mode&amp;quot;&amp;quot; in the Interface/Alt-mode settings has to be checked and &amp;quot;Alt-mode&amp;quot; has to be turned on.&lt;br /&gt;
&lt;br /&gt;
== Lights ==&lt;br /&gt;
[[File:LightWiredToChest.png|border|left|430px]]&lt;br /&gt;
&lt;br /&gt;
=== Lamp showing chest content condition ===&lt;br /&gt;
&lt;br /&gt;
This is one of the simplest possible use of circuit-network. A [[lamp]] is light depending on the number of goods (in this example empty barrels) in a chest.&lt;br /&gt;
&lt;br /&gt;
==== Setting up circuit connection ====&lt;br /&gt;
&amp;lt;div style=&amp;quot;margin-left:440px;&amp;quot;&amp;gt;&lt;br /&gt;
* The lamp is connected to the chest.&lt;br /&gt;
* The lamp is set to light if the chest contain less than 10 empty barrels.&lt;br /&gt;
&lt;br /&gt;
==== To set the light condition ====&lt;br /&gt;
* Open the lamp (left click on it).&lt;br /&gt;
* Set the input to barrels.&lt;br /&gt;
* Set the operator to &amp;lt; (less than).&lt;br /&gt;
* Set the constant number:&lt;br /&gt;
** Left click on the constant number&lt;br /&gt;
** Move the slider until 10 is shown, or edit the value box directly.&lt;br /&gt;
** Press set.&lt;br /&gt;
&lt;br /&gt;
Depending on the condition you set, the lamp may light if the chest is empty, or if it contains the required quantity of items.&lt;br /&gt;
&lt;br /&gt;
The drawback with this scenario is that the lamp has a white light , and is therefore difficult to differentiate from an ordinary lamp at night.&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
{{clear}}&lt;br /&gt;
&lt;br /&gt;
[[File:ConditionalLights.png|border|left|430px]]&lt;br /&gt;
&lt;br /&gt;
=== Conditional Lights ===&lt;br /&gt;
&amp;lt;div style=&amp;quot;margin-left:440px;&amp;quot;&amp;gt;&lt;br /&gt;
* In this circuit we connect a series of [[lamp]]s to a [[storage tank]].&lt;br /&gt;
* By setting different conditions on each lamp we can build an indicator strip. &lt;br /&gt;
* The Enabled condition of the first lamp is &#039;&#039;&#039;Petroleum gas &amp;gt; 100&#039;&#039;&#039;.&lt;br /&gt;
* The others light up when gas is greater than 200, 300, 400 and 500 respectively.&lt;br /&gt;
&lt;br /&gt;
In this setup you can connect the storage tank to the lamps directly.&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
{{clear}}&lt;br /&gt;
&lt;br /&gt;
[[File:ColoredLights.png|border|left|430px]]&lt;br /&gt;
&lt;br /&gt;
=== Colored Lights ===&lt;br /&gt;
&amp;lt;div style=&amp;quot;margin-left:440px;&amp;quot;&amp;gt;&lt;br /&gt;
To light a [[lamp]] with a color rather than white, you need an intermediate device like an [[arithmetic combinator]] that can send a color signal.  &lt;br /&gt;
Instead of directly connect the [[lamp]] and the [[Storage tank]] you need:&lt;br /&gt;
# Add the arithmetic combinator.&lt;br /&gt;
# Connect the [[storage tank]] with the input of the  arithmetic combinator.&lt;br /&gt;
# Connect the  output of the [[arithmetic combinator]] with the lamp.&lt;br /&gt;
# Set up the arithmetic combinator:&lt;br /&gt;
## Setting the input to petroleum Gas + 0 (the constant 0 not the signal 0)&lt;br /&gt;
## Set the output to the pink signal (on the bottom row of the last tab of signals.)&lt;br /&gt;
# Set up the [[lamp]]:&lt;br /&gt;
##  Select the &amp;quot;Use colors&amp;quot; check box on the lamp.&lt;br /&gt;
## Set the condition to the pink signal, and what value you want (i.e. &amp;gt; 100)&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
{{clear}}&lt;br /&gt;
&lt;br /&gt;
== Oil Setups ==&lt;br /&gt;
Balancing the production of petroleum gas, light oil and heavy oil is one of the most important use cases of the circuit network.&lt;br /&gt;
&lt;br /&gt;
[[File:LgtOilCracking.png|border|left|430px]]&lt;br /&gt;
&lt;br /&gt;
=== Light Oil Cracking ===&lt;br /&gt;
&amp;lt;div style=&amp;quot;margin-left:440px;&amp;quot;&amp;gt;&lt;br /&gt;
* This circuit provides balanced light oil and petroleum gas production by cracking excess light oil into gas. &lt;br /&gt;
* The [[pump]] is connected to the [[storage tank]] by a [[red wire]]. &lt;br /&gt;
* The pump has an enabled condition set to &#039;&#039;&#039;Light Oil &amp;gt; 20000&#039;&#039;&#039;.&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
{{clear}}&lt;br /&gt;
&lt;br /&gt;
[[File:HvyOilCracking.png|border|left|430px]]&lt;br /&gt;
&lt;br /&gt;
=== Heavy Oil Cracking ===&lt;br /&gt;
&amp;lt;div style=&amp;quot;margin-left:440px;&amp;quot;&amp;gt;&lt;br /&gt;
* This circuit extends on the previous circuit by adding optional heavy oil cracking to provide lubricant etc.&lt;br /&gt;
* The pump has an enabled condition set to &#039;&#039;&#039;Heavy oil &amp;gt; 20000&#039;&#039;&#039;.&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
{{clear}}&lt;br /&gt;
&lt;br /&gt;
=== Alternative Setup for Cracking and Lubricant Production ===&lt;br /&gt;
This setup compares different fluid levels to each other instead of checking fixed values. It offers some guarantees such as petroleum gas being produced when you have light oil to spare, and light oil not being cracked when you have plenty of petroleum gas, and similar rules for heavy oil cracking and lubricant production. &lt;br /&gt;
&lt;br /&gt;
[[File:oil-single-cct.png|border|left|430px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;margin-left:440px;&amp;quot;&amp;gt;&lt;br /&gt;
It takes 4 steps:&lt;br /&gt;
&lt;br /&gt;
# Have a fluid tank for heavy oil, light oil, petroleum gas, and lubricant. For each fluid, make sure to connect the tank via pipes to every location where the fluid is being produced or consumed.&lt;br /&gt;
# For each chemical plant (or each row of them, if you use rows) add a pump to the non-water fluid input pipe to make it possible to block the flow. Note: Alternatively, the blocking pumps could be added to the chemical plant output pipes, but there is no need to add pumps to both inputs and outputs.&lt;br /&gt;
# Connect every pump and every fluid tank to a single circuit network of red (or green) wire. The resulting circuit network will know about the fluid level in every storage tank and pass this information to every pump.&lt;br /&gt;
# For each connected pump set the circuit “enable condition” to &amp;quot;[input fluid] &amp;gt; [output fluid]&amp;quot; , for its respective chemical plant recipe. E.g. set &amp;quot;heavy oil &amp;gt; light oil&amp;quot; for the heavy oil cracking input pump, set &amp;quot;heavy oil &amp;gt; lubricant&amp;quot; for the lubricant production input pump, and set &amp;quot;light oil &amp;gt; petroleum gas&amp;quot; for the light oil cracking input pump.&lt;br /&gt;
&lt;br /&gt;
Done! Now all the pumps will move to equalize the fluid levels to each other. This will prevent fluid system deadlocks where you have plenty of one fluid but you are unable to make any of the other.&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
{{clear}}&lt;br /&gt;
&lt;br /&gt;
== Misc ==&lt;br /&gt;
[[file:MulitipleChestsAndPoles.png|border|left|430px]]&lt;br /&gt;
&lt;br /&gt;
=== Multiple Storages ===&lt;br /&gt;
&amp;lt;div style=&amp;quot;margin-left:440px;&amp;quot;&amp;gt;&lt;br /&gt;
* If you connect multiple chests to a pole, the pole displays the sum of items in all the chests.&lt;br /&gt;
* This also works with [[storage tank]]s and [[roboport]]s.&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
{{clear}}&lt;br /&gt;
&lt;br /&gt;
[[File:ConstantComb.png|border|left|430px]]&lt;br /&gt;
&lt;br /&gt;
=== Constant Combinator ===&lt;br /&gt;
&amp;lt;div style=&amp;quot;margin-left:440px;&amp;quot;&amp;gt;&lt;br /&gt;
* With a [[constant combinator]] you can generate any signals you may need. &lt;br /&gt;
* In this example we have generated a signal of 50 Laser turrets and 200 Piercing round magazine. &lt;br /&gt;
* Constant combinators are not of much use on their own but we shall use them later.&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
{{clear}}&lt;br /&gt;
&lt;br /&gt;
[[File:ThisASign.png|border|left|430px]]&lt;br /&gt;
&lt;br /&gt;
=== Constant Combinator Signs (Words) ===&lt;br /&gt;
&amp;lt;div style=&amp;quot;margin-left:440px;&amp;quot;&amp;gt;&lt;br /&gt;
* You can use [[constant combinator]]s to make signs, just set the letter signals in the combinator, each combinator can display 2 characters side by side.&lt;br /&gt;
* Note that to see these letters, Alt-mode must be on and the Interface setting “Show combinator settings in “Alt-Mode”” must also be enabled.&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
{{clear}}&lt;br /&gt;
&lt;br /&gt;
[[File:constant_combinator_signs2.png|border|left|430px]]&lt;br /&gt;
&lt;br /&gt;
=== Constant Combinator Signs (Managing Belts) ===&lt;br /&gt;
&amp;lt;div style=&amp;quot;margin-left:440px;&amp;quot;&amp;gt;&lt;br /&gt;
* Somewhat similar to the previous example, constant combinator signals can be used with belts to help indicate what items should be on which belts. This is extremely useful when sharing blueprints, as it&#039;s possible for blueprints to be shared albeit with no indication on which items are meant for which belts.&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
{{clear}}&lt;br /&gt;
&lt;br /&gt;
[[File:MemoryCell.png|border|left|430px]]&lt;br /&gt;
&lt;br /&gt;
=== Memory Cell / Counter ===&lt;br /&gt;
&amp;lt;div style=&amp;quot;margin-left:440px;&amp;quot;&amp;gt;&lt;br /&gt;
* Basic memory cell that counts all the items moved by the inserter&lt;br /&gt;
* The [[fast inserter]] is connected to &#039;&#039;&#039;BOTH&#039;&#039;&#039; ends of the arithmetic combinator.&lt;br /&gt;
* If the fast inserter hasn&#039;t picked anything up this tick the input to the Arithmetic combinator is the same as and output and hence the values are persisted. &lt;br /&gt;
* When the fast inserter does pick something up its value is added to the output from the previous tick thus incrementing that item.&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
{{clear}}&lt;br /&gt;
&lt;br /&gt;
== Inserters ==&lt;br /&gt;
[[File:LimitItemsPlacedIntoAChest.png|border|left|430px]]&lt;br /&gt;
&lt;br /&gt;
=== Limit items placed into a chest ===&lt;br /&gt;
&amp;lt;div style=&amp;quot;margin-left:440px;&amp;quot;&amp;gt;&lt;br /&gt;
*  The [[inserter]] is connected to the [[wooden chest]] using a [[red wire]]. &lt;br /&gt;
*  The inserter&#039;s enabled condition is &#039;&#039;&#039;Advanced Circuit &amp;lt; 10&#039;&#039;&#039;. &lt;br /&gt;
*  In reality this means the inserter may place more than 10 Advanced circuits in the chest because it could pick up to 3 at once due to stack size bonuses.&lt;br /&gt;
*  This effect can be even greater with Stack inserters because of their large carrying capacity. &lt;br /&gt;
*  This technique still gives far greater control than limiting the inventory on the chest.&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
{{clear}}&lt;br /&gt;
&lt;br /&gt;
[[File:BalancedChestInsert.png|border|left|430px]]&lt;br /&gt;
&lt;br /&gt;
=== Balanced chest insert ===&lt;br /&gt;
&amp;lt;div style=&amp;quot;margin-left:440px;&amp;quot;&amp;gt;&lt;br /&gt;
Goal: Load n chests with approximately the same number of items. This can be used for train stations: [https://www.reddit.com/r/factorio/comments/4e03g2/madzuris_smart_loading_train_station_guide/ MadZuri&#039;s smart loading train station]&lt;br /&gt;
*  Place n chests and n inserters. &lt;br /&gt;
*  Place 1 [[arithmetic combinator]]&lt;br /&gt;
*  Set the combinator to take Each (yellow star) and divide by the negative number of chests. ie &amp;amp;minus;n.&lt;br /&gt;
*  Connect all chests to each other and to the input of the combinator using red wire.&lt;br /&gt;
*  Connect all inserters to each other and to the output of the combinator using red wire.&lt;br /&gt;
*  Connect each inserter to the box it inserts into with green wire.&lt;br /&gt;
*  Set the enable condition on each inserter to be Everything (red star) &amp;lt; 0.&lt;br /&gt;
&lt;br /&gt;
The combinator calculates the average number of items in the chests, and makes it negative. Each inserter gets the amount in the chest it is inserting to and adds the negative average, i.e. it calculates how many more than the average it has in its chest. Thus if that number is negative, it has less than the average in the chest and it enables. &lt;br /&gt;
&lt;br /&gt;
Due to inserter stack bonus the count is not exact. If a precise count is needed, set the inserter stack size to 1.&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
{{clear}}&lt;br /&gt;
&lt;br /&gt;
[[File:SmartOutpostUnloader.png|border|left|430px]]&lt;br /&gt;
&lt;br /&gt;
=== Keeping outpost stocked with specified items ===&lt;br /&gt;
&amp;lt;div style=&amp;quot;margin-left:440px;&amp;quot;&amp;gt;&lt;br /&gt;
*  This circuit keeps a [[storage chest]] at an outpost stocked with customized levels of different items. &lt;br /&gt;
*  For example you could keep an outpost stocked with 50 laser turrets and 200 piercing magazine rounds but not have to worry about it being over filled. &lt;br /&gt;
*  The [[storage chest]] is attached to the input of the [[arithmetic combinator]] (left side in the picture) with a [[red wire]]. &lt;br /&gt;
*  Another couple of [[red wire]]s join the output of the [[arithmetic combinator]] (right side) to the [[constant combinator]] and to the [[stack filter inserter]]. &lt;br /&gt;
*  The [[arithmetic combinator]] &#039;&#039;&#039;multiplies&#039;&#039;&#039; each input value (from the storage chest) by &#039;&#039;&#039;-1&#039;&#039;&#039;. &lt;br /&gt;
*  Finally the filter stack inserter&#039;s mode of operation is set to &#039;&#039;&#039;Set filters&#039;&#039;&#039;.&lt;br /&gt;
*  So the input to the [[stack filter inserter]] is &#039;&#039;&#039;&amp;lt;constant combinator&amp;gt; - &amp;lt;storage chest contents&amp;gt;&#039;&#039;&#039; and the filter is set to filter for the first item by inventory order.&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
{{clear}}&lt;br /&gt;
&lt;br /&gt;
[[File:SolarAccumalatorBalancer.png|border|left|430px]]&lt;br /&gt;
&lt;br /&gt;
=== Balanced Solar panel / Accumulator Production ===&lt;br /&gt;
&amp;lt;div style=&amp;quot;margin-left:440px;&amp;quot;&amp;gt;&lt;br /&gt;
* This circuit balances production of [[solar panel]]s and [[accumulator]]s to a desired ratio in my case 24:20.&lt;br /&gt;
* The first [[arithmetic combinator]] takes the number of accumulators in the chest and &#039;&#039;&#039;multiplies&#039;&#039;&#039; it by &#039;&#039;&#039;24&#039;&#039;&#039;. &lt;br /&gt;
* The second [[arithmetic combinator]] takes the output of the first combinator and &#039;&#039;&#039;divides&#039;&#039;&#039; it by &#039;&#039;&#039;20&#039;&#039;&#039;. &lt;br /&gt;
* This gives us the number of accumulators that we can directly compare to the number of Solar panels in both inserters. &lt;br /&gt;
* If the number of accumulators is greater we enable the Solar panels inserter, if the number of Solar panels is greater we enable the accumulators inserter. &lt;br /&gt;
* However, if they are equal, neither machine does anything. So we add a single accumulator to one of the inserters using a constant combinator and a wire of the other color, therefore breaking the deadlock.&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
{{clear}}&lt;br /&gt;
&lt;br /&gt;
== Sushi Belts ==&lt;br /&gt;
[[File:SushiScience1.png|border|left|430px]]&lt;br /&gt;
&lt;br /&gt;
=== Reading Belt Design ===&lt;br /&gt;
&amp;lt;div style=&amp;quot;margin-left:440px;&amp;quot;&amp;gt;&lt;br /&gt;
* Six belts in a row are connected with Red wire and set to &#039;&#039;&#039;Read belts contents&#039;&#039;&#039; and &#039;&#039;&#039;Hold&#039;&#039;&#039; &lt;br /&gt;
* This [[red wire]] is then connected to the inserters that insert onto the belt. &lt;br /&gt;
* Read hand contents is unselected for all inserters.&lt;br /&gt;
* Mode of operation is set to &#039;&#039;&#039;Enable/Disable&#039;&#039;&#039; on all inserters. &lt;br /&gt;
* The first inserter is enabled when &#039;&#039;&#039;Automation science pack = 0&#039;&#039;&#039;&lt;br /&gt;
* The other inserters are set similarly for the other science packs.&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
{{clear}}&lt;br /&gt;
&lt;br /&gt;
[[File:SushiScience2.png|border|left|430px]]&lt;br /&gt;
&lt;br /&gt;
=== Memory Cell Design ===&lt;br /&gt;
&amp;lt;div style=&amp;quot;margin-left:440px;&amp;quot;&amp;gt;&lt;br /&gt;
* This circuit counts the number of items of each type on a looping belt by counting the numbers that are added and removed from the belt by inserters.&lt;br /&gt;
* Each inserter that takes items off the belt is connected together with Red wire and each of these inserters is set to &#039;&#039;&#039;Mode of operation none, Read hand content selected&#039;&#039;&#039; and &#039;&#039;&#039;Hand read mode pulse&#039;&#039;&#039;. &lt;br /&gt;
* These inserters are connected to the input of the left arithmetic combinator. &lt;br /&gt;
* The left [[arithmetic combinator]] multiples &#039;&#039;&#039;each&#039;&#039;&#039; input by &#039;&#039;&#039;-1&#039;&#039;&#039; and outputs it to &#039;&#039;&#039;each&#039;&#039;&#039;. &lt;br /&gt;
* The right [[arithmetic combinator]] is a &#039;&#039;&#039;memory cell&#039;&#039;&#039; as above.&lt;br /&gt;
* The memory cell&#039;s input is connected to the inserters that are placing items on the belt and the output of the left [[arithmetic combinator]]. &lt;br /&gt;
* The inserters that place items onto the belt have an enabled condition that is based on the number of items on the belt.&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
{{clear}}&lt;br /&gt;
&lt;br /&gt;
== Power ==&lt;br /&gt;
[[File:SteamBackup.png|border|left|430px]]&lt;br /&gt;
&lt;br /&gt;
=== Backup steam power ===&lt;br /&gt;
&amp;lt;div style=&amp;quot;margin-left:440px;&amp;quot;&amp;gt;&lt;br /&gt;
* The [[steam engine]]s are not directly connected to the power network. They are connected to the power network through a [[power switch]]. &lt;br /&gt;
* The [[power switch]] is connected to one of the [[accumulator]]s in the main network. &lt;br /&gt;
* The [[power switch]] turns on when A &amp;lt; 10. That is when the [[accumulator]]s are less than 10% full.&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
{{clear}}&lt;br /&gt;
&lt;br /&gt;
=== Optimal usage of fuel for nuclear power ===&lt;br /&gt;
Unlike the normal steam power that adjusts fuel usage based on power usage, the [[Power_production#Nuclear_power|nuclear reactors]] spend fuel in fixed units of time. To be exact, the consumption of 1 fuel cell takes exactly 200 seconds.&lt;br /&gt;
&lt;br /&gt;
Combined with the fact that creating the nuclear fuel cells are time consuming and expensive to create, it is therefore beneficial to optimize their use to match the actual consumed power.&lt;br /&gt;
&lt;br /&gt;
[[File:NuclearCircuits.png|border|left|430px]]&lt;br /&gt;
&amp;lt;div style=&amp;quot;margin-left:440px;&amp;quot;&amp;gt;&lt;br /&gt;
This picture shows a setup with 4 reactors, that spend only 1 fuel cell each whenever steam runs low.&amp;lt;br&amp;gt;&lt;br /&gt;
&#039;&#039;Note: The GUI in the image above has been altered to make sure all important info fits within the image size.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
There are a few elements in this setup:&lt;br /&gt;
* Storage tank that provides the [[steam]] signal.  You should only read from one storage tank, and it should have pipe connections to all your other steam storage tanks.&lt;br /&gt;
* Chests containing [[uranium fuel cell]]s for the reactor.&lt;br /&gt;
* Output inserter that takes [[Used_up_uranium_fuel_cell|empty fuel cells]] from the reactor. This is connected to the storage tank to listen for the steam signal, and to the chests to listen for the uranium fuel cell signal. If the steam level is low and there are uranium fuel cells available, it removes the empty fuel cells from the reactor and sends an empty fuel cell signal (since &amp;quot;Read hand contents&amp;quot; is checked).&lt;br /&gt;
* Input inserter that put uranium fuel cells into the reactor. This is connected to the output inserter and listens for the empty fuel cell signal. The &amp;quot;Override stack size&amp;quot; is set to 1, so that it only inserts 1 fuel cell at a time.&lt;br /&gt;
* If you are using multiple reactors you should only wire one output inserter to one steam tank, and then connect all input inserters to the single output inserter. This will synchronize fuel insertion to maximize the reactor neighbour heat bonus. The other reactors can have &amp;quot;dumb&amp;quot; output inserters that remove [[Used_up_uranium_fuel_cell|empty fuel cells]] immediately.&lt;br /&gt;
&lt;br /&gt;
Since this design uses empty fuel cells as a signal to fill the reactor, you need to manually insert 1 uranium fuel cell into the reactor to get it started.&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
{{clear}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Prioritize usage of uranium towards nuclear fuel production ===&lt;br /&gt;
Because a continuous supply of [[uranium fuel cell]]s is critical to maintaining a [[nuclear reactor]], the circuit network can be used to set up a system where [[uranium-235]] and [[uranium-238]] are conserved for the production of nuclear fuel before other uses.&lt;br /&gt;
&lt;br /&gt;
[[File:Nuclear Fuel Circuit Network.png|border|left|430px]]&lt;br /&gt;
&amp;lt;div style=&amp;quot;margin-left:440px;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Using a [[splitter]], divert the two types of uranium onto two parallel conveyors, with an [[inserter]] positioned to gather uranium from each conveyor (a [[long-handed inserter]] will be needed for the far belt). Each of these inserters deposits their load into a container, from which two more inserters deliver the contents to an [[assembling machine]] making nuclear fuel. An inserter delivers the produced fuel to a third container, from which inserter(s) delivers the fuel to your nuclear reactor. Wire the two inserters gathering from the conveyors to the container each of them is delivering to, and to the tile of conveyor immediately after the tile the inserter is gathering from. Set each inserter&#039;s enable condition to &amp;quot;less than or equal to X amount of uranium&amp;quot;, using the appropriate type of uranium the inserter is gathering and X being the number of reserve uranium desired (optimally, one uranium-235 and nineteen uranium-238, the amount needed to produce nuclear fuel; the amount may be increased if a greater stockpile is desired). Set each conveyor&#039;s enable condition to &amp;quot;greater than or equal to X amount of uranium&amp;quot; in the same manner. Finally, connect the inserters delivering uranium to the assembly machine up to the container the assembly machine is delivering nuclear fuel to, and set each of their enable conditions to &amp;quot;nuclear fuel = 0 (the enable condition can be set to &amp;quot;less than or equal to X amount of nuclear fuel&amp;quot; if a larger stockpile is desired).&lt;br /&gt;
&lt;br /&gt;
This set-up accomplishes the following:&lt;br /&gt;
&lt;br /&gt;
* When there is sufficient nuclear fuel and uranium stockpiled, the inserters will deactivate and the conveyors activate, allowing the uranium to continue down the conveyors to other facilities.&lt;br /&gt;
* When the nuclear fuel stockpile hits zero (or decreases below the desired amount), the inserters delivering to the assembly machine will activate and deliver uranium to resume production of nuclear fuel until quota is reached again.&lt;br /&gt;
* When there is not enough uranium stockpiled to produce a batch of nuclear fuel, the inserters gathering uranium will activate and and resume gathering uranium until they reach their quota. The conveyors carrying uranium will stop past the inserters, cutting off other facilities from that type of uranium until its respective inserter reaches quota.&lt;br /&gt;
* The assembly machine will only be provided with uranium when the stockpile of nuclear fuel hits zero (or decreases below the desired amount), preventing over-production of nuclear fuel and thus over-consumption of uranium.&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
{{clear}}&lt;br /&gt;
&lt;br /&gt;
== Railway network ==&lt;br /&gt;
=== Set train routing ===&lt;br /&gt;
The circuit network can be used to allow deeper micromanagement of [[train]]s. Circuits can be used to adjust train limits for [[Train stop|stops]], effectively disabling a stop when a resource is not available for loading, or if an unloading station already has more than enough of a resource. Note that adjusting train limits runs into fewer problems than fully enabling/disabling stops; see [https://factorio.com/blog/post/fff-361 Friday Facts #361 - Train stop limit, Tips and tricks] and the [[Train stop]] page for additional information about using train limits.&lt;br /&gt;
&lt;br /&gt;
=== Player safety ===&lt;br /&gt;
The circuit network can be used to ensure the player&#039;s safety when crossing train tracks so they do not get hit. Place [[gate]]s at designated crossing areas and connect an adjacent [[wall]] to [[rail signal]]s near the gate. Set the gate to &amp;quot;read sensor&amp;quot; and the signal to &amp;quot;close signal&amp;quot; with the condition being the signal the gate sends out being &amp;quot;1&amp;quot;. This means that when the gate is closed, the signal will be green and trains can pass freely, but when the player approaches the gate and it opens for them, the train signal will be turned red and trains will be stopped until the player clears the area.&lt;br /&gt;
&lt;br /&gt;
Alternatively, this system can be reversed - by setting the gate to &amp;quot;open gate&amp;quot; and the train signal set to &amp;quot;read signal&amp;quot;, the gate will remain open normally and will close when a train is approaching, preventing the player from crossing until it is safe.&lt;br /&gt;
&lt;br /&gt;
In lieu of gates, the player can connect a [[programmable speaker]] to the train signals to broadcast a warning siren when a train is approaching the area.&lt;br /&gt;
&lt;br /&gt;
== Latches ==&lt;br /&gt;
=== RS latch - single decider version ===&lt;br /&gt;
[https://forums.factorio.com/viewtopic.php?f=193&amp;amp;t=14556 This discussion] on the Factorio forums starts with the common 2 decider RS latch version, but later a [https://forums.factorio.com/viewtopic.php?p=111192#p111192 single decider version was proposed]. The thread [https://forums.factorio.com/viewtopic.php?p=160896#p160896 goes on to explain] why this is better. In the thread, the latch is described as an SR latch. However, when both inputs are true, the latch will reset, so it is an RS latch.&lt;br /&gt;
&lt;br /&gt;
==== Backup steam example ====&lt;br /&gt;
This example will turn on the steam generator when the Accumulator charge drops to 20%, but will &amp;quot;latch&amp;quot; (remember) the On state until the accumulator is charged to 90%.&lt;br /&gt;
&lt;br /&gt;
Latching is used to introduce [[Wikipedia:hysteresis|hysteresis]] and avoid the power switch rapidly cycling on and off (as the accumulator falls to 19%, charges to 20%, falls to 19% and so on). &lt;br /&gt;
[[File:SR-01-Layout.png|850px|left]]&lt;br /&gt;
{{clear}}&lt;br /&gt;
{{BlueprintString|bp-string=0eNrFVk1vozAQ/SuVz1ABCaRBq5WqXntKjqsKOTBJR8IGGTtpFPHfd+w0HyU0G6pVewkxnnmemfdmzI4tSgO1QqlZumOYV7Jh6Z8da3AleWnf6W0NLGVrVNrQG49JLuyLvYU/Z63HUBbwxtKw9QZ4zs48o15P1CBObgXkWIDy80osUHJdqTOAUfviMZAaNcI+A7fYZtKIBSiK7YgjoEAjfCgh1wpzv65KoFPqqiHnStrzCdAPA49t6Rm1NrYOWjQY7QrY6FQZwcvyX1jJFajxEYrnuRGmdGW6DCe+jx1KcB9TDYl1raoyW8ArXyM5kFVldG10djObj6zdI0kKHp2Mdiy0PysFIM8pwYKldHyOKjeo3TI8y8Wup93tl7Yv3fiaOC6zjt6z9uk4VqDaR+rY7CvBO2ZGewUec1qiaobVxaE3mtseiwK7EjVXLsaU/SKPobWe7zHrLYVmpM6WqhIZSsJg6ZKXDQyiYkzF9Vhk9xUU3d3kNiaSQUwEB/l9Hw+uZg1YjGzYiPpA1+/vpKuHjk7fRNf7JrJTsZf05MLwoIFbzLvtOvlEFZNjKepqQ5poNqjz10s9jA6N+fk8Ohx/FMFXNXDqxeCC20F901vCJxN07UjVG9K4+x9YQp5M2LUZfbTpq+XDKRsNnG4cuULZcz089HZWD+D0a8Pz52bnNPgPzTj76dlJAnDfNenZp5fHSr4ACp/NZ3fPnHrkDt64qN31vwbVuFIn43GUjCdxHIVt+xcL2lBp}}&lt;br /&gt;
{{clear}}&lt;br /&gt;
[[File:SR-02-Accumulator.png|left]]Accumulator outputs the current charge level as % on signal [[File:Signal-A.png|21px]]&lt;br /&gt;
{{clear}}&lt;br /&gt;
[[File:SR-03-RangeDeciders.png|left]]First decider outputs &amp;quot;Set&amp;quot; ([[File:Signal-S.png|21px]] = 1) if Accumulator is less than 20%.&lt;br /&gt;
Second decider outputs &amp;quot;Reset&amp;quot; ([[File:Signal-R.png|21px]] = 1) once Accumulator is more than 90% full.&lt;br /&gt;
{{clear}}&lt;br /&gt;
[[File:SR-04-SRLatch.png|left]]&lt;br /&gt;
&lt;br /&gt;
==== RS Latch configuration ====&lt;br /&gt;
&#039;&#039;&#039;The central decider and green feedback wire is the actual RS Latch.&#039;&#039;&#039;&lt;br /&gt;
It latches the Set signal [[File:Signal-S.png|21px]] until the Reset signal [[File:Signal-R.png|21px]] is received (and vice-versa).&amp;lt;br /&amp;gt;&lt;br /&gt;
NB: the latch expects binary inputs ([[File:Signal-S.png|21px]] &amp;amp; [[File:Signal-R.png|21px]] must be 0 or 1) - this is why the previous two deciders are required.&amp;lt;br /&amp;gt;&lt;br /&gt;
When both inputs are true, the reset signal takes priority and the latch resets. This means it is an RS latch instead of an SR latch.&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
[[File:SR-05-PowerSwitch.png|left]]The Power switch isolates the generator from the rest of the factory until [[File:Signal-S.png|21px]] = 1&lt;br /&gt;
&amp;lt;br clear=all&amp;gt; &lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
[[File:SRLatch.png|border|left|430px]]&lt;br /&gt;
&lt;br /&gt;
=== RS latch ===&lt;br /&gt;
&amp;lt;div style=&amp;quot;margin-left:440px;&amp;quot;&amp;gt;&lt;br /&gt;
* This should be familiar to anyone with any background in electronics. &lt;br /&gt;
* The signal is set and reset with the [[constant combinator]]s on the left by setting an A=1 signal. &lt;br /&gt;
* The latch &amp;quot;remembers&amp;quot; which one was last set and the light stays on until another signal is received.&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
{{clear}}&lt;br /&gt;
&lt;br /&gt;
[[File:SRlatchinaction.png|border|left|430px]]&lt;br /&gt;
&lt;br /&gt;
=== Usage of RS latch ===&lt;br /&gt;
&amp;lt;div style=&amp;quot;margin-left:440px;&amp;quot;&amp;gt;&lt;br /&gt;
* Here is an example of how you could use an RS latch.&lt;br /&gt;
* The two extra [[decider combinator]]s provide the set and reset conditions. &lt;br /&gt;
* Petroleum gas &amp;lt; 50 and petroleum gas &amp;gt; 100.&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
{{clear}}&lt;br /&gt;
&lt;br /&gt;
[[File:BeltLatch.png|border|left|430px]]&lt;br /&gt;
&lt;br /&gt;
=== Belt only latch ===&lt;br /&gt;
&amp;lt;div style=&amp;quot;margin-left:440px;&amp;quot;&amp;gt;&lt;br /&gt;
* To make it work, &#039;&#039;&#039;3&#039;&#039;&#039; pieces of raw wood must be placed on the inside lane of the belt.&lt;br /&gt;
* It will have higher latency than the combinator version, but in most situations you will not notice the difference.&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
{{clear}}&lt;br /&gt;
&lt;br /&gt;
== Displays ==&lt;br /&gt;
[[File:5digitDisplay.png|border|left|430px]]&lt;br /&gt;
&lt;br /&gt;
=== Numerical Display ===&lt;br /&gt;
&amp;lt;div style=&amp;quot;margin-left:440px;&amp;quot;&amp;gt;&lt;br /&gt;
* Each digit is driven by its own [[green wire]], that wire holds 15 signals, one for each lamp used in the digit.&lt;br /&gt;
* [[constant combinator]]s are used to define which lamp should light up for each value.&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
{{clear}}&lt;br /&gt;
&lt;br /&gt;
[[File:BWDisplay.png|border|left|430px]]&lt;br /&gt;
&lt;br /&gt;
=== Black and White Grid Display ===&lt;br /&gt;
&amp;lt;div style=&amp;quot;margin-left:440px;&amp;quot;&amp;gt;&lt;br /&gt;
* Each row has its own [[red wire]] connection and within that row each light has a numbered signal 0-9.&lt;br /&gt;
* We turn each light on by just setting or clearing the relevant signal.&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
{{clear}}&lt;br /&gt;
&lt;br /&gt;
[[File:MultiColoredDisplay.png|border|left|430px]]&lt;br /&gt;
&lt;br /&gt;
=== Multicolor Display by DaveMcW ===&lt;br /&gt;
&amp;lt;div style=&amp;quot;margin-left:440px;&amp;quot;&amp;gt;&lt;br /&gt;
* To understand how this works, you first need to understand how color lights choose which color to light up when there are multiple colored signals. &lt;br /&gt;
* The [[lamp]] will light up with the colored signal that is greater than zero and earliest in this list: red, green, blue, yellow, pink, cyan, white.  &lt;br /&gt;
* We have a [[red wire]] per column, that wire has each of the colored signals on it at different values and a numbered signal for each row. &lt;br /&gt;
* There is a [[arithmetic combinator]] for each cell that subtracts the &amp;quot;row&amp;quot; value from each of the colored signals. &lt;br /&gt;
* And this enables us to choose the color for each cell. &lt;br /&gt;
* Simple!&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
{{clear}}&lt;br /&gt;
&lt;br /&gt;
== See Also ==&lt;br /&gt;
* [[Arithmetic combinator]]&lt;br /&gt;
* [[Constant combinator]]&lt;br /&gt;
* [[Decider combinator]]&lt;br /&gt;
* [[Circuit network]]&lt;/div&gt;</summary>
		<author><name>Ndh</name></author>
	</entry>
	<entry>
		<id>https://wiki.factorio.com/index.php?title=User:Ndh&amp;diff=199023</id>
		<title>User:Ndh</title>
		<link rel="alternate" type="text/html" href="https://wiki.factorio.com/index.php?title=User:Ndh&amp;diff=199023"/>
		<updated>2024-07-10T18:59:02Z</updated>

		<summary type="html">&lt;p&gt;Ndh: Blanked the page&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Ndh</name></author>
	</entry>
	<entry>
		<id>https://wiki.factorio.com/index.php?title=Tutorial:Combinator_tutorial&amp;diff=198869</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=198869"/>
		<updated>2024-06-29T13:20:41Z</updated>

		<summary type="html">&lt;p&gt;Ndh: /* Introduction */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&#039;&#039;This is an &#039;&#039;&#039;advanced&#039;&#039;&#039; tutorial. Beginners should refer to the [[Tutorial:Circuit network cookbook]] for examples and the [[Circuit network]] page for an overview over the circuit network. This tutorial assumes a basic understanding of circuits and covers more advanced topics like SR latches, memory cells and clocks.&#039;&#039;&lt;br /&gt;
&lt;br /&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. Combinator logic works because Factorio only updates at &#039;&#039;&#039;60 times per second&#039;&#039;&#039;. Logically, each update tick is separated into two steps. In the first step, all combinators first read the input from the connected network(s), perform their computations. This produces an output value for every combinator. The tick update concludes with the second step, where the values of each network will be updated as the sum of all connected values.&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, its 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; they carry information in the connected wires, meaning that if there are similar signals on a wire it will add them automatically. If the signal is different, it will be carried in that wire as well, but as a different signal.&lt;br /&gt;
&lt;br /&gt;
When cross-connecting combinators, it is 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. Combinators will sum the red and green inputs prior to calculation, so either color can be used when wiring the output back to the input. In most cases however, it is more useful to use the opposing color of the wire so that it will not interfere with the resulting output and input.&lt;br /&gt;
&lt;br /&gt;
When trying to understand combinators, your best friend is the in-game editor. You can pause the game and, with the &amp;quot;Tick once&amp;quot; keybinding, inspect nodes and networks as they go through different states.&lt;br /&gt;
&lt;br /&gt;
== Virtual signals ==&lt;br /&gt;
&lt;br /&gt;
[[File:Virtual Signals dialog box.png|thumb|right|Virtual Signals available for use in the circuit network]]&lt;br /&gt;
&lt;br /&gt;
In addition to the standard item signals, Factorio&#039;s circuit network also includes a set of signals that do not represent any particular game item. Instead, these virtual signals serve as user-definable channels for the circuit network; they hold whatever meaning the user wants them to. There are currently 48 virtual signals that can be sent over the circuit network:&lt;br /&gt;
&lt;br /&gt;
* The 36 alphanumeric characters (A-Z, 0-9)&lt;br /&gt;
* Nine colors: red, green, blue, yellow, magenta, cyan, white, grey, and black&lt;br /&gt;
* Three icons: a check mark, an informational letter &#039;i&#039;, and a small, white dot&lt;br /&gt;
&lt;br /&gt;
=== Logic signals ===&lt;br /&gt;
&lt;br /&gt;
There are three additional virtual signals known as &#039;&#039;logic signals&#039;&#039;. Unlike other signals, they cannot be sent over the circuit network; instead, they apply additional logic to combinators that modify their behavior. Specifically, these logic symbols act as wildcards, which are special signals that represent &#039;&#039;&#039;zero or more&#039;&#039;&#039; arbitrary signals instead of representing a single discrete signal.  Factorio&#039;s circuit network implements three types of wildcards.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;span style=&amp;quot;color:#FF6666&amp;quot;&amp;gt;Everything wildcard&amp;lt;/span&amp;gt; [[File:Signal_everything.png|left|20px]] ====&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;Everything&#039;&#039; wildcard is used with decider combinators. Its exact behavior depends on whether it is used as an input or an output:&lt;br /&gt;
* &#039;&#039;&#039;Input&#039;&#039;&#039;: Returns true if &#039;&#039;all&#039;&#039; input signals pass the condition, or if there are &#039;&#039;no&#039;&#039; input signals, otherwise it returns false.&lt;br /&gt;
* &#039;&#039;&#039;Output&#039;&#039;&#039;: Returns &#039;&#039;all&#039;&#039; non-zero input signals.&lt;br /&gt;
&lt;br /&gt;
When used as an input, the &#039;&#039;everything&#039;&#039; wildcard can be thought of as a logical AND, or a [[:Wikipedia:universal quantification|universal quantifier]]. When used as an output, it acts as an &#039;echo&#039; or &#039;dump&#039; of input signals.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039;: Can be used as an output as long as the input is not an &#039;&#039;each&#039;&#039; wildcard.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;span style=&amp;quot;color:#99FF99&amp;quot;&amp;gt;Anything wildcard&amp;lt;/span&amp;gt; [[File:Signal_anything.png|left|20px]] ====&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;Anything&#039;&#039; wildcard is also used with decider combinators.&lt;br /&gt;
&lt;br /&gt;
Given &#039;&#039;&#039;at least one&#039;&#039;&#039; input signal, it returns true if &#039;&#039;any&#039;&#039; input signal passes the condition. If no signal passes the condition, or there are no input signals, then it returns false. From this behavior, the &#039;&#039;anything&#039;&#039; wildcard can be thought of as a logical OR, or an [[:Wikipedia:existential quantification|existential quantifier]].&lt;br /&gt;
&lt;br /&gt;
When used in both the input and output of a decider combinator, &#039;&#039;anything&#039;&#039; will return one of the signals that matched.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;span style=&amp;quot;color:#FFFF99&amp;quot;&amp;gt;Each wildcard&amp;lt;/span&amp;gt; [[File:Signal_each.png|left|20px]] ====&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;Each&#039;&#039; wildcard is used with both decider combinators and [[arithmetic combinator]]s, and behaves somewhat uniquely compared to the previous two. Generally speaking, it performs a combinator action on each signal &#039;&#039;&#039;individually&#039;&#039;&#039;, with the exact action depending on how it is used, and the type of combinator it is used in. It can be used as an input, and it can be used as an output, but &#039;&#039;only when it is used as input as well&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
In a &#039;&#039;&#039;decider combinator&#039;&#039;&#039;, when used as an input, the &#039;&#039;each&#039;&#039; wildcard individually compares each input signal against the combinator condition, returning each signal that passes the condition. The manner that the &#039;&#039;each&#039;&#039; wildcard returns signals when used as input depends on whether or not it is also used as output:&lt;br /&gt;
* &#039;&#039;&#039;Input only&#039;&#039;&#039;: Sums each input signal that passed the condition, and depending on output settings returns either a count of the passed signals or a summation of their values as the desired output signal.&lt;br /&gt;
* &#039;&#039;&#039;Input and Output&#039;&#039;&#039;: Returns each signal that passed the condition, their values depending on the output settings.&lt;br /&gt;
&lt;br /&gt;
In an &#039;&#039;&#039;arithmetic combinator&#039;&#039;&#039;, the designated arithmetic operation is applied individually to each input signal, and similar to the decider combinator, the signal that is returned depends on whether or not the &#039;&#039;each&#039;&#039; wildcard is used as output:&lt;br /&gt;
* &#039;&#039;&#039;Input only&#039;&#039;&#039;: The result of each operation on the input signals is summed and returned as the desired output signal.&lt;br /&gt;
* &#039;&#039;&#039;Input and Output&#039;&#039;&#039;: Each input signal is returned with the result of the specified operation applied to it.&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;Each&#039;&#039; wildcard is therefore notably more complex than the other two wildcards, but offers a good deal of power in exchange for its complexity.&lt;br /&gt;
&lt;br /&gt;
== Input insulator &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 insulator 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 insulator 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, which is 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.&amp;lt;br&amp;gt;&lt;br /&gt;
Whenever the 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;
In this specific example, the pump runs when light oil reaches 20000, and turns off when it reaches 5000:&lt;br /&gt;
&lt;br /&gt;
[[File:SR_latch.png|600px]]&lt;br /&gt;
&lt;br /&gt;
A similar backup steam power example with detailed configuration and explanation can be found here:&amp;lt;br&amp;gt;[[Tutorial:Circuit_network_cookbook#RS_latch_-_single_decider_version|RS latch - single decider version]]&lt;br /&gt;
&lt;br /&gt;
== Basic memory ==&lt;br /&gt;
A decider combinator can be used to store values, either for a counter or for more advanced logic (see below). The decider combinator is configured with&lt;br /&gt;
* input and output connected to the same network (typically each other),&lt;br /&gt;
* condition set to a signal &amp;gt; 0 for positive values or ≠ 0 to store both positive and negative values,&lt;br /&gt;
* output set to the input count of a specific input signal or [*].&lt;br /&gt;
As long as all inputs on the network are zero, it will hold the previously set value.&lt;br /&gt;
&lt;br /&gt;
Remember the two step update process from above? If the network has value [X]=5, the combinator will read this value from the network as its input, determine that it is &amp;gt; 0. It will then set the output to the input, which is [X]=5. In the next step, the value of the network will be computed, which is the sum of all the connected outputs, which is [X]=5, again.&lt;br /&gt;
&lt;br /&gt;
A non-zero input held over time, e. g. the output of a constant combinator, will create a basic runaway clock. The stored value will be incremented by the sum of all connected input values every cycle. So e. g. with a constant combinator that produces [A]=1 connected to the memory, the network will store the value 1 in the first tick, 2 in the second, etc., incrementing 60 times per second.&lt;br /&gt;
{{BlueprintString|bp-string=0eNqlU11rwzAM/C96TkuStWvqh8F+xyghH2orSOygyGWh5L/PjkcJJetW9hKQLd2d7pwrlI3FjkkLqCtQZXQP6uMKPZ100fgzGToEBSTYQgS6aH1VY0U18qoybUm6EMMwRkC6xk9QyRj9CuCJpNCyjJCOhwhQCwlh0DMVQ65tWyI7iodAEXSmd7NGe36Ht9sk620EA6jVNsvWW8fk5oRNk5d4Li7khlznkRpB/sGAC7FYd3JjDh2rd5jQrHcwiWcmHAKLxsor6T1U4j8nRtTzpah2G7te4sqSTKWfHr2Nd3unjxJYWPtu6Zo4qAmECxZ8w+burqab7iNxL/mfLcEL8iBn0qfgTUgIVOyLtit4kqvgzU0aK539B3Y35JP5+ZFNm5N2YKCELY7P2J/MvF6II53CTJ9Lzz3h6c2r2T8WgZPfhwCyZLPbp7vsdR+/xJtx/AJNbzZ8}}&lt;br /&gt;
&lt;br /&gt;
Again, how does this work in detail? The network will start without any values set. As soon as the constant combinator becomes active, it will produce [A]=1, and the decider combinator will produce 0 because no value is set yet. Step 2: The network will be set to the sum of all output, so [A]=1. In the next update tick, the constant combinator produces [A]=1 again, but now the decider sees [A]=1, so it would also output [A]=1. Step 2: The network is set to the sum, which is [A]=2. And so on.&lt;br /&gt;
&lt;br /&gt;
Typically a constant combinator producing 1 will be used, but of course it could output other values, including negative values.&lt;br /&gt;
A negative values would decrease the stored value in the example below.&lt;br /&gt;
If the decider combinator uses &amp;gt; 0 as the condition, only positive values will be allowed, so the value will stop decreasing if 0 is reached.&lt;br /&gt;
If the condition is ≠ 0, negative values will also be allowed.&lt;br /&gt;
&lt;br /&gt;
A single pulse of an input will cause a single increment by the pulsed value, creating a counter. In the following blueprint, place one item on the belt. Every time it is scanned by the connected belt, a pulse is generated that increments the stored value.&lt;br /&gt;
{{BlueprintString|bp-string=0eNqllMGO4jAMQP/F5zAqpaXQw/7IahWljQFLbVIlLtoK5d83aXdZEJ3DMBeQU+fFenZyg6YbcXBkGOobUGuNh/rnDTydjerSGk8DQg3E2IMAo/oUsVPGD9bxpsGOIQggo/E31NvwSwAaJiZcSHMwSTP2DbqY8BlDwGB93GZNOjWiqqL8KAVMUG/KQ/ZRhiBeaPl7tG2kCdDksF1S8hX27gvs/XOlT+xCQNTKznaywYu6knVpX0uuHYklGtV0KDX59A/1SXUexf2zQ6XlRRktEySWGK2yGx8y/q0vqb3VEZKF+VCz1ODTedv0c3aI5rEtpKEu/7NSGFsY1lwX7/l4cV2ssMs7W2NLGt2mtX1DRnGUtcI/fmo7X7f9F5tkabo7OZHzLF9m/UqOx7hyL2rJ2OAV3cQXMmdY/HpW6eJkKegH5eZya/gRd9qRh/Eb7GGKtY6G5cnZXpKJsKXx4Sut3T24Xml1HlstIP/uZOzfuoXVcf1OV2/N2Ux7moR9eormZ6t+eOUERNF+GZXDtqiOeXXYH7NdVoTwB9igtjA=}}&lt;br /&gt;
&lt;br /&gt;
A stored value is cleared if the condition is no longer met, which makes the decider clear its output. This only works if the value is also not output elsewhere in the network. A stored value can also be reset to zero if a negative pulse equal to the input occurs. The latter can also happen while other inputs are still connected.&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;
With a single decider combinator, a self-resetting clock can be built. Wire output to input and configure with Less Than (&amp;lt;) with a specific number, and Input -&amp;gt; Output. When a constant combinator is then connected to the input, every cycle it will count up by the output of the constant combinator until the number is reached. The decider will then clear its output, only the constant combinator will contribute to the value in the network, which resets the clock.&lt;br /&gt;
&lt;br /&gt;
This means that the clock sequence will not include zero. It will begin at the value set in the constant combinator. Furthermore, it will include the number value that causes the conditional to become false. An arithmetic combinator can modify the clock sequence, but remember that 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. The clock can get reset by enabling and disabling the constant combinator that outputs [R].&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;
{{BlueprintString|bp-string=0eNq1VdtugzAM/Rc/p1Wh9BZtPzHtaVOFKLidJUhQSKpVFf8+B6oK9QrT9oJI4hzb5xzDETa5w9KQsiCPQKlWFcjPI1S0U0nu9+yhRJBAFgsQoJLCrzJMKUMzSnWxIZVYbaAWQCrDb5BBLZ4C+EQ2UfY2QlivBaCyZAnbeprFIVau2KDhFI8qEVDqiq9q5dMz3GI2E3AAOZqtgvGM02RkMG0D5sLXYo3O4w1+JXtiAL51go35LGugKr+7JVPZ+Kq1PRnreOdcVBsxevctVegx+l/68Je4mzIxTTcSXjhGO1u6oalTXR64A6dsvDW6iEkxBshtkldYN+dKtTw03QX+YTDrEk68ijiSTOrINstGnJ1BVJeBfMKoYT+YgINr75QLacOHHrmh7WI8WN0t5RbNHac/Ecb5UQmWk47d13e4vElS0I+G6VAawjMNy9V/0vDWpaFLAr9Xsc/W+msAJT2dEf1y6K/5CP9x6E/8tJqBnFwM8+sfD7M1bsgsB31nedoR4PZH4MGoX3tcDFDeO8n/LGTn5yRgz05txVsG0WIVLpbz1WQ6ier6B+n0TYg=}}&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;
== Memory cells ==&lt;br /&gt;
&lt;br /&gt;
=== Simple latch ===&lt;br /&gt;
&lt;br /&gt;
When looping the combinator to itself, use a different color of wire from your main inputs or outputs. &lt;br /&gt;
&lt;br /&gt;
[[File:SimpleLatchv2.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;
!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;
=== Positive cell ===&lt;br /&gt;
&lt;br /&gt;
Cell for storing a positive value, with reset support:&lt;br /&gt;
&lt;br /&gt;
[[File:AdvancedMemoryCell.png|500px]]&lt;br /&gt;
&lt;br /&gt;
Connect the desired value as signal I on the right side to set the memory cell and connect a negative value as signal I to reset the cell.&lt;br /&gt;
&lt;br /&gt;
* The output of the memory cell is 2 mutually exclusive signals.&lt;br /&gt;
** In case input signal I &amp;gt; 0 then signal I is passed to the other side.&lt;br /&gt;
** In case input signal I is interrupted, then signal M is passed instead as a memory of previous input value.&lt;br /&gt;
* When input signal I is interrupted, it takes 2 ticks to switch to memory signal M.&lt;br /&gt;
* In case input I signal lasts only one tick then memory cell starts to cycle between the 2 previous values, tick by tick. Indefinitely.&lt;br /&gt;
* Switching is seamless, e.g. there are no ticks with empty signal.&lt;br /&gt;
&lt;br /&gt;
=== Positives and negatives cell ===&lt;br /&gt;
&lt;br /&gt;
This cell can store negatives or positives. Reset is done on a dedicated line. Additionally, a 1-tick burst is handled properly. [https://forums.factorio.com/viewtopic.php?f=193&amp;amp;t=60330&amp;amp;p=362377#p362377 Forum post].&lt;br /&gt;
&lt;br /&gt;
* The output M (memory) is the last non-zero input I (Input).&lt;br /&gt;
* A non zero R (reset) signal sets the output to zero.&lt;br /&gt;
* 1-tick bursts of R or I are handled properly.&lt;br /&gt;
* Negatives are handled properly.&lt;br /&gt;
&lt;br /&gt;
[[File:Memory_cell_with_negatives.png|500px]]&lt;br /&gt;
&lt;br /&gt;
== Multiplier and Dictionaries/Arrays ==&lt;br /&gt;
[[File:combinatorMultiplierDetailed.png|left|500px]]&lt;br /&gt;
* Multiplying two signals together is simple and requires only a single combinator, however multiplying a set of signals is more complicated.&lt;br /&gt;
* A proof is shown below for the equation and why it works.&lt;br /&gt;
* A dictionary is a system that allows a value on a specific signal to be accessed. For example, A can contain many signals (either from a constant combinator or memory cell) and B can contain 1 of a specific signal (such as blue signal). What remains is the blue-signal value from A. This is because all the other signals are multiplied by 0.&lt;br /&gt;
* Arrays are similar to dictionaries, but instead of using a signal as a key, we use a number. Constant combinators are placed mapping each signal to a unique number (such as 1 yellow belt, 2 red belt, 3 blue belt, 4 burner inserter, etc). Then, use a combinator of &amp;quot;each = index OUTPUT 1 of each&amp;quot; and plug that in as the input to a dictionary.{{clear}}&lt;br /&gt;
[[File:combinatorMultiplierMath.png|left|500px]]&lt;br /&gt;
&lt;br /&gt;
    ((A+B)^2 - (A-B)^2)/4 = AB&lt;br /&gt;
    (A+B)^2 - (A-B)^2 = 4AB&lt;br /&gt;
    (A^2 + 2AB + B^2) - (A^2 - 2AB + B^2) = 4AB&lt;br /&gt;
    4AB = 4AB&lt;br /&gt;
&lt;br /&gt;
{{clear}}&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;
* [[Tutorial:Circuit network cookbook]]&lt;br /&gt;
* [[Circuit network]]&lt;br /&gt;
* [[Arithmetic combinator]]&lt;br /&gt;
* [[Constant combinator]]&lt;br /&gt;
* [[Decider combinator]]&lt;/div&gt;</summary>
		<author><name>Ndh</name></author>
	</entry>
	<entry>
		<id>https://wiki.factorio.com/index.php?title=Tutorial_talk:Combinator_tutorial&amp;diff=198868</id>
		<title>Tutorial talk:Combinator tutorial</title>
		<link rel="alternate" type="text/html" href="https://wiki.factorio.com/index.php?title=Tutorial_talk:Combinator_tutorial&amp;diff=198868"/>
		<updated>2024-06-29T13:15:44Z</updated>

		<summary type="html">&lt;p&gt;Ndh: /* Memory cells */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Memory cells  ==&lt;br /&gt;
&lt;br /&gt;
I am aiming to update the &amp;quot;memory cells&amp;quot; section.&lt;br /&gt;
* The &amp;quot;advanced cell&amp;quot; does not handle 1-tick bursts properly. (I updated the article and wrote about that)&lt;br /&gt;
* There should be more versions of the memory cell, including versions that can handle negative input.&lt;br /&gt;
&lt;br /&gt;
I may post some of my designs here once I finish polishing them.&lt;br /&gt;
-- [[User:SafwatHalaby|SafwatHalaby]] ([[User talk:SafwatHalaby|talk]]) 09:46, 13 May 2018 (UTC)&lt;br /&gt;
&lt;br /&gt;
:Thank you for this, designs are appreciated here. It&#039;s good that you remain objective about their advantages and disadvantages. -- [[User:Bilka|Bilka]] ([[User talk:Bilka|talk]]) - &amp;lt;span style=&amp;quot;color:#FF0000&amp;quot;&amp;gt;Admin&amp;lt;/span&amp;gt; 11:57, 13 May 2018 (UTC)&lt;br /&gt;
&lt;br /&gt;
:: Thank you for your incredible work on the Wiki. I am always 100% objective. In this particular scenario, the initial design is objectively flawed. Try connecting a simple clock (self-connected arithmetic combinator with + 1) into it and then disconnecting it suddenly, its memory will flicker between the last two values. More generally, if the current input is only given for 1 tick, then it flickers between the current and the previous input. I do not want to remove it without the approval of the original poster. Here is a demo of the flicker. This device on the left sends a 1-tick pulse of 1. The lamp turns on if the output signal is 1. -- [[User:SafwatHalaby|SafwatHalaby]] ([[User talk:SafwatHalaby|talk]]) 13:46, 13 May 2018 (UTC)&lt;br /&gt;
&lt;br /&gt;
:: (edit: fixed link): https://streamable.com/5r7w8&lt;br /&gt;
&lt;br /&gt;
::: Because your memory cell has the same size, the other memory cell has no advantages over it. So, I am okay with a removal of the &amp;quot;positive cell&amp;quot;. -- [[User:Bilka|Bilka]] ([[User talk:Bilka|talk]]) - &amp;lt;span style=&amp;quot;color:#FF0000&amp;quot;&amp;gt;Admin&amp;lt;/span&amp;gt; 14:53, 13 May 2018 (UTC)&lt;br /&gt;
&lt;br /&gt;
:::: Ok. Let&#039;s wait for a while in case the original poster has comments that we&#039;ve missed.&lt;br /&gt;
&lt;br /&gt;
:::: There&#039;s one advantage for the previous design: It&#039;s useful for someone that absolutely requires a reset-on-negative and not reset on a dedicated line, and does not care about the flicker issue. But that seems like a very rare edge case, and someone who needs it is most likely very experienced and doesn&#039;t need this guide. -- [[User:SafwatHalaby|SafwatHalaby]] ([[User talk:SafwatHalaby|talk]]) 15:54, 13 May 2018 (UTC)&lt;br /&gt;
&lt;br /&gt;
There is a mistake in the new image for the &amp;quot;Positives and Negatives cell&amp;quot; by &amp;quot;Zippy.&amp;quot; In the original image there is a green wire connecting the input of [2] to the input of [3] which must be present for the memory cell to function properly; without it the [M] output simply increments on each tick. In case that description is confusing, here is an image where I use the blueprint selection box to highlight the wire I&#039;m talking about: https://i.imgur.com/XRLAEkh.png [[User:Maoman|Maoman]] ([[User talk:Maoman|talk]]) 11:07, 12 February 2021 (UTC)&lt;br /&gt;
&lt;br /&gt;
The image for the decider combinator shows 1 greater than 30.  It should be less than in order to work, and to match the text. -- [[User:Kathrynn|Kathrynn]] ([[User talk:Kathrynn|talk]]) 18:06, 13 February 2021 (UTC)&lt;br /&gt;
:Thank you to both of you for letting me know. I have fixed the two images. -- [[User:Bilka|Bilka]] ([[User talk:Bilka|talk]]) - &amp;lt;span style=&amp;quot;color:#FF0000&amp;quot;&amp;gt;Admin&amp;lt;/span&amp;gt; 12:30, 16 February 2021 (UTC)&lt;br /&gt;
&lt;br /&gt;
I&#039;ve updated this section. I found combinators very hard to understand. The examples always only include the combinators, but not how they&#039;re used. And I haven&#039;t found a source that clearly explains what&#039;s happening, on a tick-by-tick basis. So I&#039;ve added some blueprints, some images, and a lot more explanatory text. However, I&#039;m not sure if that is in the spirit of this tutorial. Maybe there should be two pages: This tutorial, which only explains *how* to use combinators, and another page that explains *why* it works, what&#039;s going on. --[[User:Ndh|Ndh]] ([[User talk:Ndh|talk]]) 13:15, 29 June 2024 (UTC)&lt;br /&gt;
&lt;br /&gt;
== Binary gates redundant? ==&lt;br /&gt;
&lt;br /&gt;
The binary gates do not seem to have much function, because As of 0.16, arithmetic combinators have built-in binary logic support. -- [[User:SafwatHalaby|SafwatHalaby]] ([[User talk:SafwatHalaby|talk]]) 09:56, 13 May 2018 (UTC)&lt;br /&gt;
&lt;br /&gt;
:I am not very experienced in combinators, but aren&#039;t the combinators OR, XOR and AND option bitwise instead of binary? [[User:My3DS]] changed the page to specify that just yesterday, so it seems important to me. -- [[User:Bilka|Bilka]] ([[User talk:Bilka|talk]]) - &amp;lt;span style=&amp;quot;color:#FF0000&amp;quot;&amp;gt;Admin&amp;lt;/span&amp;gt; 11:57, 13 May 2018 (UTC)&lt;br /&gt;
&lt;br /&gt;
:: I am not sure I understand the difference between &amp;quot;bitwise&amp;quot; and &amp;quot;binary&amp;quot; in the context of 1-bit inputs.&lt;br /&gt;
&lt;br /&gt;
:: The built-in OR, XOR, and AND produce exactly the same truth tables as the ones currently in the article for inputs of 1&#039;s and zeros, and are additionally capable of performing more than that for inputs greater than 1.&lt;br /&gt;
&lt;br /&gt;
:: -- [[User:SafwatHalaby|SafwatHalaby]] ([[User talk:SafwatHalaby|talk]]) 13:25, 13 May 2018 (UTC)&lt;br /&gt;
&lt;br /&gt;
::: Like I said, combinators aren&#039;t my strong suit :) So yes, they are redundant, but I&#039;d personally wait and see what My3DS wants to do with the gates before removing them. Perhaps give them a week, and if nothing is changed until then, remove them. -- [[User:Bilka|Bilka]] ([[User talk:Bilka|talk]]) - &amp;lt;span style=&amp;quot;color:#FF0000&amp;quot;&amp;gt;Admin&amp;lt;/span&amp;gt; 14:53, 13 May 2018 (UTC)&lt;br /&gt;
&lt;br /&gt;
:::: Ok :), does the wiki have some sort of &amp;quot;pinging&amp;quot; system to let them see the conversation?. -- [[User:SafwatHalaby|SafwatHalaby]] ([[User talk:SafwatHalaby|talk]]) 15:54, 13 May 2018 (UTC)&lt;br /&gt;
&lt;br /&gt;
::::: You can&#039;t ping people directly, but if you leave a message on someones talk page, they will see a notification until they check it. -- [[User:Bilka|Bilka]] ([[User talk:Bilka|talk]]) - &amp;lt;span style=&amp;quot;color:#FF0000&amp;quot;&amp;gt;Admin&amp;lt;/span&amp;gt; 18:12, 13 May 2018 (UTC)&lt;br /&gt;
&lt;br /&gt;
:::::: Thank you :) -- [[User:SafwatHalaby|SafwatHalaby]] ([[User talk:SafwatHalaby|talk]]) 14:06, 14 May 2018 (UTC)&lt;br /&gt;
&lt;br /&gt;
::: I can see the merit in these designs for 3 or more inputs. But I think  it should be clear to the reader that the 2-input designs are alternatives to the built-in ones, and that the bitwise vs binary sentence should be clarified. -- [[User:SafwatHalaby|SafwatHalaby]] ([[User talk:SafwatHalaby|talk]]) 14:06, 14 May 2018 (UTC)&lt;br /&gt;
&lt;br /&gt;
I have updated the page to have some clarification of what is meant by bitwise and some additional notes on the gates, as some can function with boolean or non-boolean values (or binary vs non-binary values), and some can have more inputs. Let me know if something doesn&#039;t make sense or should be improved. I&#039;m also not sure if the built in ones should be under the others or before it. [[User:BlackJack69|BlackJack69]] ([[User talk:BlackJack69|talk]]) 00:19, 12 February 2019 (UTC)&lt;br /&gt;
&lt;br /&gt;
== This is not a beginner tutorial at the moment ==&lt;br /&gt;
&lt;br /&gt;
This page seems inappropriate for circuit beginners and I&#039;ve added a sentence at the beginning to keep beginners from getting frustrated; the circuit network page and cookbook page should be more helpful for beginners. A beginner section on this (or on a different page) that explains how to connect wires, how signals work and so on would be useful.&lt;br /&gt;
&lt;br /&gt;
There&#039;s also a decent overlap with the cookbook page (the madzuri setup, memory cells, sr latches, logic gates). And virtual signals are explained here and on the circuit network page. That is not a problem as such but it means there is more work to keep it updated. In sections where the intended depth of explanation is comparable between the pages, it may be better to keep the content on one page and have a link on the other one. [[User:Unique 2|Unique 2]] ([[User talk:Unique 2|talk]]) 23:25, 10 March 2019 (UTC)&lt;br /&gt;
&lt;br /&gt;
== Working on improving the Virtual Signal section ==&lt;br /&gt;
&lt;br /&gt;
So far I&#039;ve rewritten the section explaining wildcards, as it was very terse compared to overview at the [[Circuit network#Logic signals]] section. Given that this is a tutorial page, they should be explained in depth, which I attempted to do.&lt;br /&gt;
&lt;br /&gt;
I plan to add a similar explanation for the other virtual signals, but for now I&#039;ve stayed up way past my bed time :) --[[User:ZeroKnight|ZeroKnight]] ([[User talk:ZeroKnight|talk]]) 10:41, 4 October 2019 (UTC)&lt;/div&gt;</summary>
		<author><name>Ndh</name></author>
	</entry>
	<entry>
		<id>https://wiki.factorio.com/index.php?title=Tutorial:Combinator_tutorial&amp;diff=198841</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=198841"/>
		<updated>2024-06-27T19:38:07Z</updated>

		<summary type="html">&lt;p&gt;Ndh: /* Basic clocks */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&#039;&#039;This is an &#039;&#039;&#039;advanced&#039;&#039;&#039; tutorial. Beginners should refer to the [[Tutorial:Circuit network cookbook]] for examples and the [[Circuit network]] page for an overview over the circuit network. This tutorial assumes a basic understanding of circuits and covers more advanced topics like SR latches, memory cells and clocks.&#039;&#039;&lt;br /&gt;
&lt;br /&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. Combinator logic works because Factorio only updates at &#039;&#039;&#039;60 times per second&#039;&#039;&#039;. Logically, each update tick is separated into two steps. In the first step, all combinators first read the input from the connected network(s), perform their computations. This produces an output value for every combinator. The tick update concludes with the second step, where the values of each network will be updated as the sum of all connected values.&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, its 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; they carry information in the connected wires, meaning that if there are similar signals on a wire it will add them automatically. If the signal is different, it will be carried in that wire as well, but as a different signal.&lt;br /&gt;
&lt;br /&gt;
When cross-connecting combinators, it is 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. Combinators will sum the red and green inputs prior to calculation, so either color can be used when wiring the output back to the input. In most cases however, it is more useful to use the opposing color of the wire so that it will not interfere with the resulting output and input.&lt;br /&gt;
&lt;br /&gt;
== Virtual signals ==&lt;br /&gt;
&lt;br /&gt;
[[File:Virtual Signals dialog box.png|thumb|right|Virtual Signals available for use in the circuit network]]&lt;br /&gt;
&lt;br /&gt;
In addition to the standard item signals, Factorio&#039;s circuit network also includes a set of signals that do not represent any particular game item. Instead, these virtual signals serve as user-definable channels for the circuit network; they hold whatever meaning the user wants them to. There are currently 48 virtual signals that can be sent over the circuit network:&lt;br /&gt;
&lt;br /&gt;
* The 36 alphanumeric characters (A-Z, 0-9)&lt;br /&gt;
* Nine colors: red, green, blue, yellow, magenta, cyan, white, grey, and black&lt;br /&gt;
* Three icons: a check mark, an informational letter &#039;i&#039;, and a small, white dot&lt;br /&gt;
&lt;br /&gt;
=== Logic signals ===&lt;br /&gt;
&lt;br /&gt;
There are three additional virtual signals known as &#039;&#039;logic signals&#039;&#039;. Unlike other signals, they cannot be sent over the circuit network; instead, they apply additional logic to combinators that modify their behavior. Specifically, these logic symbols act as wildcards, which are special signals that represent &#039;&#039;&#039;zero or more&#039;&#039;&#039; arbitrary signals instead of representing a single discrete signal.  Factorio&#039;s circuit network implements three types of wildcards.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;span style=&amp;quot;color:#FF6666&amp;quot;&amp;gt;Everything wildcard&amp;lt;/span&amp;gt; [[File:Signal_everything.png|left|20px]] ====&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;Everything&#039;&#039; wildcard is used with decider combinators. Its exact behavior depends on whether it is used as an input or an output:&lt;br /&gt;
* &#039;&#039;&#039;Input&#039;&#039;&#039;: Returns true if &#039;&#039;all&#039;&#039; input signals pass the condition, or if there are &#039;&#039;no&#039;&#039; input signals, otherwise it returns false.&lt;br /&gt;
* &#039;&#039;&#039;Output&#039;&#039;&#039;: Returns &#039;&#039;all&#039;&#039; non-zero input signals.&lt;br /&gt;
&lt;br /&gt;
When used as an input, the &#039;&#039;everything&#039;&#039; wildcard can be thought of as a logical AND, or a [[:Wikipedia:universal quantification|universal quantifier]]. When used as an output, it acts as an &#039;echo&#039; or &#039;dump&#039; of input signals.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039;: Can be used as an output as long as the input is not an &#039;&#039;each&#039;&#039; wildcard.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;span style=&amp;quot;color:#99FF99&amp;quot;&amp;gt;Anything wildcard&amp;lt;/span&amp;gt; [[File:Signal_anything.png|left|20px]] ====&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;Anything&#039;&#039; wildcard is also used with decider combinators.&lt;br /&gt;
&lt;br /&gt;
Given &#039;&#039;&#039;at least one&#039;&#039;&#039; input signal, it returns true if &#039;&#039;any&#039;&#039; input signal passes the condition. If no signal passes the condition, or there are no input signals, then it returns false. From this behavior, the &#039;&#039;anything&#039;&#039; wildcard can be thought of as a logical OR, or an [[:Wikipedia:existential quantification|existential quantifier]].&lt;br /&gt;
&lt;br /&gt;
When used in both the input and output of a decider combinator, &#039;&#039;anything&#039;&#039; will return one of the signals that matched.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;span style=&amp;quot;color:#FFFF99&amp;quot;&amp;gt;Each wildcard&amp;lt;/span&amp;gt; [[File:Signal_each.png|left|20px]] ====&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;Each&#039;&#039; wildcard is used with both decider combinators and [[arithmetic combinator]]s, and behaves somewhat uniquely compared to the previous two. Generally speaking, it performs a combinator action on each signal &#039;&#039;&#039;individually&#039;&#039;&#039;, with the exact action depending on how it is used, and the type of combinator it is used in. It can be used as an input, and it can be used as an output, but &#039;&#039;only when it is used as input as well&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
In a &#039;&#039;&#039;decider combinator&#039;&#039;&#039;, when used as an input, the &#039;&#039;each&#039;&#039; wildcard individually compares each input signal against the combinator condition, returning each signal that passes the condition. The manner that the &#039;&#039;each&#039;&#039; wildcard returns signals when used as input depends on whether or not it is also used as output:&lt;br /&gt;
* &#039;&#039;&#039;Input only&#039;&#039;&#039;: Sums each input signal that passed the condition, and depending on output settings returns either a count of the passed signals or a summation of their values as the desired output signal.&lt;br /&gt;
* &#039;&#039;&#039;Input and Output&#039;&#039;&#039;: Returns each signal that passed the condition, their values depending on the output settings.&lt;br /&gt;
&lt;br /&gt;
In an &#039;&#039;&#039;arithmetic combinator&#039;&#039;&#039;, the designated arithmetic operation is applied individually to each input signal, and similar to the decider combinator, the signal that is returned depends on whether or not the &#039;&#039;each&#039;&#039; wildcard is used as output:&lt;br /&gt;
* &#039;&#039;&#039;Input only&#039;&#039;&#039;: The result of each operation on the input signals is summed and returned as the desired output signal.&lt;br /&gt;
* &#039;&#039;&#039;Input and Output&#039;&#039;&#039;: Each input signal is returned with the result of the specified operation applied to it.&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;Each&#039;&#039; wildcard is therefore notably more complex than the other two wildcards, but offers a good deal of power in exchange for its complexity.&lt;br /&gt;
&lt;br /&gt;
== Input insulator &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 insulator 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 insulator 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, which is 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.&amp;lt;br&amp;gt;&lt;br /&gt;
Whenever the 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;
In this specific example, the pump runs when light oil reaches 20000, and turns off when it reaches 5000:&lt;br /&gt;
&lt;br /&gt;
[[File:SR_latch.png|600px]]&lt;br /&gt;
&lt;br /&gt;
A similar backup steam power example with detailed configuration and explanation can be found here:&amp;lt;br&amp;gt;[[Tutorial:Circuit_network_cookbook#RS_latch_-_single_decider_version|RS latch - single decider version]]&lt;br /&gt;
&lt;br /&gt;
== Basic memory ==&lt;br /&gt;
A decider combinator can be used to store values, either for a counter or for more advanced logic (see below). The decider combinator is configured with&lt;br /&gt;
* input and output connected to the same network (typically each other),&lt;br /&gt;
* condition set to a signal &amp;gt; 0 for positive values or ≠ 0 to store both positive and negative values,&lt;br /&gt;
* output set to the input count of a specific input signal or [*].&lt;br /&gt;
As long as all inputs on the network are zero, it will hold the previously set value.&lt;br /&gt;
&lt;br /&gt;
Remember the two step update process from above? If the network has value [X]=5, the combinator will read this value from the network as its input, determine that it is &amp;gt; 0. It will then set the output to the input, which is [X]=5. In the next step, the value of the network will be computed, which is the sum of all the connected outputs, which is [X]=5, again.&lt;br /&gt;
&lt;br /&gt;
A non-zero input held over time, e. g. the output of a constant combinator, will create a basic runaway clock. The stored value will be incremented by the sum of all connected input values every cycle. So e. g. with a constant combinator that produces [A]=1 connected to the memory, the network will store the value 1 in the first tick, 2 in the second, etc., incrementing 60 times per second.&lt;br /&gt;
{{BlueprintString|bp-string=0eNqlU11rwzAM/C96TkuStWvqh8F+xyghH2orSOygyGWh5L/PjkcJJetW9hKQLd2d7pwrlI3FjkkLqCtQZXQP6uMKPZ100fgzGToEBSTYQgS6aH1VY0U18qoybUm6EMMwRkC6xk9QyRj9CuCJpNCyjJCOhwhQCwlh0DMVQ65tWyI7iodAEXSmd7NGe36Ht9sk620EA6jVNsvWW8fk5oRNk5d4Li7khlznkRpB/sGAC7FYd3JjDh2rd5jQrHcwiWcmHAKLxsor6T1U4j8nRtTzpah2G7te4sqSTKWfHr2Nd3unjxJYWPtu6Zo4qAmECxZ8w+burqab7iNxL/mfLcEL8iBn0qfgTUgIVOyLtit4kqvgzU0aK539B3Y35JP5+ZFNm5N2YKCELY7P2J/MvF6II53CTJ9Lzz3h6c2r2T8WgZPfhwCyZLPbp7vsdR+/xJtx/AJNbzZ8}}&lt;br /&gt;
&lt;br /&gt;
Again, how does this work in detail? The network will start without any values set. As soon as the constant combinator becomes active, it will produce [A]=1, and the decider combinator will produce 0 because no value is set yet. Step 2: The network will be set to the sum of all output, so [A]=1. In the next update tick, the constant combinator produces [A]=1 again, but now the decider sees [A]=1, so it would also output [A]=1. Step 2: The network is set to the sum, which is [A]=2. And so on.&lt;br /&gt;
&lt;br /&gt;
Typically a constant combinator producing 1 will be used, but of course it could output other values, including negative values.&lt;br /&gt;
A negative values would decrease the stored value in the example below.&lt;br /&gt;
If the decider combinator uses &amp;gt; 0 as the condition, only positive values will be allowed, so the value will stop decreasing if 0 is reached.&lt;br /&gt;
If the condition is ≠ 0, negative values will also be allowed.&lt;br /&gt;
&lt;br /&gt;
A single pulse of an input will cause a single increment by the pulsed value, creating a counter. In the following blueprint, place one item on the belt. Every time it is scanned by the connected belt, a pulse is generated that increments the stored value.&lt;br /&gt;
{{BlueprintString|bp-string=0eNqllMGO4jAMQP/F5zAqpaXQw/7IahWljQFLbVIlLtoK5d83aXdZEJ3DMBeQU+fFenZyg6YbcXBkGOobUGuNh/rnDTydjerSGk8DQg3E2IMAo/oUsVPGD9bxpsGOIQggo/E31NvwSwAaJiZcSHMwSTP2DbqY8BlDwGB93GZNOjWiqqL8KAVMUG/KQ/ZRhiBeaPl7tG2kCdDksF1S8hX27gvs/XOlT+xCQNTKznaywYu6knVpX0uuHYklGtV0KDX59A/1SXUexf2zQ6XlRRktEySWGK2yGx8y/q0vqb3VEZKF+VCz1ODTedv0c3aI5rEtpKEu/7NSGFsY1lwX7/l4cV2ssMs7W2NLGt2mtX1DRnGUtcI/fmo7X7f9F5tkabo7OZHzLF9m/UqOx7hyL2rJ2OAV3cQXMmdY/HpW6eJkKegH5eZya/gRd9qRh/Eb7GGKtY6G5cnZXpKJsKXx4Sut3T24Xml1HlstIP/uZOzfuoXVcf1OV2/N2Ux7moR9eormZ6t+eOUERNF+GZXDtqiOeXXYH7NdVoTwB9igtjA=}}&lt;br /&gt;
&lt;br /&gt;
A stored value is cleared if the condition is no longer met, which makes the decider clear its output. This only works if the value is also not output elsewhere in the network. A stored value can also be reset to zero if a negative pulse equal to the input occurs. The latter can also happen while other inputs are still connected.&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;
With a single decider combinator, a self-resetting clock can be built. Wire output to input and configure with Less Than (&amp;lt;) with a specific number, and Input -&amp;gt; Output. When a constant combinator is then connected to the input, every cycle it will count up by the output of the constant combinator until the number is reached. The decider will then clear its output, only the constant combinator will contribute to the value in the network, which resets the clock.&lt;br /&gt;
&lt;br /&gt;
This means that the clock sequence will not include zero. It will begin at the value set in the constant combinator. Furthermore, it will include the number value that causes the conditional to become false. An arithmetic combinator can modify the clock sequence, but remember that 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. The clock can get reset by enabling and disabling the constant combinator that outputs [R].&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;
{{BlueprintString|bp-string=0eNq1VdtugzAM/Rc/p1Wh9BZtPzHtaVOFKLidJUhQSKpVFf8+B6oK9QrT9oJI4hzb5xzDETa5w9KQsiCPQKlWFcjPI1S0U0nu9+yhRJBAFgsQoJLCrzJMKUMzSnWxIZVYbaAWQCrDb5BBLZ4C+EQ2UfY2QlivBaCyZAnbeprFIVau2KDhFI8qEVDqiq9q5dMz3GI2E3AAOZqtgvGM02RkMG0D5sLXYo3O4w1+JXtiAL51go35LGugKr+7JVPZ+Kq1PRnreOdcVBsxevctVegx+l/68Je4mzIxTTcSXjhGO1u6oalTXR64A6dsvDW6iEkxBshtkldYN+dKtTw03QX+YTDrEk68ijiSTOrINstGnJ1BVJeBfMKoYT+YgINr75QLacOHHrmh7WI8WN0t5RbNHac/Ecb5UQmWk47d13e4vElS0I+G6VAawjMNy9V/0vDWpaFLAr9Xsc/W+msAJT2dEf1y6K/5CP9x6E/8tJqBnFwM8+sfD7M1bsgsB31nedoR4PZH4MGoX3tcDFDeO8n/LGTn5yRgz05txVsG0WIVLpbz1WQ6ier6B+n0TYg=}}&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;
== Memory cells ==&lt;br /&gt;
&lt;br /&gt;
=== Simple latch ===&lt;br /&gt;
&lt;br /&gt;
When looping the combinator to itself, use a different color of wire from your main inputs or outputs. &lt;br /&gt;
&lt;br /&gt;
[[File:SimpleLatchv2.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;
!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;
=== Positive cell ===&lt;br /&gt;
&lt;br /&gt;
Cell for storing a positive value, with reset support:&lt;br /&gt;
&lt;br /&gt;
[[File:AdvancedMemoryCell.png|500px]]&lt;br /&gt;
&lt;br /&gt;
Connect the desired value as signal I on the right side to set the memory cell and connect a negative value as signal I to reset the cell.&lt;br /&gt;
&lt;br /&gt;
* The output of the memory cell is 2 mutually exclusive signals.&lt;br /&gt;
** In case input signal I &amp;gt; 0 then signal I is passed to the other side.&lt;br /&gt;
** In case input signal I is interrupted, then signal M is passed instead as a memory of previous input value.&lt;br /&gt;
* When input signal I is interrupted, it takes 2 ticks to switch to memory signal M.&lt;br /&gt;
* In case input I signal lasts only one tick then memory cell starts to cycle between the 2 previous values, tick by tick. Indefinitely.&lt;br /&gt;
* Switching is seamless, e.g. there are no ticks with empty signal.&lt;br /&gt;
&lt;br /&gt;
=== Positives and negatives cell ===&lt;br /&gt;
&lt;br /&gt;
This cell can store negatives or positives. Reset is done on a dedicated line. Additionally, a 1-tick burst is handled properly. [https://forums.factorio.com/viewtopic.php?f=193&amp;amp;t=60330&amp;amp;p=362377#p362377 Forum post].&lt;br /&gt;
&lt;br /&gt;
* The output M (memory) is the last non-zero input I (Input).&lt;br /&gt;
* A non zero R (reset) signal sets the output to zero.&lt;br /&gt;
* 1-tick bursts of R or I are handled properly.&lt;br /&gt;
* Negatives are handled properly.&lt;br /&gt;
&lt;br /&gt;
[[File:Memory_cell_with_negatives.png|500px]]&lt;br /&gt;
&lt;br /&gt;
== Multiplier and Dictionaries/Arrays ==&lt;br /&gt;
[[File:combinatorMultiplierDetailed.png|left|500px]]&lt;br /&gt;
* Multiplying two signals together is simple and requires only a single combinator, however multiplying a set of signals is more complicated.&lt;br /&gt;
* A proof is shown below for the equation and why it works.&lt;br /&gt;
* A dictionary is a system that allows a value on a specific signal to be accessed. For example, A can contain many signals (either from a constant combinator or memory cell) and B can contain 1 of a specific signal (such as blue signal). What remains is the blue-signal value from A. This is because all the other signals are multiplied by 0.&lt;br /&gt;
* Arrays are similar to dictionaries, but instead of using a signal as a key, we use a number. Constant combinators are placed mapping each signal to a unique number (such as 1 yellow belt, 2 red belt, 3 blue belt, 4 burner inserter, etc). Then, use a combinator of &amp;quot;each = index OUTPUT 1 of each&amp;quot; and plug that in as the input to a dictionary.{{clear}}&lt;br /&gt;
[[File:combinatorMultiplierMath.png|left|500px]]&lt;br /&gt;
&lt;br /&gt;
    ((A+B)^2 - (A-B)^2)/4 = AB&lt;br /&gt;
    (A+B)^2 - (A-B)^2 = 4AB&lt;br /&gt;
    (A^2 + 2AB + B^2) - (A^2 - 2AB + B^2) = 4AB&lt;br /&gt;
    4AB = 4AB&lt;br /&gt;
&lt;br /&gt;
{{clear}}&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;
* [[Tutorial:Circuit network cookbook]]&lt;br /&gt;
* [[Circuit network]]&lt;br /&gt;
* [[Arithmetic combinator]]&lt;br /&gt;
* [[Constant combinator]]&lt;br /&gt;
* [[Decider combinator]]&lt;/div&gt;</summary>
		<author><name>Ndh</name></author>
	</entry>
	<entry>
		<id>https://wiki.factorio.com/index.php?title=Tutorial:Combinator_tutorial&amp;diff=198840</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=198840"/>
		<updated>2024-06-27T19:17:45Z</updated>

		<summary type="html">&lt;p&gt;Ndh: /* Memory */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&#039;&#039;This is an &#039;&#039;&#039;advanced&#039;&#039;&#039; tutorial. Beginners should refer to the [[Tutorial:Circuit network cookbook]] for examples and the [[Circuit network]] page for an overview over the circuit network. This tutorial assumes a basic understanding of circuits and covers more advanced topics like SR latches, memory cells and clocks.&#039;&#039;&lt;br /&gt;
&lt;br /&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. Combinator logic works because Factorio only updates at &#039;&#039;&#039;60 times per second&#039;&#039;&#039;. Logically, each update tick is separated into two steps. In the first step, all combinators first read the input from the connected network(s), perform their computations. This produces an output value for every combinator. The tick update concludes with the second step, where the values of each network will be updated as the sum of all connected values.&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, its 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; they carry information in the connected wires, meaning that if there are similar signals on a wire it will add them automatically. If the signal is different, it will be carried in that wire as well, but as a different signal.&lt;br /&gt;
&lt;br /&gt;
When cross-connecting combinators, it is 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. Combinators will sum the red and green inputs prior to calculation, so either color can be used when wiring the output back to the input. In most cases however, it is more useful to use the opposing color of the wire so that it will not interfere with the resulting output and input.&lt;br /&gt;
&lt;br /&gt;
== Virtual signals ==&lt;br /&gt;
&lt;br /&gt;
[[File:Virtual Signals dialog box.png|thumb|right|Virtual Signals available for use in the circuit network]]&lt;br /&gt;
&lt;br /&gt;
In addition to the standard item signals, Factorio&#039;s circuit network also includes a set of signals that do not represent any particular game item. Instead, these virtual signals serve as user-definable channels for the circuit network; they hold whatever meaning the user wants them to. There are currently 48 virtual signals that can be sent over the circuit network:&lt;br /&gt;
&lt;br /&gt;
* The 36 alphanumeric characters (A-Z, 0-9)&lt;br /&gt;
* Nine colors: red, green, blue, yellow, magenta, cyan, white, grey, and black&lt;br /&gt;
* Three icons: a check mark, an informational letter &#039;i&#039;, and a small, white dot&lt;br /&gt;
&lt;br /&gt;
=== Logic signals ===&lt;br /&gt;
&lt;br /&gt;
There are three additional virtual signals known as &#039;&#039;logic signals&#039;&#039;. Unlike other signals, they cannot be sent over the circuit network; instead, they apply additional logic to combinators that modify their behavior. Specifically, these logic symbols act as wildcards, which are special signals that represent &#039;&#039;&#039;zero or more&#039;&#039;&#039; arbitrary signals instead of representing a single discrete signal.  Factorio&#039;s circuit network implements three types of wildcards.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;span style=&amp;quot;color:#FF6666&amp;quot;&amp;gt;Everything wildcard&amp;lt;/span&amp;gt; [[File:Signal_everything.png|left|20px]] ====&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;Everything&#039;&#039; wildcard is used with decider combinators. Its exact behavior depends on whether it is used as an input or an output:&lt;br /&gt;
* &#039;&#039;&#039;Input&#039;&#039;&#039;: Returns true if &#039;&#039;all&#039;&#039; input signals pass the condition, or if there are &#039;&#039;no&#039;&#039; input signals, otherwise it returns false.&lt;br /&gt;
* &#039;&#039;&#039;Output&#039;&#039;&#039;: Returns &#039;&#039;all&#039;&#039; non-zero input signals.&lt;br /&gt;
&lt;br /&gt;
When used as an input, the &#039;&#039;everything&#039;&#039; wildcard can be thought of as a logical AND, or a [[:Wikipedia:universal quantification|universal quantifier]]. When used as an output, it acts as an &#039;echo&#039; or &#039;dump&#039; of input signals.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039;: Can be used as an output as long as the input is not an &#039;&#039;each&#039;&#039; wildcard.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;span style=&amp;quot;color:#99FF99&amp;quot;&amp;gt;Anything wildcard&amp;lt;/span&amp;gt; [[File:Signal_anything.png|left|20px]] ====&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;Anything&#039;&#039; wildcard is also used with decider combinators.&lt;br /&gt;
&lt;br /&gt;
Given &#039;&#039;&#039;at least one&#039;&#039;&#039; input signal, it returns true if &#039;&#039;any&#039;&#039; input signal passes the condition. If no signal passes the condition, or there are no input signals, then it returns false. From this behavior, the &#039;&#039;anything&#039;&#039; wildcard can be thought of as a logical OR, or an [[:Wikipedia:existential quantification|existential quantifier]].&lt;br /&gt;
&lt;br /&gt;
When used in both the input and output of a decider combinator, &#039;&#039;anything&#039;&#039; will return one of the signals that matched.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;span style=&amp;quot;color:#FFFF99&amp;quot;&amp;gt;Each wildcard&amp;lt;/span&amp;gt; [[File:Signal_each.png|left|20px]] ====&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;Each&#039;&#039; wildcard is used with both decider combinators and [[arithmetic combinator]]s, and behaves somewhat uniquely compared to the previous two. Generally speaking, it performs a combinator action on each signal &#039;&#039;&#039;individually&#039;&#039;&#039;, with the exact action depending on how it is used, and the type of combinator it is used in. It can be used as an input, and it can be used as an output, but &#039;&#039;only when it is used as input as well&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
In a &#039;&#039;&#039;decider combinator&#039;&#039;&#039;, when used as an input, the &#039;&#039;each&#039;&#039; wildcard individually compares each input signal against the combinator condition, returning each signal that passes the condition. The manner that the &#039;&#039;each&#039;&#039; wildcard returns signals when used as input depends on whether or not it is also used as output:&lt;br /&gt;
* &#039;&#039;&#039;Input only&#039;&#039;&#039;: Sums each input signal that passed the condition, and depending on output settings returns either a count of the passed signals or a summation of their values as the desired output signal.&lt;br /&gt;
* &#039;&#039;&#039;Input and Output&#039;&#039;&#039;: Returns each signal that passed the condition, their values depending on the output settings.&lt;br /&gt;
&lt;br /&gt;
In an &#039;&#039;&#039;arithmetic combinator&#039;&#039;&#039;, the designated arithmetic operation is applied individually to each input signal, and similar to the decider combinator, the signal that is returned depends on whether or not the &#039;&#039;each&#039;&#039; wildcard is used as output:&lt;br /&gt;
* &#039;&#039;&#039;Input only&#039;&#039;&#039;: The result of each operation on the input signals is summed and returned as the desired output signal.&lt;br /&gt;
* &#039;&#039;&#039;Input and Output&#039;&#039;&#039;: Each input signal is returned with the result of the specified operation applied to it.&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;Each&#039;&#039; wildcard is therefore notably more complex than the other two wildcards, but offers a good deal of power in exchange for its complexity.&lt;br /&gt;
&lt;br /&gt;
== Input insulator &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 insulator 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 insulator 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, which is 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.&amp;lt;br&amp;gt;&lt;br /&gt;
Whenever the 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;
In this specific example, the pump runs when light oil reaches 20000, and turns off when it reaches 5000:&lt;br /&gt;
&lt;br /&gt;
[[File:SR_latch.png|600px]]&lt;br /&gt;
&lt;br /&gt;
A similar backup steam power example with detailed configuration and explanation can be found here:&amp;lt;br&amp;gt;[[Tutorial:Circuit_network_cookbook#RS_latch_-_single_decider_version|RS latch - single decider version]]&lt;br /&gt;
&lt;br /&gt;
== Basic memory ==&lt;br /&gt;
A decider combinator can be used to store values, either for a counter or for more advanced logic (see below). The decider combinator is configured with&lt;br /&gt;
* input and output connected to the same network (typically each other),&lt;br /&gt;
* condition set to a signal &amp;gt; 0 for positive values or ≠ 0 to store both positive and negative values,&lt;br /&gt;
* output set to the input count of a specific input signal or [*].&lt;br /&gt;
As long as all inputs on the network are zero, it will hold the previously set value.&lt;br /&gt;
&lt;br /&gt;
Remember the two step update process from above? If the network has value [X]=5, the combinator will read this value from the network as its input, determine that it is &amp;gt; 0. It will then set the output to the input, which is [X]=5. In the next step, the value of the network will be computed, which is the sum of all the connected outputs, which is [X]=5, again.&lt;br /&gt;
&lt;br /&gt;
A non-zero input held over time, e. g. the output of a constant combinator, will create a basic runaway clock. The stored value will be incremented by the sum of all connected input values every cycle. So e. g. with a constant combinator that produces [A]=1 connected to the memory, the network will store the value 1 in the first tick, 2 in the second, etc., incrementing 60 times per second.&lt;br /&gt;
{{BlueprintString|bp-string=0eNqlU11rwzAM/C96TkuStWvqh8F+xyghH2orSOygyGWh5L/PjkcJJetW9hKQLd2d7pwrlI3FjkkLqCtQZXQP6uMKPZ100fgzGToEBSTYQgS6aH1VY0U18qoybUm6EMMwRkC6xk9QyRj9CuCJpNCyjJCOhwhQCwlh0DMVQ65tWyI7iodAEXSmd7NGe36Ht9sk620EA6jVNsvWW8fk5oRNk5d4Li7khlznkRpB/sGAC7FYd3JjDh2rd5jQrHcwiWcmHAKLxsor6T1U4j8nRtTzpah2G7te4sqSTKWfHr2Nd3unjxJYWPtu6Zo4qAmECxZ8w+burqab7iNxL/mfLcEL8iBn0qfgTUgIVOyLtit4kqvgzU0aK539B3Y35JP5+ZFNm5N2YKCELY7P2J/MvF6II53CTJ9Lzz3h6c2r2T8WgZPfhwCyZLPbp7vsdR+/xJtx/AJNbzZ8}}&lt;br /&gt;
&lt;br /&gt;
Again, how does this work in detail? The network will start without any values set. As soon as the constant combinator becomes active, it will produce [A]=1, and the decider combinator will produce 0 because no value is set yet. Step 2: The network will be set to the sum of all output, so [A]=1. In the next update tick, the constant combinator produces [A]=1 again, but now the decider sees [A]=1, so it would also output [A]=1. Step 2: The network is set to the sum, which is [A]=2. And so on.&lt;br /&gt;
&lt;br /&gt;
Typically a constant combinator producing 1 will be used, but of course it could output other values, including negative values.&lt;br /&gt;
A negative values would decrease the stored value in the example below.&lt;br /&gt;
If the decider combinator uses &amp;gt; 0 as the condition, only positive values will be allowed, so the value will stop decreasing if 0 is reached.&lt;br /&gt;
If the condition is ≠ 0, negative values will also be allowed.&lt;br /&gt;
&lt;br /&gt;
A single pulse of an input will cause a single increment by the pulsed value, creating a counter. In the following blueprint, place one item on the belt. Every time it is scanned by the connected belt, a pulse is generated that increments the stored value.&lt;br /&gt;
{{BlueprintString|bp-string=0eNqllMGO4jAMQP/F5zAqpaXQw/7IahWljQFLbVIlLtoK5d83aXdZEJ3DMBeQU+fFenZyg6YbcXBkGOobUGuNh/rnDTydjerSGk8DQg3E2IMAo/oUsVPGD9bxpsGOIQggo/E31NvwSwAaJiZcSHMwSTP2DbqY8BlDwGB93GZNOjWiqqL8KAVMUG/KQ/ZRhiBeaPl7tG2kCdDksF1S8hX27gvs/XOlT+xCQNTKznaywYu6knVpX0uuHYklGtV0KDX59A/1SXUexf2zQ6XlRRktEySWGK2yGx8y/q0vqb3VEZKF+VCz1ODTedv0c3aI5rEtpKEu/7NSGFsY1lwX7/l4cV2ssMs7W2NLGt2mtX1DRnGUtcI/fmo7X7f9F5tkabo7OZHzLF9m/UqOx7hyL2rJ2OAV3cQXMmdY/HpW6eJkKegH5eZya/gRd9qRh/Eb7GGKtY6G5cnZXpKJsKXx4Sut3T24Xml1HlstIP/uZOzfuoXVcf1OV2/N2Ux7moR9eormZ6t+eOUERNF+GZXDtqiOeXXYH7NdVoTwB9igtjA=}}&lt;br /&gt;
&lt;br /&gt;
A stored value is cleared if the condition is no longer met, which makes the decider clear its output. This only works if the value is also not output elsewhere in the network. A stored value can also be reset to zero if a negative pulse equal to the input occurs. The latter can also happen while other inputs are still connected.&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;
== Memory cells ==&lt;br /&gt;
&lt;br /&gt;
=== Simple latch ===&lt;br /&gt;
&lt;br /&gt;
When looping the combinator to itself, use a different color of wire from your main inputs or outputs. &lt;br /&gt;
&lt;br /&gt;
[[File:SimpleLatchv2.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;
!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;
=== Positive cell ===&lt;br /&gt;
&lt;br /&gt;
Cell for storing a positive value, with reset support:&lt;br /&gt;
&lt;br /&gt;
[[File:AdvancedMemoryCell.png|500px]]&lt;br /&gt;
&lt;br /&gt;
Connect the desired value as signal I on the right side to set the memory cell and connect a negative value as signal I to reset the cell.&lt;br /&gt;
&lt;br /&gt;
* The output of the memory cell is 2 mutually exclusive signals.&lt;br /&gt;
** In case input signal I &amp;gt; 0 then signal I is passed to the other side.&lt;br /&gt;
** In case input signal I is interrupted, then signal M is passed instead as a memory of previous input value.&lt;br /&gt;
* When input signal I is interrupted, it takes 2 ticks to switch to memory signal M.&lt;br /&gt;
* In case input I signal lasts only one tick then memory cell starts to cycle between the 2 previous values, tick by tick. Indefinitely.&lt;br /&gt;
* Switching is seamless, e.g. there are no ticks with empty signal.&lt;br /&gt;
&lt;br /&gt;
=== Positives and negatives cell ===&lt;br /&gt;
&lt;br /&gt;
This cell can store negatives or positives. Reset is done on a dedicated line. Additionally, a 1-tick burst is handled properly. [https://forums.factorio.com/viewtopic.php?f=193&amp;amp;t=60330&amp;amp;p=362377#p362377 Forum post].&lt;br /&gt;
&lt;br /&gt;
* The output M (memory) is the last non-zero input I (Input).&lt;br /&gt;
* A non zero R (reset) signal sets the output to zero.&lt;br /&gt;
* 1-tick bursts of R or I are handled properly.&lt;br /&gt;
* Negatives are handled properly.&lt;br /&gt;
&lt;br /&gt;
[[File:Memory_cell_with_negatives.png|500px]]&lt;br /&gt;
&lt;br /&gt;
== Multiplier and Dictionaries/Arrays ==&lt;br /&gt;
[[File:combinatorMultiplierDetailed.png|left|500px]]&lt;br /&gt;
* Multiplying two signals together is simple and requires only a single combinator, however multiplying a set of signals is more complicated.&lt;br /&gt;
* A proof is shown below for the equation and why it works.&lt;br /&gt;
* A dictionary is a system that allows a value on a specific signal to be accessed. For example, A can contain many signals (either from a constant combinator or memory cell) and B can contain 1 of a specific signal (such as blue signal). What remains is the blue-signal value from A. This is because all the other signals are multiplied by 0.&lt;br /&gt;
* Arrays are similar to dictionaries, but instead of using a signal as a key, we use a number. Constant combinators are placed mapping each signal to a unique number (such as 1 yellow belt, 2 red belt, 3 blue belt, 4 burner inserter, etc). Then, use a combinator of &amp;quot;each = index OUTPUT 1 of each&amp;quot; and plug that in as the input to a dictionary.{{clear}}&lt;br /&gt;
[[File:combinatorMultiplierMath.png|left|500px]]&lt;br /&gt;
&lt;br /&gt;
    ((A+B)^2 - (A-B)^2)/4 = AB&lt;br /&gt;
    (A+B)^2 - (A-B)^2 = 4AB&lt;br /&gt;
    (A^2 + 2AB + B^2) - (A^2 - 2AB + B^2) = 4AB&lt;br /&gt;
    4AB = 4AB&lt;br /&gt;
&lt;br /&gt;
{{clear}}&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;
* [[Tutorial:Circuit network cookbook]]&lt;br /&gt;
* [[Circuit network]]&lt;br /&gt;
* [[Arithmetic combinator]]&lt;br /&gt;
* [[Constant combinator]]&lt;br /&gt;
* [[Decider combinator]]&lt;/div&gt;</summary>
		<author><name>Ndh</name></author>
	</entry>
	<entry>
		<id>https://wiki.factorio.com/index.php?title=Tutorial:Combinator_tutorial&amp;diff=198838</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=198838"/>
		<updated>2024-06-27T18:25:36Z</updated>

		<summary type="html">&lt;p&gt;Ndh: /* Introduction */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&#039;&#039;This is an &#039;&#039;&#039;advanced&#039;&#039;&#039; tutorial. Beginners should refer to the [[Tutorial:Circuit network cookbook]] for examples and the [[Circuit network]] page for an overview over the circuit network. This tutorial assumes a basic understanding of circuits and covers more advanced topics like SR latches, memory cells and clocks.&#039;&#039;&lt;br /&gt;
&lt;br /&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. Combinator logic works because Factorio only updates at &#039;&#039;&#039;60 times per second&#039;&#039;&#039;. Logically, each update tick is separated into two steps. In the first step, all combinators first read the input from the connected network(s), perform their computations. This produces an output value for every combinator. The tick update concludes with the second step, where the values of each network will be updated as the sum of all connected values.&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, its 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; they carry information in the connected wires, meaning that if there are similar signals on a wire it will add them automatically. If the signal is different, it will be carried in that wire as well, but as a different signal.&lt;br /&gt;
&lt;br /&gt;
When cross-connecting combinators, it is 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. Combinators will sum the red and green inputs prior to calculation, so either color can be used when wiring the output back to the input. In most cases however, it is more useful to use the opposing color of the wire so that it will not interfere with the resulting output and input.&lt;br /&gt;
&lt;br /&gt;
== Virtual signals ==&lt;br /&gt;
&lt;br /&gt;
[[File:Virtual Signals dialog box.png|thumb|right|Virtual Signals available for use in the circuit network]]&lt;br /&gt;
&lt;br /&gt;
In addition to the standard item signals, Factorio&#039;s circuit network also includes a set of signals that do not represent any particular game item. Instead, these virtual signals serve as user-definable channels for the circuit network; they hold whatever meaning the user wants them to. There are currently 48 virtual signals that can be sent over the circuit network:&lt;br /&gt;
&lt;br /&gt;
* The 36 alphanumeric characters (A-Z, 0-9)&lt;br /&gt;
* Nine colors: red, green, blue, yellow, magenta, cyan, white, grey, and black&lt;br /&gt;
* Three icons: a check mark, an informational letter &#039;i&#039;, and a small, white dot&lt;br /&gt;
&lt;br /&gt;
=== Logic signals ===&lt;br /&gt;
&lt;br /&gt;
There are three additional virtual signals known as &#039;&#039;logic signals&#039;&#039;. Unlike other signals, they cannot be sent over the circuit network; instead, they apply additional logic to combinators that modify their behavior. Specifically, these logic symbols act as wildcards, which are special signals that represent &#039;&#039;&#039;zero or more&#039;&#039;&#039; arbitrary signals instead of representing a single discrete signal.  Factorio&#039;s circuit network implements three types of wildcards.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;span style=&amp;quot;color:#FF6666&amp;quot;&amp;gt;Everything wildcard&amp;lt;/span&amp;gt; [[File:Signal_everything.png|left|20px]] ====&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;Everything&#039;&#039; wildcard is used with decider combinators. Its exact behavior depends on whether it is used as an input or an output:&lt;br /&gt;
* &#039;&#039;&#039;Input&#039;&#039;&#039;: Returns true if &#039;&#039;all&#039;&#039; input signals pass the condition, or if there are &#039;&#039;no&#039;&#039; input signals, otherwise it returns false.&lt;br /&gt;
* &#039;&#039;&#039;Output&#039;&#039;&#039;: Returns &#039;&#039;all&#039;&#039; non-zero input signals.&lt;br /&gt;
&lt;br /&gt;
When used as an input, the &#039;&#039;everything&#039;&#039; wildcard can be thought of as a logical AND, or a [[:Wikipedia:universal quantification|universal quantifier]]. When used as an output, it acts as an &#039;echo&#039; or &#039;dump&#039; of input signals.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039;: Can be used as an output as long as the input is not an &#039;&#039;each&#039;&#039; wildcard.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;span style=&amp;quot;color:#99FF99&amp;quot;&amp;gt;Anything wildcard&amp;lt;/span&amp;gt; [[File:Signal_anything.png|left|20px]] ====&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;Anything&#039;&#039; wildcard is also used with decider combinators.&lt;br /&gt;
&lt;br /&gt;
Given &#039;&#039;&#039;at least one&#039;&#039;&#039; input signal, it returns true if &#039;&#039;any&#039;&#039; input signal passes the condition. If no signal passes the condition, or there are no input signals, then it returns false. From this behavior, the &#039;&#039;anything&#039;&#039; wildcard can be thought of as a logical OR, or an [[:Wikipedia:existential quantification|existential quantifier]].&lt;br /&gt;
&lt;br /&gt;
When used in both the input and output of a decider combinator, &#039;&#039;anything&#039;&#039; will return one of the signals that matched.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;span style=&amp;quot;color:#FFFF99&amp;quot;&amp;gt;Each wildcard&amp;lt;/span&amp;gt; [[File:Signal_each.png|left|20px]] ====&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;Each&#039;&#039; wildcard is used with both decider combinators and [[arithmetic combinator]]s, and behaves somewhat uniquely compared to the previous two. Generally speaking, it performs a combinator action on each signal &#039;&#039;&#039;individually&#039;&#039;&#039;, with the exact action depending on how it is used, and the type of combinator it is used in. It can be used as an input, and it can be used as an output, but &#039;&#039;only when it is used as input as well&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
In a &#039;&#039;&#039;decider combinator&#039;&#039;&#039;, when used as an input, the &#039;&#039;each&#039;&#039; wildcard individually compares each input signal against the combinator condition, returning each signal that passes the condition. The manner that the &#039;&#039;each&#039;&#039; wildcard returns signals when used as input depends on whether or not it is also used as output:&lt;br /&gt;
* &#039;&#039;&#039;Input only&#039;&#039;&#039;: Sums each input signal that passed the condition, and depending on output settings returns either a count of the passed signals or a summation of their values as the desired output signal.&lt;br /&gt;
* &#039;&#039;&#039;Input and Output&#039;&#039;&#039;: Returns each signal that passed the condition, their values depending on the output settings.&lt;br /&gt;
&lt;br /&gt;
In an &#039;&#039;&#039;arithmetic combinator&#039;&#039;&#039;, the designated arithmetic operation is applied individually to each input signal, and similar to the decider combinator, the signal that is returned depends on whether or not the &#039;&#039;each&#039;&#039; wildcard is used as output:&lt;br /&gt;
* &#039;&#039;&#039;Input only&#039;&#039;&#039;: The result of each operation on the input signals is summed and returned as the desired output signal.&lt;br /&gt;
* &#039;&#039;&#039;Input and Output&#039;&#039;&#039;: Each input signal is returned with the result of the specified operation applied to it.&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;Each&#039;&#039; wildcard is therefore notably more complex than the other two wildcards, but offers a good deal of power in exchange for its complexity.&lt;br /&gt;
&lt;br /&gt;
== Input insulator &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 insulator 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 insulator 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, which is 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.&amp;lt;br&amp;gt;&lt;br /&gt;
Whenever the 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;
In this specific example, the pump runs when light oil reaches 20000, and turns off when it reaches 5000:&lt;br /&gt;
&lt;br /&gt;
[[File:SR_latch.png|600px]]&lt;br /&gt;
&lt;br /&gt;
A similar backup steam power example with detailed configuration and explanation can be found here:&amp;lt;br&amp;gt;[[Tutorial:Circuit_network_cookbook#RS_latch_-_single_decider_version|RS latch - single decider version]]&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;
== Memory cells ==&lt;br /&gt;
&lt;br /&gt;
=== Simple latch ===&lt;br /&gt;
&lt;br /&gt;
When looping the combinator to itself, use a different color of wire from your main inputs or outputs. &lt;br /&gt;
&lt;br /&gt;
[[File:SimpleLatchv2.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;
!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;
=== Positive cell ===&lt;br /&gt;
&lt;br /&gt;
Cell for storing a positive value, with reset support:&lt;br /&gt;
&lt;br /&gt;
[[File:AdvancedMemoryCell.png|500px]]&lt;br /&gt;
&lt;br /&gt;
Connect the desired value as signal I on the right side to set the memory cell and connect a negative value as signal I to reset the cell.&lt;br /&gt;
&lt;br /&gt;
* The output of the memory cell is 2 mutually exclusive signals.&lt;br /&gt;
** In case input signal I &amp;gt; 0 then signal I is passed to the other side.&lt;br /&gt;
** In case input signal I is interrupted, then signal M is passed instead as a memory of previous input value.&lt;br /&gt;
* When input signal I is interrupted, it takes 2 ticks to switch to memory signal M.&lt;br /&gt;
* In case input I signal lasts only one tick then memory cell starts to cycle between the 2 previous values, tick by tick. Indefinitely.&lt;br /&gt;
* Switching is seamless, e.g. there are no ticks with empty signal.&lt;br /&gt;
&lt;br /&gt;
=== Positives and negatives cell ===&lt;br /&gt;
&lt;br /&gt;
This cell can store negatives or positives. Reset is done on a dedicated line. Additionally, a 1-tick burst is handled properly. [https://forums.factorio.com/viewtopic.php?f=193&amp;amp;t=60330&amp;amp;p=362377#p362377 Forum post].&lt;br /&gt;
&lt;br /&gt;
* The output M (memory) is the last non-zero input I (Input).&lt;br /&gt;
* A non zero R (reset) signal sets the output to zero.&lt;br /&gt;
* 1-tick bursts of R or I are handled properly.&lt;br /&gt;
* Negatives are handled properly.&lt;br /&gt;
&lt;br /&gt;
[[File:Memory_cell_with_negatives.png|500px]]&lt;br /&gt;
&lt;br /&gt;
== Multiplier and Dictionaries/Arrays ==&lt;br /&gt;
[[File:combinatorMultiplierDetailed.png|left|500px]]&lt;br /&gt;
* Multiplying two signals together is simple and requires only a single combinator, however multiplying a set of signals is more complicated.&lt;br /&gt;
* A proof is shown below for the equation and why it works.&lt;br /&gt;
* A dictionary is a system that allows a value on a specific signal to be accessed. For example, A can contain many signals (either from a constant combinator or memory cell) and B can contain 1 of a specific signal (such as blue signal). What remains is the blue-signal value from A. This is because all the other signals are multiplied by 0.&lt;br /&gt;
* Arrays are similar to dictionaries, but instead of using a signal as a key, we use a number. Constant combinators are placed mapping each signal to a unique number (such as 1 yellow belt, 2 red belt, 3 blue belt, 4 burner inserter, etc). Then, use a combinator of &amp;quot;each = index OUTPUT 1 of each&amp;quot; and plug that in as the input to a dictionary.{{clear}}&lt;br /&gt;
[[File:combinatorMultiplierMath.png|left|500px]]&lt;br /&gt;
&lt;br /&gt;
    ((A+B)^2 - (A-B)^2)/4 = AB&lt;br /&gt;
    (A+B)^2 - (A-B)^2 = 4AB&lt;br /&gt;
    (A^2 + 2AB + B^2) - (A^2 - 2AB + B^2) = 4AB&lt;br /&gt;
    4AB = 4AB&lt;br /&gt;
&lt;br /&gt;
{{clear}}&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;
* [[Tutorial:Circuit network cookbook]]&lt;br /&gt;
* [[Circuit network]]&lt;br /&gt;
* [[Arithmetic combinator]]&lt;br /&gt;
* [[Constant combinator]]&lt;br /&gt;
* [[Decider combinator]]&lt;/div&gt;</summary>
		<author><name>Ndh</name></author>
	</entry>
	<entry>
		<id>https://wiki.factorio.com/index.php?title=User:Ndh&amp;diff=198837</id>
		<title>User:Ndh</title>
		<link rel="alternate" type="text/html" href="https://wiki.factorio.com/index.php?title=User:Ndh&amp;diff=198837"/>
		<updated>2024-06-27T18:09:17Z</updated>

		<summary type="html">&lt;p&gt;Ndh: /* Basic memory */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
&lt;br /&gt;
== Basic memory ==&lt;br /&gt;
A decider combinator can be used to store values, either for a counter or for more advanced logic (see below). The decider combinator is configured with&lt;br /&gt;
* input and output connected to the same network (typically each other),&lt;br /&gt;
* condition set to a signal &amp;gt; 0 for positive values or ≠ 0 to store both positive and negative values,&lt;br /&gt;
* output set to the input signal or [*].&lt;br /&gt;
As long as all inputs on the network are zero, it will hold the previously set value, because the game will copy the input to the output every tick.&lt;br /&gt;
&lt;br /&gt;
A non-zero input held over time, e. g. the output of a constant combinator, will create a basic runaway clock. The stored value will be incremented by the sum of all connected input values every cycle. So e. g. with a constant combinator that produces [A]=10 connected to the memory, the network will store the value 10 in the first pulse, 20 in the second, incrementing 60 times per second.&lt;br /&gt;
{{BlueprintString|bp-string=0eNqlU11rwzAM/C96TkuStWvqh8F+xyghH2orSOygyGWh5L/PjkcJJetW9hKQLd2d7pwrlI3FjkkLqCtQZXQP6uMKPZ100fgzGToEBSTYQgS6aH1VY0U18qoybUm6EMMwRkC6xk9QyRj9CuCJpNCyjJCOhwhQCwlh0DMVQ65tWyI7iodAEXSmd7NGe36Ht9sk620EA6jVNsvWW8fk5oRNk5d4Li7khlznkRpB/sGAC7FYd3JjDh2rd5jQrHcwiWcmHAKLxsor6T1U4j8nRtTzpah2G7te4sqSTKWfHr2Nd3unjxJYWPtu6Zo4qAmECxZ8w+burqab7iNxL/mfLcEL8iBn0qfgTUgIVOyLtit4kqvgzU0aK539B3Y35JP5+ZFNm5N2YKCELY7P2J/MvF6II53CTJ9Lzz3h6c2r2T8WgZPfhwCyZLPbp7vsdR+/xJtx/AJNbzZ8}}&lt;br /&gt;
Typically a constant combinator producing 1 will be used.&lt;br /&gt;
&lt;br /&gt;
Note that constant combinators can also produce negative values, which will decrease the stored value in the example below. If the decider combinator uses &amp;gt; 0 as the condition, only positive values will be allowed, so the value will stop decreasing if 0 is reached. If the condition is ≠ 0, negative values will also be allowed.&lt;br /&gt;
&lt;br /&gt;
A single pulse of an input will cause a single increment by the pulsed value, creating a counter. In the following blueprint, place one item on the belt. Every time it is scanned by the connected belt, a pulse is generated that increments the stored value.&lt;br /&gt;
{{BlueprintString|bp-string=0eNqllMGO4jAMQP/F5zAqpaXQw/7IahWljQFLbVIlLtoK5d83aXdZEJ3DMBeQU+fFenZyg6YbcXBkGOobUGuNh/rnDTydjerSGk8DQg3E2IMAo/oUsVPGD9bxpsGOIQggo/E31NvwSwAaJiZcSHMwSTP2DbqY8BlDwGB93GZNOjWiqqL8KAVMUG/KQ/ZRhiBeaPl7tG2kCdDksF1S8hX27gvs/XOlT+xCQNTKznaywYu6knVpX0uuHYklGtV0KDX59A/1SXUexf2zQ6XlRRktEySWGK2yGx8y/q0vqb3VEZKF+VCz1ODTedv0c3aI5rEtpKEu/7NSGFsY1lwX7/l4cV2ssMs7W2NLGt2mtX1DRnGUtcI/fmo7X7f9F5tkabo7OZHzLF9m/UqOx7hyL2rJ2OAV3cQXMmdY/HpW6eJkKegH5eZya/gRd9qRh/Eb7GGKtY6G5cnZXpKJsKXx4Sut3T24Xml1HlstIP/uZOzfuoXVcf1OV2/N2Ux7moR9eormZ6t+eOUERNF+GZXDtqiOeXXYH7NdVoTwB9igtjA=}}&lt;br /&gt;
&lt;br /&gt;
Reset to zero occurs 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;
== Memory cells ==&lt;br /&gt;
&lt;br /&gt;
=== Simple latch ===&lt;br /&gt;
&lt;br /&gt;
When looping the combinator to itself, use a different color of wire from your main inputs or outputs. &lt;br /&gt;
&lt;br /&gt;
[[File:SimpleLatchv2.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;
!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;
=== Positive cell ===&lt;br /&gt;
&lt;br /&gt;
Cell for storing a positive value, with reset support:&lt;br /&gt;
&lt;br /&gt;
[[File:AdvancedMemoryCell.png|500px]]&lt;br /&gt;
&lt;br /&gt;
Connect the desired value as signal I on the right side to set the memory cell and connect a negative value as signal I to reset the cell.&lt;br /&gt;
&lt;br /&gt;
* The output of the memory cell is 2 mutually exclusive signals.&lt;br /&gt;
** In case input signal I &amp;gt; 0 then signal I is passed to the other side.&lt;br /&gt;
** In case input signal I is interrupted, then signal M is passed instead as a memory of previous input value.&lt;br /&gt;
* When input signal I is interrupted, it takes 2 ticks to switch to memory signal M.&lt;br /&gt;
* In case input I signal lasts only one tick then memory cell starts to cycle between the 2 previous values, tick by tick. Indefinitely.&lt;br /&gt;
* Switching is seamless, e.g. there are no ticks with empty signal.&lt;br /&gt;
&lt;br /&gt;
=== Positives and negatives cell ===&lt;br /&gt;
&lt;br /&gt;
This cell can store negatives or positives. Reset is done on a dedicated line. Additionally, a 1-tick burst is handled properly. [https://forums.factorio.com/viewtopic.php?f=193&amp;amp;t=60330&amp;amp;p=362377#p362377 Forum post].&lt;br /&gt;
&lt;br /&gt;
* The output M (memory) is the last non-zero input I (Input).&lt;br /&gt;
* A non zero R (reset) signal sets the output to zero.&lt;br /&gt;
* 1-tick bursts of R or I are handled properly.&lt;br /&gt;
* Negatives are handled properly.&lt;br /&gt;
&lt;br /&gt;
[[File:Memory_cell_with_negatives.png|500px]]&lt;br /&gt;
&lt;br /&gt;
== Multiplier and Dictionaries/Arrays ==&lt;br /&gt;
[[File:combinatorMultiplierDetailed.png|left|500px]]&lt;br /&gt;
* Multiplying two signals together is simple and requires only a single combinator, however multiplying a set of signals is more complicated.&lt;br /&gt;
* A proof is shown below for the equation and why it works.&lt;br /&gt;
* A dictionary is a system that allows a value on a specific signal to be accessed. For example, A can contain many signals (either from a constant combinator or memory cell) and B can contain 1 of a specific signal (such as blue signal). What remains is the blue-signal value from A. This is because all the other signals are multiplied by 0.&lt;br /&gt;
* Arrays are similar to dictionaries, but instead of using a signal as a key, we use a number. Constant combinators are placed mapping each signal to a unique number (such as 1 yellow belt, 2 red belt, 3 blue belt, 4 burner inserter, etc). Then, use a combinator of &amp;quot;each = index OUTPUT 1 of each&amp;quot; and plug that in as the input to a dictionary.{{clear}}&lt;br /&gt;
[[File:combinatorMultiplierMath.png|left|500px]]&lt;br /&gt;
&lt;br /&gt;
    ((A+B)^2 - (A-B)^2)/4 = AB&lt;br /&gt;
    (A+B)^2 - (A-B)^2 = 4AB&lt;br /&gt;
    (A^2 + 2AB + B^2) - (A^2 - 2AB + B^2) = 4AB&lt;br /&gt;
    4AB = 4AB&lt;/div&gt;</summary>
		<author><name>Ndh</name></author>
	</entry>
	<entry>
		<id>https://wiki.factorio.com/index.php?title=Factorio_talk:Style_guide&amp;diff=198836</id>
		<title>Factorio talk:Style guide</title>
		<link rel="alternate" type="text/html" href="https://wiki.factorio.com/index.php?title=Factorio_talk:Style_guide&amp;diff=198836"/>
		<updated>2024-06-27T18:03:00Z</updated>

		<summary type="html">&lt;p&gt;Ndh: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== How can I add a blueprint? ==&lt;br /&gt;
I would like to edit https://wiki.factorio.com/Tutorial:Combinator_tutorial#Memory, and I would like to add blueprints to make it easier to follow along. I would very much appreciate some guidance on the preferred way of sharing blueprints here on the Wiki.&lt;br /&gt;
--[[User:Ndh|Ndh]] ([[User talk:Ndh|talk]]) 17:30, 27 June 2024 (UTC)&lt;br /&gt;
: Hey, you interest is appreciated! You can use [[Template:BlueprintString]] for blueprint strings, see [[Inserters#Inserter_Throughput]] for example. [[Tutorial:Circuit_network_cookbook#Memory_Cell_/_Counter]] may also interest you. Happy editing! -- [[User:Bilka|Bilka]] ([[User talk:Bilka|talk]]) - &amp;lt;span style=&amp;quot;color:#FF0000&amp;quot;&amp;gt;Admin&amp;lt;/span&amp;gt; 17:50, 27 June 2024 (UTC)&lt;br /&gt;
:: Ooooh that is awesome! Thank you so much! Although now I&#039;m wondering how I could have found this. On the left there is a list of links under &amp;quot;Editor Help&amp;quot;, but &amp;quot;Templates&amp;quot; links to some generic mediawiki page. Would it be possible maybe to change this link to https://wiki.factorio.com/Category:Templates instead? Both https://wiki.factorio.com/Special:WhatLinksHere/Category:Templates and https://wiki.factorio.com/Special:WhatLinksHere/Category:Documentation_templates are pretty empty right now. Or maybe the style guide would be the better place? --[[User:Ndh|Ndh]] ([[User talk:Ndh|talk]]) 18:02, 27 June 2024 (UTC)&lt;/div&gt;</summary>
		<author><name>Ndh</name></author>
	</entry>
	<entry>
		<id>https://wiki.factorio.com/index.php?title=User:Ndh&amp;diff=198835</id>
		<title>User:Ndh</title>
		<link rel="alternate" type="text/html" href="https://wiki.factorio.com/index.php?title=User:Ndh&amp;diff=198835"/>
		<updated>2024-06-27T17:52:36Z</updated>

		<summary type="html">&lt;p&gt;Ndh: /* Basic memory */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
&lt;br /&gt;
== Basic memory ==&lt;br /&gt;
A decider combinator can be used to store values, either for a counter or for more advanced logic (see below). The decider combinator is configured with&lt;br /&gt;
* input and output connected to the same network (typically each other),&lt;br /&gt;
* condition set to a signal &amp;gt; 0 for positive values or ≠ 0 to store both positive and negative values,&lt;br /&gt;
* output set to the input signal or [*].&lt;br /&gt;
As long as all inputs on the network are zero, it will hold the previously set value, because the game will copy the input to the output every tick.&lt;br /&gt;
&lt;br /&gt;
A non-zero input held over time, e. g. the output of a constant combinator, will create a basic runaway clock. The stored value will be incremented by the sum of all connected input values every cycle. So e. g. with a constant combinator that produces [A]=10 connected to the memory, the network will store the value 10 in the first pulse, 20 in the second, incrementing 60 times per second.&lt;br /&gt;
{{BlueprintString|bp-string=0eNqlU11rwzAM/C96TkuStWvqh8F+xyghH2orSOygyGWh5L/PjkcJJetW9hKQLd2d7pwrlI3FjkkLqCtQZXQP6uMKPZ100fgzGToEBSTYQgS6aH1VY0U18qoybUm6EMMwRkC6xk9QyRj9CuCJpNCyjJCOhwhQCwlh0DMVQ65tWyI7iodAEXSmd7NGe36Ht9sk620EA6jVNsvWW8fk5oRNk5d4Li7khlznkRpB/sGAC7FYd3JjDh2rd5jQrHcwiWcmHAKLxsor6T1U4j8nRtTzpah2G7te4sqSTKWfHr2Nd3unjxJYWPtu6Zo4qAmECxZ8w+burqab7iNxL/mfLcEL8iBn0qfgTUgIVOyLtit4kqvgzU0aK539B3Y35JP5+ZFNm5N2YKCELY7P2J/MvF6II53CTJ9Lzz3h6c2r2T8WgZPfhwCyZLPbp7vsdR+/xJtx/AJNbzZ8}}&lt;br /&gt;
Typically a constant combinator producing 1 will be used.&lt;br /&gt;
&lt;br /&gt;
Note that constant combinators can also produce negative values, which will decrease the stored value in the example below. If the decider combinator uses &amp;gt; 0 as the condition, only positive values will be allowed, so the value will stop decreasing if 0 is reached. If the condition is ≠ 0, negative values will also be allowed.&lt;br /&gt;
&lt;br /&gt;
A single pulse of an input will cause a single increment by the pulsed value, creating a counter. Reset to zero occurs 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;
== Memory cells ==&lt;br /&gt;
&lt;br /&gt;
=== Simple latch ===&lt;br /&gt;
&lt;br /&gt;
When looping the combinator to itself, use a different color of wire from your main inputs or outputs. &lt;br /&gt;
&lt;br /&gt;
[[File:SimpleLatchv2.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;
!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;
=== Positive cell ===&lt;br /&gt;
&lt;br /&gt;
Cell for storing a positive value, with reset support:&lt;br /&gt;
&lt;br /&gt;
[[File:AdvancedMemoryCell.png|500px]]&lt;br /&gt;
&lt;br /&gt;
Connect the desired value as signal I on the right side to set the memory cell and connect a negative value as signal I to reset the cell.&lt;br /&gt;
&lt;br /&gt;
* The output of the memory cell is 2 mutually exclusive signals.&lt;br /&gt;
** In case input signal I &amp;gt; 0 then signal I is passed to the other side.&lt;br /&gt;
** In case input signal I is interrupted, then signal M is passed instead as a memory of previous input value.&lt;br /&gt;
* When input signal I is interrupted, it takes 2 ticks to switch to memory signal M.&lt;br /&gt;
* In case input I signal lasts only one tick then memory cell starts to cycle between the 2 previous values, tick by tick. Indefinitely.&lt;br /&gt;
* Switching is seamless, e.g. there are no ticks with empty signal.&lt;br /&gt;
&lt;br /&gt;
=== Positives and negatives cell ===&lt;br /&gt;
&lt;br /&gt;
This cell can store negatives or positives. Reset is done on a dedicated line. Additionally, a 1-tick burst is handled properly. [https://forums.factorio.com/viewtopic.php?f=193&amp;amp;t=60330&amp;amp;p=362377#p362377 Forum post].&lt;br /&gt;
&lt;br /&gt;
* The output M (memory) is the last non-zero input I (Input).&lt;br /&gt;
* A non zero R (reset) signal sets the output to zero.&lt;br /&gt;
* 1-tick bursts of R or I are handled properly.&lt;br /&gt;
* Negatives are handled properly.&lt;br /&gt;
&lt;br /&gt;
[[File:Memory_cell_with_negatives.png|500px]]&lt;br /&gt;
&lt;br /&gt;
== Multiplier and Dictionaries/Arrays ==&lt;br /&gt;
[[File:combinatorMultiplierDetailed.png|left|500px]]&lt;br /&gt;
* Multiplying two signals together is simple and requires only a single combinator, however multiplying a set of signals is more complicated.&lt;br /&gt;
* A proof is shown below for the equation and why it works.&lt;br /&gt;
* A dictionary is a system that allows a value on a specific signal to be accessed. For example, A can contain many signals (either from a constant combinator or memory cell) and B can contain 1 of a specific signal (such as blue signal). What remains is the blue-signal value from A. This is because all the other signals are multiplied by 0.&lt;br /&gt;
* Arrays are similar to dictionaries, but instead of using a signal as a key, we use a number. Constant combinators are placed mapping each signal to a unique number (such as 1 yellow belt, 2 red belt, 3 blue belt, 4 burner inserter, etc). Then, use a combinator of &amp;quot;each = index OUTPUT 1 of each&amp;quot; and plug that in as the input to a dictionary.{{clear}}&lt;br /&gt;
[[File:combinatorMultiplierMath.png|left|500px]]&lt;br /&gt;
&lt;br /&gt;
    ((A+B)^2 - (A-B)^2)/4 = AB&lt;br /&gt;
    (A+B)^2 - (A-B)^2 = 4AB&lt;br /&gt;
    (A^2 + 2AB + B^2) - (A^2 - 2AB + B^2) = 4AB&lt;br /&gt;
    4AB = 4AB&lt;/div&gt;</summary>
		<author><name>Ndh</name></author>
	</entry>
	<entry>
		<id>https://wiki.factorio.com/index.php?title=User:Ndh&amp;diff=198834</id>
		<title>User:Ndh</title>
		<link rel="alternate" type="text/html" href="https://wiki.factorio.com/index.php?title=User:Ndh&amp;diff=198834"/>
		<updated>2024-06-27T17:51:07Z</updated>

		<summary type="html">&lt;p&gt;Ndh: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
&lt;br /&gt;
== Basic memory ==&lt;br /&gt;
A decider combinator can be used to store values, either for a counter or for more advanced logic (see below). The decider combinator is configured with&lt;br /&gt;
* input and output connected to the same network (typically each other),&lt;br /&gt;
* condition set to a signal &amp;gt; 0 for positive values or ≠ 0 to store both positive and negative values,&lt;br /&gt;
* output set to the input signal or [*].&lt;br /&gt;
As long as all inputs on the network are zero, it will hold the previously set value, because the game will copy the input to the output every tick.&lt;br /&gt;
&lt;br /&gt;
A non-zero input held over time, e. g. the output of a constant combinator, will create a basic runaway clock. The stored value will be incremented by the sum of all connected input values every cycle. So e. g. with a constant combinator that produces [A]=10 connected to the memory, the network will store the value 10 in the first pulse, 20 in the second, incrementing 60 times per second. &lt;br /&gt;
&amp;lt;div class=&amp;quot;toccolours mw-collapsible mw-collapsed&amp;quot;&amp;gt;&lt;br /&gt;
Blueprint&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible-content&amp;quot;&amp;gt;0eNqlU11rwzAM/C96TkuStWvqh8F+xyghH2orSOygyGWh5L/PjkcJJetW9hKQLd2d7pwrlI3FjkkLqCtQZXQP6uMKPZ100fgzGToEBSTYQgS6aH1VY0U18qoybUm6EMMwRkC6xk9QyRj9CuCJpNCyjJCOhwhQCwlh0DMVQ65tWyI7iodAEXSmd7NGe36Ht9sk620EA6jVNsvWW8fk5oRNk5d4Li7khlznkRpB/sGAC7FYd3JjDh2rd5jQrHcwiWcmHAKLxsor6T1U4j8nRtTzpah2G7te4sqSTKWfHr2Nd3unjxJYWPtu6Zo4qAmECxZ8w+burqab7iNxL/mfLcEL8iBn0qfgTUgIVOyLtit4kqvgzU0aK539B3Y35JP5+ZFNm5N2YKCELY7P2J/MvF6II53CTJ9Lzz3h6c2r2T8WgZPfhwCyZLPbp7vsdR+/xJtx/AJNbzZ8&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
Typically a constant combinator producing 1 will be used.&lt;br /&gt;
&lt;br /&gt;
Note that constant combinators can also produce negative values, which will decrease the stored value in the example below. If the decider combinator uses &amp;gt; 0 as the condition, only positive values will be allowed, so the value will stop decreasing if 0 is reached. If the condition is ≠ 0, negative values will also be allowed.&lt;br /&gt;
&lt;br /&gt;
A single pulse of an input will cause a single increment by the pulsed value, creating a counter. Reset to zero occurs 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;
== Memory cells ==&lt;br /&gt;
&lt;br /&gt;
=== Simple latch ===&lt;br /&gt;
&lt;br /&gt;
When looping the combinator to itself, use a different color of wire from your main inputs or outputs. &lt;br /&gt;
&lt;br /&gt;
[[File:SimpleLatchv2.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;
!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;
=== Positive cell ===&lt;br /&gt;
&lt;br /&gt;
Cell for storing a positive value, with reset support:&lt;br /&gt;
&lt;br /&gt;
[[File:AdvancedMemoryCell.png|500px]]&lt;br /&gt;
&lt;br /&gt;
Connect the desired value as signal I on the right side to set the memory cell and connect a negative value as signal I to reset the cell.&lt;br /&gt;
&lt;br /&gt;
* The output of the memory cell is 2 mutually exclusive signals.&lt;br /&gt;
** In case input signal I &amp;gt; 0 then signal I is passed to the other side.&lt;br /&gt;
** In case input signal I is interrupted, then signal M is passed instead as a memory of previous input value.&lt;br /&gt;
* When input signal I is interrupted, it takes 2 ticks to switch to memory signal M.&lt;br /&gt;
* In case input I signal lasts only one tick then memory cell starts to cycle between the 2 previous values, tick by tick. Indefinitely.&lt;br /&gt;
* Switching is seamless, e.g. there are no ticks with empty signal.&lt;br /&gt;
&lt;br /&gt;
=== Positives and negatives cell ===&lt;br /&gt;
&lt;br /&gt;
This cell can store negatives or positives. Reset is done on a dedicated line. Additionally, a 1-tick burst is handled properly. [https://forums.factorio.com/viewtopic.php?f=193&amp;amp;t=60330&amp;amp;p=362377#p362377 Forum post].&lt;br /&gt;
&lt;br /&gt;
* The output M (memory) is the last non-zero input I (Input).&lt;br /&gt;
* A non zero R (reset) signal sets the output to zero.&lt;br /&gt;
* 1-tick bursts of R or I are handled properly.&lt;br /&gt;
* Negatives are handled properly.&lt;br /&gt;
&lt;br /&gt;
[[File:Memory_cell_with_negatives.png|500px]]&lt;br /&gt;
&lt;br /&gt;
== Multiplier and Dictionaries/Arrays ==&lt;br /&gt;
[[File:combinatorMultiplierDetailed.png|left|500px]]&lt;br /&gt;
* Multiplying two signals together is simple and requires only a single combinator, however multiplying a set of signals is more complicated.&lt;br /&gt;
* A proof is shown below for the equation and why it works.&lt;br /&gt;
* A dictionary is a system that allows a value on a specific signal to be accessed. For example, A can contain many signals (either from a constant combinator or memory cell) and B can contain 1 of a specific signal (such as blue signal). What remains is the blue-signal value from A. This is because all the other signals are multiplied by 0.&lt;br /&gt;
* Arrays are similar to dictionaries, but instead of using a signal as a key, we use a number. Constant combinators are placed mapping each signal to a unique number (such as 1 yellow belt, 2 red belt, 3 blue belt, 4 burner inserter, etc). Then, use a combinator of &amp;quot;each = index OUTPUT 1 of each&amp;quot; and plug that in as the input to a dictionary.{{clear}}&lt;br /&gt;
[[File:combinatorMultiplierMath.png|left|500px]]&lt;br /&gt;
&lt;br /&gt;
    ((A+B)^2 - (A-B)^2)/4 = AB&lt;br /&gt;
    (A+B)^2 - (A-B)^2 = 4AB&lt;br /&gt;
    (A^2 + 2AB + B^2) - (A^2 - 2AB + B^2) = 4AB&lt;br /&gt;
    4AB = 4AB&lt;/div&gt;</summary>
		<author><name>Ndh</name></author>
	</entry>
	<entry>
		<id>https://wiki.factorio.com/index.php?title=User:Ndh&amp;diff=198832</id>
		<title>User:Ndh</title>
		<link rel="alternate" type="text/html" href="https://wiki.factorio.com/index.php?title=User:Ndh&amp;diff=198832"/>
		<updated>2024-06-27T17:41:20Z</updated>

		<summary type="html">&lt;p&gt;Ndh: Created page with &amp;quot;&amp;lt;div class=&amp;quot;toccolours mw-collapsible mw-collapsed&amp;quot;&amp;gt; Blueprint &amp;lt;div class=&amp;quot;mw-collapsible-content&amp;quot;&amp;gt;0eNqlU11rwzAM/C96TkuStWvqh8F+xyghH2orSOygyGWh5L/PjkcJJetW9hKQLd2d7pwrlI3FjkkLqCtQZXQP6uMKPZ100fgzGToEBSTYQgS6aH1VY0U18qoybUm6EMMwRkC6xk9QyRj9CuCJpNCyjJCOhwhQCwlh0DMVQ65tWyI7iodAEXSmd7NGe36Ht9sk620EA6jVNsvWW8fk5oRNk5d4Li7khlznkRpB/sGAC7FYd3JjDh2rd5jQrHcwiWcmHAKLxsor6T1U4j8nRtTzpah2G7te4sqSTKWfHr2Nd3unjxJYWPtu6Zo4qAmECxZ8w+burqab7iNxL/mfLcEL8iBn0qfgTUgIVOyLtit4kqvgzU0aK539B3Y...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div class=&amp;quot;toccolours mw-collapsible mw-collapsed&amp;quot;&amp;gt;&lt;br /&gt;
Blueprint&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible-content&amp;quot;&amp;gt;0eNqlU11rwzAM/C96TkuStWvqh8F+xyghH2orSOygyGWh5L/PjkcJJetW9hKQLd2d7pwrlI3FjkkLqCtQZXQP6uMKPZ100fgzGToEBSTYQgS6aH1VY0U18qoybUm6EMMwRkC6xk9QyRj9CuCJpNCyjJCOhwhQCwlh0DMVQ65tWyI7iodAEXSmd7NGe36Ht9sk620EA6jVNsvWW8fk5oRNk5d4Li7khlznkRpB/sGAC7FYd3JjDh2rd5jQrHcwiWcmHAKLxsor6T1U4j8nRtTzpah2G7te4sqSTKWfHr2Nd3unjxJYWPtu6Zo4qAmECxZ8w+burqab7iNxL/mfLcEL8iBn0qfgTUgIVOyLtit4kqvgzU0aK539B3Y35JP5+ZFNm5N2YKCELY7P2J/MvF6II53CTJ9Lzz3h6c2r2T8WgZPfhwCyZLPbp7vsdR+/xJtx/AJNbzZ8&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&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;
== Memory cells ==&lt;br /&gt;
&lt;br /&gt;
=== Simple latch ===&lt;br /&gt;
&lt;br /&gt;
When looping the combinator to itself, use a different color of wire from your main inputs or outputs. &lt;br /&gt;
&lt;br /&gt;
[[File:SimpleLatchv2.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;
!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;
=== Positive cell ===&lt;br /&gt;
&lt;br /&gt;
Cell for storing a positive value, with reset support:&lt;br /&gt;
&lt;br /&gt;
[[File:AdvancedMemoryCell.png|500px]]&lt;br /&gt;
&lt;br /&gt;
Connect the desired value as signal I on the right side to set the memory cell and connect a negative value as signal I to reset the cell.&lt;br /&gt;
&lt;br /&gt;
* The output of the memory cell is 2 mutually exclusive signals.&lt;br /&gt;
** In case input signal I &amp;gt; 0 then signal I is passed to the other side.&lt;br /&gt;
** In case input signal I is interrupted, then signal M is passed instead as a memory of previous input value.&lt;br /&gt;
* When input signal I is interrupted, it takes 2 ticks to switch to memory signal M.&lt;br /&gt;
* In case input I signal lasts only one tick then memory cell starts to cycle between the 2 previous values, tick by tick. Indefinitely.&lt;br /&gt;
* Switching is seamless, e.g. there are no ticks with empty signal.&lt;br /&gt;
&lt;br /&gt;
=== Positives and negatives cell ===&lt;br /&gt;
&lt;br /&gt;
This cell can store negatives or positives. Reset is done on a dedicated line. Additionally, a 1-tick burst is handled properly. [https://forums.factorio.com/viewtopic.php?f=193&amp;amp;t=60330&amp;amp;p=362377#p362377 Forum post].&lt;br /&gt;
&lt;br /&gt;
* The output M (memory) is the last non-zero input I (Input).&lt;br /&gt;
* A non zero R (reset) signal sets the output to zero.&lt;br /&gt;
* 1-tick bursts of R or I are handled properly.&lt;br /&gt;
* Negatives are handled properly.&lt;br /&gt;
&lt;br /&gt;
[[File:Memory_cell_with_negatives.png|500px]]&lt;br /&gt;
&lt;br /&gt;
== Multiplier and Dictionaries/Arrays ==&lt;br /&gt;
[[File:combinatorMultiplierDetailed.png|left|500px]]&lt;br /&gt;
* Multiplying two signals together is simple and requires only a single combinator, however multiplying a set of signals is more complicated.&lt;br /&gt;
* A proof is shown below for the equation and why it works.&lt;br /&gt;
* A dictionary is a system that allows a value on a specific signal to be accessed. For example, A can contain many signals (either from a constant combinator or memory cell) and B can contain 1 of a specific signal (such as blue signal). What remains is the blue-signal value from A. This is because all the other signals are multiplied by 0.&lt;br /&gt;
* Arrays are similar to dictionaries, but instead of using a signal as a key, we use a number. Constant combinators are placed mapping each signal to a unique number (such as 1 yellow belt, 2 red belt, 3 blue belt, 4 burner inserter, etc). Then, use a combinator of &amp;quot;each = index OUTPUT 1 of each&amp;quot; and plug that in as the input to a dictionary.{{clear}}&lt;br /&gt;
[[File:combinatorMultiplierMath.png|left|500px]]&lt;br /&gt;
&lt;br /&gt;
    ((A+B)^2 - (A-B)^2)/4 = AB&lt;br /&gt;
    (A+B)^2 - (A-B)^2 = 4AB&lt;br /&gt;
    (A^2 + 2AB + B^2) - (A^2 - 2AB + B^2) = 4AB&lt;br /&gt;
    4AB = 4AB&lt;/div&gt;</summary>
		<author><name>Ndh</name></author>
	</entry>
	<entry>
		<id>https://wiki.factorio.com/index.php?title=Factorio_talk:Style_guide&amp;diff=198831</id>
		<title>Factorio talk:Style guide</title>
		<link rel="alternate" type="text/html" href="https://wiki.factorio.com/index.php?title=Factorio_talk:Style_guide&amp;diff=198831"/>
		<updated>2024-06-27T17:30:12Z</updated>

		<summary type="html">&lt;p&gt;Ndh: Created page with &amp;quot;== How can I add a blueprint? == I would like to edit https://wiki.factorio.com/Tutorial:Combinator_tutorial#Memory, and I would like to add blueprints to make it easier to follow along. I would very much appreciate some guidance on the preferred way of sharing blueprints here on the Wiki. --~~~~&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== How can I add a blueprint? ==&lt;br /&gt;
I would like to edit https://wiki.factorio.com/Tutorial:Combinator_tutorial#Memory, and I would like to add blueprints to make it easier to follow along. I would very much appreciate some guidance on the preferred way of sharing blueprints here on the Wiki.&lt;br /&gt;
--[[User:Ndh|Ndh]] ([[User talk:Ndh|talk]]) 17:30, 27 June 2024 (UTC)&lt;/div&gt;</summary>
		<author><name>Ndh</name></author>
	</entry>
</feed>