A move consists of a Source (SRC) and a Target (TGT). The source is
the starting position of the piece being moved while the target is a list
of positions where the piece has landed. Note that the target list
may have length of more than one, as a piece can jump over multiple pieces.
Getting and running the server
To run the server you must first download the following java classes.
BasicRules.class
Board.class
CheckersGame.class
CheckersServer$SymAction.class
CheckersServer$SymWindow.class
CheckersServer.class
ComputerMoveTranslator.class
HumanMoveTranslator.class
InvalidMove.class
Move.class
MoveTranslator.class
Piece.class
Player.class
SocketCommunicator.class
Timer.class
These files are all included in the following tar file:
CheckersServer.tar.gz
Once you have the files, you run the server by typing:
java CheckersServer&
A window should pop up, and you are ready to start.
To play Checkers using the CheckersServer
Human vs. Human
To play with two people, simply choose that option from the menu and click
on begin. The red player gets to move first. To make a simple
move (no jump), first click on the piece to be moved, then click on the position
where it should move to. To jump over a single piece, click on the
piece then click on the space it will land on. If the jump captures
more than one piece, then the intermediate squares must be chosen by right
clicking on them. If a player tries to make an illegal move then an
error message is given, and the player must try again.
Human vs. Computer
Select Human vs. Computer from the menu. The human will play as described
above.
A perl script (
CheckersInterface.pl
) is used to interface between the server and the checker playing program.
This script was also included in
CheckersServer.tar.gz
.
Once Human vs Computer has been chosen from the menu, the port which the
server will communicate with the program is displayed. At this point
the following command must be run
perl
CheckersInterface.pl <name of machine running checkers server> <port>
<name of main class of computer prog>
Click on begin to start. Remember, the red player moves first. This
is assigned randomly to either the program or the human.
Computer vs. Computer
This is similar to Human vs Computer except that two ports are displayed.
Run the command listed above twice, with the appropriate parameters.
Time Limits
The server's default is to specify no time limit for the game. However,
there is an option in the menu that lets one enable a 5 minute time limit
for each player. Note: For the tournament, the time limit will be enabled.
Communication Between CheckersServer and your Program
From the perspective of your program, communication is very
straightforward. The server writes all pertinent information into a
specially formatted file with the same name as the port number. Here
is a sample file:
(setq whose-turn 'player)
(setq move-count 0)
(setq time-left 0)
(setq opponent-prev-move '(9 14))
(setq the-board '(p p p p p p p p p p p p e e e e e e e e o o o o o o o o
o o o o ))
We provide a class that parses this file and gets the useful information.
To send a move to the server, your program must format the message correctly.
(Again, we provide methods for doing this -- see the documentation of
Helper class for the random player).
Assume that your program wants to move piece at position x to position y.
Then it must print the following line to stdout
(SEND-MOVE-TO-SERVER x y)
If your program wishes to make a jump it uses a slightly different format.
Assume that the piece is originally at position x, jumps over position o,
and lands at position y.
Then the message must be
(SEND-MOVE-TO-SERVER x (y))
If the piece is making a longer jump (for example over two pieces) then the
format is
(SEND-MOVE-TO-SERVER x ( y1 y2))
where y1 is the first position it lands, and y2 is the final position
it lands on.