# CODE with Redstone

## May 18, 2019 15:00 · 444 words · 3 minutes read

In the last segment we covered the half and full adders which allow us (with some modifications) to make a fully functioning arithmetic unit. In this segment, I’ll introduce two final components.

## D-type Flip Flop

Our D-Type flip flop is fairly straight forward to wire up after having wired up the half and full adders. This one would be level triggered, but it would be simple to convert it to an edge triggered version by wiring two of these together.

The data input is the switch closest to the observer in this picture while the one above it is the set bit. This input is what we would want to wire into our clock signal.

Speaking of that, how do we make a clock in Minecraft?

## Clock

The clock circuit is actually pretty simple. Because Redstone propagates at a certain speed, we can sort of “trap” this propagation within a loop of gates that feed into one another and then tap into the loop at some point to get a clock signal that varies between zero and one:

In order to construct this circuit, you don’t have to do anything special really. 5 inverters connected by Redstone will naturally produce a clock signal. The repeaters are added to slow down the signal, but the clock works just as well if you remove them. The only important thing to remember is that we need to use an odd number of inverters in order to get the signal to vary between 0 and 1. An even number will always produce the same value.

## Building a full computer

From here, the only thing stopping us from building a full computer in Minecraft is time and effort. Using a multitude of flip flops, we could construct a fully working RAM array. Our simple clock circuit would prove sufficient to support reading through this array sequentially to execute code segments. We have the building blocks of an ALU from part 1, and we could use Redstone lamps to create 7 segment displays for output.

I will note however that none of this is really practical because of the sheer slowness of Redstone. Even our simple full adder circuit takes a little over a second to propagate the signal. Reading a single bit from the flip flop is about the same speed. The more gates the signal has to go through, the slower our computer will get. While Redstone is a fun and simple medium, it does not scale well.

## Recommended reading

If you are interested in this subject and you want to take it further, I recommend checking out: