What is the probability of 4?
Solution 1:
Extracted from the source code (line 71) :
var value = Math.random() < 0.9 ? 2 : 4;
Math.random()
returns a number between 0 and 1. This code can be read as follows : Is the pseudo-randomly generated number strictly less than 0.9? If yes the tile value is 2, if no the value is 4. Assuming Math.random()
generates numbers with uniform probability over (0,1), the code implies a 90% chance of a 2, and 10% chance of a 4.
As for your second question: Yes, the probability is the same at the beginning. When the game starts 2 tiles are generated and their value randomized with the code above.
Solution 2:
i believe its 10% for a 4 and 90% for a 2