Live data from Hacker News

Show HN: Tetris Implemented in ClojureScript

djblue.github.io

1–10 of 26 posts

Re: Show HN: Tetris Implemented in ClojureScript

#7
This is super condensed but still very readable if you know Reagent and Hiccup.

It's interesting to compare this to a lot of tetris clones written in TypeScript. There are a few that take enormous pleasure in defining a type hierarchy and what not.

Contrasting that to the very compact representation of tetrominos

    {:I {:color "#1197dd"
       :dim [4 1]
       :zero [1 0]
       0 [[-1 +0] [+0 +0] [+1 +0] [+2 +0]]
       1 [[+1 -1] [+1 +0] [+1 +1] [+1 +2]]
       2 [[-1 +1] [+0 +1] [+1 +1] [+2 +1]]
       3 [[+0 +1] [+0 +0] [+0 -1] [+0 +2]]}
and the very cute rotate function:

   (defn rotate [r] (-> r inc (mod 4)))
gives you a good idea what a Lisp is about.

Re: Show HN: Tetris Implemented in ClojureScript

#10
post #7

This is super condensed but still very readable if you know Reagent and Hiccup. It's interesting to compare this to a lot of tetris clones written in TypeScript. There are a few that take enormous pleasure in defining a type hierarchy and what not. Contrasting that to the very compact representation of tetrominos {:I {:color "#1197dd" :dim [4 1] :zero [1 0] 0 [[-1 +0] [+0 +0] [+1 +0] [+2 +0]] 1 [[+1 -1] [+1 +0] [+1 +…

Thanks! I really enjoyed the data modeling aspect of this project. I also ended up modeling the board as a mapping of [row, column] -> color which might be different from the traditional 2D array representation.
Post reply on HN