(back to the assignments page)
For this assignment, you will:
ArrayList classIn this assignment, you will create a graphical version of Bailey’s Silver Dollar Game. Read Section 3.10 of the textbook Java Structures for a description of the game. In this version of the game, the user will use the mouse to move the coins instead of typing commands on the keyboard.
The correctness of the assignments in this class will be automatically verified. For this reason, you must follow all naming conventions specified in this assignment.
CoinThe Coin class represents a single coin. This class is already implemented for you.
CoinSquareThe CoinSquare class represents a square. This class is already implemented for you.
GraphicsCoinStripThe GraphicsCoinStrip class uses the Coin and CoinSquare classes to implement the Silver Dollar Game. This class is partially implemented. There are comments suggesting what you need to add. The contains methods that Coin and CoinSquare inherit from Eclipse2D and Rectangle2D may be helpful.
Notice that there are no play or move methods in the GraphicsCoinStrip class because the mouse is in control of the game. Much of what drives the game is the mouse event handling which can be found in the inner class CoinMouseListener inside the GraphicsCoinStrip class. The purpose of the inner class CoinMouseListener is to encapsulate all of the methods that deal with the mouse.
You can add whatever methods you think would be useful to the GraphicsCoinStrip or CoinMouseListener classes, but do not change the names of any of the existing methods or variables.
After you have a working copy of the game, write a method in this class that checks to see if the game is over and, if so, signal this to the user in some fashion.
Possible examples are to print out a message to the console, or better, change the color of all of the coins. You can also make sure that the coins no longer move once the game is completed (although this is not required).
BAILEY variable to the project. If you’ve forgotten how to do this, see the instructions from the lab here./common/cs/cs062/assignments/assignment01 inside of the silverdollar directory. Copy the entire silverdollar directory over into your src directory (“silverdollar” is the package name), and also grab the asg01.json file, which you’ll need to submit (you can just put it on your Desktop for now).Coin and CoinSquare classes are complete. You do not need to modify them. However, take a look at them to see what methods are available.GraphicsCoinStrip class to play the game. As much as possible, try and develop incrementally. That is, get one small piece working and then move on to another piece.asg01.You will be graded based on the following criteria:
| Criterion | Points |
| Game starts with random coin positions | 1 |
| Coins can be dragged | 1 |
| Coins can be dragged multiple squares | 1 |
| Dropped coins end up centered in correct location | 1 |
| Illegal moves are not allowed | 3 |
| Game over is indicated somehow | 2 |
| General correctness | 2 |
| Appropriate comments (including JavaDoc) | 2 |
| Style and formatting | 2 |
| General correctness | 2 |
| Submitted correctly | 1 |
NOTE: Code that does not compile will not be accepted! Make sure that your code compiles before submitting it.
Before you submit, you must comment your code. We will be using the JavaDoc commenting style. To be compliant with JavaDoc, you must have the following:
/** and end with **/. Every line in between should start with * and be appropriately indented.author tag after the class description, and the @version tag after the author tag.@param, @return and @throws tags for each method (when appropriate)Follow the directions for submitting on the documentation page. This assignment should be submitted as asg01.
NOTE: If you submit multiple times, we will grade the latest submission, and assess any late penalty based on when it was submitted.