An Introduction to Logic Using Minecraft

           In this article we will be covering one of the most important concepts in Circuitry: Logic “Gates”. Although at first these may seem tricky, with a little bit of practice you will easily have the hang of it. In fact, chances are you already understand how each of these works, even if you don’t know it.

        Today we will be covering the 7 most important logic gates: NOT, AND, NAND, OR, NOR, XOR, XNOR.  These gates are what allow electronic devices to do very complex tasks. Although the individual gates are simple, when used together, these gates can perform difficult tasks. We will go further into detail about this later on, but first we need to understand what a logic gate is.

         In a Circuit, electrical current is manipulated in different ways in order to do different things.  Electricity in a circuit has two states: On and Off. If you have ever heard of “Binary,” that is exactly what this is: One’s represent On, and Zeros represent Off.

Chances are you have a device that has a switch that looks like this:

 

 

This is a great example of binary. The 1 on the switch turns the device On, the 0 turns the device Off.

Logic gates typically have two inputs. These inputs can be one of two things, On or Off (1 or 0). The output is also binary, ON or OFF. Our Minecraft examples will have two switches to represent these inputs.

In Minecraft

For our Minecraft map, the lamp represents the output of the circuit. If the lamp is OFF, the output is 0, if the lamp is ON, the output is 1. 

I have uploaded a Minecraft map I have made with examples of each circuit, which you can download here.

To install the map, take a look at this page on the Minecraft Wiki: http://minecraft.gamepedia.com/Tutorials/Map_downloads.

On our Minecraft map, there is an example of each logic gate with two switches in front of each.

Here, the switch is in the Off position.

The switch is giving an input of Zero to the circuit

 

 

 

 

Here the switch is in the On position.

The switch provides an input of One to the circuit.

 

 

 

 

Each circuit has two input levers. With different inputs, we see different results.

The redstone configuration is not important. Just focus on what combinations of inputs makes each lamp turn on and off.

In this next section, we will go over each different gate and how they work.

The Logic Gates

The first logical gate is very simple, the NOT gate.

The NOT gate simply does the opposite of your input.

If you turn the switch On, the Output becomes Off - thus the lamp is turned Off.

This will come up in the later logic gates NAND, NOR, and XNOR

The first gate with two inputs is the OR gate.

If the first switch is On OR the second switch is On, the lamp turns On.

Here, the first switch is On, so the lamp turns On, even though the second switch is Off.

Here, the first switch is On, so the lamp turns On, even though the second switch is Off.

The next gate is just as simple, the AND gate.

The AND gate gives an output of On (1) if the first switch AND the second switch are both On.

The next gate is the NOR gate.

The output from the gate is 0 (Off)

The output from the gate is 0 (Off)

This gate is basically the same as the OR gate, but reversed.

Just like the NOT gate above, the NOR gate outputs On when both switches are Off.

The lamp is On if the first switch NOR the second switch is Off.  

If either switch is turned On, the output becomes Off.

The next gate is similar to the NOR gate. The NAND gate.

Just like the NOR gate, the NAND gate reverses the input.

The lamp is On by default.

If both the left AND right switches are On, then the lamp turns Off.

 

 

 

 

 

 

 

 

The next gate is the trickiest of them all, but with a bit of tinkering it becomes easy.

The XOR gate

The output of the XOR gate is ON when one switch is ON and the other switch is OFF.

If both switches are the same, On or Off, then the output is Off.

 

 

 

 

 

 

Finally, the last example is the XNOR gate.

The XNOR gate is the opposite of the XOR gate. This means that when both switches have the same value, the output is ON.

If the switches differ, then the output is OFF.

If the switches are the same, then the output is ON.

Mess around with each gate until you think you have a clear understanding of different inputs affect the output.

 

 

 

 

An Example of Combining Gates: A Half-adder

Half-Adders

A half adder is used in circuitry to add two binary digits. Individually this may not seem like a very grand task, but consider that a single circuit could have tons of these, all coming together to do much more complex tasks.

A half adder adds binary numbers through the use of only two of our logic gates: The XOR and the AND gates.

For the half adder, the AND gate is incorporated into the XOR gate. Two binary inputs are provided, which will be added, then our result will be the sum of these (in binary).

The actual configuration of the gates goes a little beyond the scope of this article.

The main point is to understand that logic gates can be used in circuits to do extremely complex tasks.

I have added a simple half adder to the Minecraft map.

The two lamps represent our binary outputs.

When we add 1 and 0 (with the levers), we get an output of 01

When we add 1 and 1, we get an output of 10

This is but one of many examples of how these logic gates can be used in order to do complex tasks. For a grand example, check out this video: https://www.youtube.com/watch?v=BEXtiwXHTfk

Here, this person has used the gates we discussed above to create a long series of circuits that all work together to perform some very impressive tasks.

Hopefully you now have a basic understanding of how basic circuitry works. This information is very useful for comprehending how each device we use every day functions, and the sheer complexity of even the most simple of circuits.