Arqade is a question and answer site for passionate videogamers on all platforms. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

In the 2048 game each move causes a new 2-block to spawn. However, I couldn't figure out the logic behind where that block spawns. Is it random? Does it depend on the direction of your last move?

share|improve this question
@TheifMaster I took a look at Manishearth's link and it turns out that 10% of the time 4-blocks also spawn! – Louis Apr 25 '14 at 20:03
up vote 19 down vote accepted

It's randomly chosen out of the available cells, as seen in the code here:

if (cells.length) 
    return cells[Math.floor(Math.random() * cells.length)];

(which is used here and eventually here)

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.