Page 1 of 1

Combinators: How to pick one item type from many?

Posted: Sun Aug 13, 2017 2:31 pm
by mrvn
I have a chest (actually a hauler from the AAI mod, but chest is the simplest analog) with iron ore, copper ore, raw wood, coal, ... many different items in it.

Now I need some circuit logic that picks one item type present in the chest and outputs a number N for it. E.g. N=1 for raw wood, N=2 for coal, N=3 for iron ore and so on. I'm looking for a simple circuit with short and constant signal path that outputs either the number for the item type with the most items or the item type with lowest or highest number. In a pinch a random number would also do.

My current solution assigns a power of 2 to each item type, adds all the present item types up and then figures out the lowest set bit and converts that into the item type number. Has a path length of 4 combinators and a constant combinator and 2 decider combinators per item type. Problem is that only works for 30 items and with Bob's mod I have more items. So I would have to cascade that. I'm looking at around 150 combinators just to pick one item type out of a chest.

So any better ideas?

Re: Combinators: How to pick one item type from many?

Posted: Sun Aug 13, 2017 11:00 pm
by DaveMcW

Re: Combinators: How to pick one item type from many?

Posted: Mon Aug 14, 2017 1:05 pm
by mrvn
thanks