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)

8 thoughts on “Emacs Poker

  1. Let the Emacs -vs- VI battle begin!

    Nice job though, Lisp is fun.

    –greg.

  2. Anyone who wants to start that battle better come prepared with code that implements poker in vi 😉

  3. 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. 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!

Leave a Reply

Your email address will not be published. Required fields are marked *