[Community Puzzle] Logic gates

Coding Games and Programming Challenges to Code Better

Send your feedback or ask for help here!

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”?

3 Likes

That’s because x XOR y is just a fancy way to say x != y :slight_smile:

6 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

1 Like

For example:

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

Thanks. :slightly_smiling_face:
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 :joy: 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.

4 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.

2 Likes

I think NXOR is simply the opposite of XOR … like NAND and NOR

4 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.

1 Like

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 :crazy_face:

6 Likes