8 ms·
Had you made Tetris before? Or used an external resource to see any pseudocode? Reason I'm asking is, I was doing a similar thing with Snake and it took me a bi
by zzguy 10y ago
Had you made Tetris before? Or used an external resource to see any pseudocode? Reason I'm asking is, I was doing a similar thing with Snake and it took me a bit longer (probably 4 hours) because I messed up the basic mechanics in the beginning (I didn't think of how to structure the growing body as a linked list). I want to gauge how much I suck (at least at games programming) lol.
- jstimpfle 10y agoI once spoke about it with a friend who had to do it in C. However C is a dangerous trap here, I think it gets you in the wrong mindset. 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.
- pgt 10y agoI made Snake in 103 lines of ClojureScript for a talk once: https://github.com/pate/cljs-snake https://github.com/pate/cljs-snake (LOC excludes whitespace and links to repo). Comes in under 100 LOC if you strip out the aesthetics.
- jstimpfle 10y agoVery nice!
- rbirkby 10y agoCheck out the encoding of the tetrominoes in this implementation: https://github.com/jakesgordon/javascript-tetris https://github.com/jakesgordon/javascript-tetris My subsequent port to C and Arduino was very natural: http://youtu.be/t3QOeQbEHVs http://youtu.be/t3QOeQbEHVs
- electrum 10y agoHere's one I wrote a long time ago in Z80 assembly for the TI-86 graphing calculator: https://gist.github.com/electrum/76ac88de2e1d6c9254deaba003a74b6b https://gist.github.com/electrum/76ac88de2e1d6c9254deaba003a...
- bbcbasic 10y agoThe "Random" subroutine looks surprisingly simple
- deleted 10y ago[deleted]