Forgot your password?
typodupeerror
Chrome Classic Games (Games) Programming Games

Javascript Game of Tron In 226 Bytes 115

Posted by timothy
from the tattoo-sized dept.
Have you upgraded your hardware to play something beefier than 140-byte Tetris? New submitter alokmenghrajani writes with "a detailed view of how we size-optimized a game of Tron to just 226 bytes." It's also optimized for Chrome, and very fast.
This discussion has been archived. No new comments can be posted.

Javascript Game of Tron In 226 Bytes

Comments Filter:
  • by TheGoodNamesWereGone (1844118) on Sunday March 25, 2012 @12:00PM (#39466525)
    1KB Chess for the Sinclair still has that beat.
  • Re:Damn. (Score:5, Informative)

    by TheRaven64 (641858) on Sunday March 25, 2012 @12:14PM (#39466635) Journal
    Works fine in Safari. That said, if you press a key other than ijkl it does something random. I assumed wasd would work, and was very confused until I read the instructions. It's also single player, so you basically drive around until you hit your own wall - there's no way of winning. It's more a drawing program with a crappy UI than a game. Making it only 226 bytes of source isn't that impressive, it's basically:
    • Change direction if key is pressed
    • Test if pixel next in that direction is white, if so exit
    • If not, set it to white, set current location to that address
    • Repeat.

    I wouldn't be surprised if you could write the same game in under 226 bytes of Z80 or 6502 assembly, so doing it in a high-level language seems much less impressive.

  • by lobiusmoop (305328) on Sunday March 25, 2012 @12:21PM (#39466701) Homepage

    Actually it was only 672 bytes - the 1024 byte memory had to include the screen memory also, much like shared video memory today - could take up to 768 of the 1024 bytes for a full 32x24 screen! (the chess game only used an 11-line screen for the board etc)

    And it's even considered by some to be the greatest program ever written. [kuro5hin.org]

  • 2 player? (Score:5, Informative)

    by Ambitwistor (1041236) on Sunday March 25, 2012 @12:25PM (#39466735)

    It's not really a game of Tron without a competing lightcycle. (Without fruit, it's not really a game of Snake either.)

  • Re:Controls? (Score:3, Informative)

    by Anonymous Coward on Sunday March 25, 2012 @01:08PM (#39467067)

    IJKL instead of WASD or arrow keys. It saves space because IJKL is actually in alphabetical order, which makes it a neat modulus away from being the four directions.

  • by Juippi (416370) on Sunday March 25, 2012 @01:34PM (#39467271)
    This was fun, because I got pretty much the same thing down to 56 bytes in x86 assembly some 15 years ago. I remember the best entry in the competition I wrote it for being around 48 bytes or so; I missed at least one trick for setting the graphics segment more efficiently, and also something related to either collision handling or keyboard input, don't remember which.
    In any case, this [pastebin.com] is possibly the right version of the code. Should compile with NASM, and is even playable in Dosbox with arrow keys if you turn the emulation speed as low as it can go.

The world is moving so fast these days that the man who says it can't be done is generally interrupted by someone doing it. -- E. Hubbard

Working...