Page 1 of 1

Find the intersection of two signals (or chests items)

Posted: Wed Jan 04, 2023 2:45 pm
by mboxdk
This blueprint allows you to show the number of items in the first chest, but only from those that are available in the second chest.
The number of actual uses in the game is large :D
Capture.PNG
Capture.PNG (405.71 KiB) Viewed 1770 times


s.PNG
s.PNG (2.19 MiB) Viewed 1770 times

Re: Find the intersection of two signals (or chests items)

Posted: Wed Jan 04, 2023 4:53 pm
by mboxdk
A bit different version that returns "item -1" if such item exists in the second chest but not exists in the first chest. By chests I mean signals.
Capture.PNG
Capture.PNG (447.27 KiB) Viewed 1746 times

Re: Find the intersection of two signals (or chests items)

Posted: Wed Jan 04, 2023 5:26 pm
by Tertius
I didn't have a use case yet for the combinator combinations you posted previously, but this kind of filtering is something I actually use. However, my solution is slightly smaller:
screenshot_899h_01m_26s 1.png
screenshot_899h_01m_26s 1.png (109.68 KiB) Viewed 1741 times


Works with bit operations for positive numbers only, because it uses the sign bit for filtering.
If you're sure the filtering input (right constant combinator) isn't arbitrary numbers but 1 for everything you want as output, you can even shave off the bottom right combinator and directly connect to the next that moves the 1 to the sign bit.

Bonus:
If you reverse the condition in the left combinator, you get the items NOT present in the right and don't need the AND combinator.

Re: Find the intersection of two signals (or chests items)

Posted: Wed Jan 04, 2023 7:47 pm
by mboxdk
Tertius thanks!

Your solution is certainly more elegant, I should think about it, but you should also add additional signal delay combinators to avoid incorrect output with a rapidly changing signal.

I use my blueprints myself, so I see the point in them)) All my blueprints are designed for frequent signal changes.

I'm playing Space Exploration and more complex combinators are needed.

Re: Find the intersection of two signals (or chests items)

Posted: Wed Jan 04, 2023 10:10 pm
by Nidan
Here are the blueprints I have for filtering. The first three I found in a blueprint book somewhere, the last two are my adaptions for the filtering signal being boolean (0/1). All use 5 to 7 combinators and 2 ticks.



Shameless plug with the complete blueprint books where I took these from. My adaptions are in the OP, the other blueprint book is in the (currently) second to last post.