The FishNet protocol

Your program (a client) will communicate with another player (also a client) via a server. The server runs on port 1530 of brussels.lti.cs.cmu.edu (IP address 128.2.211.107).

The server's job is to pair players together, to deal cards, to referee the game, and to notify players of the game's progress. The server keeps track of both players' hands and takes care of forced communication (replying to requests and revealing books) on its own. It frequently sends information to the clients about the progress of the game, and it prompts the clients to choose which rank to request when appropriate. The client's primary tasks, therefore, are to keep track of what is in the hand (based on the server's messages) and to generate requests when the server prompts the program to do so. Your program may assume the server referees the game properly; very few of the rules will need to be incorporated into the program.

Sample FishNet session

In this sample transcript of communication between server and client, messages from the server are in boldface, and messages from the client are in normal type. Italicized comments describe what is happening and are not part of the communication.

play cburch spot  You identify yourself and who you want to play
fish 3            Server deals the hand 2,2,3,4,4,9,12 to you
fish 4
fish 2
fish 2
fish 4
fish 9
fish 12
oppmakes 0        Spot made a book of four 0s during the deal
fish 2            You are dealt your seventh card
yourturn          Server chose you to go first
request 4
oppgives 2 4      Spot had two of the 4s you requested
youmake 4         Server announces you completed a books of 4s
yourturn          Server tells you to go again
request 12
fish 8            Spot had none; you draw an 8
request 2         Spot requests 2s (you lose two 2s)
request 2         Spot requests 2s again (you lose none)
oppmakes 2        Spot completes a book of four 2s
youlose           Spot is out; with two books to your one, Spot wins
quit

In this game, Spot receives seven cards in the deal and happens to complete a book of 0s, leaving three cards. Spot loses two of these when you request 4s, leaving one card. Then, when it becomes Spot's turn, Spot holds a single card. Spot requests 2s, of which you have two. Spot requests 2s again, and of course you have none. But Spot fishes a 2, completing a book. Since Spot fishes the same card as requested, Spot gets another request. But Spot has no cards; thus the game ends. Spot has two books (of 0s and 2s) while you have one (of 4s), so you lose.

Messages from client

Each FishNet message consists of an operation, followed by some arguments separated by spaces, followed by the end of a line. The following describes FishNet operations that your client might send.

Messages from server

Following are messages that the server might send to the client.