Hacker News new | past | comments | ask | show | jobs | submit login
Show HN: Interactive guide to Tetris in ClojureScript (shaunlebron.com)
157 points by undershirt on Sept 4, 2014 | hide | past | favorite | 15 comments



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.


Thanks, Chris. I hope github attains longevity for reasons like this.


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!


Resources like this are exactly what I've been searching for while learning clojure(script). Really great work.


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.


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).


Same on my 15" whatever. Zooming out makes everything fine, allowing scrolling would, too.


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 :)


Fantastic work. As 'ibdknox said, a wonderful display of open source and ingenuity. Here the links to Shaun's work.

slides: https://github.com/shaunlebron/t3tr0s-slides

game: https://github.com/imalooney/t3tr0s


Shaun is a really cool guy, very friendly and helpful. :)


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?


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.


I used advanced optimizations, and the problem went away.


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.


Really nice interactive demo! Great work!




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: