Compare four items
-
- Burner Inserter
- Posts: 7
- Joined: Tue May 21, 2019 10:59 am
- Contact:
Compare four items
Ok, so heres the idea. From one (1) Cargo wagon, I'd like to use one (1) filter inserter to extract exactly 50 pcs each of 4 different items. Can it be done? I've scratched my head quite alot but have to admit defeat.
Re: Compare four items
There is this thing i tried :
It is slow with only 1 filter inserter, because of the override stack size, a stack filter inserter with stack size 5 or 10 could do faster
This work ?
When the chest is empty, there are 4 filters on the inserter, when 1 item is at quantity 50, it does [50*(-1)] + 50 = 0, so the filter disable and the inserter change item, untill all quantities are the same as specified on constant combinator. Then it just stop like on the picture.It is slow with only 1 filter inserter, because of the override stack size, a stack filter inserter with stack size 5 or 10 could do faster

This work ?
Re: Compare four items
If you set the constant value to 2147483597, you can skip the arithmetic combinator by using integer overflow.
Re: Compare four items
So there is this other thing that function in mysterious ways:
i tried with 2,147,483,647 it took me some time to realize i had to go backward, and still not sure what i was doing i stopped when it was fine.
Then i realise you had made the math already.
If you use 2,147,483,647, there is 1 of each item that end up in the chest before the system stop.
I can only explain the easier solution with the extra combinator
2,147,483,598 for some reason 
i tried with 2,147,483,647 it took me some time to realize i had to go backward, and still not sure what i was doing i stopped when it was fine.
Then i realise you had made the math already.
If you use 2,147,483,647, there is 1 of each item that end up in the chest before the system stop.
I can only explain the easier solution with the extra combinator

-
- Burner Inserter
- Posts: 7
- Joined: Tue May 21, 2019 10:59 am
- Contact:
Re: Compare four items
That's great! It worked like a charm. I'll start building my support train differently from now on!mmmPI wrote: Thu Aug 08, 2019 12:57 am There is this thing i tried :
50pcs.jpg
When the chest is empty, there are 4 filters on the inserter, when 1 item is at quantity 50, it does [50*(-1)] + 50 = 0, so the filter disable and the inserter change item, untill all quantities are the same as specified on constant combinator. Then it just stop like on the picture.
It is slow with only 1 filter inserter, because of the override stack size, a stack filter inserter with stack size 5 or 10 could do faster
This work ?

Re: Compare four items
The 2,147,483,647 magic is the 32bit signed integer overflow. 2,147,483,647 + 1 == -2,147,483,648.
That aside I use a similar setup. Nut not limited to 1 inserter.
Instead I have 1 filter inserter with override stack size = 1. Then 1 stack filter inserter with an extra decider combinator set to "each > 12 = each" and 4 more stack filter inserter with a decider combinator "each > 60 = each". So as long as the item count is >60 all 6 inserters work. Then when I get close to the goal count first it drops to 2 inserters (<= 60 missing items) and then to the single filter inserter (<= 12 items). That way I don't have to wait forever for larger counts.
That aside I use a similar setup. Nut not limited to 1 inserter.
Instead I have 1 filter inserter with override stack size = 1. Then 1 stack filter inserter with an extra decider combinator set to "each > 12 = each" and 4 more stack filter inserter with a decider combinator "each > 60 = each". So as long as the item count is >60 all 6 inserters work. Then when I get close to the goal count first it drops to 2 inserters (<= 60 missing items) and then to the single filter inserter (<= 12 items). That way I don't have to wait forever for larger counts.
Re: Compare four items
I have heard of that, i don't what is happening in this particular case though.mrvn wrote: Thu Aug 08, 2019 12:04 pm The 2,147,483,647 magic is the 32bit signed integer overflow. 2,147,483,647 + 1 == -2,147,483,648.
2,147,483,598 is a smaller number than the overflow one, why would it act as a negative ? i realised i had to count backward in game i had closed the forum tab, at this point I questionned my understanding

I can picture that, will keep inside a little room in my headmrvn wrote: Thu Aug 08, 2019 12:04 pm That aside I use a similar setup. Nut not limited to 1 inserter.
Instead I have 1 filter inserter with override stack size = 1. Then 1 stack filter inserter with an extra decider combinator set to "each > 12 = each" and 4 more stack filter inserter with a decider combinator "each > 60 = each". So as long as the item count is >60 all 6 inserters work. Then when I get close to the goal count first it drops to 2 inserters (<= 60 missing items) and then to the single filter inserter (<= 12 items). That way I don't have to wait forever for larger counts.

Re: Compare four items
2,147,483,647 + 1 == 2,147,483,598 + 50 == -2,147,483,648mmmPI wrote: Thu Aug 08, 2019 12:23 pmI have heard of that, i don't what is happening in this particular case though.mrvn wrote: Thu Aug 08, 2019 12:04 pm The 2,147,483,647 magic is the 32bit signed integer overflow. 2,147,483,647 + 1 == -2,147,483,648.
2,147,483,598 is a smaller number than the overflow one, why would it act as a negative ? i realised i had to count backward in game i had closed the forum tab, at this point I questionned my understanding![]()
Re: Compare four items
I added the word i forgot maybe that's better to understand my sentence if i write all the words sorry x)
From that i am reminded of the "complement of something" logic, but i can't picture in my head what is happening exactly ( or even remotely) with the 1 and 0 for the game to have overflow that you can use to implement that logic and predict the behavior.
Now I understand it as , you need 50 in the chest so the quantity stop being a very high positive and become neutral (0).
I would compare that to a score board that has only 1 digit, but this extraordinary game reach the digit 8, then 9, and then it stop showing something positive ,the 1 is hidden the display can't show 10.
I will give another thought to see if can use that in other situations thanks for explaining !
Re: Compare four items
That's pretty much what happens. It's a wheel in the scoreboard. But instead of going from 0-9 is goes from -2,147,483,648 to 2,147,483,647. It simply loops around to the negative numbers when it gets too big.mmmPI wrote: Thu Aug 08, 2019 3:01 pmI added the word i forgot maybe that's better to understand my sentence if i write all the words sorry x)
From that i am reminded of the "complement of something" logic, but i can't picture in my head what is happening exactly ( or even remotely) with the 1 and 0 for the game to have overflow that you can use to implement that logic and predict the behavior.
Now I understand it as , you need 50 in the chest so the quantity stop being a very high positive and become neutral (0).
I would compare that to a score board that has only 1 digit, but this extraordinary game reach the digit 8, then 9, and then it stop showing something positive ,the 1 is hidden the display can't show 10.
I will give another thought to see if can use that in other situations thanks for explaining !