Skip to main content

Learning Binary


Binary 100 Simplified

Binary is the essence of all of existence. Everything can be divided down to the simplest form of computing, which is by using binary. Black and white, yes and no, true or false, good or evil are all examples of binary in action. But what about in computers? In computers, all programs are written using some other machine language that ultimately relies on some form of binary input. That is to say, binary is the primary building block of all other programming languages. Another language, which we can study later, is hexadecimal.
Just like binary, hexadecimal is not actually a language, it is a code of numbers. In the case of binary, the code is either zero or one. That is why it is called binary, because the only options are one of two.
So, in order to build binary code, we are limited to either using a zero or a one. To build a yes or no value is as simple as assigning one to yes and zero to no. In math, that looks like this: y=1 & n=0. In binary, it's even simpler: 0 or 1.
So you must be wondering, what about 2? The olde 1 plus 1. Well, a bit can only contain a single one value. So either a bit is empty, or a bit has a value of 1. So now, we can assign a set of bits either nothing or a 1. Zero is nothing, right? That's simple math.
1 is not-zero or true.
Zero is false, the bit does not have a value. It is false because there is no value assigned. You assign a value by not assigning the true value. That is the essence of binary: true or false.
In math and coding, zero is followed by one, which is followed by 10. In decimal (latin for ten), after nine, you start over back to a one after a zero. Same thing with binary, after one, you start over. In base-3, you start over after 2; so: 1, 2, 10, 11, 12, 20, 21, 22, 100, and start over again.
Same thing with binary, only there's only the one by itself. So in essence, we already are familiar with the concept, since we practice it in base-10 everyday by exchanging money in decimal-based denominations.
After 1 is 10, because there is no 2 in binary, only zero and one. After 10, 11, but then no 20, it's straight to 100, and that's our 4.
Interestingly, every power of two is the number of zeroes behind the one. So two squared, or 4, is hundred, eight is two cubed, which are equal to 1000 in binary format. Each bit is combined with seven other bits to form one byte of data. A byte is eight bits. So that was pretty simple. How did things get so complex?

Candy Crush

Binary is simple, there is a one and there's a zero. After that it's just more ones and zeros. So how does that apply to a game? Simple, the game was programmed with only 1's and 0's.
Each tile is connected on one side.
If the colors match, assign a 1.
If the colors do not match, then not 1, or zero.
So if a tile has the color blue and a blue tile above, then the game was programmed to assign a value of 1 to the space between them. Now if a blue is nearby, then a zero can become a one by switching the two tiles creating a zero value so that the further tile generates a second one value.
Thus, when two 1's are together, we see visually three tiles connected, but really, the programmer just created a simple equation that if 1 + 1 = 2, you can continue; if not, then it subtracts 1, and you see one less move available in the game.
Any questions? Basically,just ignore the hypnotic colors.

Applying the rule

The rule is simple, when two colors match, you have a value of 2, right?
Impossible. In binary, there is no two. There is only 1's and 0's. So how did they program a value of 2?
Well, in order to understand how binary can be used to program a game, you must first be able to see the number values associated with the binary values.

Binary Conversions

0 = 0
1 = 1
2 = 10
3 = 11
4 = 100
5 = 101
6 = 110
7 = 111
8 = 1000
Okay, that should be enough for us to figure out the coding behind a program such as Candy Crush or Soda Crush. It's not the colored tiles that you pay attention to, it's the value between each pair of tiles.

Popular posts from this blog

The Dark Market

Dark Market Once upon a time, and that time is now. Shen do Shen owns a small business in the dark market, which he keeps hidden in the back room of a legitimate business in the royal marketplace. The front business, also known as just a front, is a dry cleaning store. In the back room, Shen sells various spices as a luxury commodity to the wealthier class of citizens in the kingdom. Today is a special occasion for which the dry cleaner's store is closed and no visitors are permitted into the back market. The king has requested a visit a few days ago to purchase spice. Aside from the fact that the king wants the store to himself because he is very busy and doesn't have time to get tangled up in long lines at a busy market, Shen knows the king will purchase a large quantity of spice. So Shen can afford to close the market for one day and still earn a day's worth of profits just from what the king will spend. "Your majesty, to what do I owe this pleasure?" Sh

Hob v Gob (Hidden Beginning)

Welcome to Goblin's Hidden Game. In this puzzle, you have to decode the hidden meaning of the words spoken with a thick accent that makes it sound like other words were spoken instead. Click the links (...) at the end of the coded sentences to play. Scroll down to the bottom to see if you guessed right on any given puzzle set. The answers appear in the story after each play. My responses to Hob are hints at what he was trying to say. The best part is after you finish the puzzle, you can start over, and they'll still be just as difficult to solve. Difficulty ratings are provided. Even I can't figure them all out, and I'm the one who wrote them, so hopefully you'll enjoy the challenge... Goblin's Grammar help " Juan's supper knit, I'm dare! Wassup? Bee gain hand? ... " he says. L1 "Right? Beginning... go on..." I answer. " Hand edge; jostle happy! inn satay Miss now ... " he continues. L2 "Okay? Rig

111 Semicolons (English)

Home >> Grammar Style Guide >> Semicolons Understanding Semicolons Semicolons have a number of useful reasons to be included in a sentence or paragraph. Where colons can be useful outside of sentence structures, semicolons are typically limited to separating text in paragraphs or similar constructs. You may think semicolons are the halfway point between commas and colons, and in some respects, that assumption wouldn't be far from the truth. Where a comma offers a pause and a colon introduces something, a semicolon can be considered a halfway point between these two attributes. However, a semicolon adds value to a sentence with its own merits. At times, only a semicolon can offer the clear interpretation of text intended to be set off in a manner that other punctuation might not be able to achieve as precisely and clearly. Using a semicolon in a sentence may not be as forgiving as a misplaced comma or period , so special consideration should be taken before tr