Free Website Tips

I read a lot of website advice every day. The best of that advice I wish everyone knew. Brainstorm! Let's put the greatest advice in quick tips. Usually I see a really good tip every few weeks. Remember to act on the tips - they are short so it should be easy.

Recent Twitter Posts

    Clients Include

    United Nations

    Center for Interpersonal Effectiveness


    Coram Deo Consulting Group


    Benchmarx

    Installing the Crafty chess engine on Debian Lenny

    Warning: Very technical matters here - we're combining hardcore Linux nerd-dom with guru chess programs.  Geek overload!

    One of our clients is a National Chess Master.  He's pretty good at chess.  The kids he and his staff coach are half decent.  They used to beat me, but they don't anymore.  That's because I won't play them anymore.  I'm a bit competitive so it isn't good for my psyche.

    A couple years ago we built an online chess training program called E-School which includes videos, multiple-choice questions, and even puzzles.  Now we're building something even bigger.  We want to create a place where their chess students can play other students online - or if nobody else is around, they can play a computer.

    We like to build on existing, open-source work so we don't have to reinvent the wheel.  In this case we needed a chess-website framework (more about that in another blog post perhaps) and a really strong chess engine.  Remember, this chess engine had to be really strong, because these kids are really good.

    Fortunately, just the thing exists and is called Crafty.  It is the brain-child of Professor Robert Hyatt at University of Alabama at Birmingham.  Along with a team of smart programmers he's created a powerful chess engine that ranks quite strongly in computer chess championships (yes, they exist).  Even better, he's made it available for others to use!

    Alright, in to the nitty gritty.  I've spent time this last week setting Crafty up on a Debian (Lenny) cloud server (from VPS.NET).  There are two things that make it a bit tricky to install on Debian Lenny.

    1. Crafty lives in the Non-Free world of Debian packages.
    2. Only Squeeze (Lenny's successor) has a stable Crafty package.

    Fortunately, some easy (thanks, Google!) solutions exist - even for a non-sys admin like myself!  And in this case a single step solves both of these issues.

    Adding Non-Free Packages to apt-get for Squeeze

    We need to tell apt-get to look in the non-free branch of Debian packages.  To do this, we add our URL to the file /etc/apt/sources.list.  Open that up in your favourite Unix editor as below:

    vim /etc/apt/sources.list


    Then add a line to the bottom saying something like:

    deb http://host/debian distribution section1 section2 section3
    deb-src http://host/debian distribution section1 section2 section3


    In this case we want to add the non-free section for Lenny:

    deb http://ftp.us.debian.org/debian/ lenny non-free
    deb-src http://ftp.us.debian.org/debian/ lenny non-free


    But wait, Crafty doesn't live in Lenny!  So we just switch that to Squeeze...

    deb http://ftp.us.debian.org/debian/ squeeze non-free
    deb-src http://ftp.us.debian.org/debian/ squeeze non-free

     

    Updating apt-get and installing Crafty

    Now that we have apt-get's new source in place, let it know that these new packages exist by running:

    apt-get update


    Once this is finished, all it takes is:

    apt-get install crafty


    A number of supporting packages were required for my install, and they all used their respective Lenny versions without a hitch.  There was an SSL version issue which I imagine was likely due to pulling from Squeeze packages with Lenny installed, but ignoring it didn't cause an issue for me.

     

    Finding and running Crafty on Debian

    Now it is installed beautifully.  But where is it?  From reading only you'd expect it to be found in /etc/bin/crafty.  However, at least for me, that didn't do the trick.  Instead a quick call to whereis found it for me:

    whereis crafty
     

    There it was!  Hiding in /usr/games/crafty.  Now I could run it and play to my heart's content:

    /usr/bin/crafty
     

    Receive the Crafty prompt for my first move:

    white(1):
     

    And of course, good 'ol:

    white(1): e4
     

    I'm guessing a few times losing to Crafty and I'll start taking the same approach as I do with our client - not playing anymore! Fortunately, with Crafty there are a lot of configuration options available to dumb it down.  You can find all of these over at Dr. Hyatt's command documentation page.

    Enjoy playing and feel free to post any questions or issues you run into below!