Re: The 140 character webapp challenge

Reading a friends blog post, I found out about a challenge for making a web app in 140 characters or less.

In Wikipedia you read:

In software engineering, a web application or webapp is an application that is accessed via web browser over a network such as the Internet or an intranet. It is also a computer software application that is coded in a browser-supported language (such as HTML, JavaScript, Java, etc.) and reliant on a common web browser to render the application executable.

So this is what I could come up with: just paste the following piece of code (140 characters) in a file with a .html extension, open it with a browser and you have a crude number guessing game:

<script>function
x(){if(confirm("odd?")&&((Math.floor(Math.random()*10))%2))alert(":)");else
alert(":(");if(confirm("rpt?"))x()}x()</script>

The browser calculates a random integer and asks you if it is an odd numbers. If your answer is correct it returns a smiley (or a frown if you’ve guessed wrong). Finally it asks you if you want to repeat the game and if you choose “ok” the whole thing starts over again.

You can save many characters by omitting the loop. Also you can save 10 whole characters by having the browser randomly choose “1” or “0” and asks you to guess between them.

<script>function x(){if(confirm(“1?”)&&(Math.round(Math.random())))alert(“:)”);else alert(“:(“);if(confirm(“rpt?”))x()}x()</script>

Advertisements

3 thoughts on “Re: The 140 character webapp challenge

  1. Pingback: ioannis cherouvim » Blog Archive » Re: The 140 character webapp challenge!

  2. Just found your code on the webapp challenge. I just liked to point out that your 132 chars 1 or 0 game could have been wayyy shorter.
    For example Math.Floor(…) is pointless since “>0.5” would have done the trick with 5 less characters.

    So a shorter version of this could look like this (hope the blog won’t screw it):
    a=confirm;while(1){alert(a(‘1?’)&&Math.random()>0.5?’:)’:’:(‘);if(!a(‘rpt?’))break}

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s