



Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Community
Ask the community for help and clear up your study doubts
Discover the best universities in your country according to Docsity users
Free resources
Download our free guides on studying techniques, anxiety management strategies, and thesis advice from Docsity tutors
An undergraduate team project where students developed a networked version of the classic board game 'sorry!' using tcp protocol and java classes. Details on application protocol, client-server messages, and instructions for compiling and running the application in linux/unix and windows environments.
Typology: Study Guides, Projects, Research
1 / 6
This page cannot be seen from the preview
Don't miss anything!
Data Communications and Networks I Erik Corwin James Loomis Winter Quarter 2009 Team Awesome Our Project is an adaptation of the classic board game, Sorry! Application Protocol The network protocol used by our application uses the TCP protocol. We used DataInputStream and DataOutputStream Java classes, and a Network Proxy pattern, just as we did with the in-class examples. A character encoded as a byte is used to determine the command. What follows is determined by the command. Client to Server Messages Update 'U' Game State * Update the client with a new game state. Error 'E' String Report an error to the client. For example, a player has already been chosen. Message 'M' String Display a message on the client. For example, the move the user attempted was invalid, or it is not their turn. Server to Client Messages Join 'J' String, Int Join a named session (or create, if it does not already exist) as a specific player ID. Discard 'D' Int, Int Discard a card from a specific hand position Play 'M' Play ** Display a message on the client. For example, the move the user attempted was invalid, or it is not their turn. List Sessions
Developer's Manual: Linux/UNIX environment: Download sorry-src.jar onto a Linux/Unix based system. To compile the files, you must extract them from the jar. To do this type into the terminal: jar -xvf viagra.jar Once the files are extracted they can be compiled by executing: javac *java This should compile all of the source files. To start the Server, type into the terminal: java SorryServer
If the host name or port number are incorrect, the user is notified and returned to the Sorry! splash screen. If the connection was successful, the user is prompted to choose either “Join an existing game” or “Create a new game”. If a user wants to create a new game, click “Create a new game” and type the name of the game they want to create, otherwise click “Join an existing game” and choose from the list (if there are any there). After a selection is made, a user can choose what color they want to be (Red, Blue, Yellow, Green). Once all of the choices are made, click Connect. The board is created and displayed to the user. In order to move a piece, click on a card (if its your turn), then click on the piece you want to move. The available moves are shown to the user, once the piece is clicked. The game ends when a user gets all four of their playing pieces to the home circle. Illustration 2 : Game Setup screen Illustration 3 : Sorry! Board
UML Diagram: Sequence Diagram: SERVER CLIENT ViewListener SessionManager ViewProxy ViewListener SorryGame ModelListener SorryState ModelProxy ViewListener Network – TCP SorryUI ModelListener Before joining a session After Joining SorryState copy ModelListener SorryClient SelectSessionUI A Session Server Client 1 Client 2 Server SessionManager (^) (SorryGame, Model)Session TCP connect TCP connect 'L' – list sessions List of existing sessions 'J' – join a session update() 'L' – list sessions List of existing sessions 'J' – join a session update() update() 'P' – make a move update() update() 'P' – make a move update() update() TCP close TCP close update() First player connects; joins a session Second player connects; joins same session Player 1 Moves Player 2 Moves Player 2 disconnects Player 1 disconnects