2048, an addicting web game

There’s a very effective strategy for 2048:

  1. always keep the largest tile in a corner (I prefer lower left)
  2. keep the next-largest tiles, sorted, in the adjacent row (bottom)
  3. never press “up” except when no other move is possible
  4. try to always keep the bottom row full so that new tiles wouldn’t push the largest tile out of the corner when moving sideways
  5. treat the remaining three rows as the assembly line that works on the tile to be merged into the lower right corner

It may be counterproductive to play strictly by these rules at the beginning (until you get tile 256 or so), but it really works quite well. There are of course some nuances you have to figure out on a case-by-case basis (e.g.: what to do if the largest tile is pushed away from the corner, or how to deal with the cases when you do need to go up).

The extra space makes it very forgiving and easy to automate. I set up an infinite loop that simulated keypresses “left, down, right” (originally just “left, down” with manual presses of “right” when it got stuck, but I got tired of that) and this mindless bot got a score of 4,468,524 and largest tile 131,072:

For Linux users who want to try it out, the Bash command is:
while true; do xvkbd -text '\[Left]\[Down]\[Right]'; done

Beware that the keypresses are X-server-wide, so you probably won’t be able to do much else while it is running.

1 Like

I was doing fine until I accidentally hit the spacebar

Brilliant, or rather, THANK YOU for releasing me from algorithmic hell. Because you don’t just play a game. You have to game the game.

1 Like

Excellent. But, let me suggest an improvement:
while true; do xvkbd -text '\[Down]\[Left]\[Down]\[Right]'; done

This seems to be a bit more effective at keeping the board relatively clean.

That’s Numberwang!

1 Like

Largest tile: 1,048,576, total score 47,409,192

Awesome! And there’s a platform-independent, non-keyboard-grabbing way to do this by going through the game’s javascript. Just use this bookmarklet:

javascript:function dumbbot(){GM.move(2);GM.move(3);GM.move(2);GM.move(1);setTimeout(dumbbot,0);};dumbbot();

The direction codes for GM.move() are: 0 - up, 1 - right, 2 - down, 3 - left. The number in setTimeout is the delay (in milliseconds) between subsequent moves. I’ve been running this for several hours now, it got to tile 2,097,152 and score of over 62 million so far and keeps going.

“addicting” is not an adjective.

This topic was automatically closed after 5 days. New replies are no longer allowed.