Home > clojure > Regenemies: A very simple game in Clojure

Regenemies: A very simple game in Clojure

February 26th, 2012

Lately I’ve been working on several things in Clojure with the goal of getting a better handle on general app development as opposed to library dev. Working on Seesaw and other libraries is fun and an interesting challenge in API design, but wrapping up Java interop is quite different from building a functioning app.

Anyway, one of my little experiments is a game called Regenemies. A long time ago a friend and I had the idea for “regex invaders” where regular expressions fall down the screen and you have to type in matches for them to “kill” them as fast as you can. Well, I finally got around to it this weekend. The whole falling regex thing didn’t work that well, so I opted for just showing 1 or more expressions in a grid, each with a little countdown timer to tell you how long you’ve got.

The game itself isn’t really that fun. In fact, it’s a little stressful since every missed pattern is a strike against your skills as a programmer, and therefore, your worth as a human being. But it was a useful exercise in building up the game representation and defining state transitions in a mostly functional way.

The UI, which is rudimentary in the extreme, is currently implemented in Seesaw, but I will probably give porting it to ClojureScript and canvas a try.

The game is hosted via JavaWebStart here, the code’s on github, and here’s a screenshot since people like those:

Comment and criticism welcome, especially on the game state representation. Regex generation could also use a little more love as well.

clojure ,

  1. February 27th, 2012 at 00:29 | #1

    Cool stuff :)

  2. February 28th, 2012 at 10:20 | #2

    It makes me think of Typing of the Dead. http://en.wikipedia.org/wiki/The_Typing_of_the_Dead

  3. March 12th, 2012 at 10:00 | #3

    I love this idea! I tried it, and I only had a couple ideas:

    1) it would be great to get an example of a string that would have worked if you fail… that way it is still “educational”. Otherwise I never get better.

    2) something worked in to scale the difficulty… if you keep sucking, either adjust the timeout, or length of regexes or something.

    just ideas.

    Thanks for a great idea!

  4. January 7th, 2013 at 11:54 | #4

    haha, great idea, this is fun.

  1. No trackbacks yet.