MAX/MIN functions

Moderator: ickputzdirwech

nets
Burner Inserter
Burner Inserter
Posts: 9
Joined: Sat Apr 01, 2017 4:36 pm
Contact:

MAX/MIN functions

Post 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!

Roflhouse42
Burner Inserter
Burner Inserter
Posts: 10
Joined: Fri Nov 10, 2023 7:28 pm
Contact:

Re: MAX/MIN functions

Post 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

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

Re: MAX/MIN functions

Post 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.
Last edited by Nidan on Sun Nov 12, 2023 7:43 am, edited 1 time in total.

User avatar
ickputzdirwech
Filter Inserter
Filter Inserter
Posts: 787
Joined: Sun May 07, 2017 10:16 am
Contact:

Re: MAX/MIN functions

Post by ickputzdirwech »

[Ick] Moved to Implemented in 2.0
Mods: Shortcuts for 1.1, ick's Sea Block, ick's vanilla tweaks
Tools: Atom language pack
Text quickly seems cold and unfriendly. Be careful how you write and interpret what others have written.
- A reminder for me and all who read what I write

Post Reply

Return to “Implemented in 2.0”