banner_gamerz.gif (6081 bytes)

For those of you who have an interest in implementation of pbmserv modules...

My PBeM Server is implemented as a series of scripts/commands.

When mail is received by pbmserv@gamerz.net, it looks for the subject line to tell it what to do. If it is not an administrative command (signup, change password, list, etc.) it looks to see if it has a games of that type defined (currently trax and twixt). If so, it executes the command specified by the subject line.

The PBeM server script also sets a couple of environment variables that are inheritied by the game commands: INPUTFILE name of the file containing the message being processed LOGFILE name of a log file SENDER email address of the sender FROM Name of the sender (if known)

The pbmserv script itself is written in perl.

    	Subject: fetch.2 pbmserv.pl
    

will retrieve the script.

It is up to the individual game implementations to keep track of whatever they need. However, Soren and I have implemented a series of C++ classes that will make implementation of additional pbmserv modules easy.

All PBeM stuff is located under the $PBMHOME directory

        $PBMHOME
    		/etc		misc PBeM files
    		/bin		command executables
    		/games	
                            /Ataxx
                            /Trax
                            etc.
    		/history	history files
    		/ratings	ratings files
    		/standings	standings files (for tournaments)
    		/help		help files
    		/src		source code
    		/src.2		source code (for the 2nd generation pbmserv code)
    

All games *must* support a 'list' command to show what games are on-line (both current and recent past). 'show' and 'preview' commands are nice. 'standings' is also nice. 'challenge' allows two players to begin a game. Most of these commands are handled by the generic "Game" class. The important parts are

    	Init()			-- initialize the board
    	MakeMove()		-- validate the move, and apply it to the board
    	PrintBoard()	-- display the board
    	IsGameOver()	-- is the game over?  who won?
    	MustSkip()		-- can the current player make a move?
    	ForcedMove()	-- is the current move forced?  if so, what is it?
    

To get a sample implementation (Ataxx is a good example), send pbmserv a fetch.2 request...

    	Subject: fetch.2 game.h game.cpp board2d.h board2d.cpp ataxx.h ataxx.cpp
    

Known bugs in the current implementation include 1st move resignation not resulting in a board "cancellation", and simultaneous move forfeits are not necessary handled correctly.

--Richard

apache_pb.gif (2326 bytes)