Uploaded by Rachel Robins

readme

advertisement
Readme – computer networking Ex.1
Gali Heim – 206295941 galih1195@gmail.com
Rachel Robins – 341419513 rachel.robins98@gmail.com
The program is a server-client game named Nim. The server can support
several clients .The server's arguments are: an integer representing num
of players(clients that can play with server),an integer representing the
queue size(num of clients that can wait in a queue waiting for the server
to play with them), three natural numbers representing the heap sizes
at the beginning of the game and two optional strings representing the
port and the Ip..
Nim game flow for each server-client game (repeated until someone
wins , quits the game or an exception has occurred):
The client sends a connection request to server. Once accepted, the
game begins. Game flow: 1)The client sends the sever the current heap
sizes, and the current game status( who won in case the game ended or
sends "your turn" otherwise.) 2) If someone won the game, the client
closes the connection and exists, and the server is ready to accept more
clients at this point. 3) If it’s the client's turn, it sends the server the heap
he wants to remove from and the number of cubes to remove from it.
Legal values are A, B, C for the heap, and a number which is equal o
smaller than the heap size. Both values should be separated by space. 4)
The server notifies the client weather it's move was legal or not, and
then conducts the game logic as specified in the exercise. Program
structure: We have two files, one for client-size flow and one for serverside flow.
As we mentioned, the server can play at once with up to Num of
players(the parameter) clients, if the sever is playing with num of players
clients, and an additional clients wants to plat, it will need to wait in the
queue, if the queue is full it will be refused. When one of the clients
quits the game, or the game is finished- the server will play with the first
client in the queue, and the queue size will be decreased.
Download