top | item 8268927

Show HN: Interactive guide to Tetris in ClojureScript

157 points| undershirt | 11 years ago |shaunlebron.com

15 comments

order
[+] ibdknox|11 years ago|reply
This is a great example of the magic of open source. He took a project I haven't touched in almost 3 years and made something wonderful out of it. That may very well have never happened 10 years ago.

Awesome work Shaun, thanks for contributing back to the ecosystem.

[+] undershirt|11 years ago|reply
Thanks, Chris. I hope github attains longevity for reasons like this.
[+] mrcwinn|11 years ago|reply
Even aside from the specifics of ClojureScript, this is just a wonderful example of separating and planning for the requirements of an application.

How is a piece defined and drawn? What control does the user have over a piece? Since two pieces cannot intersect, how can I detect that? And so on...

Not unique to ClojureScript, it's a great reminder the best way to write great code is to ask these questions and answer them before you begin composition.

Anyway, great work!

[+] tgriesser|11 years ago|reply
Resources like this are exactly what I've been searching for while learning clojure(script). Really great work.
[+] kcorbitt|11 years ago|reply
Just an FYI in case the creator is here: on my 13" Macbook Pro the bottom of the slides are cut off at the default zoom level. I had to decrease the size to 75% to see the whole thing.
[+] roryokane|11 years ago|reply
Same for me on my 1080p external display on a Mac.

To clarify, the part that is cut off is the code inside the black rectangle, not the black rectangle itself. The problem is only on slides where the output is the 20-row board matrix. Since I can’t scroll the code, I could only fix it by zooming out (text-only zoom).

[+] NoodleIncident|11 years ago|reply
Same on my 15" whatever. Zooming out makes everything fine, allowing scrolling would, too.
[+] arms|11 years ago|reply
Wow - perfect timing. My copy of Clojure Programming should be delivered tomorrow, and this looks like a nice way to complement my learning. Plus, I love Tetris :)
[+] tl|11 years ago|reply
Cool presentation, but I have a question: go to slide #1, mouse over the top row, move your mouse along the element to the bottom row. There is noticeable lag in Chrome 37 as the page tries to re-draw the rows highlighted.

Other slides seem to have reasonable performance; is there something in ClojureScript that we should avoid here?

[+] undershirt|11 years ago|reply
Thanks for bringing this up, I noticed that too. I think I might be handling React.js keys incorrectly, causing the DOM-diffing to perform poorly for number-highlighting. Haven't really looked into it too deeply.
[+] undershirt|11 years ago|reply
I used advanced optimizations, and the problem went away.
[+] adrianm|11 years ago|reply
Color me impressed with this. Kudos to the author! It's a fantastic example of not only how to progress through concept to implementation with a game, but how interactive development can make this process all the more enjoyable for the developer, with a much faster feedback loop than more traditional (statically compiled) game design allows.
[+] robertfw|11 years ago|reply
Really nice interactive demo! Great work!