tkMOO-light

Experimental Chess Game Application

This is an attempt to understand what it takes to make the client support a useful game of chess (short of remote controlling an xchess session!). The result is about 300 lines of Tcl and 200 lines of MOO code. The Tcl code provides the interface between tkMOO-light's XMCP/1.1 module and the stateless chess client. The MOO code provides the only persistant state for the game, the client's internal state is entirely reset with each request from the server to update the board. This approach also greatly simplifies the client code.

On a separate note, I thought it would be a nice idea to make the interface as realistic as possible. Everyone knows the rules of chess so there's no internal checking to see if the moves made are legal, which greatly simplifies the code. In short, people can cheat, so it's important that you keep an eye on what your opponent is up to! I've stopped short of modelling each piece as a separate object, ie: just pieces being moved around on a surface, which would be the most realistic form of this program.

XMCM/1.1 message format

Information about the state of the chess board is passed from server to client by a single authenticated XMCP/1.1 message chess-board containing the following fields: In this example, the fields of the message appear on separate lines for the sake of clarity. In real life this message would be a single line of text.
    $#$chess-board 29360152 
        object: #269 
        board: RP....prNB.P..pn.P....pbKP....pkQP....pqBPN...p..P...p.nRP...bpr 
        turn: 0 
        colour: white 
        sequence: 5 

Server-side support

The chess widget relies upon a MOO Chess Board object. The source code for such an object is available.

Possible Improvements

It'd be nice to have an undo feature, and be able to play games from a preloaded starting state, rather then just a regular game.