Just getting around to exploring what's possible with combinators in .13, and the *each* special signal is pretty awesome. It's allowing me to do all sorts of fun things by sending a whole bunch of signals at once and do operations on them - useful for sending inventory requests, for example.
One thing I'd like to do that I haven't figured out is do a pairwise multiply without just using a combinator per signal. Is this possible?
e.g. if I have one network that has these signals "red 1 green 3 blue 12" and another that looks like "red 2 green 2 blue 3" I'd like to be able to use a constant number of combinators (so, doesn't scale up with the number of signals) and get "red 2 green 6 blue 36".
Is this possible?
Can you pairwise multiply using combinators?
-
- Filter Inserter
- Posts: 814
- Joined: Fri Apr 29, 2016 5:27 pm
- Contact:
Re: Can you pairwise multiply using combinators?
Wouldn't an arithmetic combinator with output set to Each*Each do it? I mean, as long as one of the inputs is the red wire, the other green, I would expect it to do that.ribsngibs wrote:Just getting around to exploring what's possible with combinators in .13, and the *each* special signal is pretty awesome. It's allowing me to do all sorts of fun things by sending a whole bunch of signals at once and do operations on them - useful for sending inventory requests, for example.
One thing I'd like to do that I haven't figured out is do a pairwise multiply without just using a combinator per signal. Is this possible?
e.g. if I have one network that has these signals "red 1 green 3 blue 12" and another that looks like "red 2 green 2 blue 3" I'd like to be able to use a constant number of combinators (so, doesn't scale up with the number of signals) and get "red 2 green 6 blue 36".
Is this possible?
Re: Can you pairwise multiply using combinators?
no, anything getting a signal from the CN just adds the values of each network together.Frightning wrote:Wouldn't an arithmetic combinator with output set to Each*Each do it? I mean, as long as one of the inputs is the red wire, the other green, I would expect it to do that.ribsngibs wrote:Just getting around to exploring what's possible with combinators in .13, and the *each* special signal is pretty awesome. It's allowing me to do all sorts of fun things by sending a whole bunch of signals at once and do operations on them - useful for sending inventory requests, for example.
One thing I'd like to do that I haven't figured out is do a pairwise multiply without just using a combinator per signal. Is this possible?
e.g. if I have one network that has these signals "red 1 green 3 blue 12" and another that looks like "red 2 green 2 blue 3" I'd like to be able to use a constant number of combinators (so, doesn't scale up with the number of signals) and get "red 2 green 6 blue 36".
Is this possible?
also, an arithmatic combinator can't use Each for the second input
no yes yes no yes no yes yes
Re: Can you pairwise multiply using combinators?
As far as I have read the doku you could make a mod that can perform operations like green wire times red wire since there are methods in place to read the wire signals separate from each other. But I have not found a method to write the result back to the output side.
XKnight posted a vanilla method here but it is complicated since it involves splitting the signals, performing the operation one signal at a time and buffering the individual signals to get a complete result.
XKnight posted a vanilla method here but it is complicated since it involves splitting the signals, performing the operation one signal at a time and buffering the individual signals to get a complete result.
Re: Can you pairwise multiply using combinators?
Thanks for the link to that discussion - there are some combinator masters out there for sure - pretty impressive stuff.