Turing Complete

Turing Complete

View Stats:
ThemePark Oct 29, 2021 @ 12:55pm
In trouble with "Double Trouble"
I'm throwing my hands in the air like I just don't care, and admitting defeat on Double Trouble. Sure, I managed to find a crazy solution to it, but when I then found out I'd be needing to reuse that solution in Counting Signals, I knew I had to find a more viable solution.

Thing is, I can't. Maybe I'm overthinking it? I don't see how I'm supposed to think otherwise. I mean, it seems logical to me that you're somehow supposed to make a circuit that counts if there's just zero or one on signals, and then Not that. But how is beyond me. My current solution uses 6 AND gates and some other gates, and it's not pretty.

Someone, please help me unclog my brain and get it on the right train of thought.
< >
Showing 1-7 of 7 comments
wbradley Oct 29, 2021 @ 1:23pm 
There are four inputs. Let's call them x0, x1, x2, x3.

For two of more of them to be high, there must be some pair where both are high. So you need an AND gate for every pair: and(x0,x1), and(x0,x2), and(x0,x3), and(x1,x2), and (x1,x3), and(x2,x3)

So if two or more inputs are high, at least one of those and() gates will have a high output. So just OR all of those outputs together (nest a bunch of OR gates if you need to), and that should be that.
ThemePark Oct 29, 2021 @ 1:25pm 
That is the exact solution I came up with. But that uses so many gates, that it seems there must be a simpler, more elegant solution, and that's what the comment about overthinking it refers to. Is there not?
wbradley Oct 29, 2021 @ 1:31pm 
Nope, not really. You can do some fancy wired-OR tricks to save some gates, but you can't always get away with stuff like that.

However, you don't really need to *reuse* your solution here, because Double Trouble wants "at least two inputs" and Counting Gates will want (among other things) "two or three inputs, but not four"...
erikvictory Oct 29, 2021 @ 2:37pm 
If you really want to optimize things or be clever, you could do a few things. I had the impression that it was modeling itself after a very common thing, which is basically just using a few AND and OR gates to construct a pre-defined truth table. That's what the solution should be, I presume.
If you'd rather not throw around a few logic gates to make things easier, you're liable to lose your mind when you get to the stage "Logic Engine". Maybe.
Last edited by erikvictory; Oct 29, 2021 @ 2:46pm
Arnavion Oct 30, 2021 @ 10:55pm 
Originally posted by ThemePark:
That is the exact solution I came up with. But that uses so many gates, that it seems there must be a simpler, more elegant solution, and that's what the comment about overthinking it refers to. Is there not?

Even if you stick to using AND and OR gates, you can do much better than 6 AND gates that then feed into OR gates.

Eg: AB + AC + AD on the surface looks like it requires three AND gates and one three-input OR gate, but can be rewritten as A(B + C + D) which now requires one AND gate and one three-input OR gate.
GT May 26, 2022 @ 3:12am 
Originally posted by Arnavion:
Originally posted by ThemePark:
That is the exact solution I came up with. But that uses so many gates, that it seems there must be a simpler, more elegant solution, and that's what the comment about overthinking it refers to. Is there not?

Even if you stick to using AND and OR gates, you can do much better than 6 AND gates that then feed into OR gates.

Eg: AB + AC + AD on the surface looks like it requires three AND gates and one three-input OR gate, but can be rewritten as A(B + C + D) which now requires one AND gate and one three-input OR gate.
Tried "one AND gate and three input OR gate", does not work. Can you prove that it works?
SunCat May 26, 2022 @ 12:39pm 
Originally posted by Reaper dude:
Tried "one AND gate and three input OR gate", does not work. Can you prove that it works?
you can't solve double trouble just with a circuit that equals AB+AC+AD; you need to wire a circuit that is equivalent to AB+AC+AD+BC+BD+CD. But "one AND gate and three input OR gate" can be part of that circuit, as it implements part of the equation.
< >
Showing 1-7 of 7 comments
Per page: 1530 50

Date Posted: Oct 29, 2021 @ 12:55pm
Posts: 7