As I’m sure everyone knows by now, computers run on good ol’ 1’s and 0’s. An easy statement to make, but a difficult one to truly grasp in reality and scope. I mean think about it: that shiny new game you just bought, with its whizzing bullets, roaring monsters, vast landscapes, online connectivity letting you frag your friends… that ALL gets crunched down into simple 1’s and 0’s. Pretty staggering that that amount of interaction can be reduced to microscopic electrons flying through a miniature universe the size of your cell phone (or even smaller).
So how does it work? Well you’ll need about a dozen years of college and a Masters Degree in computer engineering, to find out! But I can at least give you a small taste of how those 1’s and 0’s form information.
One of the most essential tools for a computer is to be able to count. Not just 1 and 0, but actual whole numbers. Well how does a computer represent a number like 734 with just 1’s and 0’s? It all stems from the idea of numbers itself, a concept that is hard to grasp for us 10-digit (0 to 9) humanoids. You may not be aware of it, but you’ve been using an idea called the place-value system to do all your counting since you were first taught to draw numbers. Here’s the basic concept:
When using a number system, you must have a base. The base determines how many different options there are when writing out a digit. For example, we humans use base-10; there are 10 options we have when writing digits: 0,1,2,3,4,5,6,7,8, and 9. A computer uses base-2, meaning it has two options, 0 and 1.
In a “number” you have places, and each of those places is filled with a value. Let’s continue to use 734 as our number. Each “place” represents a magnitude that is equal to the base, raised to the power of its position. This is much easier to explain using a visual:
I know, I know, it LOOKS and SOUNDS hard. But you essentially do all of this in your head in milliseconds. It is second nature to you. We have our 1’s positions, our 10’s position, and our 100’s position. So bear with me now… we are going to do the EXACT same thing, except using base 2. Each place will now represent a different value since we are using base 2. Let’s define the magnitude of each of those places using our method from above:‘
Now, we can start to assign a value to each of those places (remember our only option is a 1 or 0, since we are using base-2). Let’s start with a small number like 13. Using our pattern above, the number 13 would be represented as:
And Finally 734:
So in binary (we call base-2 numbers ‘binary’):
13 = 1101
42 = 101010
734 = 1011011110
I know it’s a bit confusing at first, but it makes sense after reading it through a couple times. Now there are many techniques to actually get those 1’s and 0’s, but typically you start with the highest possible magnitude that will fit into the number you are trying to decode. So in the example above, 512 is the largest place-magnitude that will fit inside of 734, so we start there and work down, subtracting as we go. There is ONLY ONE combination of ones and zeroes for each number. Pretty crazy!
I hope you enjoyed my math lesson for the day. Again, its not easy to pick up on, but once you see the pattern, it starts to make sense. And that was only for numbers. Imagine the complexity behind things like audio processing, screen graphics, object collisions, etc. To me, computers are fascinating for the simple fact that such complex ideas can be represented by such a simple building block. I guess that’s why they call me a nerd