Hares wrote: Tue Dec 24, 2024 7:52 pm
Tried to reduce this to one combinator but didn't succeed.
I think i heard of this one called "edge detector", if i'm not mistaken, you can achieve this with a single arithmetic combinator set up to do EACH * -1 output EACH
The wiring is the trick, if you have a constant combinator representing the input value, it need to be connected to the input and the output of the arithmetic with different colors of wire, and at the output, if the signal change, during 1 tick there will be "something" , and the next tick the arithmetic combinator will again nullify everything.
Hares wrote: Tue Dec 24, 2024 7:52 pm
Tried to reduce this to one combinator but didn't succeed.
I think i heard of this one called "edge detector", if i'm not mistaken, you can achieve this with a single arithmetic combinator set up to do EACH * -1 output EACH
The wiring is the trick, if you have a constant combinator representing the input value, it need to be connected to the input and the output of the arithmetic with different colors of wire, and at the output, if the signal change, during 1 tick there will be "something" , and the next tick the arithmetic combinator will again nullify everything.
Okay, something like this:
12-24-2024, 23-41-05.png (664.32 KiB) Viewed 3900 times
Even though it is now reduced to 1 comb, it has very limited use case, and work well only for deterministic logical signals.
I'd prefer to stay at 2-comb design.
Hares wrote: Tue Dec 24, 2024 7:52 pm
Tried to reduce this to one combinator but didn't succeed.
I think i heard of this one called "edge detector", if i'm not mistaken, you can achieve this with a single arithmetic combinator set up to do EACH * -1 output EACH
The wiring is the trick, if you have a constant combinator representing the input value, it need to be connected to the input and the output of the arithmetic with different colors of wire, and at the output, if the signal change, during 1 tick there will be "something" , and the next tick the arithmetic combinator will again nullify everything.
Okay, something like this:
12-24-2024, 23-41-05.png
Even though it is now reduced to 1 comb, it has very limited use case, and work well only for deterministic logical signals.
I'd prefer to stay at 2-comb design.
It is still basically a 2 device setup, just arranged in a manner to allow embedding of the second differencing stage (+ve/-ve/any detect) in the second device.
Re: Combinator cookbook 2.0
Posted: Tue Dec 24, 2024 9:41 pm
by mmmPI
Hares wrote: Tue Dec 24, 2024 8:43 pm
Okay, something like this:
Yes ! I'm using this often
Hares wrote: Tue Dec 24, 2024 8:43 pm
Even though it is now reduced to 1 comb, it has very limited use case, and work well only for deterministic logical signals.
I'd prefer to stay at 2-comb design.
Well it can be used as a building block for many more advanced contraption. It is meant to detect when signal changes, and let thru the magnitude of the change be it a positive or a negative, so it can be used to trigger one time action with "if something" => then do "thing" . But it can also be used to "count" things. If you have such deviced attached to say a chest, and you pick up manually 100 things, in one single click, such edge detector will detect "-100" variation. But if you take 10 and then 10 and then 10 as an inserter does, it will detect also - 10 and -10 and - 10.
Re: Combinator cookbook 2.0
Posted: Wed Dec 25, 2024 8:52 pm
by coffee-factorio
I wanted to point out the advantages and current state of the new display panel for signage.
What you guys are doing with rs latches and timers is beautiful. I made some examples that show how that can be used in practice if you ship some combinators onto a space platform. The second latch shows how to stack on conditions - so I'm suggesting this is a "stacking latch" as a name on that basis. RS/ect. can refer to the old multi-combinator model.
The circuits shown demonstrate ammo and fuel-oxidizer safety switches for a space platform. If it can get to a port but can't raise either value after they fall under a tolerance range, it will not be able to raise a flag. This forces a platform to stay in a dock till these values are brought into a "safe flight" range. The fuel tolerance is probably looser than it ought to be.
I think that clocks are a bit more interesting now and wanted to make an example piece as to why.
This shows a clock that has been decorated with a reset condition and that passes along an enabling condition. The lamp shows that the passed signal is lost for one tick on T = 0. It also shows how time interacts with a properly set display, and signal passing over radar; which has practical applications for synchronizing remote machines to a global time.
If you revisit the old classic memory cell timers those are actually a lot of fun to play with! You can now make them cycle. And you can make a classic one-shot count up to N timer. But you can have the one shot time area reset on a control now, so you can control how each combinator works and manipulate them independently.
To demonstrate this I used a new style latch to make a reset button. It's "interesting" because you need to involve the constant combinator in the circuit. A safer design can be made by tying that circuit to a logic combinator that reads when S=1 and forwards that. It will reset the count independently of signal R, which controls if the timer can increment at all (but otherwise doesn't do anything to memory). As for the practical use of this I'm really not sure
12-26-2024, 13-34-24.png (76.64 KiB) Viewed 3789 times
P.S.
Let me know if you want to see more of this, i.e. version that prints in display components instead of constant combinators.
Re: Combinator cookbook 2.0
Posted: Thu Dec 26, 2024 5:13 pm
by dontdieych
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.
It could be used as priority filter for signal to assembly machine. e.g. sending chemical plant and pipe signal to machine recipe -> pipe should have priority over chemical plant. If not, machine try to make chemical plant at first.
Re: Combinator cookbook 2.0
Posted: Sat Dec 28, 2024 5:57 pm
by Tertius
Pulse Extender
This is one thing I didn't see yet, it's the counterpart of the edge detector: the pulse extender. It's another variation of the memory cell that simply holds the last non-null signal forever or until you reset with R <> 0.
To hold and store one specific signal and not simply everything, replace all the EACH wildcards with the specific signal you want.
combinator_18405600_512x192.png (42.16 KiB) Viewed 3702 times
The fascinating thing is the AND EACH = 0 part of the condition in the lower combinator. Usually, EACH=0 is never true, because if everything is 0 there is nothing for EACH to expand, so no check is being done, so it can never result in anything being true. But here the signals seem to have been collected by the other EACH that checks for the other wire.
So if you provide a list of non-null signals on one wire, you're able to check for EACH=0 on the other wire and get results!
Seeing all these 1- or 2-combinator setups that look all the same in the screenshot but provide meaningful different generic behaviors, I would say the 2.0 combinator changes are not just convenience, they really add generic functionality not available previously. I'm not decided yet which of all the 1-combinator examples to add to the wiki guide I intend to create, since they seem kind of trivial if you look at them. On the other hand, it's not trivial to find the right combination of wire selection, wildcard, loopback, comparison. There are so many variations possible now. People might not realize on their own some task is trivial.
Re: Combinator cookbook 2.0
Posted: Sun Jan 05, 2025 7:21 pm
by Tertius
I found an interesting MAP on discord with just 1 decider.
This simple variant picks the most available fluid and outputs the corresponding solid fuel recipe, so always the most available fluid is converted into solid fuel.
The variant in discord additionally uses the green wire color to perform additional comparisons against configured values across wire colors, for example for "...but only if > minimum" conditions. To differ between item and recipe, the recipe values are bumped into the millions.
01-05-2025, 20-13-07.png (278.67 KiB) Viewed 3508 times
Tertius wrote: Sun Jan 05, 2025 7:21 pm
I found an interesting MAP on discord with just 1 decider.
This simple variant picks the most available fluid and outputs the corresponding solid fuel recipe, so always the most available fluid is converted into solid fuel.
Mindblowing. Instantly updated my auto-unbarelling setup to be 3 ticks faster.
This, however, works only for static maps -- for dynamic maps you still need an extra combinator or two.
01-06-2025, 17-06-39.png (672.64 KiB) Viewed 3479 times
I've find a way to make filter combinator even simpler compared to the presented in the OP post.
02-27-2025, 18-14-50.png (239.96 KiB) Viewed 2767 times
Filter-out comb, however, does not work with this trick, and requires AND condition if not comparing EACH with EACH (which is complicated to setup because the logic is inverse).
02-27-2025, 18-16-09.png (209.82 KiB) Viewed 2767 times
Re: Combinator cookbook 2.0
Posted: Sat Mar 01, 2025 3:12 am
by Engeki
Signal Extender
Probably already existing but I got inspired by the periodic combinator system
For a single combinator to able to extend a signal for a set period off time to prevent flickering
03-10-2025, 14-14-29.png (93.31 KiB) Viewed 2421 times
Unloading exact amount of items could take several combinators.
You might try this trick made by one decider.
It selects one positive value item from the list and creates S (the Control Stack) value to unload the Exact amount :
Input list of items comes by GREEN_WIRE. Self-feedback by RED_WIRE makes the exact stack. WildEach passes all items which pass conditon, in our case it is two items, whole list. Whole list one by one is passed to the output, but Output is WildAny it means it re-evaluate incoming values, ( one by one beouse of WildEach ) passes only one item from the incoming list. So at this point we have just One Selected Item on the combinator output.
Then, the Sellf-Feedback loop, we create the Stack value from this One Selected Item. The Stack value has one tick delay but it doesnt matter.
Another trick is: when inserter gets item signal and Stack is not_defined it starts move anyway, then one tick later he gets the stack. For some reason, size of the Stack is locked by inserter only in case it is non zero number. You cant change non zero Stack when inserter moves. However, you can change the Stack, if it has non_defined value in the beginning of the move. Therefore it works reliably.
Re: Combinator cookbook 2.0
Posted: Mon Mar 10, 2025 10:54 pm
by Hares
gGeorg wrote: Mon Mar 10, 2025 4:26 pm
Unloading exact amount of items could take several combinators.
You might try this trick made by one decider.
I've read this three times and it stills looks like a dark magic to me.
gGeorg wrote: Mon Mar 10, 2025 4:26 pm
Unloading exact amount of items could take several combinators.
You might try this trick made by one decider.
I've read this three times and it stills looks like a dark magic to me.
Combinators could make your brain spin, isnt it ?
I made a screen rather than BP. I thought that it would be more usefull see the values to help understand workflow.
I made description a bit better, does it helps ? Read original post.
Re: Combinator cookbook 2.0
Posted: Tue Mar 11, 2025 7:27 am
by Hares
Am I correct that there's one tick delay between filter signal and stack size signal?
Re: Combinator cookbook 2.0
Posted: Tue Mar 11, 2025 9:26 am
by Nidan
Yes, the stack size will lag one tick behind. Unless the output signal changes, which will result in one tick without stack size signal. When controlling inserters and having somewhat stable inputs this probably isn't an issue since the combinators are usually done updating before the inserter is ready to pick up items again.
If the one tick lag causes problems you'll need a second combinator, first reducing the input to one signal, then forwarding that signal while copying it to S as well: "if [conditions using Each] output Anything input count" connected to "if Each != 0 output Each input could and S input count"
Re: Combinator cookbook 2.0
Posted: Tue Mar 11, 2025 1:37 pm
by Tertius
This stack size computation is truly great. Unfortunately, it has its downsides because it occupies both inputs, so they cannot be used to isolate signals.
I developed a multi wagon supply train loading and unloading station, where for the inserter of each chest (wagon) one input gets a negative global value derived from train content, and the other input gets a positive chest specific value configured with a constant combinator. Both added together create the items to load or unload as positive values.
There is an alternative. It's possible to handle everything globally and continuously switch through all items every tick. Every inserter gets every signal over the course of this switching, so if it happens the item of the current signal is either in the wagon (for unload) or in the chest (for load), the inserter will swing and move that item. But in this case the stack size must not have this 1 tick delay. Otherwise the inserter will always use the stack size of the previous signal, not of the current.
Re: Combinator cookbook 2.0
Posted: Tue Mar 11, 2025 4:37 pm
by gGeorg
Hares wrote: Tue Mar 11, 2025 7:27 am
Am I correct that there's one tick delay between filter signal and stack size signal?
Yes. Filter gets out on first tick, so inserter is activated and start move. On second tick, the self-feedback creates the S virtual signal. Inserter gets S one tick later than Filter signal.