My first “weekend hack” of the year is up. It’s an online game of Go; you can play with your friends via email.
So, what’s a “weekend hack,” and why Go?
The intent of a “weekend hack” is to build something small, but useful or fun. It won’t change the world; it needs to be small enough to fit into a weekend of coding. It should force you to learn some new technologies. And, most importantly: it should ship on Monday with a reasonable degree of polish – it won’t be perfect, of course, and it might even be buggy. But it must ship.
I chose “Go” as my first project for two reasons.
First, my parents got me a beautiful Go set for Christmas, along with series of Go instruction books. I’m not sure why they decided to do this, because prior to Christmas I’d played two games of Go in my life – but I sort of feel guilty enough about the awesomeness of the gift (thanks, Mom) to at least learn the basics.
Second, I’m giving a talk next weekend on the promise and practice of Google’s AppEngine. It seemed like a perfect platform on which to build this “hack.” For a toy application like Go, AppEngine grants me care-free scalability and it probably won’t ever cost me a penny to maintain the app. That’s just swell.
Howd it go?
I planned this project out a few weeks in advance. I listed as many fine-grained tasks as I could think of in Cultured Code’s Things, a solid task-manager for the OSX world. On Friday evening I collected the artwork (lifted and altered from the Wikimedia Commons,) sketched out the basic flow in a notebook, and got the splash screen and registration pages looking right. On Saturday, I got all the registration machinery complete; this required building the underlying data structures for the game and board. Along the way, tons of new fine-grained tasks accumulated, and I dutifully entered them into Things. By Saturday evening I had the board displaying and emails were sent out to users. Sunday was all about getting the gameplay finished, including atari and capture detection. This ended up requiring major surgery on the structures I’d built just the day before. There was an extra unexpected hour at the end while I grappled with AppEngine’s restrictions on email sender addresses – originally, players were supposed to email each other.
There are a lot of tasks I didn’t get to, two of which I thought were essential to making things great, and the rest of which I labeled “stretch” at some point on Saturday or Sunday. The two “essential” features I cut tonight:
1. Enforce the rule of Ko 2. Add re-captcha to the sign-up page
The rule of Ko is subtle and good Go players are polite about it, but I want to enforce it explicitly for novice players. The captcha is for my protection: I’d hate to have the service spammed out of AppEngine quota.
As for the remaining goals, they were all originally part of the plan, but as time moved on I understood they had to be cut:
1. Automatically determine the winner after the game is over 2. Notify players of all ataris, not just recent ataris 3. Support "history" 4. Allow users to "speculate" by placing temporary stones 5. Support log-in to see all your games 6. Facebook integration
The first isn’t as bad an omission as it might seem; Go players are friendly and games are often decided by verbal agreement. As for “history” and “speculation”: the underlying infrastructure keeps track of the entire game’s history and provides a board branching mechanism, so it shouldn’t be a huge amount of work to support these in the future.
Alright, that’s all – go play go and let me know what you think.