3 ms·
> Once you reach 2048, the game continues. That's a bug, it should pop up a dialog with your score. Rest is intentional. newtile = 2 vs. newtile = Math.rand
by rwinn 13y ago
> Once you reach 2048, the game continues.
That's a bug, it should pop up a dialog with your score. Rest is intentional.
newtile = 2 vs. newtile = Math.random() > 0.25 ? 2 : 4
- jader201 13y ago> That's a bug, it should pop up a dialog with your score. Rest is intentional. Yeah, just played, and it stops after the "GG" alert.
- stormbrew 13y agoOr: // in setup, use everywhere you use Math.random r=Math.random // generating a new tile newtile=(r()*2+1)<<1 That's a 50/50 chance and it's still a few more characters, obviously, but not nearly that many. Not spawning fours makes this a lot easier.
- rwinn 13y agoI'm using JSCrush (http://www.iteral.com/jscrush/ http://www.iteral.com/jscrush/) so it actually pays to write stuff out repeatedly instead of assigning short variables. (Math.random()*2+1)<<1 Math.random()>.25?2:4 But still too much, I only have 2 bytes to spare :)
- stormbrew 13y agoDo you have the uncrushed source somewhere?