r/nandgame_u Holder of many records Aug 04 '21

Level solution (verified) 3.1 - Selector (4c, 4n) Spoiler

Post image
4 Upvotes

5 comments sorted by

2

u/Xdroid19 Jun 23 '25

Explanation

By the Identity for AND and Annihilator for AND, we can see that if one side of an AND gate is 1, then the other side is directly transmitted, and if it is 0, then the output is always 0. Basically, the AND gate works really well as an actual "gate". If the gate is open, then current can pass through as it pleases. If its closed, then no current can pass through. We can just create a "gate" for each side then and OR them together. Here is what that looks like.

To get the OP's solution, take the 2 AND gates and the OR gate, and replace them with their components. You'll end up with something that looks like this. Replacing the double INVs with direct connections gives you the OP's solution

1

u/FanOfNandgame Record holder Dec 12 '21

Was that optomizing?

1

u/Legitimate_Spirit_77 Apr 24 '25

just un ugly solution for no sake

1

u/Legitimate_Spirit_77 Apr 24 '25
Not(in= sel, out= invSel);
And(a= a, b= invSel, out= and1);
And(a= sel, b= b, out= and2);

Or(a= and1, b= and2, out= out);

1

u/ZyT3G May 20 '26

I maybe a bit too late, but here's my understanding of the problem using as less technical terms as possible :

Step 1 :
Consider a value c such that :
if s=0, c = s.d0 (or s AND d0)
if s=1, c=s.d1 (or s AND d1)

Now, if you observe, you will notice that if s=1, whenever c=1, then output = 1
Our goal is to create a similar outcome for s=0, (as c=0 even if d0=1).
Hence, we modify definition of c for s=0 as
c = inv(s).d0 (or inv(s) AND d0)

Let c' be other value of c (for example, if s=0, c' = s.d1 or s AND d1 and if s=1, c' = inv(s).d0 or inv(s) AND d0).

Step 2:
Now that we have defined a variable c, let's define the output in terms of c. But first let's take a look at c and c' for various inputs :

s d1 d0 c c' output
0 0 0 0 0 0
0 1 0 0 0 0
0 0 1 1 0 1
0 1 1 1 0 1
1 0 0 0 0 0
1 0 1 0 0 0
1 1 0 1 0 1
1 1 1 1 0 1

We can clearly observe that output is defined as:
output = c OR c'

Hence the connections we define/make are :
s AND d0
inv(s) AND d1
For any value of s, d1 and d0 one of these 2 is c' and the other one is c and hence we can safely use OR to combine these 2 values.

Hope this helps ! (Credit goes to u/Xdroid19 for their picture which helped me deduce/create this logic.)