Page 1 of 1
MAX/MIN functions
Posted: Fri Nov 10, 2023 6:41 pm
by nets
I've occasionally run across needing to find the signal with the lowest value, same with the highest value, in a series of signals.
Code: Select all
MAX [S] in ( [S1]=5, [S2]=15, [S3]=99 ) => [S]=99
MIN [S] in ( [S1]=5, [S2]=15, [S3]=99 ) => [S]=5
The same I've run across a need to find easily (read: not turn into a cluster of combinators) to cap values at the bottom and top.
Code: Select all
[S]=6; If [S] > 5 Then [S]=5 Else [S]=[S]
[S]=1; If [S] < 2 Then [S]=2 Else [S]=[S]
PS: I *
love* what you did with deciders 2.0, i hope wire by wire arithmetic can be done in the arithmetic combinator too!
Re: MAX/MIN functions
Posted: Fri Nov 10, 2023 7:30 pm
by Roflhouse42
Max/Min functions are supper annoying to build for train stops. Limiting the number of trains to not overwhelm your train stacker sucks. I would love for min/max to be added to the Arithmetic Combinator or the Decider Combinator. Its the most complex thing about making a train stop
Re: MAX/MIN functions
Posted: Sat Nov 11, 2023 3:59 am
by Nidan
nets wrote: Fri Nov 10, 2023 6:41 pm
The same I've run across a need to find easily (read: not turn into a cluster of combinators) to cap values at the bottom and top.
Code: Select all
[S]=6; If [S] > 5 Then [S]=5 Else [S]=[S]
[S]=1; If [S] < 2 Then [S]=2 Else [S]=[S]
You can cap values on one side with one deciders, one arithmetic and two ticks; two deciders, two arithmetic and two ticks for both sides. If keeping signals in sync is important add two extra arithmetic combinators for adjusting delays.
Roflhouse42 wrote: Fri Nov 10, 2023 7:30 pm
I would love for min/max to be added to the Arithmetic Combinator or the Decider Combinator.
As per today's FFF, 2.0's selector combinator will have those functions.
Re: MAX/MIN functions
Posted: Sat Nov 11, 2023 7:25 am
by ickputzdirwech
[Ick] Moved to Implemented in 2.0
Re: MAX/MIN functions
Posted: Fri Jul 31, 2026 8:04 am
by Roaders
I just found that FFF:
https://factorio.com/blog/post/fff-384
and either I've lost the ability to read or it doesn't mention anything about min and max functions.... Am I wrong?
Re: MAX/MIN functions
Posted: Fri Jul 31, 2026 8:12 am
by boskid
In 2.0 there was a selector combinator added where it is possible to select first lowest or first highest signal which works as a min/max across signals on a single wire. Additionally in 2.1.9 there was decider combinator else-output feature added which makes it possible to select min/max signal-wise between two wires.