Due date: Tuesday, April 17, by 11:59pm
This is the last of three projects to build an online chess game. This project focuses on setting up the networking to allow two players to play online (or to allow one player to play online against a computer opponent).
You are encouraged to build upon your first two projects, the Chess Board and Shallow Blue. If your first project really did not go well, contact the instructor for how to proceed.
Note: As for the first two projects, this project is to be done individually!
You are to enable your chess game to be played online. To do this, you will construct a client-server architecture where a player runs a client and connects to a server for online play. All communication is to and from client and server (ie- there is no client-client communication).
In the online version of the game:
As for the first project, you are free to implement your game in your choice of language (C, C++, Java, ...) using networking libraries, if you wish. You should use a language you are familiar with as you don't want to spend too much of your development effort fighting with the language.
You should think about the communication between server and client. Below is a simple, client-server chess protocol that should have most of the basically functionality you can use:
For the above protocol, a MOVE message is in the format of FROM:TO, where FROM and TO represent squares on the chess board. The rows of the chess board are numbered 1-8 and the columns a-h, like so:
As an option, the server could add a check if total time elapsed was too great. If so, the offending player would forfeit. A typical chess tournament allows about 2 minutes per move for the first 40 moves, and then 30 minutes for the rest of the game after. Note, this is not a requirement, just a suggestion. Options such as this, or others, could be specified when the server starts up via command line or a configuration file.
The chess links from project 1.
Here is some sample code showing a basic client and server in Java:
SocketServer.java
, SocketClient.java
Here is some sample code showing system calls that you may find helpful for C++ code in Windows. Some must be used while others may be used depending upon your implementation:
sockerr.h
tcp-talk.cpp
, tcp-listen.cpp
udp-talk.cpp
, udp-listen.cpp
getIPaddress.cpp
Here is some sample code showing system calls that you may find helpful for C++ code in Linux. Some must be used while others may be used depending upon your implementation:
talk-tcp.c
, listen-tcp.c
talk-udp.c
, listen-udp.c
setitimer.c
add2.c
-
add and subtract to a variable protected by a mutex (compile
with -lpthread
)
select.c
get-opt.c
Use the man
command to find out additional information
on the system calls used.
All assignments are to be submitted electronically via turnin by 11:59pm on the day the assignment is due. Turnin of code should include all the support files to allow your game to be built, along with detailed instructions on platform, libraries, etc.
The turnin should include a README with brief notes on how to run the server and client. It should detail any command line parameters for either. Also, notes on how a game against the AI is launched (as a separate client or on the server) should be included. Include information on where the system was successfully run.
The easiest way to submit your game is to zip the files, including the sub-directory. For ease of grading, call the sub-directory your_last_name-proj3 (ie- claypool-proj3), creating a proj3.zip file.
You will need to upload the file you are turning in to your CCC account on one of the CCC machines (ccc1 to ccc10). While logged into a CCC machine, you will need to enter the directory where these files are stored and execute the following:
/cs/bin/turnin submit <course> <assignment> <file1> <file2> ...
where in our case, <course> is imgd4000, <assignment> is project2, and <file1>, etc. are the files to be turned in. So for example, you might enter:
/cs/bin/turnin submit imgd4000 project3 proj3.zip
Following this, you should verify that your files have been entered into turnin by executing the following command:
/cs/bin/turnin verify imgd4000 project3
Grading Guidelines | ||||||
---|---|---|---|---|---|---|
Basic Client-Server | 65% | Chess server manages basic game. Two human clients can connect and play. | ||||
Legal Move management | 10% | Server manages state by verifying that client moves are legal. | ||||
Persistent Server | 5% | Server persists after each chess game has terminated. | ||||
Online AI | 20% | Online AI implemented, either by allowing client to play as computer-controlled opponent or having AI to run at server. |
Send all project questions to the TA mailing list (imgd4000-ta at cs.wpi.edu).