Rule in the 2048 game (Developers)
> What the function does: in the random free cell on the board places a new
> cell - which in the 90% probability is the cell "2" and in the 10%
> probability cell "4".
> My question is: This is the same algorithm like in the original
> implementation?
Yes.
GameManager.prototype.addRandomTile = function() {
if (this.grid.cellsAvailable()) {
var e = Math.random() < .9 ? 2 : 4,
t = new Tile(this.grid.randomAvailableCell(), e);
this.grid.insertTile(t)
}
},
Complete thread:
- Rule in the 2048 game - Laaca, 25.07.2022, 00:46
- Rule in the 2048 game - jadoxa, 25.07.2022, 03:22
- Rule in the 2048 game - bretjohn, 25.07.2022, 22:39