$35
CS 342 Project#3
RPSLS JavaFX GUI
Description:
You will implement the game Rock, Paper, Scissors, Lizard, Spock. This is just an
augmented version of the traditional Rock, Paper, Scissors game. Your implementation
will be a two player game where each player is a separate client and the game is run by
a server. Your server and clients will use the same machine; with the server choosing a
port on the local host and clients knowing the local host and port number (just as was
demonstrated in class). Each round of the game will be worth one point. Games will be
played until one of the players has three points. At the end of each game, each user will
be able to play again or quit.
All networking must be done utilizing Java Sockets (as shown in class). The server
must run on its own thread and handle each client on a separate thread. You may
not use libraries or classes not included in the standard Java 8 release. You may not
alter the POM file. You may work in teams of two but do not have to.
Implementation Details:
You will create separate programs, each with a GUI created in JavaFX, for the server
and the client.
For the server GUI:
- A way to chose the port number to listen to
- Have a button to turn on the server.
- Display the state of the game(you can display more info, this is the minimum):
- how many clients are connected to the server.
- what each player played.
- how many points each player has.
- if someone won the game.
- are they playing again.
- Any other GUI elements you feel are necessary for your implementation.
Notes: Your server GUI must have a minimum of two scenes: an intro screen that allows
the user to input the port number and start the server and another that will display the
CS 342 Project#3 Fall 2019
state of the game information. To display the game information, you must incorporate a
listView (as seen in class) with any other widgets used. Keep in mind, you can
dynamically add items to the listView without using an ArrayList.
For the server logic:
- It will only allow a game to start if there are two clients connected.
- It will notify a client if they are the only one connected.
- It will keep track of what each player played.
- It will evaluate who won each hand.
- It will evaluate if a client has won the game.
- It will update each client with the above items in time.
- It will do all things necessary to run the game.
It is expected that your server code will open, manage and close all resources needed
and handle all exceptions in a graceful way. For game play, each client will chose to
play either Rock, Paper, Scissors, Lizard or Spock and send that choice to the server.
The server will determine who won and then update each client with what the other
played and the resulting state of the game. If a client has won the hand and has
reached three points, the server will send what the other player played, the resulting
state of the game and require each client to make a choice as to play again or quit. If a
player quits, the server will end that connection. If one player quits and the other wants
to play again, the server will notify the client that they must wait for another person to
connect. If both want to play again, the server will start a new game.
For the client GUI:
- A way for the user to enter the port number and ip address to connect to
- A button to connect to the server.
- A way to display the points each player has.
- A way to display what the opponent played each round using images.
- Clickable images to choose what to play.
- A way to display messages from the server.
- Buttons to choose to play again or quit.
- Any other GUI elements you feel are necessary for your implementation.
Notes: Your client GUI must have a minimum of three scenes: an intro screen that
allows the user to input the port number and ip address to connect to the server,
another that will display the state of the game information and game play and a third of
your choice. To display the game information, you must incorporate a listView (as seen
in class) with any other widgets used. Keep in mind, you can dynamically add items to
the listView without using an ArrayList. Buttons should be disabled when not in use or
when waiting for a response from the server.
CS 342 Project#3 Fall 2019
For the client logic:
After entering the port number and ip address, the user will click to connect to the
server. When there is another client to play, the game will start. The user will select
which item to play and send to the server. The server will respond with what the
opponent played, who won and what points were distributed. The client GUI will update
with this information and allow the user to either keep playing or, if someone has won,
chose to either play again or quit. Quit will end the client program. It is expected that
your client code will open, manage and close all resources needed and handle all
exceptions in a graceful way.
Passing info between clients and server:
You must implement the GameInfo class. class GameInfo implements
Serializable{}
You will add serializable data members to this class that keep track of the state of
the game( i.e. int p1Points, int p2Points, String p1Plays, String p2Plays ,
Boolean have2players…..). This class will be used to send information back and
forth between the server and two clients. This is the only way you are allowed to
send and receive information.
Testing Code:
You are required to include JUnit 5 test cases for your program. Add these to the
src/test/java directory of your Maven Project.
Part 1: Wireframe for client and server:
You are required to create a wireframe for both the client and server program.
Part 2: UML Activity Diagram:
You are required to create a UML Activity Diagram showing the sequence of events for
the client program. Format this as a PDF.
Part 3: UML Class Diagrams:
You are required to create a UML Class Diagram for the server and client programs;
including all classes, data members and methods of those classes, interfaces and
interactions between them. Format these as PDFs.
Use of templates found on the web:
You may use ideas from templates( fxml, css or other) for styling your programs found
on the web. You may not import those templates and pass them off as your own work. If
you use an idea or part of such template, include a reference to that work in the header
of the file where used. Failure to do this will result in academic misconduct charges.
CS 342 Project#3 Fall 2019
Electronic Submission:
If you worked in a group, only one of you needs to submit each part of this project.
• For Parts #1, #2, and #3, put both of your names and netids on a cover sheet in
each PDF.
• For part #4, you must include a PDF file called Collaboration.pdf. In that
document, put both of your names and netIds as well as a description of who
worked on what in parts #1 through #4 in the project.
For parts #1 - #3, name the PDFs with your netid + name of the part. For example, I
would have submissions called mhalle5Wireframe, mhalle5UMLActivity and
mhalle5UMLClass. Submit these to the links on the Blackboard course website.
For part #4, zip the Maven projects P3Server and P3Client together and name it with
your netid + Project3Part4: for example, I would have a submission called
mhalle5Project3Part4.zip, and submit it to the link on Blackboard course website.
Assignment Details:
For parts #1, #2, and #3, late work is not accepted. For part #4, you may submit your
code up to 24 hours late for a 15% penalty. Anything later than 24 hours will not be
graded and result in a zero.
We will test all projects on the command line using Maven 3.6.1. You may develop
in any IDE you chose but make sure your project can be run on the command line
using Maven commands. Any project that does not run will result in a zero. If you
are unsure about using Maven, come see your TA or Professor.