TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Show HN: Tetris Implemented in ClojureScript

135 pointsby djblueabout 6 years ago

8 comments

bedersabout 6 years ago
This is super condensed but still very readable if you know Reagent and Hiccup.<p>It&#x27;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.<p>Contrasting that to the very compact representation of tetrominos<p><pre><code> {:I {:color &quot;#1197dd&quot; :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]]} </code></pre> and the very cute rotate function:<p><pre><code> (defn rotate [r] (-&gt; r inc (mod 4))) </code></pre> gives you a good idea what a Lisp is about.
评论 #19708130 未加载
评论 #19708476 未加载
评论 #19710863 未加载
评论 #19709587 未加载
chrisoakmanabout 6 years ago
Nice work! :)<p>A few years ago some friends and I wrote a tetris clone to celebrate the 30th anniversary of tetris and learn ClojureScript in the process. Really fun group project.<p>Playable here: <a href="http:&#x2F;&#x2F;t3tr0s.com&#x2F;" rel="nofollow">http:&#x2F;&#x2F;t3tr0s.com&#x2F;</a><p>Repo: <a href="https:&#x2F;&#x2F;github.com&#x2F;imalooney&#x2F;t3tr0s" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;imalooney&#x2F;t3tr0s</a>
评论 #19708149 未加载
gunnabout 6 years ago
Here&#x27;s my tetris copy: <a href="http:&#x2F;&#x2F;wolandbros.com&#x2F;tetris&#x2F;" rel="nofollow">http:&#x2F;&#x2F;wolandbros.com&#x2F;tetris&#x2F;</a><p>Both the game and the source are much more minimal, it&#x27;s very easy to customise the rules. You can see the source here: <a href="https:&#x2F;&#x2F;github.com&#x2F;gunn&#x2F;tetris&#x2F;blob&#x2F;master&#x2F;src&#x2F;store.js" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;gunn&#x2F;tetris&#x2F;blob&#x2F;master&#x2F;src&#x2F;store.js</a>
评论 #19709402 未加载
评论 #19713993 未加载
rschachteabout 6 years ago
This is sick! Link to source: <a href="https:&#x2F;&#x2F;github.com&#x2F;djblue&#x2F;tetris" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;djblue&#x2F;tetris</a>
评论 #19707978 未加载
city41about 6 years ago
If interested in more ClojureScript games, I made Breakout: <a href="http:&#x2F;&#x2F;city41.github.io&#x2F;reagent-breakout&#x2F;" rel="nofollow">http:&#x2F;&#x2F;city41.github.io&#x2F;reagent-breakout&#x2F;</a>
soup10about 6 years ago
<a href="https:&#x2F;&#x2F;jstris.jezevec10.com&#x2F;" rel="nofollow">https:&#x2F;&#x2F;jstris.jezevec10.com&#x2F;</a>
brabelabout 6 years ago
The HTML page, which includes the JS scripts embedded, is only 75KB... not bad for a language so different from JS.
a_t48about 6 years ago
Up being rotate rather than hard drop is tripping me up. I guess I could fork it, though. :)
评论 #19708105 未加载
评论 #19708094 未加载