This is a miniature version of the classic Frogger arcade game. It is written in the smallest amount of JavaScript that I could squeeze it. The core logic of the game is a single function that fits in less than 140 characters.
#OO##OO##OO# O Lilly pad
~~==~~~~==~~ ~ Water
~~~~====~~~~ = Log
:::::::::::: : Grass
............ . Road
..##...##... # Truck
.....@...... @ Frog You
:::::::::::: : Sidewalk
Left Arrow = Move left
Right Arrow = Move right
Up Arrow = Move up
Down Arrow = Move down
The update function is the core logic of the game. It processes all game data for the next display frame. This is the function that I am trying to minimize. I realize it's cheating a bit to ignore the size of the outer script, but it's the benchmark I have chosen since the display mechanism is arbitrary and less important, for my purposes.
The update function can be stripped of white-space and formatted to in less than 140 characters of text which is small enough for tweeting etc.
See my other games:
Btw: to make it a valid entry for http://140byt.es you should avoid leaking to the global scope, (such as
H
,t
,V
, ...).But impressive anyway!
Update: This should fix the global scope:
It's 144 bytes so how do we get rid of 4 chars here?
Update 2: Hmm, when passing the vars as arguments, we have no chance to override them outside.