Binary, or base two, is another way to represent numbers.
The main difference between binary and decimal (“normal numbers”) is the number of symbols we can use.
In decimal, we have 0 through 9, ten total symbols.
However, in binary, we only have two symbols 0 and 1.
To avoid confusion, the rest of the numbers will be written using a notation.
If X is a number in binary and Y is the same number in decimal, it can be written as:
In redstone, binary is usually represented with on being 1 and off being 0.
With this representation, we can make redstone circuits capable of doing arithmetic and logic operations on binary values.
This isn’t meant to cover ALL binary topics, just a simple explanation of binary.
If you have any further questions, feel free to reply below.
Right! So:
To calculate the value of a binary number (A string of ones and zeros), you take the sum of every digit multiplied by 2 to the power of the zero indexed position of the binary digit from the right (left of the decimal point)
for example:
Take the binary number 101. Then it’s value is: 1*2^2 + 0*2^1 + 1*2^0
Or generally for any base:
To calculate the value of a number (A string of digits), you take the sum of every digit multiplied by the base of the number to the power of the zero indexed position of the digit from the right (left of the decimal point).
or in pseudo-code:
base = 2 # base of the number
listOfDigits # in reverse order (least significant digit first)
length = lengthOf(listOfDigits)
sum = 0
for i = 0..length-1:
sum += listOfDigits[i]*(base^i)
return sum
This way the example is just a clarification, whereas the definition is concise and exhaustive such that it’s self-contained and doesn’t depend on the example.
I intentionally avoided talking about powers of 2, I’ve seen enough cases of people too young to know how exponents work. If someone is able to understand programming and exponents, then I don’t think there’d be an issue in them understanding my initial examples.
Binary in redstone is just 1 = on and 0 = off. I haven’t made any further guides yet so it’d probably be a good idea to hop on the server to learn more about computational redstone.