Java代写 | COSC1176/1179 – Network Programming (NP) Assignment

本次Java代写是开发一个多人网络猜数字的游戏
COSC1176/1179 – Network Programming (NP) Assignment (2020 Semester 1)
Aims: Apply the learnt networking concepts to a practical application
Instructions
• This assignment contributes 25% to your final marks.
• There are two options, Task A and Task B. You only need to choose either A or B.
o Task A (includes A1 and A2) is an individual work.
o Task B is a group-based (max. 3 members) work.
• Due date: 23:59pm 17th May 2020.
• Your program will be marked on the netprog1 and netprog2 server.
• There are two milestones to monitoring the progress of your assignment.
o Week 8: submit your milestone task (referenced to individual tasks).
o Week 11 lab test (5 marks): attend online demo and answer questions related to your work.
 Every student must live demo his/her work in week 11-12 tute/lab slots
 Registration thread for demo will be opened on week 9 on Canvas
 Firs reserved first get the slots (10 mins each slot).
Submission
• Submission via Canvas. Please zip all your documents, and use your student number, e.g.,
s3255601, as the file name for submission.
o For group works, full name and student number of each team member should be listed in a
file named team.txt, which is included in your submission.
o A team leader’s student number is used for submission.
• Your submission should consist of following parts:
o All source files.
o how to compile and run the program in netprog1 and netprog2.
o how the program operates.
Note: You need to insert comments into your program with correct indentation specified in lab 1, as
appropriate.
Late submission policy for both online test and assignment submission
• There will be a late submission period of 5 working days for this assignment.
• Late submissions will incur a penalty of 10% per day of full mark (i.e. 2.5 marks per day) unless
prior arrangements are made with the tutor regarding an extension.
• Submissions that are received after the late submission period expires will not be assessed and
will hence receive no mark.
2
Task A. Develop a simple game played (individual task implemented with Java socket).
The game is implemented with separate client and server machines. One player per client, and the
server is administering the game. You are required to implement the game in two stages:
• Stage 1: Single-player game: one client communications with the server.
• Stage 2: Multiplayer game: the server can handle several (up to 6) clients simultaneously.
A.1 Single player version (Guessing game)
The server generates a number between 0-12. The client guesses the number (maximum of 4 guesses).
If the client correctly guesses the number, i.e. the guess number X matches the generated number
• The server announces “Congratulation!”.
It the client fails to guess the number. For each incorrect guess, the client gets a clue:
• The client’s guess number X is bigger than the generated number, or
• The client’s guess number X is smaller than the generated number,
• After 4 attempts incorrect guess, the server announces the answer.
On completion, record a live video to show the key functions (in Italic) and submit on week 8.
A.2 Multiplayer are playing against the server (3 are playing, 3 are waiting in the queue)
The server maintains a lobby queue. Clients are required to register with the server (using their first
name), then to be queued in the lobby. The players will be picked up from the queue.
The game is played in rounds. At the start of each round, the server takes the first three clients from
the lobby (or all the clients if there are less than three clients in the lobby) and starts the round.
Then the server announces the name of the 3 participants.
• Each player can guess at any time (with their number of guesses tracked by the server).
Once all players have either:
• Correctly guessed the number,
• Reached their maximum guess of 4 or limited time-period (say 5 minutes, can be hard-coded),
• Chosen “e” to exit from the guess.
The server announces to all the players the number of guesses for each client.
Players can then choose to play again (p), or quit (q).
The players that choose to play again are added to the end of the lobby queue to wait for the server to
take them to the next available round.
Program components, live demo in weeks 11-12.
You need to choose the appropriate socket for each task,
• The client program (one thread per client)
It connects to the server, the guessed numbers are sent to the server. The server’s messages are
displayed to the player.
• The server program (handles maximum 6 threads while three clients are playing)
It maintains a lobby queue, accepts clients’ requests to sign up, and selects three players from the
queue for each round. It also manages the game.
First, it announces the number of players and generates a random number between 0-12.
In the guessing phase, it takes guesses from players, compares it to the generated number and sends
the feedback to the corresponding player while updating their guess count.
On completion of each round, the server announces the rankings based on a number of guesses (e.g.,
Alice 2, Bob, 2, Charlie 3, means Alice and Bob were congratulated on their second guess, Charlie on
his third guess), and allows players to either play again by entering “p” or quit by entering “q”.
3
Task B Development of a web application for the robot-served showrooms
This is a group-based task with maximum 3 members in a group.
The communication is via Java socket. No programming language requirement for other components.
A company has three autoshop showrooms in VIC, NSW and QLD (one shop in each state), which are
served by Temi (referenced to https://www.robotemi.com/au/ ). Your task is to develop:
B1. A server program
Temi works in the client site (showroom), while the server manages his work.
Pre-service stage:
• Accept clients’ online booking
o Clients are required to give name, email and/or mobile in the booking
o Select location and time slot (1 hour per slot) of visiting the showroom
• Assign a code to open the digital lock for client to access a showroom
o The code is a randomly generated number with 6 digits (e.g., 366329)
o The access code will be sent to the client via SMS or email recorded in the booking
In-room service
• Communicate with clients by using text information
B1. A client program for being used for in- room service:
• Create a client program for each client to communicate with the server
o Give the welcome information to the client on his/her entry to the showroom
o Using the recorded name of the client to welcome, then
o Demo the basic help information
o Communicate with server using text information
The development of the web application will be monitored:
• Stage 1: to be submitted in week 8
o The breakdown structure (gather requirement, design a framework)
o The detailed class diagram of the server and client
o The sequence diagram to indicate the communications between clients and server.
• Stage 2: Live demo in weeks 11-12:
o Implement back-end and the user interface (code and read me file)
o Java socket is used for in-room service communication; feel free to use other programming
languages for other parts.
o A user manual with screenshots of execution of each step in netprog1 and netprog2
The End