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.

JavaScript game of Tron in 219 bytes

129 pointsby bhaveshdhuparalmost 13 years ago

19 comments

necubialmost 13 years ago
It's unfortunate that they decided to save 2 bytes by using onkeyup instead of onkeydown. That choice makes the game nearly unplayable for me. Compare the version in the demo to the one here: <a href="http://micahw.com/tron.html" rel="nofollow">http://micahw.com/tron.html</a> (221 bytes).<p>In any case, this is really impressive. It's always fun to see the tricks people employ to get these tiny sizes (smaller than this comment!).
评论 #4125319 未加载
评论 #4125299 未加载
评论 #4159751 未加载
评论 #4127977 未加载
评论 #4126019 未加载
评论 #4126231 未加载
评论 #4125472 未加载
Irfaanalmost 13 years ago
I think I see a way of shaving another byte:<p>instead of "0&#60;x%n&#38;", you should be able to do "x%n&#38;&#38;". Works for me on Chrome.<p>My goal is to shave 2 bytes, so you can change the key handler <i>back</i> to onkeydown. :P
评论 #4126111 未加载
评论 #4125586 未加载
groaneralmost 13 years ago
Is this supposed to be Tron or Snake? I distinctly remember Tron being a multiplayer game, with the mechanics such that moving along a wall or trail increases your speed, putting you in position to cut off the other players and make them crash.
评论 #4125661 未加载
评论 #4125525 未加载
chrisbroadfootalmost 13 years ago
I would save 2 bytes by changing<p><pre><code> n=150,x=11325 </code></pre> to<p><pre><code> n=632,x=1e6 (or similar) </code></pre> This increases the board size to 632x632 and saves 2 bytes, which can be used to use <i>onkeydown</i>.<p>I suppose you only start approximately in the center, though.
cstuderalmost 13 years ago
The code documentation part is a quite clever use of a slide tool. Very enlightening.
unimpressivealmost 13 years ago
Encountered a bug: When I die, the game keeps counting score as my "dead" player keeps going across land behind the scenes.
评论 #4125310 未加载
zrgiu_almost 13 years ago
Here's a question for you: how will this look on the new Mackbook Pro with Retina Display ? The tron line is 1px wide, and on that computer's screen the one pixel is too small to see.
评论 #4126363 未加载
评论 #4125454 未加载
评论 #4125459 未加载
AlexFromBelgiumalmost 13 years ago
I read 'j' 'k' 'l' and thought "Sweet! Vim controls"<p>Not... :(
评论 #4146351 未加载
julesalmost 13 years ago
Cool, but due to limitations of the human mind it's almost impossible to play without QWERTY.
odddogmediaalmost 13 years ago
It's really cool to see how you've come up with tron in just 219b.<p>You mention saving 11 bytes, bringing the total to 212. Then another 9 (seemingly making it 203). But go on to say you saved 2 more bytes, making it 219. I'm confused.
评论 #4125443 未加载
creamyhorroralmost 13 years ago
I can't see the white line in my browser, just a square of black. I know it's working because I get "game over" if I start the game with i, j, k or l. I'm on Firefox 14.0. Do fix it.
评论 #4125488 未加载
评论 #4125977 未加载
ohadpralmost 13 years ago
beautiful.<p>i once participated in a similar competition only that it was in x86 Assembly, my friends and I brought it down to 70 bytes and the winner from Finland did it in 48!<p><a href="http://myweb.cableone.net/benlunt/hugi/compoold.htm#compo1" rel="nofollow">http://myweb.cableone.net/benlunt/hugi/compoold.htm#compo1</a>
dekzalmost 13 years ago
You have a typo in the first sentence, 'exercice'. I like your presentation of code walk throughs with slides.
评论 #4126044 未加载
epagaalmost 13 years ago
Clever stuff, thanks!<p>typos: "exercice" -&#62; "exercise", "brining" -&#62; "bringing"
评论 #4126052 未加载
yowmamasitaalmost 13 years ago
219b for a buggy Tron game. my score keeps going up on game over screen
anootheralmost 13 years ago
Why are the control reversed (mirrored)? Is that normal?
评论 #4126063 未加载
vhfalmost 13 years ago
Score doesn't work properly on my chromium. After game over, hitting keys makes me score more points.
评论 #4125659 未加载
bousquetcmalmost 13 years ago
so... we don't like Chrome? Bc it's not playable and I don't feel like opening FireFox.
itsbitsalmost 13 years ago
219 bytes makes it look gr8 work but lot of bugs...
评论 #4126071 未加载