Page 1 of 1

[0.13.3] logic combinator

Posted: Mon Jul 04, 2016 1:49 am
by Shaymes
Logic Combinator like the aretmetic combinator just for NOT OR NAND NOR AND XOR
we have a green color left for a logicnetwork device :D

Image

Re: [0.13.3] logic combinator

Posted: Mon Jul 04, 2016 8:30 am
by ssilk
Could you make me a logic table? Like so:
Image

Especially: What is Iron XOR Copper ? What is NOT copper plates? Etc. Input-signals and output signals.

Re: [0.13.3] logic combinator

Posted: Mon Jul 04, 2016 8:47 am
by Shaymes
its just like all device if the input is TRUE do the output; if the input is FALSE then do not

A = is there a Copper signal yes/no B = is there an Iron signal yes/no
Y = Give output signal yes/no

XOR
A B Y = A ⊻ B
0 0 0
0 1 1
1 0 1
1 1 0

its hard to translate what i want to say, so the logic combinator dont work with exact ammout of a signal it just check A = 0 or A > 0 then B = 0 or B > 0 then we can do all logic gates AND NAND XOR OR
the oput is free to define for my screeny its a red signal so for the XOR example: i have burner inserter in my chest FALSE; i have yellow inserter in my chest = TURE

FALSE XOR TURE = TRUE,

so do the output; the icon i choosed as 1, es example Y = 1

for a more complex circuit i can add 2 devicer infront the logic gate so that i get a signal if the yellow iserter > 10 and the 2nd deciver burner inserter > 5 with the output of the logic gate
i can control a inserters to produce burner inserters / yellow inserters; the value of a signal doesnt matters, just is one there or not; i hope you can follow me
-------------------------

ok for a NOT gate i can easy use the deciver combinator A = 0; Y = 1

Re: [0.13.3] logic combinator

Posted: Mon Jul 04, 2016 9:56 am
by Neotix
There is no boolean signals in Factorio. All signals are integer. How you want to solve logic based on integers? 619 Iron plate XOR 937645 Copper plate = ?

We can build logic gates witch arithmetic/decider combinators because we can determine which value is 1 and which is 0.

Re: [0.13.3] logic combinator

Posted: Mon Jul 04, 2016 10:08 am
by Zeblote
Neotix wrote:There is no boolean signals in Factorio. All signals are integer. How you want to solve logic based on integers? 619 Iron plate XOR 937645 Copper plate = ?
937158 of whatever output signal you set. All boolean operations can be represented by binary operators on integers so there's no problem. To make the whole thing useful, use it with signals that are 0 or 1...

Re: [0.13.3] logic combinator

Posted: Mon Jul 04, 2016 10:14 am
by Shaymes
there is no need of the exact integer for the logic combinator there is a signal so copperplates = 3123 is simple a TRUE and iron = 0 is simple a FLASE
there is no need to get a boolean from a deciver combinator

Re: [0.13.3] logic combinator

Posted: Mon Jul 04, 2016 10:56 am
by Neotix
@Zeblote binary calculations are not intuitive for normal player. Most of the people don't even know how to convert integer into binary and vice versa. Then how useful would be that logic combinator? Besides when we want to use 0;1 signals, we already can build that logic.

@Shaymes if i understand it correctly, you want to use any signal that id > 0 as TRUE and any signal = 0 as FALSE? Or you want to you just want to ser pair of conditions and set logic between them?

Re: [0.13.3] logic combinator

Posted: Mon Jul 04, 2016 11:28 am
by ssilk
I don't know the others, but for me it's now quite clear what Shaymes meant.

But I don't know, if that should be called "logic combinator", cause from the functionality it is a "router":

Route Signal X if Signal Y present XOR Signal Z present (where Y could be the same signal as X for example). That can make much sense.

Re: [0.13.3] logic combinator

Posted: Mon Jul 04, 2016 12:04 pm
by terror_gnom
hmmm... If you go this way, you should do a bitwise xor on the Integer :P I Think I could make use of it, but 99% of Factorio-Players will post a Bug report :P

Re: [0.13.3] logic combinator

Posted: Mon Jul 04, 2016 1:34 pm
by ssilk
Bitwise XOR is nonsense. :)

Well, lets say we call this thing a router. Then it would also look quite different - and has of course a quite different interface (completely different to shown above). I won't go deeper here, cause it looks like overtaking a suggestion. ;)

Re: [0.13.3] logic combinator

Posted: Mon Jul 04, 2016 3:07 pm
by Shiandow
I don't think this would really add any new behaviour, most of these can be replicated using the arithmetic combinator if you consider all positive values TRUE and 0 FALSE (and negative values neither).

Then you'd get:

NOT A = (A == 0)
A AND B = A * B
A OR B = A + B
A XOR B = NOT (A == B)
A NAND B = NOT (A AND B)
A NOR B = NOT (A OR B)

For XOR, NAND and NOR you do need two combinators but I don't really see a realistic scenario where you'd need to use those.

Edit: XOR is somewhat more difficult.

Re: [0.13.3] logic combinator

Posted: Mon Jul 04, 2016 3:57 pm
by stellatedHex
Hmm, I don't think your XOR works. If positive numbers are all TRUE, then 2 XOR 3 should be 0. You probably would need 4 combinators to do XOR (3 if A and B use the same signal). I think a superior schema would be to use 0 and 1, all using the same channel, where signals that don't conform are divided by themselves before being circuitified. Then A XOR B could be done as (A+B)*(2^-31)/(2^-31), or NOT (A==B) both of which require only 2 combinators.

Re: [0.13.3] logic combinator

Posted: Mon Jul 04, 2016 4:30 pm
by terror_gnom
Bitwise XOR is at least more usefull than integer xor :P But even if I like it, because I do some bitshifting in my combinator builds, I dont think it will be implemented and its definitive unintuitive :lol:

Re: [0.13.3] logic combinator

Posted: Mon Jul 04, 2016 4:48 pm
by Shiandow
stellatedHex wrote:Hmm, I don't think your XOR works. If positive numbers are all TRUE, then 2 XOR 3 should be 0. You probably would need 4 combinators to do XOR (3 if A and B use the same signal). I think a superior schema would be to use 0 and 1, all using the same channel, where signals that don't conform are divided by themselves before being circuitified. Then A XOR B could be done as (A+B)*(2^-31)/(2^-31), or NOT (A==B) both of which require only 2 combinators.
Yeah you're right, however if you only want to use 1 and 0 then you could also just do the following:

NOT A = (A == 0)
A AND B = A * B
A OR B = (A + B) > 0
A XOR B = NOT (A == B)
A NAND B = NOT (A AND B)
A NOR B = NOT (A OR B)

Since OR is the only operation that returns values other than 1. I suppose a "max" operator would have made it easier, then you could just use A OR B = max(A,B).

Re: [0.13.3] logic combinator

Posted: Mon May 15, 2017 6:05 am
by Shaymes
added 0.15 with logic network thread can be closed