- due to value truncation it does not work well on small numbers e.g. "4 and 5" ; same as "The Largest Item Finder" in viewtopic.php?f=193&t=20732 which makes believe that the job can be done. This is not a problem for "4 and 6"
- I like to have all max signals . so for the example above there is the "wrong" result "4 and 5".
But for my train station setup (e.g. 50k, 0k, 120k, ... ) having multipe unload areas and for blocking rails this it is the first step.
blueprint 0.14.9
My main idea is to recursivley increase the average of the exising array. And to reduce the elements in the array by adding their negative opposite and the end of one cylce.e.g. [20, 50, 80,90,100]
first round : N = 5, S = 360 => A = 72
[-20,-50, 80, 90, 100]
filtered ==> [-20,-50] ==> reinsert/add in first combinator ==> [20 + -20, 50 + -50, 80 + 0, 90 + 0, 100 +0 ]
2nd round : N = 3, S = 270 => A = 90
[-20,-50, -80, 90, 100]
4th N=2, S = 190 => A = 95
[-20,-50, -80, -90, 100] ==> filter only for positive ==> 100
detailed setup
Hm I thought it would be easy to flip some expression to get a Math.min but the setup does not yet stabilze. I have to keep trying...
And I´m suprised that this is still working. I made several tries and had alot of more NOOP combinators to stabilize the setup. Maybe I need them now again...
UPDATE 160916_2046:
setup is instable on certain array e.g. [2,5] because avererage of 2.5 is truncated to 2, and removing it from the array flickers. 2 combinators are doing the jobs - input *=1000 and output /=1000 - but this makes me not happy. Also the math.min is not that easy for. I think I'm still missing some skills and experiences.
Help is welcome.
Update 1.10.
I realized thinking in logic gates is not my nature and for smaller things the "best item finder" and its explained details withour recursion will do it for the most scenrios.
Therefore I won't spend any more time in vanilla combinators.
I started implementing the math.min, max and rand as new combinators https://mods.factorio.com/mods/Cobaltur/MathCoProcessor