Selector Combinator is not Min/Max
Posted: Thu Nov 16, 2023 9:20 pm
A little while back there a Comment asked for the implementation of Min/Max as operators in something like the Arithmetic Combinator. This link viewtopic.php?f=236&t=109636
This was closed as already implemented by the selector combinator in 2.0. Which I don't think is an accurate statement. The argument is that the selector combinator sorts a list of input signals and can return the largest/smallest signal. The problem is that in factorio, signals with zero value are not signals. So the selector combinator's sort will sort the list with the zero signal missing and thus will return the constant value when the input is zero. So, using it as a min/max operator only works if you don't have input values in the zero range.
In my opinion, the selector combinator is not a replacemeant for a min/max operator. Because if you want a number say between the values of 0 and 3(what you want on a train stop) you have to bend over backwards to make it work. By offsetting the values away from zero or something like that. This would likely be 2 Arithmetic operators, a selector, and a constant combinator.
In practice, everyone is likely going to stick with what they do today and use 2 decider combinators and multiply and a bunch of ugly constant management. So, I would like to suggest again that the arithmetic combinator have a min/max and possible clamp operator. It's simple and easy to understand and fits very well in the existing functionality of the Arithmetic Combinator.
The Arithmetic Combinator Min/Max I admit still has some issues around inputs of zero while using the undefined input signal option, but those issues are the same for any Arithmetic Combinator operator.
This was closed as already implemented by the selector combinator in 2.0. Which I don't think is an accurate statement. The argument is that the selector combinator sorts a list of input signals and can return the largest/smallest signal. The problem is that in factorio, signals with zero value are not signals. So the selector combinator's sort will sort the list with the zero signal missing and thus will return the constant value when the input is zero. So, using it as a min/max operator only works if you don't have input values in the zero range.
In my opinion, the selector combinator is not a replacemeant for a min/max operator. Because if you want a number say between the values of 0 and 3(what you want on a train stop) you have to bend over backwards to make it work. By offsetting the values away from zero or something like that. This would likely be 2 Arithmetic operators, a selector, and a constant combinator.
In practice, everyone is likely going to stick with what they do today and use 2 decider combinators and multiply and a bunch of ugly constant management. So, I would like to suggest again that the arithmetic combinator have a min/max and possible clamp operator. It's simple and easy to understand and fits very well in the existing functionality of the Arithmetic Combinator.
The Arithmetic Combinator Min/Max I admit still has some issues around inputs of zero while using the undefined input signal option, but those issues are the same for any Arithmetic Combinator operator.