Rocking the blogosphere
Apple Online Store

Emacs Poker

A few weekends ago, I had been reading about Lisp and decided that I should try to write something semi-interesting to cement my knowledge. So I fired up Emacs and started messing around and this is what came out of it.

Emacs poker screenshot
Emacs poker

It’s a simple video poker game like the kind that you play in Vegas. It doesn’t take bets or keep any kind of running score and there’s no support for wild cards, but I figured I’d see if more than 3 people download it before I started adding more features.

My observations from writing this:

  • Programming in Lisp is fun. Especially when using Emacs and SLIME. Being able to redefine things on the fly is very powerful.
  • Lisp seems to be a pretty good fit for this type of game. There’s a lot of power in lists and recursion was pretty natural for the functions that determine what kind of hand you have.
  • There are a few small irritating little differences between Common Lisp and Emacs Lisp. For instance, the format function takes different arguments and in Emacs Lisp, I had to use lexical-let in order to get a closure. This is because Emacs Lisp predates ANSI Common Lisp.

Writing GNU Emacs Extensions: Editor Customizations and Creations with Lisp (O\'Reilly Nutshell)

Del.icio.us Digg Reddit Technorati

Possibly related posts

Comments

  1. Greg
    April 17th, 2006 | 10:22 am

    Let the Emacs -vs- VI battle begin!

    Nice job though, Lisp is fun.

    –greg.

  2. Dennis
    April 17th, 2006 | 11:11 am

    Anyone who wants to start that battle better come prepared with code that implements poker in vi ;)

  3. Felipe
    April 17th, 2006 | 1:55 pm

    Pleaaaase add more features! :)
    Nice way to learn Lisp…I am on this path myself, so maybe I will come with something as cool as this.I hope.

  4. Marc
    April 17th, 2006 | 2:56 pm

    What features would you like to see?

  5. G.
    April 18th, 2006 | 1:00 am

    Well, I do play tetris in Vi..

  6. April 26th, 2006 | 12:01 pm
  7. Jonathan
    May 22nd, 2006 | 9:05 am

    I got it from EmacsWiki, but in order to run it, I needed to add (require ‘cl) to the file, otherwise setf wasn’t defined. Cool program!

  8. September 22nd, 2006 | 2:36 pm

    Didn’t know the o’reilly book. So thanks for that hint. :)

Leave a reply

Apple Online Store
Apple Online Store