# [Community Puzzle] Logic gates

Coding Games and Programming Challenges to Code Better

Created by @b0n5a1,validated by @Zorg1,@Remi and @Westicles.
If you have any issues, feel free to ping them.

2 Likes

first! nice puzzle, so NXOR is just a fancy way of saying âa == bâ?

2 Likes

Thatâs because x XOR y is just a fancy way to say x != y

4 Likes

Cool little puzzle.

I used a HashMap an ArrayList and switchcase !

Nice and easy. I am way rusty so it took me some time to brainstorm my idea out but now that I got it, it shouldnât take long for someone who is experienced.

How else would this be implemented?

How do we handle clock? I am stuck on doing the and AND, when the input is AND CLK IN1.

Whatever the input name, the signal form is provided.

3 Likes

Nice challenge for begginer like me.
But my problem is to get the input datas (coding with Java)
At the end of each âforâ loops, the variables are overwritten (eg, inputSignal).
So, before solving all the cases, I donât know how to âstoreâ the input dataâs.
(or maybe I donât have the good vision of the context)
Stephane

For example:

``````data=[]
for _ in range(n):
data.append(input())
``````

Thanks.
I forgot to say I use Java.

It might be the same.

ummm iâm really stuck on this puzzle and itâs breaking my brain Are âAâ, âBâ, âCâ etc letters in the output represent AND, OR, XOR etc? Then how do you get the following output of 'C _- âŚ - â etc?
When i tried to test it by printing n and m, it prints numbers from 0 to 2 and i am confused.

No, A, B and C are inputs.

I donât know if youâve solved it already, but here are some insights, in case you didnât:

1. n is the number of input signals, so in the first for loop, you will be reading n input signals, in which the input signal has a name, which is the first non-space separated string, then itâs followed by the form of its signal.
2. m is the number of output signals, which youâll be reading them in the 2nd for loop. Each line will be composed of: âOutputName GateToApply FirstInputSignal SecondInputSignalâ; here, OutputName is the name of the resulting form of the signal after applying the gate to FirstInputSignal and SecondInputSignal, the GateToApply is the logic gate, FirstInputSignal is the form of the signal, represented by its name, so if you have an âAâ signal, that means, you need the form of the signal called âAâ and the same happens with SecondInputSignal. For example, âC AND A Bâ, C is OutputName, AND is GateToApply, A is FirstInputSignal, and B is SecondInputSignal.

Hope this helps.

2 Likes

i solved it, thank you <3 This will definitely be helful for the people who will be completing this puzzle in the future

Since when is NXOR a logic gate type? Shouldnât that be XNOR?

And is there any particular point in using _ and - for the inputs and outputs rather than the somewhat more logical 0 and 1?

Other than that, pretty cool puzzle.

I think NXOR is simply the opposite of XOR âŚ like NAND and NOR

5 Likes

And NXOR is equality.

I know what they mean, but that gate type is called XNOR, not NXOR.

Both versions appear on https://en.wikipedia.org/wiki/XNOR_gate.

Next time b0n5a1 you will call your gates âtotoâ, âtataâ âŚ or âfooâ, âbarâ for the english speaking people ^^
Since it is in the statement, it should not be a problem

7 Likes