CMSC 22001: Software Construction Assignment 2u: Networked Player

In this assignment, you must implement an automated, networked player for Scrabble. Download the zipfile or the tgz file containing the server. Use it to play games with your player (Of course, you'll want to test your player independently.) Read the README file in the archive for details on how to run it.

The interaction between the client and server mirrors the method calls that you would get if you had objects implemeting the PlayerI and TurnI interfaces. Each method call corresponds to a pair of messages across the network: one for the method invocation and one for the method return.

To begin the communication, the client establishes a TCP/IP connection to the server and then sends a registerPlayer message to the server, to which the server replies with a void message (see below for the precise content of all of the messages).

After that initial sequence of messages, the communication follows this state machine:

The hexagonal, gray states indicate places where the server decides what to do next, and the round states are where the client decides. Each edge leaving a state corresponds to a single message. Edges leaving the hexagonal states are sent from the server to the client, and edges leaving the round states are send from the client to the server. The labels on the edges indicate the content of messages; note that each edge's label is on the right-hand side of the edge.

These are the precise specification of the messages on the edges in the above diagram (see the data page for the definitions of the non-terminals and whitespace conventions):
registerPlayer
 = 
(register <string>)
draw
 = 
(draw <tile> ...)
takeTurn
 = 
(take-turn <board> <number>)
placeTile
 = 
(place-tile <coord> <coord> <letter>)
placeBlank
 = 
(place-blank <coord> <coord> <letter>)
donePlace
 = 
(done-place)
exchange
 = 
(exchange-tile <tile> ...)
tiles
 = 
(tiles <tile> ...)
gameOver
 = 
(game-over <number> <wl>)
tournamentOver
 = 
(tournament-over <wl>)
void
 = 
()
Notes: The string in the register player message is the player's name. The tiles in the draw message are the initial tiles in the player's rack. In the takeTurn message, the board is the board at the beginning of the player's turn and the number is the number of tiles left in the bag. In the placeTile and placeBlank messages, the two numbers are the x and y coordinates (respectively), and the letter is the letter the player wishes to place. When exchanging, the player specifies which of their tiles to place. The gameOver message contains the player's score and if they won or lost. The tournamentOver message indicates if they won or lost.

For now, test your new system on a local machine. Use port 9000 to communicate via TCP/IP.



CMSC 22001: Software Construction