Musing: The 2048 Game

Here’s an amusing little time waster: http://gabrielecirulli.github.io/2048/

The goal of the game is simple: Get a tile of value 2048.  The controls are also simple: press an arrow key and every tile that can move in that direction, will.  If two tiles of the same value are next to each other, they’ll combine to one tile double that value.  Also, with every move, a two or a four will appear at random in a free spot on the board.  Seems easy, right?

Well keep in mind that to get a 2048 tile, you’ll need to create and combine two 1024 tiles.  To get those two 1024 tiles, you’ll need four 512 tiles, which require eight 256 tiles, which require sixteen 128 tiles.  All of these numbers are powers of two, which are the key to the concept of binary numbers, which at the most basic and fundamental level is how computers operate.  A binary number is one of base two, in the same way that a “conventional,” decimal number is base 10.  Consider the number 2048.  You might remember from elementary school that this could be thought of as two 1000′s, zero 100′s, four 10′s, and eight 1′s.  Those numbers – 1000, 100, 10, and 1 – are all powers of 10 (10^3, 10^2, 10^1, and 10^0, respectively).  A number written in binary uses powers of 2, meaning there is a 2^0 = 1′s place, a 2^1 = 2′s place, a 2^2 = 4′s place, and so on.

Moreover, just as any one place value in a decimal number could be occupied by a digit from 0-9, giving you ten options, a place value in a binary number can only be occupied by two digits: 0 and 1.  To write a decimal number like 459 in binary, you first need to figure out how to “assemble” the number using powers of two.  The biggest power of two that fits is 256 (2^8).  That leaves 203 left, meaning 128 (2^7) fits also.  Subtracting that leaves 75, meaning we can take away 64 (2^6).  This leaves only 11 left, from which we can subtract 8 (2^3), then 2 (2^1), then only 1 (2^0) remaining.  So the decimal number 459 can be rewritten as 11100111.  Taken in the other direction, the binary number 110101 would be interpreted as one 1, one 4, one 16, and one 32, giving a decimal number of 53.

What’s important to note is that 53 and 110101 are referring to the same quantity; they are just different ways of representing that quantity.  It’s the same way as how “the cat,” “el gato,” and “l’chat” all refer to the same animal.  Thinking of decimal and binary as different languages for numbers is actually a great analogy, because binary is how computers think of numbers.  The reason why has to do with how computers are made.  The circuits on the motherboard, inside the processor, and all throughout your computer are essentially tiny wires.  At any instant, the wire either has an active electrical charge running through it or it doesn’t.  If the wire is “on,” it is considered a 1.  If it is “off,” it is considered a 0.  The sender on one end of the wire will turn the current on and off extremely quickly in a manner much like morse code, and the receiver on the other end of the wire will interpret the rapid fire of 1′s and 0′s as binary numbers that can be interpreted in any number of ways.

So far, the best I’ve been able to get in the game is a pair of 256 tiles that I wasn’t able to combine before blocking myself off, so my high score is only 3180.  Think you can beat it?

About these ads

9 Comments

Filed under Musing

9 responses to “Musing: The 2048 Game

  1. C

    Sorry Mr Kirk I have a Stats test to study for!

  2. Yes, it’s an amazing game. And YES, I killed lots of time too (: . A tip – try to have the biggest tile always in one of the down corners. That helped me. Also, there is a bit easier to remember url http://2048game.com . Enjoy!

    p.s. if you have work to do, don’t start playing this game.

  3. boreddude

    my highest score is 7096. I’ve found that if you use one direction until its full, then move another direction only, it is easiest to get to the highest tiles. Ive gotten a 512 tile and two 256 tiles, so i had the means of getting a 1024 tile/ i believe there is an algabraic way to beat this game.

  4. I beat that high score second time; 4548.

  5. Pooooja

    8120 eyyooo

Questions? Comments?

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s