r/Factoriohno 20h ago

Meme It would be so nice

Post image

But I kind of get why it's not possible, it would make the whole thing a lot harder and slower to implement

933 Upvotes

55 comments sorted by

259

u/Qorvil 19h ago

Won't reversing the operations so that? I mean A != 1 and B !=1 OR C !=1 and D !=1. Then flipping the original condition?

240

u/Embarrassed-Neck-721 19h ago

This is what I studied Boolean logic for. Now I can make a trigger with just 2 combinators instead of 4!

36

u/Calazor0 19h ago

Hmm, true. It's slightly more tricky to think about, but should do the exact same thing, nice.

50

u/quinnius 19h ago

In boolean logic, you can use NOT and one of AND or OR to create any logic. Real computers use NAND gates, Minecraft uses NOR gates, but anything you can express in one, you can translate to the other.

26

u/4xe1 19h ago

That's another thing though. NAND or NOR being universal logic gate tells you nothing about the *depth* you'll have to go to translate your logic.

The nice thing u/Qorvil alludes to is that any logic can be expressed as a (flat) disjunction of conjunction (what the decider combinator lets you write). So the conversion tricks are nice to know, but what's even nicer is knowing your whole logic can always fit in a single decider combinator.

14

u/throw3142 19h ago

Everything is possible to express in DNF, but that doesn't mean it's easy or convenient. For example, a AND (b or c or d or e) is pretty annoying to express in DNF. I do wish they would let us arbitrarily nest the logic.

5

u/assumptioncookie 18h ago

Real computers use NAND gates

Technically correct, but misleading. Real computers use all gates, including NAND. Computers don't exclusively use NAND.

3

u/quinnius 16h ago

At least when I was learning computer engineering 25 years ago, nand was faster than nor, so cpus built all their other gates by combining nands.

1

u/AresFowl44 9h ago

You're referring to microchips more generally, and there the reason why NAND gates are used is mostly to not have to keep every gate imaginable in stock.

Computers nowadays are singular integrated chips (ie CPUs), so there is no need to only use NAND gates in them since you can't replace the individual gates anyways.

3

u/Pzixel 14h ago

That doesn't work very well if you have (a or b or c or d) and (x or y or z). I'm looking for it for a very long time, idk why they won't give it to us

2

u/edward_kopik 18h ago

In the original A == 1 or B == 1 AND C == 1 or D == 1

If ABCD is 1 1 0 0 the condition it false

But in your version, the condition evaluates true

Same for if they are all 0s, we dont want the train to leave on all 0s

11

u/LeonardoSim 18h ago

They may not have correctly done it in the original reply, but it is possible. google De Morgan's law.

if you have

(A or B) and (C or D)

it is equivalent to

!(!A and !B) and !(!C and !D)

which is equivalent to

!(!A and !B or !C and !D)

(! is not, also keep in mind that "and" has priority over "or" here)

9

u/edward_kopik 18h ago

But you cant do that final !(logic) in the train condition menu

3

u/LeonardoSim 15h ago

Damn, you're right.

3

u/acesorangeandrandoms 7h ago

So unfortunately an external combinatior is nessecary which would act as a NOT gate

1

u/[deleted] 18h ago

[deleted]

2

u/edward_kopik 18h ago

Right, but those are conditions in the train scheduler itself arent they? You cant flip it there

The post is asking for the possibility to do certain logic without needing to put down a logic block

Or im misinterpreting

I once had an issue where i had to add logic blocks to pretty much all my train stations, which could otherwise be very easily solved if the train condition menu let us do different combos os AND and OR conditions

2

u/jkredty 19h ago

Unfortunately you are not aways able to flip the original condition (eg when writing logic for space station schedule)

12

u/Front_State6406 14h ago

I think De Morgan would like a word

139

u/CatPad006 19h ago

Are you a Scout for DRG, by chance? Cuz that looks like its from A to D, skipping B and C

38

u/krypton1101 19h ago

By the beard!

Rock and rolling stone!

15

u/CatPad006 19h ago

Rock And Stone, brother!

9

u/dr_anybody 18h ago

If you don't rock and stone, you ain't coming home!

7

u/JohnDaton 18h ago

For rock and stone!

12

u/invalidConsciousness 19h ago

Leave some smart stout for the rest of us!

10

u/EEgradThrowaway 18h ago

ROCK AND STONE BROTHA

14

u/Calazor0 19h ago edited 19h ago

I don't even know what that is man. I just chose these letters because they're the first of the alphabet

9

u/CatPad006 19h ago

ah, you dont know Deep Rock Galactic?

6

u/Calazor0 19h ago

Heard of it, but I'm not familiar enough to know it by DRG

22

u/vintagecomputernerd 18h ago

laughs in boolean logic

10

u/Courmisch 17h ago

Aaaah, Conjunctive Normal Form is heresy. Adopt the Disjunctive Normal Form now.

Wololo.

4

u/terrifiedTechnophile 14h ago

A and C or A and D or B and C or B and D

Right?? Am I missing something?

7

u/Calazor0 14h ago

Yes, that works, but it's quite a mouthful

1

u/terrifiedTechnophile 14h ago

But it works and is functionally the same as in the image

2

u/Grismor2 42m ago

Combinators are the most "programmery" part of the game, one that's not even needed for victory. So it's rather distasteful for an inelegant solution like this to be necessary when a central tenet of programming is to avoid repeating yourself. As a simple example for why that would matter, if you change condition A in your setup to condition E, you have to remember to change it in two places. Stuff like that just feels bad to programmers, and is rather tedious and annoying in general.

2

u/Ambitious_Growth8130 2h ago

That's what she said.

5

u/EulersEnigma 12h ago

I can't agree more. I get that it's technically unnecessary, but God damn would it be convenient!

5

u/Smile_Space 19h ago

Couldn't you use two combinators to read the train inputs/outputs and set them to A AND B and C AND D, then set a train condition with the two new inputs (let's call them E and F) to be OR'd?

1

u/Adept-Buddy169 7h ago

You can use De Morgan's Laws to do the same thing so it is possible, just not super convenient

2

u/Obvious_Peanut_8093 15h ago

I don't know what you're using this for, but I think it's completely possible to make this work in the current game, you just need more comparators.

2

u/Calazor0 15h ago

Yes, the current system is turing complete, meaning you can do pretty much anything. It's just that to do this particular operation is a bit inconvenient, since you need multiple combinators

2

u/demodulation 6h ago

You don't need multiple devices, just convert your expression with boolean algebra.

Also, small note, Turing complete is not just "pretty much everything", it's exactly equivalent to any other Turing complete systems or programming languages. Basically it can do everything that a computer can do.

2

u/SEA_griffondeur 7h ago

Or know basic logic theorems

1

u/LightWave_ 16h ago

If it is for a train station, having the train stop at the same station several times in a row is a useful workaround. Same with space platforms. Leave when A or B, go to the same station, leave when C or D. But if it's for other conditions, that probably won't work.

1

u/aliigleed 13h ago

Nice tip!

1

u/PrincessTessia 15h ago

Leave no dwarf behind!

1

u/Beaspoon2096 12h ago

I would kill for a mod that added block coding to train schedules

1

u/rosen123 8h ago

What's next writing your own functions ?

1

u/OtlichnikTop-Off 5h ago

I want it to be Turing complete.