Art is Art and Water is Water

May 16, 2010

April Game: IRC scramble + pank

Filed under: Month Games — foone @ 7:03 pm


<Foone> bot: game scramble
<bot> Unscramble this word: holelwob
<Foone> holebowl
<bot> Here's a hint: b.......
<bot> Here's a hint: blo.....
<Foone> blowhole
<bot> Foone: You got it! (blowhole)

For my April game, I added game support to my IRC bot. I’d been meaning to do this for a while, to replace a word scramble game that had been on a retired bot.
Instead of hardcoding the game (Which would have been a mess) as its own module, I wrote a generic game-playing module to abstract away some of the annoyances of IRC and the IRC bot framework I used. This’d let me write games in a very simple style, without having to care much about how the framework worked. The main annoyance with using the framework as-is is that it is designed on a very simple stateless almost-CGI style. You get a function call when someone says something that matches a regex, and you need to return fast because if you don’t you’ll prevent other handlers from running. Not exactly optimal for a long-running game module which does things like waiting for 30 seconds for a user to say something.
So I wrote a framework, where a game can be started and this creates a new thread. Anything said while the game is running goes into a buffer, and the running thread simply waits on new input from the buffer (with easy specifications of timeouts, to make things like “quit if no one answers in 60 seconds” very easy to implement.

I implemented a simple word scramble game and a bastardized version of Blackjack (called “pank” for some reason) on top of it. I also added centralized score storage, so you can get your lifetime score at descrambling words.

Advertisements

1 Comment »

  1. […] scramble/pank […]

    Pingback by Game Inventory « Art is Art and Water is Water — November 1, 2010 @ 8:47 am


RSS feed for comments on this post. TrackBack URI

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 )

Google photo

You are commenting using your Google 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 )

Connecting to %s

Blog at WordPress.com.

%d bloggers like this: