Building circuits in Minecraft
Before looking at logic gates, it’s important to first understand how you can create circuits and transmit binary signals in Minecraft. In the real world, circuits are created by using wires to conduct electricity, and the presence of an electrical voltage (meaning there is electricity flowing through the circuit) indicates that the output is 1, or on. In Minecraft, circuits are created using ‘redstone dust’, a material used to conduct power (see Figure 1), and as in the real world, electricity flowing through the circuit indicates that the output is 1, or on. Input devices in Minecraft (for example, buttons, switches, and pressure plates) generate power that can be transferred to output devices (for example, lamps, doors, and dispensers). For instance, connect a switch to a lamp block using redstone dust and turn the switch on; power is conducted through the redstone dust and the lamp turns on (Figure 1).
In addition to redstone dust and input and output devices, there are also components for making more sophisticated circuits, such as redstone torches, repeaters, and comparators. Redstone torches are essential for creating logic gates, as they are not only a source of power, similar to a battery, but they can also invert a signal (for example, if the power is on, the torch will be off, and vice versa). This ability to act like a switch allows you to use redstone torches in similar ways to transistors, the basis of all logic circuits.
Constructing logic circuits
By connecting redstone dust and redstone torches together in the right configuration, you can create logic gates. The simplest logic gate is a NOT gate whose output is the opposite of the input (for example, if the input is on, the output is off). This can be produced using a redstone torch to invert the input (Figure 2).
A practical example of the use of a NOT gate is to create a night light. You can do this by connecting a daylight detector (which is powered when the sun is up) to a lamp via a NOT gate (Figure 3 above). At night, the daylight detector will be off; the NOT gate will invert this signal and turn the lamp on.
You can also create OR, AND, and XOR gates using redstone torches, dust, and blocks (Figure 4):
An OR gate is simply the connection between two inputs. When either or both inputs are on, the output is also on.
An AND gate’s output is on when both inputs are on. To create an AND gate, you need to use two redstone torches to invert the input connected to a third redstone torch, which will output on when both inputs are also on.
An XOR (exclusive OR) gate’s output is on when either input is on, but off when both inputs are on. The layout of the XOR gate with redstone is more complicated, needing seven redstone torches connected together. This mirrors the complexity of constructing an XOR from NOT, OR, and AND gates.
Investigating how these gates work, and seeing the interaction between the input switches and the lamp, can help learners develop an understanding of each gate’s operation and act as an engaging introduction to truth tables.
Connecting the Minecraft world
Using these logic gates and different input and output devices in Minecraft, you can create realistic devices, for example, a door that can only be opened by two players at the same time by using two buttons connected to a door via an AND gate (Figure 5). This is also an excellent opportunity to introduce logic circuit diagrams, connecting the abstract to the concrete (see the diagram in the top left of Figure 5).
Multiple logic gates and circuits can also be linked together to create more complex devices. Take some time to look through the different input and output blocks and components in Minecraft, and let your imagination guide what you create. You may also find it useful to create a logic circuit diagram before embarking on your build.
While writing this article, I experimented myself, and created an alarm that beeps when one of my sheep in the Minecraft world leaves its pen. The alarm is automatically activated at night, but also has a switch so I can also turn it on manually during the day (Figure 6).
Minecraft and its redstone give you the opportunity to play and experiment with logic gates and circuits, without being constrained by the physicality of creating actual electrical circuits. I hope you have as much fun as I did!
A redstone computer
Fully functional computers have been created using redstone in Minecraft by building on top of logic circuits like those introduced in this article.
There are some very impressive builds, including this quad-core computer with user interfaces and displays (helloworld.cc/minecraftcomputer).