How To: Make a 4 Input XOR-Gate in Minecraft

Make a 4 Input XOR-Gate in Minecraft

How to Make a 4 Input XOR-Gate in Minecraft

The most complicated logic-gate to build in Minecraft is the XOR-gate. (Well, actually it is the XNOR but it is just a XOR with a NOT at the end.)
On a XOR-gate any of the inputs (usually two) can be high but only one at a time. So far I haven't seen good XOR-gates with more than 2 inputs, you can do a 4-input one by connecting two XOR-gates to a third one, but it gets quite large.

But today I thought that maybe you do it in a better way by using the goldilocks-gate I came up with. And I guess most of you who are reading this are thinking "What? How?"

Let me explain. The goldilocks-gate only lets a signal through if it is 15 blocks away from the source, too far away and the signal is to weak, too close and the signal is too strong.

But if the signal is just right it will reach the lower repeater, which will in turn let the upper torch on, while the power isn't too strong and won't reach the upper repeater that would quench the torch. (Please notice the 2-tick delay on the upper repeater, otherwise it wil get out of sync with the lower part and the upper torch will give a short pulse when the signal is too strong.)

Ok, that maybe didn't make things clearer and I guess you are still thinking: "What? How?" Well, this is the tricky part.

Here is an example, the power would need too travel 2 blocks longer on the wood blocks what it would have to do on the dirt since there is a lapiz block blocking the shortest path. And now some of you are thinking "Oooh, yeah, that is clever." but for the rest of you, here is what I made.

I simply placed 4 of these in a row, put power in one end and placed a goldilocks-gate on the other end in such a way that as long as exactly one of the holes was cut off, by a piston, the sum of the path would be 15 blocks, just right for Goldilocks. :)

This looks a bit confusing but I'm using a feature of glowstone, power can not run down the edge of them. (Up is ok, just not down.) I did this to be able to squeeze in 4 inputs before I would run out of power.

Anyway, better show this step by step.

Step 1:

First build one of these.

Step 2:

And then add a sticky-piston that will push a block to make the path longer. You do not need to build it this way, the piston can just as well block the path from above, whatever fits you build best.

Step 3:

Copy it four times.

Step 4:

Break the first two blocks and power it like this. It looks a bit weird but I found it to be the easiest way to do it.

Step 5:

Add the goldilocks-gate on the other side.

Step 6:

Add some inputs, an output and you are done. :)

6 Comments

I made a v2.0 at /warp rsplayground that doesn't use any glowstone if anyone is interested. :)

you're awesome :O

So, wait, what does this actually do?

I'm also curious on that. Is it a gate or what? 'cause it doesn't look like a gate.

It is a logic-gate, not the kind of gate you walk through. And maybe the best way to explain what the difference between an OR-gate and an XOR-gate is that XOR is more like the kind of common sense humans have. If you ask for "A coffee or tea, please" in a boolean-OR way you might as well get a mix of the two, since it is still true that what you got is coffee or tea. While XOR is exclusive-or, meaning that you ask for either coffee OR tea, not both.

This can be used, for example, when building a vending-machine and want to be sure the player has choosen exactly one item.

So what you're saying is that this is a four-input XOR gate that lets you select exactly one input, but not more? That's awesome! Great job, Yownas. =)

And Snono, if you're fuzzy on logic gates, you can check out this earlier post on them, which should explain it a little better. =)

Share Your Thoughts

  • Hot
  • Latest