I made Snake in 103 lines of ClojureScript for a talk once: https://github.com/pate/cljs-snake (LOC excludes whitespace and links to repo). Comes in under 100 LOC if you strip out the aesthetics.
Re:Show HN: Simple JavaScript Tetris
by jstimpfle on Wednesday November 02, 2016 @06:55PM
(#12860136)
Very nice!
Check out the encoding of the tetrominoes in this implementation:
https://github.com/jakesgordon/javascript-tetris
My subsequent port to C and Arduino was very natural: http://youtu.be/t3QOeQbEHVs
Re:Show HN: Simple JavaScript Tetris
by electrum on Wednesday November 02, 2016 @08:16PM
(#12860570)
Here's one I wrote a long time ago in Z80 assembly for the TI-86 graphing calculator: https://gist.github.com/electrum/76ac88de2e1d6c9254deaba003a...
Data representation is pretty universally one of the most important things (basically the "design" part to me). Four hours is pretty quick I guess. Snake might be more difficult (but an array or llist + snake direction + board map should be straightforward). I'd done chess that week and the representation is also doable unless thinking about AI or history or... which is when I quickly go bikeshedding. Multiple different representations for different tasks (and transforming in between) might be a way to go.