A 'Tron' JavaScript game in just 219 Bytes

Discussion in 'General Undergound Newz' started by GaryOPA, Mar 30, 2012.

By GaryOPA on Mar 30, 2012 at 9:43 AM
  1. 21,879
    1,924
    113
    GaryOPA

    GaryOPA Master Phoenix Admin Staff Member Top-Dog Brass

    Joined:
    Mar 18, 2006
    Media:
    16
    Occupation:
    Design Eng.
    Location:
    Tropical Island
    Home Page:
    'An exercise known as javascript golfing'.

    [​IMG]

    This is the smallest possible game of Tron written in JavaScript. Try it out and see the code by yourself inside.

    Well, if you are already tired of the 140-Bytes Tetris JavaScript game, you can try another one. Some programmers managed to make the smallest possible game of Tron, also written in JS.

    Here are the game 'rules':

    Well, as you can see, apparently it only runs on Chrome 17. And finally, here's the game code:

    Code:
    <body id=b onkeyup=e=event onload=
      z=c.getContext('2d');
      z.fillRect(s=0,0,n=150,x=11325);
      setInterval("
        0<x%n
        &x<n*n
        &(z[x+=[1,-n,-1,n][e.which&3]]^=1)
          ?z.clearRect(x%n,x/n,1,1,s++)
          :b.innerHTML='gameā¬œover:'+s
      ",9)
    ><canvas id=c>
    
    Very impressive. You can try it at the link below!

    OFFICIAL SITE: http://alokmenghrajani.github.com/tron/

    NEWS SOURCE: http://developers.slashdot.org/story/12/03/25/1442228/javascript-game-of-tron-in-226-bytes

    Our thanks to 'Gauss' for this news story!
     

Comments

Discussion in 'General Undergound Newz' started by GaryOPA, Mar 30, 2012.

Share This Page