Combinator cookbook 2.0

Post pictures and videos of your factories.
If possible, please post also the blueprints/maps of your creations!
For art/design etc. you can go to Fan Art.

Tertius
Smart Inserter
Smart Inserter
Posts: 1076
Joined: Fri Mar 19, 2021 5:58 pm
Contact:

Combinator cookbook 2.0

Post by Tertius »

This is a cookbook for common combinator tasks. The 2.0 version of the game contains a few tiny but powerful enhancements with circuits, so it's possible to do many things very easily with just one or two combinators where multiple ones were required previously.

The major power we gained is to use the red and green wire inputs separately. This enables us to use the EACH wildcard with different wires for its operands. This is used throughout almost all of my examples.

I consider adding this as additional combinator tutorial to the wiki, so I'm interested in feedback and bugfixes for blueprints and descriptions. Or if you have more generic snippets I should add. Or if language can be improved, I'm not native English speaking. I tried to keep everything as generic as possible and not just show how I personally solve the circuit challenges.

It goes from easy to somewhat advanced and specialized.
Basic combinator setups
One or two combinators with simple functionality.
The descriptions you see are also added as combinator descriptions everywhere in the blueprints.

Math/basic arithmetic operations
Divide everything from red-wire by everything from green-wire.
Can be used for all the other arithmetic operations as well. This wiring and wire selection within the combinator is the basic setup how to use the 2 wires independently throughout all the other examples.
combinator_16224331_384x224.png
combinator_16224331_384x224.png (34.17 KiB) Viewed 2203 times

Find the minimum/maximum of 2 inputs
For finding the minimum, the first combinator outputs all signals from green-wire whose values are lower or equal than the corresponding signals on red-wire.
The other combinator outputs all signals from red-wire whose values are lower than the corresponding signals on green-wire.
The combined output represents the minimum values of both inputs.

The maximum works the same, just the conditions reversed.
combinator_16225110_384x224.png
combinator_16225110_384x224.png (38.45 KiB) Viewed 2203 times
combinator_16225876_384x224.png
combinator_16225876_384x224.png (37.98 KiB) Viewed 2203 times
Minimum:
Maximum:

Include only filtered items
Arbitrary signals are on red-wire.
Filter definition is on green-wire.
Output only signals from red-wire that are also present on green-wire.

Values on green-wire can be any <> 0, don't need to be 1.
combinator_16226262_512x224.png
combinator_16226262_512x224.png (40.66 KiB) Viewed 2203 times


Exclude filtered items
Arbitrary signals are on red-wire.
Filter definition is on green-wire.
Output only signals from red-wire that are not present on green-wire.

Values on green-wire can by any <> 0, don't need to be 1.
combinator_16226597_544x224.png
combinator_16226597_544x224.png (40.91 KiB) Viewed 2203 times


Limit filtered items
Filter everything below or above some limit.
On red wire a list of limits for given signals is input.
Output every signal from green wire that's below the limit. Ignore signals from green-wire that don't exist in the filter on red-wire.
Inverse the condition to > to output every signal above the limit.

Example usage: use output as filter for an inserter that's moving only items with less than (or more than) the given amount of items in some storage.
combinator_16226945_544x224.png
combinator_16226945_544x224.png (44.66 KiB) Viewed 2203 times


Generic latch (hysteresis)
Activate [signal-check] if input signal [iron-ore] raises above the upper limit (200).
[signal-check] stays active until input signal [iron-ore] goes below the lower limit (100).
Signal has to raise above 200 again to activate [signal-check] again.

Reversed functionality: Use < and <= as comparison and exchange higher and lower limit, if you need to activate the output if the input is below the lower threshold and keep it activated until the upper limit is reached.
combinator_16227231_544x160.png
combinator_16227231_544x160.png (31.44 KiB) Viewed 2203 times


Counter
Counts things, for example items moved by an inserter.
It is reset to 0 if [R]>0 is provided.
combinator_16228147_544x160.png
combinator_16228147_544x160.png (32.03 KiB) Viewed 2203 times


Clock
This clock counts from 0 to 100, then starts from 0 again.
Feel free to provide a different reset condition with different input signals. The clock counts as long as the conditions render true.

In contrast to clocks from game version 1.1, you're able to provide the +1 increment inline as output signal, so an extra constant combinator is usually not needed.
combinator_16228753_384x160.png
combinator_16228753_384x160.png (23.01 KiB) Viewed 2203 times
Last edited by Tertius on Sat Dec 21, 2024 1:24 pm, edited 5 times in total.
Tertius
Smart Inserter
Smart Inserter
Posts: 1076
Joined: Fri Mar 19, 2021 5:58 pm
Contact:

Re: Combinator cookbook 2.0

Post by Tertius »

Multi combinator setups
Now to some more complex setups with 2 and more combinators.
Memory cell
Store an arbitrary signal composition.
One combinator passes the incoming signals if the set condition is true, the other one passes the output via loopback as long as the set condition is false. Both combined create a memory cell: either the first combinator sends the outgoing signal or the second one.
The given example stores the incoming signal on red while S<>0 on green and holds it as memory while S=0.

Since the incoming signals are passed on a different wire color than the set condition, the set condition is independent from the signals to store. With this example, some other S could be included in the signals to store and will not interfere with the S queried for the set condition.
combinator_16229000_416x224.png
combinator_16229000_416x224.png (46.96 KiB) Viewed 2201 times


Filter real items
I don't know how useful this is. By checking if an incoming signal has an associated stack value and filter all that hasn't one, we can drop fluids and virtual signals and keep only signals from real items.
combinator_16229290_448x192.png
combinator_16229290_448x192.png (43.94 KiB) Viewed 2201 times

Iterate over a list of signals
This setup iterates over a list of incoming signals, outputting signals separately tick per tick and terminating a sequence with a "null" signal (no signal).
There are 2 variants. The first one has one combinator less and actually sends 2 empty signals at the end of a sequence. The 3 combinator setup sends exactly 1 empty signal.
Both work by using a counter (or index) that starts with 0 and increases every tick. The item corresponding to the index is picked by a selector combinator. The difference is with the counter reset: The smaller setup resets if it detects an empty value as output and outputs an additional empty value due to the combinator latency. The other one determines the number of items with an additional selector combinator, so it's able to reset after exactly one empty value.
combinator_16229606_512x192.png
combinator_16229606_512x192.png (40.04 KiB) Viewed 2201 times
combinator_16229994_512x224.png
combinator_16229994_512x224.png (47.33 KiB) Viewed 2201 times
2 combinators:
3 combinators:
Practical examples
The following examples are not that generic but solve specific tasks you might encounter in the game.
Digital Display
Use the display panels to create a complete number display. The magic is the EACH operator iterating over each provided divisor by the constant combinator, creating a list of numbers representing the digit to display for each position. The display panels work similar to a CASE and pick the first signal that matches the current number range. To suppress leading zeroes, the provided item is passed through as N and checked as first item.
combinator_16248048_544x256.png
combinator_16248048_544x256.png (41.88 KiB) Viewed 2042 times

Stalled belt detector
This is a counter that counts the ticks since the belt was empty AND it didn't receive any pulses from the belt.

A sufficiently high negative counter value, for example -60, indicates there are items on the belt but they're not moving since the belt is stalled.
The counter is counting as negative numbers to enable counting (negative) and checking for items and pulses (positive) within the same combinator.
combinator_16230302_736x224.png
combinator_16230302_736x224.png (51.4 KiB) Viewed 2201 times


Priority map
I don't know a better title... Consider you have a list of signals and you want to map each of these signals to an associated signal. For example you want to map an item to an associated recipe. Additionally, this setup picks the item with the highest (or lowest) value, so you're able to either consume the most available item or produce more of the least available item.
combinator_16230565_576x224.png
combinator_16230565_576x224.png (60.71 KiB) Viewed 2201 times
combinator_16230831_576x224.png
combinator_16230831_576x224.png (56.75 KiB) Viewed 2201 times
Highest:
Lowest:

Limit train limit
This one solves the task: "set the train limit to as many trains as can be filled with the current buffer chest content, but not more than MAX".
To use only one combinator for the limiter, a slightly strange means of defining the maximum is required. You need to add virtual signals with all allowed train limits. For maximum=3, you need to add 3 different virtual signals. One with value 1, one with 2, one with 3. The combinator counts the signals below or equal to the output of the division to determine the limit value, so if you enter 3 signals, it can never count more than 3, so 3 is the maximum.
To just give a M signal as maximum requires an additional combinator, but we are stingy, aren't we?
combinator_16231240_608x256.png
combinator_16231240_608x256.png (81.62 KiB) Viewed 2201 times

Asteroid collecting
This one also shows it's possible to read a machine and send it a signal at the same time over the same wire.

The collector has an inventory size of 39 and we have 3 asteroid types, so we want to buffer up to 13 for each type. The setup reads the content of the asteroid collector and removes any value higher than 13. It outputs 1 for each lower value and adds it to the wire that's connected to the collector. The collector subtracts its own output from the wire, regenerating the filter we sent, and so is able to set its filter accordingly.

This setup has a small caveat: The combinator isn't as smart as the collector and cannot differ between the content and the filter values, since both are added on the same wire. If there are exactly 12 asteroids of one type, the value the combinator sees is 13 (12 from the inventory +1 from the filter), so it removes this asteroid from the filter. The next tick the value is 12 again, so the combinator adds it to the filter again, so in the end the filter toggles for this asteroid. This is a visual glitch but doesn't actually prevent the collector from collecting the last asteroid of this type.

By using both red and green wire, it's possible to avoid this glitch: remove both green wires, then connect the input of the combinator with the collector with green wire (this reads the collector inventory) and the output of the combinator with the collector with red wire (this sends the filter).
combinator_16231559_672x224.png
combinator_16231559_672x224.png (70.25 KiB) Viewed 2201 times
Last edited by Tertius on Sat Dec 21, 2024 1:04 pm, edited 5 times in total.
jaylawl
Fast Inserter
Fast Inserter
Posts: 175
Joined: Sat Nov 23, 2024 10:14 am
Contact:

Re: Combinator cookbook 2.0

Post by jaylawl »

Your stall detector is interesting, thanks for sharing!
User avatar
Hares
Filter Inserter
Filter Inserter
Posts: 622
Joined: Sat Oct 22, 2022 8:05 pm
Contact:

Re: Combinator cookbook 2.0

Post by Hares »

7-digit display
Displays the value of a given signal that is within the range 0 ≤ x < 10M
Parameterized to filter only for the given signal.
Max range can be extended. Requires additional combinators to work with the negative numbers.

Useful for displaying contents of the network.

Variation: Independent installation
Each display comes with its own combinator.
12-21-2024, 14-16-06.png
12-21-2024, 14-16-06.png (1.66 MiB) Viewed 2072 times


Part of that display (a single digit), parameterized to by power.


Variation: Combined display
A set of common arithmetical combinators that share wire with multiple displays each.
Uses additional logic to hide leading zeroes. Range of operation is unchanged.

Usage:
  1. Deploy
  2. Connect shared red wire to the contents of the network
  3. Copy as many of top rows as you want (just note to keep the wiring)
  4. Use the standalone row as a parameterized template to copy into
12-21-2024, 14-36-14.png
12-21-2024, 14-36-14.png (1.73 MiB) Viewed 2072 times
Tertius
Smart Inserter
Smart Inserter
Posts: 1076
Joined: Fri Mar 19, 2021 5:58 pm
Contact:

Re: Combinator cookbook 2.0

Post by Tertius »

Hares wrote: Sat Dec 21, 2024 11:40 am
7-digit display
Reminds me of this fine display variant, requiring just 1 combinator per display (the constant combinator can be shared across all displays), first found here: viewtopic.php?p=644584#p644584
combinator_16248048_544x256.png
combinator_16248048_544x256.png (41.88 KiB) Viewed 2051 times

I added that to the practical examples above.
User avatar
Hares
Filter Inserter
Filter Inserter
Posts: 622
Joined: Sat Oct 22, 2022 8:05 pm
Contact:

Re: Combinator cookbook 2.0

Post by Hares »

Tertius wrote: Sat Dec 21, 2024 12:54 pm
Hares wrote: Sat Dec 21, 2024 11:40 am
7-digit display
Reminds me of this fine display variant, requiring just 1 combinator per display (the constant combinator can be shared across all displays), first found here: viewtopic.php?p=644584#p644584

combinator_16248048_544x256.png


I added that to the practical examples above.
That's pretty damn clever design!
User avatar
Hares
Filter Inserter
Filter Inserter
Posts: 622
Joined: Sat Oct 22, 2022 8:05 pm
Contact:

Re: Combinator cookbook 2.0

Post by Hares »

Periodic Memory Cell
Stores the value of given dynamic signal (in red cable), which is updated once per given interval (configured as P on constant combinator).
Use-case: Persist values of logistical network to prevent circuits (i.e., assembler recipes) flickering.
12-22-2024, 03-40-16.png
12-22-2024, 03-40-16.png (331.58 KiB) Viewed 1987 times

mmmPI
Smart Inserter
Smart Inserter
Posts: 3974
Joined: Mon Jun 20, 2016 6:10 pm
Contact:

Re: Combinator cookbook 2.0

Post by mmmPI »

Hares wrote: Sun Dec 22, 2024 12:39 am
Periodic Memory Cell
Stores the value of given dynamic signal (in red cable), which is updated once per given interval (configured as P on constant combinator).
Use-case: Persist values of logistical network to prevent circuits (i.e., assembler recipes) flickering.
It is possible to achieve the same result using less combinators if i understood correctly the contraption :


Nidan
Filter Inserter
Filter Inserter
Posts: 281
Joined: Sat Nov 21, 2015 1:40 am
Contact:

Re: Combinator cookbook 2.0

Post by Nidan »

Tertius wrote: Thu Dec 19, 2024 7:57 pm
Priority map
As long as the input contains at most one of the mapped signals, you can use the first decider to do the filtering. No need for the constant combinators shifting the values. This also removes the accidental non-match if the input is smaller than its index value.
Tertius
Smart Inserter
Smart Inserter
Posts: 1076
Joined: Fri Mar 19, 2021 5:58 pm
Contact:

Re: Combinator cookbook 2.0

Post by Tertius »

mmmPI wrote: Sun Dec 22, 2024 3:23 am
Hares wrote: Sun Dec 22, 2024 12:39 am
Periodic Memory Cell
Stores the value of given dynamic signal (in red cable), which is updated once per given interval (configured as P on constant combinator).
Use-case: Persist values of logistical network to prevent circuits (i.e., assembler recipes) flickering.
It is possible to achieve the same result using less combinators if i understood correctly the contraption :
It's even possible to squeeze the counter into the memory cell to get a memory cell that updates itself periodically. Just 2 combinators as a whole. You also don't need any constant combinator, if you put the interval directly into the combinator conditions. The only caveat: it spills the counter into the output.


Nidan wrote: Sun Dec 22, 2024 5:16 am
Tertius wrote: Thu Dec 19, 2024 7:57 pm
Priority map
As long as the input contains at most one of the mapped signals, you can use the first decider to do the filtering.
Ah, the evil "EACH combined with another condition", and here even with another EACH. I confess I never really understood how combinators will process that but took a closer look now. That's cool. I wonder how other filtering setups from the cookbook might profit from this double EACH.

Since this is a very obscure implicit functionality, I guess it should be explained in some guide. The current explanation in the wiki is not sufficient and I see many posts where people misunderstand it. I wonder if there is someone with flowchart and visualization skills who's able to create a chart that shows how an EACH is expanded and the expanded values combined/evaluated with other conditions, and how the output is picking values from the expanded input.
User avatar
Hares
Filter Inserter
Filter Inserter
Posts: 622
Joined: Sat Oct 22, 2022 8:05 pm
Contact:

Re: Combinator cookbook 2.0

Post by Hares »

Tertius wrote: Sun Dec 22, 2024 12:25 pm It's even possible to squeeze the counter into the memory cell to get a memory cell that updates itself periodically. You also don't need any constant combinator, if you put the interval directly into the combinator conditions. The only caveat: it spills the counter into the output.
The only reason I extracted period as a constant combinator is to make it possible to update multiple setups at once by using logistical groups.
Otherwise, it's entirely possible.

BTW, your design is gorgeously compact.
Last edited by Hares on Sun Dec 22, 2024 1:56 pm, edited 1 time in total.
Tertius
Smart Inserter
Smart Inserter
Posts: 1076
Joined: Fri Mar 19, 2021 5:58 pm
Contact:

Re: Combinator cookbook 2.0

Post by Tertius »

Compactness increases manageability and understanding. Nobody is able to understand a mess of 20 combinators, all with some A and X and Z=1, and if this then X=1, if X=1 and Y=0 then A=1 and so on. Not even yourself in a week.

I always try to build composite setups (that incorporate a few of the concepts from the cookbook) with the least possible amount of combinators. Can functionality be merged from 2 into 1 combinator? Can one signal be reused in a different part, so it doesn't need to be computed again? I inspect every combinator, and if I find a combinator nearby with a similar operation, I try to find proof these 2 must be separate, because they handle the same signal over the same wire color but with different values. If I find this proof they must be kept separate, otherwise there is usually a way to merge them into 1 combinator.

And if you have multiple signals merged into one wire, often synergy pops up and you already have signals together you wanted to deal with in the first place.

For example the counter in the memory cell: We had a setup that already checks for a condition similar to a counter, and we had a spare output in the combinator with the loopback. I just tried what will happen if I additionally output S=1 to increase the variable, and it was a bit of luck that the signals were independent enough to be handled this way. And the conditions in both combinators still toggled both in the same tick, which is the crucial constraint for the memory cell. First, I tried to SET the memory cell if C=0, but this didn't work out - the upper combinator toggled one tick too late, because it didn't know when the interval was reached the same tick as the lower combinator, so there was one intermediate tick with no output at all.

It might take more time to think, but compact designs also tend to have less edge cases because they are more uniform, so they are more reliable, so you need less time to debug. Overall, it is usually a time saver for me, not a time waster, to think about the most compact setup.
Last edited by Tertius on Sun Dec 22, 2024 2:05 pm, edited 1 time in total.
User avatar
Hares
Filter Inserter
Filter Inserter
Posts: 622
Joined: Sat Oct 22, 2022 8:05 pm
Contact:

Re: Combinator cookbook 2.0

Post by Hares »

Tertius wrote: Sun Dec 22, 2024 1:55 pm Compactness increases manageability and understanding. Nobody is able to understand a mess of 20 combinators, all with some A and X and Z=1, and if this then X=1, if X=1 and Y=0 then A=1 and so on. Not even yourself in a week.
No need to explain compactness.
Compactness is great.
Tertius
Smart Inserter
Smart Inserter
Posts: 1076
Joined: Fri Mar 19, 2021 5:58 pm
Contact:

Re: Combinator cookbook 2.0

Post by Tertius »

Yes, I know. Thanks for the flowers 👍 :)
I explained it for people who are already satisfied if they just plug together some setup and stop if it just works. Many don't see the whole picture and consider it as time waste to think about refining and optimizing, but there is a practical use to it. Often, you see the edge cases while you're optimizing. If you don't optimize, you wonder why this factory stops working in the middle of something else, and you have to debug it when you wanted to do that something else.
mmmPI
Smart Inserter
Smart Inserter
Posts: 3974
Joined: Mon Jun 20, 2016 6:10 pm
Contact:

Re: Combinator cookbook 2.0

Post by mmmPI »

Tertius wrote: Sun Dec 22, 2024 2:12 pm I explained it for people who are already satisfied if they just plug together some setup and stop if it just works.
Well i feel it was for me then, and i plugged a setup made for clear explanations but didn't want to complicate any further than necessary, and didn't spent time to optimize :
123884
There are different ways of making a memory cell, but often time the idea is to have a combinator looping onto itself with a value that doesn't change, thus "stored" in memory. Then variation can occur depending on how you want to set and/or read this value. This means different combinators setup.

For the usecase you describe it is possible to reuse the logic you described counting up to a minute to act as trigger signal to set the value in the memory cell, and to reset it.

The memory cell can be a decider combinator looping onto itself with red wire. With an additionnal green wire connected to the input. The idea being that the red wire will hold the value ( and you can connect and "read" from there), and the green wire will recive the counter to tell when to update. ( the new value is received on the red wire)

Then the decider combinator need to be configured to check if the signal "C" on the green wire is above or equal to 1(the counter). And if so the output should be "everything" on the red wire. This means that "most of the time" the value that are present in the input are going to be present also in the output the next tick, and will cycle "holding" the value in memory.

This also means that when the counter is at 0, the memory cell will stop this cycle, the next tick nothing will be present in output. Instead it will be the time to give a new value on the red wire for the memory to store for the next minute. It is possible to do so using a second decider combinator, also connected to the counter with a green wire to its input, and to whatever value you want to read from, but this time detecting when C = 0 on the counter. And only then, outputting "Everything". On a red wire, to feed the first decider combinator.

This means that when the counter is at 0, this second decider combinator will "read" "whatever value you want to read from". And pass this on a red wire for the next tick, at the same time as when the first decider combinator condition is invalid causing it to output nothing the next tick.

When the counter is at 1, the first decider combinator again loop onto itself the value on the red wire, but this value is the one that came from the second decider combinator the previous tick.

As always when trying to describe a ""simple"" setup with word, i feel like a blueprint would help much more, so i also join a blueprint that follows what i just described to illustrate a memory cell that update a value every 300 ticks.
Tertius
Smart Inserter
Smart Inserter
Posts: 1076
Joined: Fri Mar 19, 2021 5:58 pm
Contact:

Re: Combinator cookbook 2.0

Post by Tertius »

It was really to nobody in particular. I just want to encourage people to not stop thinking when they get the first build working. On the other hand, this creates these community driven iterations where someone posts a rough build, someone else improves it, a 3rd one adds some missing feature, and in the end a truly generic build arises with everything included but vastly smaller and better usable than the original idea. The display panel is an example for that.

It's like discovering math - nobody really invents math and owns it, it's just about discovering what is there.
Nidan
Filter Inserter
Filter Inserter
Posts: 281
Joined: Sat Nov 21, 2015 1:40 am
Contact:

Re: Combinator cookbook 2.0

Post by Nidan »

Tertius wrote: Sun Dec 22, 2024 12:25 pm Ah, the evil "EACH combined with another condition", and here even with another EACH. I confess I never really understood how combinators will process that but took a closer look now. That's cool. I wonder how other filtering setups from the cookbook might profit from this double EACH.

Since this is a very obscure implicit functionality, I guess it should be explained in some guide. The current explanation in the wiki is not sufficient and I see many posts where people misunderstand it. I wonder if there is someone with flowchart and visualization skills who's able to create a chart that shows how an EACH is expanded and the expanded values combined/evaluated with other conditions, and how the output is picking values from the expanded input.
There's only one question that changes the behavior: Does Each appear in the conditions?
If not, no special rules apply for evaluation and Anything appearing on the output side will produce a single signal from the selected input wire(s).
If at least one Each is used, the conditions are evaluated for each input signal in turn. All Each will substitute the same signal, but with potentially different values due to wire selection. (This can only make a difference in the (sub)conditions that actually use Each. If one of the other conditions evaluates to false, the combinator might output nothing even if the rows consuming Each appear to be satisfied for some signals) Signals where all used wired combinations (red, green and/or red+green) sum to zero are skipped. (As usual, 1.1 combinators and the arithmetic combinator do the same.). On the output side, Anything will produce one of the signals that passed all tests, Each will produce all of them.


The text above might look like it's complicated, but compared to 1.1 nothing really changed:
- The generic signals (Anything, Each, Everything) ignore zeros.
- Using Each puts the combinator into vector mode, evaluating it one for each nonzero input signal.
User avatar
Hares
Filter Inserter
Filter Inserter
Posts: 622
Joined: Sat Oct 22, 2022 8:05 pm
Contact:

Re: Combinator cookbook 2.0

Post by Hares »

Nidan wrote: Sun Dec 22, 2024 4:13 pm
Tertius wrote: Sun Dec 22, 2024 12:25 pm Ah, the evil "EACH combined with another condition", and here even with another EACH. I confess I never really understood how combinators will process that but took a closer look now. That's cool. I wonder how other filtering setups from the cookbook might profit from this double EACH.

[...]
[...]

The text above might look like it's complicated, but compared to 1.1 nothing really changed:
- The generic signals (Anything, Each, Everything) ignore zeros.
- Using Each puts the combinator into vector mode, evaluating it one for each nonzero input signal.
I was going to ask what will happen if we mix EACH with ANY or EVERY...
... but you can't. They may be present in different conditions, but you can't use both within the same condition.
12-22-2024, 19-45-54.png
12-22-2024, 19-45-54.png (175.57 KiB) Viewed 1782 times
But you can Q-pick these wildcards since 2.0 (which is why I figured this fact only now).
User avatar
Hares
Filter Inserter
Filter Inserter
Posts: 622
Joined: Sat Oct 22, 2022 8:05 pm
Contact:

Re: Combinator cookbook 2.0

Post by Hares »

Tried to reduce this to one combinator but didn't succeed.
Raising front detector
Description
Sends a pulse signal each time the value in the red wire increases.
In case of red wire being a logical signal, result is P == 1 only on front of incoming signal.
Otherwise, sends P for each increment of signal, including any partial change (discarding the value of increment in the process).

Can be switched to negative front by replacing > (GT) compare with < (LT).
Can be switched to purely logical mode by adding (ANY ≠ 0 → S) DC before the setup.

Use Case
Detect if signal changed to trigger one-time actions, i.e. upon train arrival to (but not leaving from) the connected train stop.

Technical Info
  • Delay: 2 ticks
  • Supports vectors: kinda
  • Supports signal in different wires: no
12-24-2024, 22-38-10.png
12-24-2024, 22-38-10.png (594.21 KiB) Viewed 1642 times
User avatar
Hares
Filter Inserter
Filter Inserter
Posts: 622
Joined: Sat Oct 22, 2022 8:05 pm
Contact:

Re: Combinator cookbook 2.0

Post by Hares »

Signal presence / no presence detector
Description
Minimalistic combinator (since 1.1 times) that sends ✔️ (❌) if any (no) signals are present. One combinator does only one of this things.

Use Case
Convert any vector or dynamic value signal into constant logical signal.

Technical Info
  • Delay: 1 tick
  • Supports vectors: yes
  • Supports signal in different wires: yes
Note: On the image attached, there are two copies of each detector, for four detectors in total.
12-24-2024, 23-10-13.png
12-24-2024, 23-10-13.png (831 KiB) Viewed 1637 times
Blueprints
  • Signal presence detector
  • Signal no presence detector
Post Reply

Return to “Show your Creations”