You are on page 1of 24

EXPLORATION

MATHEMATICS HIGHER LEVEL

Title: Exploring the usage of Boolean algebra in Minecraft by creation


of a ripple carry adder.

Exam Session: May 2015


School Name: UWC Mahindra College of India
Name: Aditya Karan
Candidate Number: 000969 0039

Introduction
Video games have been an interest of mine since I was a very young child. I
have grown up playing video games, and have throughout my childhood
played a large number of games across numerous genres which were
intrinsic to my development as an individual. I noticed that over the years,
the assimilation of information and experiences that I later associated with
video games were primarily subtle and hidden.
This changed entirely when I was first introduced Minecraft in 2014.
Minecraft is a sandbox game that hands the power to create to the player. By
manipulating the placement of blocks with various properties in a three
dimensional grid, the player is capable of creating a seemingly infinite
variety of constructions. The game is based around survival in the wilderness
and the player can obtain resources by interfacing with the environment
using certain tools, and manipulating these resources to create relatively
complex structures. The most interesting notion in Minecraft is the idea that
only basic parameters such as the properties of blocks are defined by the
game while the possibility for creation is only otherwise limited by the
creativity of the player and processing power of the system running the
game. The player-base constantly pushes the limits of the game and
promotes innovation while pushing constructions into the game that beyond
their ability to innovate, also impart conceptual understanding through
hands on, practical means.
My interest in computing grew from my attachment to video games but I
had, for the most part, no access to any materials through which I may have
created circuits to understand the basics of computing. My introduction to
Minecraft changed this, as with a little bit of innovation, the game allowed
me to explore circuitry for no additional cost, using only the game itself.
Boolean algebra is the tool I will be using for this exploration. Boolean algebra
is defined as the study of mathematical operations performed on
certain variables (called binary variables) that can have only two values: true
(represented by 1) or false (represented by 0). It provides a set
of rules (called Boolean logic) that are indispensable in digital computercircuit and switching-circuit design. Boolean operation are carried out with
algebraic operators (called Boolean operators), the most basic of which are
NOT, AND, and OR. Named after its inventor, the UK mathematician
and computer pioneer George Boole (1815-65).1

This exploration is an attempt to utilize concepts from Boolean algebra within


the scope of Minecraft to create a device that is capable of carrying out the
addition of two numbers entered as binary inputs. This will be done by
exploring some fundamental aspects of Boolean algebra and using these
concepts to create a ripple carry adder, an instrument capable of adding two
4-bit binary numbers.

Minecraft:
Minecraft is at its core a game about breaking, crafting and placing blocks
with various properties in a three dimensional grid. Each block, for the most
part, may only occupy one spot in the grid, which includes objects in the
game that are not cubes, but are still defined as blocks within the game such
as torches, levers etc. Minecraft has over the years garnered a community of
players that push the limits of what may be possible using objects and
mechanics within the game.
Minecraft contains a certain class of objects within the game, referred to
Redstone and Redstone devices that may be utilized to simulate the flow of
current and create circuits that are analogous to electrical devices that we
may encounter in our everyday life. The following are Redstone related
blocks essential to the construction of the circuits described further in the
exploration:
Redstone: Redstone is an ore that can be mined within the game. It is
analogous to wires in real life, and may be used to carry a current in the
game world by transmitting their powered state to adjacent blocks in the
direction of flow of the current.. Redstone blocks are closely similar to current
conducting wires, except for the fact that they do not need to be part of a
closed and complete circuit to carry current. They can be in two states, a
powered, or an unpowered state, which is dependent on the blocks that they
are adjacent to, and whether they are capable of supplying power to the
wire.
Redstone and Redstone wire in schematics:

Redston
e

Redstone wire

Lever: A lever is a Redstone device that can be used to power adjacent


blocks, and therefore induce a current in adjacent Redstone wire. A lever
simply has an on and off state. In a circuit, an input lever in the on state
passes an input of (1) and a lever in the off state passes an input (0).
Lever in schematics:

Torch: A Redstone torch is a device that may be used to power a circuit. It


ON
OFF
also has the property of being capable of inverting any input when used in
positi
positi
conjunction
with a regular
powerable block.
on
on

Powered and unpowered


Redstone torches placed
on a generic block.

Powered Redstone torch


placed adjacent to a
generic block.

Blocks: There are a large variety of generic blocks in Minecraft with


simulated properties of wood, stone, steel etc. Within the framework of the
game, some blocks may interact in specific ways with Redstone, but for the
purpose of this exploration, all blocks not described above will be considered
to be generic blocks (light gray color in schematics), with a property common
to most blocks in Minecraft. Most blocks in Minecraft may be activated if
placed next to powered Redstone or another device capable of inducing a
current, and will transmit power to all blocks adjacent to them. This property
allows for the creation of the NOT gate, fundamental to most circuit designs
in Minecraft.

Basic operations: The following are basic operations in Boolean algebra,


their respective logic gates (the manner in which the operation is graphically
represented in a circuit) and the logic gates recreated in Minecraft.
There are three fundamental operations in Boolean algebra; each one
defined over the set {1,0} by use of a truth table, with a corresponding logic
gate.
AND
The AND () operator is defined such that, for A B = Y, only if both A and B
are equal to one, Y equals 1. In every other case, Y is 0.
The operator may be expressed as,
A B = 1 if A=B=1. For all other pairs of A and B, A B = Y = 0.
Table 1.0: Truth table for the AND operator.
A

0
0
1
1

0
1
0
1

AB
=Y
0
0
0
1

The AND logic gate, which symbolizes the operator in a circuit diagram is
drawn as follows;

A
B

A
B

The figure is read from left to right. The two lines entering the gate
symbolize the inputs A and B while the line exiting the gate symbolizes the
output, Y.

The AND gate may be created using the following design in Minecraft using
the properties of a Redstone torch. In the following diagram, if either one of
the levers is switched off, either torch T1 or T2 powers Redstone wire R1,
resulting in no output. Therefore, the following gate only gives an output of 1
if both levers are switched on.
T1
R1

T2

OR
The OR () operator is defined such that, for A B = Y, if either A or B equals
1, then Y will equal 1. Only if both A and B are equal 0, will Y equal 0.
Therefore, the operator may be expressed as,
A B = 0 if A=B=0. For all other pairs of A and B, AB = Y = 1.

Table 1.1: Truth table for the OR operator.


A

0
0
1
1

0
1
0
1

AB
=Y
0
1
1
1

The OR logic gate, which symbolizes the operator in a circuit diagram is


drawn as follows;

A
B

A B

The OR gate in Minecraft can be created from the following design. It is


simple as if either or both of the levers are in the ON position, the gate will
output a signal of one, since the Redstone will light up if adjacent blocks are
powered on.

NOT
The final fundamental operator, the NOT () operator, is defined over a
single input, and simply inverts the input value. Therefore if A=1, A = 0
and if A=0 A = 1.
Table 1.2: Truth table for the NOT operator.
A
1
0

A
=Y
0
1

The NOT logic gate, which symbolizes the operator in a circuit diagram is
drawn as follows;

The NOT gate in Minecraft is essentially a Redstone torch connected to block,


due to which, as defined by the mechanics of the game, the torch inverts a
signal passed into the block. Thus any signal A input into the gate will result
in output A.

Complex operators
Using the fundamental operators described above, we can set out to create
more complicated circuit components, i.e. logic gates that are defined as
operators. A vast number of these operators exist, but for the purpose of this
exploration only the XOR operator is essential.
XOR
The XOR () operator, sometimes referred to as EXOR is abbreviated to
Exclusive OR. The XOR operator is defined such that,
for A B = Y,
if A=1 or B=1 and A = B, then Y = 1. For all other pairs of A and B,
Y=0.
Table 1.3: Truth table for the XOR operator.
A

AB

0
0
1
1

0
1
0
1

=Y
0
1
1
0

Most importantly, the XOR operator is not a fundamental operator, it is in


fact a composition of previously described fundamental operators, and can
be described as follows:
A B = (A B) (B A)
Proof of statement
To be capable of proving the above statement, first, a Karnough map will
have to be defined.
A Karnough map is a diagram consisting of a rectangular array of squares,
each representing a different combination of the variables of a Boolean
function.2 it is a manner of organizing a truth table such that relationships
between variables result in easily observable patterns.
The above expression is derived from the Karnough map of the XOR truth
table (Table 1.4), which is the following.

Let the above map represent the function Y.


The Karnough map indicates that there are two possible combinations of the
inputs A and B that return a high value, i.e. 1. This occurs when A=1 and
B=0 or A=0 and B=1.(The cases highlighted in blue)
This means,
When A=1 and B=0, Y=1. Which means when A=1 and B=1, Y=1.
This may be written as (A B) = 1.

Similarly, Y=1 when A=0 and B=1, which means when A=1 and B=1,
Y=1. This may be written as (A B) = 1.
The function returns 1 when either of the above statements is true,
Therefore the Boolean expression for the function is Y = (A B) (B
A)

The XOR logic gate, which symbolizes the operator in a circuit diagram is
drawn as follows;

A
B

The circuit diagram may also be draw using fundamental operators using the
derived expression A B = (A B) (B A);

AB

The XOR gate may be recreated by substituting the gates in the above
diagram with their Minecraft counterparts.

AB

The binary adder:


The adder, also referred to as a summer, is a circuit that performs addition of
given input values. The adder is therefore essentially a representation of the
addition (+) operator, and therefore the circuit can be formulated as done
previously as with the XOR operator, by use of a truth table.
Half-adder
The half adder is a highly simplified adder that only accepts 2 bits of input, in
this case A and B, giving A+B as the output. Before a truth table is designed,
we can make a simple observation. By assigning A = 1 and B = 1 as input
values, by simple arithmetic, we can observe that A+B= 10, where 10 is 2
bits of information. For the half-adder to be capable of displaying this
information, it has to be capable of returning 2 bits as output, and thus, for
the truth table, two output variables, Y and C are defined, where Y is the sum
and C is the Carry. For the above example, Cout = 1 and Y = 0.
The reason that the second bit is denoted as the carry is that when a full
adder is constructed, the Cout value is passed on to be added by the
subsequent half adder. The concept will be illustrated clearly when the full
adder is discussed.
Table 2.0: Truth table for a half adder:
A
0
0
1
1

B
0
1
0
1

Cout
0
0
0
1

Y
0
1
1
0

From the above truth table, expressions for Cout and Y can be derived by
comparison with previously described logic gates. The relationship between
A and B that results in output Cout is exactly as in Table 1.0 for A B.

Similarly the relationship between A and B that results in output Y is exactly


as in Table 1.3 for A B.
Therefore the expressions for Cout and Y are,
Cout = A B and Y = A B.
These expressions may be used to design a circuit using an AND gate and an
XOR that, by inputting 2 bits of information, (A,B), two bits of information,
(C,Y) are returned that are equal to A+B.

Circuit design
A
Y
B

Cout

The following is the schematic for a half-adder created in Minecraft by


substituting the logic gates in the above diagram with their Minecraft
counterparts.

XOR gate: It is
important to
make sure that
the inputs line
up during
construction

Cout

A full adder is an adder that is capable of receiving 3 bits of input and


returning their sum in as 2 bits, and is essentially composed of two halfadders. The additional input bit is the Cin bit that represents a bit carried over
from a previous operation. The Cin is essential when larger numbers are
added, during which the Cout of one adder is the Cin for the successive adder.
The full adder accepts A,B and Cin as inputs and returns A + B + C in terms of
the bits Y and Cout.
Table 2.1: Truth table for a full adder:
A
0
0
0
0
1
1
1
1

B
0
0
1
1
0
0
1
1

Cin
0
1
0
1
0
1
0
1

Cout
0
0
0
1
0
1
1
1

Y
0
1
1
0
1
0
0
1

From the truth table, the Karnough maps for output Y is;

From the Karnough map, the following expression may be derived;


Y = (A B Cin) (A B Cin) (A B Cin) (A B Cin)
The Karnough map for output Cout is;

From the Karnough map, the following expression may be derived;


Cout = (A B) (B C) (C A)

Cin

Cout

The full-adder is yet again simply created by substituting the components of


the above diagram with their Minecraft counterparts.

Cin

Cout

Addition of larger numbers


Given two numbers A and B, each of them can be deconstructed into single
bits of information. For instance, if A = 1010, and B = 0011 then the
numbers are deconstructed such that A0 = 0, A1= 1, A2 = 0, A3 = 1 and B0 =
1, B1= 1, B2 = 0, B3 = 0. The process of addition is analogous to conventional

addition, and each bit of A is added to its corresponding bit of B, and the Cout
from the addition is added to the next set of bits. Therefore, A0 is added to
B0, resulting in two outputs, Y0 and Cout. Cout is then added to A1 + B1. The
process continues in such a manner until the two numbers are added, and
the output received is Y0 , Y1, Y2 and Y3. From the above example, Y0 =1 , Y1
=0 , Y2 = 1 ,Y3 = 1, which means Y = 1101.
The following is a graphical representation of the concept described
previously which illustrated the addition of each corresponding bit of the two
numbers. The format is effective in displaying the similarity to addition in the
decimal system.

The above process of addition translated into a circuit using a half-adder and
multiple full adders. The half adder may be used to add the first two bits, i.e.
A0 and B0 since there is no Cin. In every other instance a full adder is used.
For this exploration I attempt to recreate a 4-bit ripple carry adder in
Minecraft, which takes two numbers A and B as input, such that each number
may have 4-bits of information, and outputs the sum of the two numbers,
A+B in binary. The 4-bit adder uses one half-adder and three full adders
connected such that the carry (Cout) from the half-adder is passed as the Cin
for the first full adder. The resulting carry from the second full adder is
passed on as input into the next adder and so forth. The following is a
diagram for a 4-bit ripple carry adder.

B3

A3

Full
adder

Full
adder

C4

Y3

Full
adder
C2

C3

Y2

B0

A1

A0

Halfadder
C1

Y1

Y0

Note: In the above diagram, C is used to represent both Cout and Cin.

A
0

Y0

Half-adder

A
1

Y1

Full-adder (1)

A
2

Y2

Full adder (2)

Full adder (3)


A
3

Y3

Cout

Note: In the above diagram, for the sake of simplicity, the inputs of the
ripple carry adder and the Carry out from the previous adder do not match
the inputs of each full adder. This result in a simpler diagram, but it should
be assumed that each input displayed in the ripple carry adder is in fact
connected to the input of its corresponding full-adder.

The above schematic is the ultimate result of this exploration and represents
a fully functional ripple carry adder. The ripple carry adder receives inputs
from the levers in the schematic in the forms of 1s and 0s, which make up a
number in the binary system and outputs the sum of the two input numbers
in Binary in the form of powered Redstone, representing 1, and unpowered
Redstone representing 0s.

Conclusion
The game of Minecraft itself is highly conducive to the creation of circuits
evident from the simplicity involved in designing basic logic gates. Instead of
involving complicated components, the game hands the player a NOT gate,
and subsequently makes the creation of other logic gates very simple, which
is not the same as in real life where components are relatively expensive and
extremely difficult to create from scratch, due to which Minecraft is both very
entertaining and educative in its capabilities. The major downside of the
circuits described in previous sections is that they are not optimal, that is,
they use more gates than absolutely necessary and result in a slower rate of
information processing. The circuits may also not be optimal within the
Minecraft context as the game renders each block individually as they
change state when a signal is passed in a circuit, which means that they
consume greater processing power to run within the game as opposed to
more compact circuits which give a similar functionality. The lack of
processing power efficiency may also be attributed to the fact that the above
circuits were built without utilizing the ability for logic gates and circuits to
be be constructed in three dimensions which further reduces the length of
wiring required for the construction of circuits, reducing the number of blocks
that need to be rendered.
Over the course of this exploration I have learned considerably about
Boolean algebra and Boolean operators with respect to logical gates and
their implementation in computing, while also generally grasping the
modeling of simple Boolean functions. I have also been able to apply these
concepts, in the above exploration, using limitations defined by the world of
Minecraft to design an instrument that is capable of conducting the addition
of two 4-bit integers, and thus compute data at a simplistic level.

Bibliography
1. "What Is Boolean Algebra? Definition and Meaning." BusinessDictionary.com.
Web. 2 Apr. 2015.
2. "Karnaugh Map." Academic Dictionaries and Encyclopedias. Web. 1 Apr. 2015.

You might also like