Introduction: Binary to Gray in Minecraft (logic Circuits)

We'll be using 'AND' and 'OR' logic gates for construction of our converter, but first we must introduce ourselves with Gray's code, Boolean algebra, Karnaugh's map and etc.

Step 1: Gray's Code

Gray's code can be easily calculated with formula n 'XOR' (n / 2).

-n is the current number.

For example: binary: 0110 (6 dec.) devided by 2 is 0011 (3 dec.), then we compare bit by bit with 'XOR' table and we end up with 0101 (Gray).

Tables in the second picture represent basic Boolean algebra, which we will use in the designing of our gates.

As a first step we will assign names to our ins and outs. We have 4 bits both in binary numbers and in Gray's numbers, so we assign (like in the third picture) 'D' 'C' 'B' 'A' for binary inputs and 'Z' 'X' 'Y' 'W' for outputs (Gray's).

We can clearly see that input 'D' is equal to the output 'Z', which means that we solved our first output.

Step 2: Karnaugh's Map and Other Three Outputs

For next three outputs we must use Karnaugh's map, while it would take quite some time to explain Karnaugh's map, i'll just leave a link about it (anyways, if you have any questions about it, just ask):

1: https://www.utdallas.edu/~dodge/EE2310/lec5.pdf

2: https://en.wikipedia.org/wiki/Karnaugh_map

In the first map we will be solving 'X' column, in the second 'Y' column and in the last 'W' column (which means that we take '1' from 'X' column (for example) and lets say that this '1' is from row '3' (not third, because third would be '2') and then we write it in the 'X' map, field '3').

Step 3: Logic Gates

Following those equations we got from Karnaugh's maps, we come to the next part, drawing scheme. Basically you follow equations an follow simple rules of Boolean algebra, such as '*' is 'AND' and '+' is 'OR'.

Again, if you have any questions about drawing this, feel free to ask.

*sorry for doing this in paint, i don't have any other software for this things.

Step 4: Implementing to Minecraft

In the following order:

1. Inverter / NOT

2. AND

3. OR

Now that we now how to make these gates in Minecraft, we can start implementing everything from the scheme that we made previously. And that's it, this converter works with levers, when it's on it counts as 1 and when it's off as 0.

Input binary numbers and see on the other side if you got it right :)