3 ms·
The new tiles are only 2 (90%) and 4 (10%). From the source https://github.com/gabrielecirulli/2048/blob/master/js/game_manager.js#L43 https://github.com/gabrie
by gus_massa 13y ago
The new tiles are only 2 (90%) and 4 (10%). From the source https://github.com/gabrielecirulli/2048/blob/master/js/game_manager.js#L43 https://github.com/gabrielecirulli/2048/blob/master/js/game_...
// Adds a tile in a random position
GameManager.prototype.addRandomTile = function () {
if (this.grid.cellsAvailable()) {
var value = Math.random() < 0.9 ? 2 : 4;
var tile = new Tile(this.grid.randomAvailableCell(), value);
this.grid.insertTile(tile);
}
};