## [Circuit Network] Why is Everything and Anything not working as expected?

Don't know how to use a machine? Looking for efficient setups? Stuck in a mission?
tezktenr
Manual Inserter
Posts: 3
Joined: Fri Apr 30, 2021 1:14 pm
Contact:

### [Circuit Network] Why is Everything and Anything not working as expected?

First Case
I met "unexpected" behaviour when I use the "Everything not equals something" operator as follows:
1.png (312.62 KiB) Viewed 321 times
2.png (595.04 KiB) Viewed 321 times
In the above situation, I think the condition "should" evaluate to False since one of the signals is indeed the Red Signal. However, the decider combinator checks the condition being True and output the specified signal.

Second Case
when I use the "Anything equals something" operator as follows:
1.png (312.62 KiB) Viewed 321 times
3.png (515.32 KiB) Viewed 321 times
In the above situation, why wouldn't the condition be evaluated to True as one signal is Red?

I must be thinking it wrong somewhere. Really appreciate if someone could point out what I misunderstand and explain the inner workings for me? I have searched on the Wiki and the forum, but nothing similar comes up. I also have some programming experience. In my current understanding, "Everything" means AND every single condition while "Anything" means OR every condition. Is that mindset wrong?

Loewchen
Global Moderator
Posts: 6908
Joined: Wed Jan 07, 2015 5:53 pm
Contact:

### Re: [Circuit Network] Why is Everything and Anything not working as expected?

If you compare a virtual signal logic signal against a specific signal it is understood that that signal exists only on the right side, otherwise the solution is always trivial and therefore useless as a tool.

tezktenr
Manual Inserter
Posts: 3
Joined: Fri Apr 30, 2021 1:14 pm
Contact:

### Re: [Circuit Network] Why is Everything and Anything not working as expected?

Could you clarify what this means: "it is understood that that signal exists only on the right side" more specifically? Does that mean I can't compare with a specific signal? I tried comparing with constant (like numbers) and everything works as expected. So, I can't use a specific signal as the right-hand side in the decider combinator?

boskid
Factorio Staff
Posts: 1467
Joined: Thu Dec 14, 2017 6:56 pm
Contact:

### Re: [Circuit Network] Why is Everything and Anything not working as expected?

If you have Everything or Anything on the left and Red on the right, then the Everything/Anything represents all the signals except of that on the right. That means if you have { Red = 1, Blue = 1, Yellow = 2 } and you have a condition Anything==Red it will be true because there is the Blue signal with the same value as Red. It does not check Red==Red because that would be always true and as such useless.

Loewchen
Global Moderator
Posts: 6908
Joined: Wed Jan 07, 2015 5:53 pm
Contact:

### Re: [Circuit Network] Why is Everything and Anything not working as expected?

In other words:
"Everything" != "Red" is actually processed as "Everything except "Red"" != "Red"
so that the red signal is not compared to itself. If this exception would not exist, all comparison with a logic signal on the left and a normal signal (instead of an integer) on the right side had a trivial result.

tezktenr
Manual Inserter
Posts: 3
Joined: Fri Apr 30, 2021 1:14 pm
Contact:

### Re: [Circuit Network] Why is Everything and Anything not working as expected?

Oh! Now I understand why.

So, thinking the signal as {key: value} pair, the operation is to compare against the "value" rather than the "key". That's what I misunderstand. Then, on top of that, the signal on the right hand side is not counted into the result.

Again, thank you very much!! That completely solved my confusion.

synyster31
Burner Inserter
Posts: 7
Joined: Mon Mar 21, 2016 4:24 pm
Contact:

### Re: [Circuit Network] Why is Everything and Anything not working as expected?

tezktenr wrote:
Fri Apr 30, 2021 3:15 pm
...the signal on the right hand side is not counted into the result.
Unless you have the output wired back to the input as is done in some uses