[ SOLVED ] Octo's Ghost Lib - Would like revising

the or is not exclusive, an Xor is a different operation. so 1|1=1 1|0=1 0|1=1 but 0|0=0

Right allined, like all bynary, adding 0’s to the left does not change the value, so add 0’s untill the legnths are equle.

I may have to go play with this in my redstone testing world. it’s easier to see how things are working that way…
Redstone now makes so much more sense… <3

Agreed XD Is there a simple way to output an integer’s raw binary to log it? And would non-numbers also translate to bits? Presumably a byte per character if so

I’m assuming that’s where ASCII chart comes into play?



I’d think. I’m under the impression that ASCII characters are comprised of 8-bits

came here to check code, left with a knowledge of how real-life redstone logic works.

1 Like

Just figure it out using the binary pattern, 1 2 4 8 16 32 64 128 256 …

take your number, say 133, for the bigest bin patern num it’s still smaller than, write a 1 and subtract it:

1 … 133- 128 = 5
then do it again, but if the next num in the bin pattern is too big write 0

10000 …

we find 4 so

100001 … 5 - 4 = 1 so

1000010 and we find one so

10000101 = 133

you can also use win calculator in programer mode (or advanced on XP and older) and change the raido buton from dec to bin with an number typed in, it will convert it


Let me show you a wireing diegram of a computer:
This is the circuit in a calculator, it adds, subtracts, and if you use it more than once in a row it can multiply and divide. This circuit, tessellated many times, on a pulse clock running at about 3.3Ghz is your CPU.

A is the input from the first number B from the second, ether 1 (on) or 0 (off); S is the output, there 1 or 0; C in is the carry switch (may carry a 1 from the last operation on the last place value); Cout is a carry out. (so you can carry the 1, just like long adding)

That moment when you’ve used diagrams like these to make redstone contraptions… xD

Well you can make this one with redstone, but a tick is 1/22 seconds so your CPU would only be 22Hz, but you could make a very good 1960’s computer that way. That would be cool.

Gosh darn it!!! Now you’ve got me thinking (that’s not a good thing, and so I try not to), I might just make a model of a 1960’s fully “digital” calculating auto-collator in redstone. Well there goes my weekend :wink:

I think redstone ticks are 10tps. The server ticks run 20tps generally. Although if you need to use pistons in your contraption, they’ll probably break if you need to run it at 10tps

10Hz, that’s poor even for a '60’s computer, and presumably lots of latency because pistons take time to move. Well I guess I just regained my weekend. T.T

1 Like

Not to mention the amount of repeaters you’d likely need to extend the circuits, which offset everything by another tick at least. XD

When doing programming work, I’d like to point out that:
10 is not 2. 01 is 2. Computers in general and most software use big-endian order. IE, the biggest value is on the right-side end, and the smallest value (1) is at the left-side start.
You can test this in your favorite programming language by converting ints to byte arrays and seeing what order the bytes go in. (EG, 1i = 1-0-0-0, 256i = 0-1-0-0, …)
This tends to confuse beginner users of binary because decimal numbers are generally written in little-endian, thus why most classes teach little-endian binary, even though little-endian is rarely used in actual practice.
Hexadecimal is also written little-endian, which adds to the general commonness of little-endian binary.


I think I’ve toyed with the idea of BigEndian when trying to re-produce an NBT library earlier in my programming days. Failed somewhat miserably, but I think I learned that Java is BigEndian by default, and I’m not sure if they offer a decent way to set your operations otherwise.

I always used small on the right, so you can add them up as you read the number. That way you add the biggest numbers first and smaller powers of 2 later so the running total will never double.

With padding 0s on the left, I think that’s LittleEndian (what we were discussing earlier)

Right, so your running total will never double, the biggest it can get after the first 1 is one less than double the power of 2 for that place value, so you can see what number it is by just looking at it.

Oh, and computercraft uses LittleEndian, so I never needed to know otherwise. But that’s good to know.