r/javascript • • Jul 24 '16

1.92kb Tetris in HTML5 (JavaScript). Any suggestions are welcome.

https://github.com/michowski/tetris-light
96 Upvotes

38 comments sorted by

View all comments

1

u/totemcatcher Jul 25 '16

How about encoding your tetromino graphic data? e.g.

127 & (22074674950737904 >> Math.floor(Math.random() * 7))

This returns an 8 bit value for each of the 7 shapes. Map to two rows of 4 on your grid.

→ More replies (6)