CS 580 Client-Server Programming
Spring Semester, 2006
Chess Project
© 2006, All Rights Reserved, SDSU & Roger Whitney
San Diego State University -- This page last updated 3/1/06
Chess Project Description
We will build a client-server system to allow people to play chess remotely. There are a number of existing systems that already do this. Two well know systems are the Free Internet Chess Server (FICS) and the Internet Chess Club (ICC). Our goal is to use this system to learn more about building client-server systems.
Chess Background
There are numerous book and on-line articles that help one understand the basics of chess. Here is a link to a pdf describing the rules of chess . There are several notational systems used to record chess games. We will use the algebraic, which is also called the english algebraic, notation. Here is a long and a short description of the algebraic notation. We need to know how chess players are rated. There are a number different ways to rate players. We will use the Elo system. Here is a detailed and a short description of the Elo system. Some chess games are timed, so here is some information about timed chess .
Functionality
Two players, each using a client, can play a game of chess. How a player indicates the move is up to the client. Once a move has been made the move, in algebraic notation, is sent to the server, which will send it to the other player. In a Daily game (see below) the move is sent via email, otherwise it is sent to the other player's client.
Before a user can play a game they need to register providing a user name, password and an email address. User names and email addresses can not be duplicated. Before a user can play a game or request to play a game a user has to log on to the server.
The system maintains players ratings. That is when two players finish a game of chess, each of the players rating is updated. We will only track games played with the system. New players start with a rank of 1200. In the Elo system the following formula computes players rating after a game:
Rn = Ro + K(W - We)
Rn = new rating
Ro = old rating
K = 20 (for this project)
W = 1 for a win, 0.5 for a tie, 0 for a loss
We = Excepted score based on Ro given the table below.
We |
Difference |
We |
Difference |
We |
Difference |
.99 |
677 |
.66 |
117 |
.33 |
-125 |
.98 |
589 |
.65 |
110 |
.32 |
-133 |
.97 |
538 |
.64 |
102 |
.31 |
-141 |
.96 |
501 |
.63 |
95 |
.30 |
-149 |
.95 |
470 |
.62 |
87 |
.29 |
-158 |
.94 |
444 |
.61 |
80 |
.28 |
-166 |
.93 |
422 |
.60 |
72 |
.27 |
-175 |
.92 |
401 |
.59 |
65 |
.26 |
-184 |
.91 |
383 |
.58 |
57 |
.25 |
-193 |
.90 |
366 |
.57 |
50 |
.24 |
-202 |
.89 |
351 |
.56 |
43 |
.23 |
-211 |
.88 |
335 |
.55 |
36 |
.22 |
-220 |
.87 |
322 |
.54 |
29 |
.21 |
-230 |
.86 |
309 |
.53 |
21 |
.20 |
-240 |
.85 |
296 |
.52 |
14 |
.19 |
-251 |
.84 |
284 |
.51 |
7 |
.18 |
-262 |
.83 |
273 |
.50 |
0 |
.17 |
-273 |
.82 |
262 |
.49 |
-7 |
.16 |
-284 |
.81 |
251 |
.48 |
-14 |
.15 |
-296 |
.80 |
240 |
.47 |
-21 |
.14 |
-309 |
.79 |
230 |
.46 |
-29 |
.13 |
-322 |
.78 |
220 |
.45 |
-36 |
.12 |
-335 |
.77 |
211 |
.44 |
-43 |
.11 |
-351 |
.76 |
202 |
.43 |
-50 |
.10 |
-366 |
.75 |
193 |
.42 |
-57 |
.09 |
-383 |
.74 |
184 |
.41 |
-65 |
.08 |
-401 |
.73 |
175 |
.40 |
-72 |
.07 |
-422 |
.72 |
166 |
.39 |
-80 |
.06 |
-444 |
.71 |
158 |
.38 |
-87 |
.05 |
-470 |
.70 |
149 |
.37 |
-95 |
.04 |
-501 |
.69 |
141 |
.36 |
-102 |
.03 |
-538 |
.68 |
133 |
.35 |
-110 |
.02 |
-589 |
.67 |
125 |
.34 |
-117 |
.01 |
-677 |
Say player A has a rating of 1500 and player B has a rating of 1600. When they play each other player A's We is .36 and player B's We is .64. If player A wins the game then A's new rating is:
1500 + 20(1 - .36) = 1500 + 20*.64 = 1513
Player B's new rating is:
1600 + 20(0 - .64) = 1587
In reading the table the first column is the difference in ratings of the two players. The examples I have seen claim that one always finds the value in the table closest to the actual difference between the players. However, in the actual calculations shown they use the smallest value larger or equal to the actual difference for positive values and the largest value less then or equal to the actual difference for negative values.
A player is allowed to play more than one game at a time.
Games are timed. Games are of the type n/k, Game/k or Daily. In a n/k game each player has k hours to make n moves. If a player fails to make n moves in the k hours, they lose the game. If they make n moves in less than k hours, their remaining time is added to their next timed allotment. In a Game/k game each player has k minutes to play all their moves. In a Daily game each player has to make a move within 24 hours of the other players last move. When a player makes a move in a Daily game the server will send the other player an email indicating that a move has occurred. n/k and game/k games are played in realtime. When a player makes a move, it is sent to the other players client. The server also keeps track of the time used by each player. In a Daily game the players do not have to have a client running all the time. A player will want to see how many moves they have to make and how much time is remaining.
A player can connect to the server and indicate their availability to play a game. The player indicates what time of game they are interested in playing. A player can have more than one request for a game active. A player can indicate if they want their name to be displayed in the request.
A player can connect to the server to see the list of players available to play a game. The list will contain the rank and the type of game. If they see a game they like they can request to play it. The other player can either accept and the game then starts or reject the request.
A player can connect to the server and see the ratings of all players registered with the server.