Java代写 | CSCI 3171 Network Computing Summer 2020

本次Java代写是使用TCP套接字完成一个剪刀石头布的在线游戏

CSCI 3171 Network Computing Summer 2020
Assignment 3 [20 marks]
you will write simple client-server application(s) in which the client acts as Player 1 and the server
acts as Player 2. The protocol between the client and server should be as follows:
• The server program is started on a user-defined port.
• The client program is started and connects to the server using the server IP and port
number provided on the command line.
• The client asks the user for input. The input may either be R (for Rock), P (for Paper) or S
(for Scissors). Any other input should result in an error message, asking the user to try
again.
• The user’s input is sent to the server via the connected socket.
• The server (acting as Player 2) must decide on any one of R, P or S. How the server decides
is completely up to you. For a fair game for example, you may use a random approach to
decide between choosing R, P or S for the server.
• The server reads the user’s input from the client socket, evaluates the outcome (Player 1
wins, Player 2 wins or a tied game), displays each players’ choice and result of the game,
and also sends this information (i.e. Client’s choice, Server’s choice and the result of the
game) back to the client.
Dalhousie University
Faculty of Computer Science
Image Ref: Enzoklop [CC BY-SA 3.0], from
Wikimedia Commons
• The client should display the server’s reply (i.e. Client’s choice, Server’s choice and the
result of the game) to the user.
• The client should give the user an option to try again or quit.