Monday, March 10, 2008

iPhone Freecell

This isn't quite up to par with Apple's latest iPhone SDK announcements, but I think people will like it anyway. Besides, you can't really get your hands on iPhone SDK games until June unless you work for Apple or are lucky enough to get into the Beta program for the SDK (fingers crossed). Plus this is a pretty good first post to my blog.

Below is an iPhone port of Michael Kohn's Freecell that he wrote in javascript/dhtml for the PSP. His version worked unaltered, but I converted it to a data:URI bookmarklet. The other changes I made make the game automatically fit the iPhone screen, and make the bookmarklet smaller, by replacing the suit images with text, dynamically generating the cards, etc. It ends up being about 13K.

You can load this on your iPhone, and bookmark it or add it to your home screen. Since the entire game is contained in the URL, it runs with no network connection. This saves on battery life by not running the radios, and lets you play where you can't get a connection, like on an airplane, or in the South.

If you want the source code, fire it up in Mozilla, Firebug is a great extension. This version works in pretty much every real web browser, including Safari, Mozilla, and Opera. Interwebs Exploder won't support data:URIs until version 8, but Mike's original version should run on it.

Here is the game in all its glory:

I think that everyone will agree that it is pound for pound, the best game out there for the iPhone.

I remember back when I was a kid, a computer magazine for the TRS-80 had a contest to make the best 1-line BASIC game. The results were amazing. My favorite was a scrolling race game, where the road wound back and forth, the scenery changed, and the road got narrower as the game progressed. 

I haven't found that code anwhere on the Internet, perhaps my dad still has his collection of 80 Micro and 80 Microcomputing magazines. Recently there was another contest, to write a Tetris clone in 1 line of BASIC, not for the TRS-80, but another machine popular in the UK. I didn't fire up an emulator and play it, but the results looked impressive.

I think its time for a modern interpretation: A programming contest for a browser-based game that fits entirely on a URL. Javascript is the new BASIC and the URL is the new line. I'm not sure what the rules should be just yet, I am still soliciting ideas. At a minimum there would be an iPhone category, but if there's enough interest there could be others. 

1 comment:

terning said...
This comment has been removed by the author.