Building a Game With a Tweet of Code

Screen Shot 2015-06-30 at 9.14.56 AM

A standard video game relies on a mountain of code, painstakingly pieced together by an army of programmers and developers.

Then you have Tiny-Twitch.

Inspired by a challenge from Australian game designer Ben Porter, developer Alex Yoder decided to create a game using 133 characters’ worth of JavaScript and HTML, like so:

[html]

<script>var e,s=0,t=Date.now();function f(){((e=Date.now()-t)<15000)?a.style.margin=++s+e%300:alert(s)}</script><p id=”a” onclick=”f()”>X

[/html]

The game itself is simple: A black “X” appears on your screen. When you click it, the “X” appears in another place. If you’re very easily amused, you could probably spend hours chasing that little digit around. Sure, as a piece of digital entertainment, it isn’t exactly Arkham Knight, but as an example of elegant coding, it’s pretty hard to beat.

Image Credit: Alex Yoder

Post a Comment

Your email address will not be published.