COSC1176/1179 – Network Programming (NP) Assignment (2020 Semester 1)
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”.
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.
• 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
• 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
本网站支持淘宝 支付宝 微信支付 paypal等等交易。如果不放心可以用淘宝交易！
E-mail: [email protected] 微信:itcsdx