Pls, help to understand combinator logic

Don't know how to use a machine? Looking for efficient setups? Stuck in a mission?
Ducker
Burner Inserter
Burner Inserter
Posts: 6
Joined: Tue Oct 18, 2016 8:42 am
Contact:

Pls, help to understand combinator logic

Post by Ducker »

Hi, i am not english speaker, but love this game too :). Can you help me to fix my problem?
I have to backup my solar power (+ acc) with steam engines. This is common task and very many solution on this forum.
So, there are : 1 acc + decider combinator + arithmetic combinato and power swich. I use red and green wires to connect them.
1 Out acc -- signal A (for example)
2 Decider A < 10 then send 1 to power swich and arithmetc
3 Arithmetic A*(-25) and send to decider
we get simple hysteresis loop. It work fine!

but if i use on arithmetic minus (A - 25) all stop, pls help me understand WHY ?
if A=1, then A*(-25) = A - 25 (well - 26), so on out arithmetic we get same value, what the differense ?
Attachments
22.jpg
22.jpg (527.73 KiB) Viewed 2054 times

User avatar
Deadly-Bagel
Smart Inserter
Smart Inserter
Posts: 1498
Joined: Wed Jul 13, 2016 10:12 am
Contact:

Re: Pls, help to understand combinator logic

Post by Deadly-Bagel »

(A * -25) will ONLY work if there is an input signal. Either you have 1 or 0:

0 * -25 = 0
1 * -25 = -25

However A - 26 will work regardless:

0 - 26 = -26
1 - 26 = -25
Money might be the root of all evil, but ignorance is the heart.

Ducker
Burner Inserter
Burner Inserter
Posts: 6
Joined: Tue Oct 18, 2016 8:42 am
Contact:

Re: Pls, help to understand combinator logic

Post by Ducker »

thanks, i can use it
.. but 1 - this is TRUE , 0 - FALSE. 0 <> FALSE
if (a<10) not true, we have no signal on exit - NOTHING. So, arithmetic get nothing (let's see GUI when mouse pointer over) and don't work. Nothing - 25 still nothing. I am a bit confusing with it. In my logic arithmetic work ONLY if decider out is true.

User avatar
Deadly-Bagel
Smart Inserter
Smart Inserter
Posts: 1498
Joined: Wed Jul 13, 2016 10:12 am
Contact:

Re: Pls, help to understand combinator logic

Post by Deadly-Bagel »

"Nothing" in the circuit network is not the same as Null in programming. When there is nothing for a signal it is treated as if that signal is 0.

So as far as the circuit network is concerned, [nothing] - 25 = -25

This is required behaviour, say you add 10 copper to the signal of a chest, even if that chest is completely empty you still want the +10 copper signal to go through.
Money might be the root of all evil, but ignorance is the heart.

Ducker
Burner Inserter
Burner Inserter
Posts: 6
Joined: Tue Oct 18, 2016 8:42 am
Contact:

Re: Pls, help to understand combinator logic

Post by Ducker »

I did some tests, you are right. Thank you a lot.

Post Reply

Return to “Gameplay Help”