Authors: Mike Henrichs and Nick Leidenfrost
| || 21 ||Nov
|| 28-29 ||Nov
|| 6-7 ||Dec
|| 8 ||Dec
By the end of this lab, you should:
- Have a better understanding of two-dimentional arrays
- Appreciate the usefullness of subclassing
- Understand the usefullness of sets
- Understand how to implement set operations
This Lab contains two parts, design and implementation...
- Play ClickOMania!
- Read over this entire document before you start.
- Study the ADT examples in class and in the notes.
- Study the subclass examples in class and in the notes.
- If you need help, please ask.
The following classes are provided for you:
Remember to type the following lines at the top of any files that use canvas classes.
- Initially, a board (ViewFrame) is constructed and filled with squares (filled Rect) so that the board is 20 squares high, and 10 squares wide.
- The squares are randomly assigned to 5 colors.
- If the user clicks on a group of squares that are the same color, then that group disappears. In order for a square to be connected to another square of the same color, they must share a side - i.e. squares of similar color positioned diagonally from
each other are not considered part of the same group.
- When a square disappears, all squares above it shift down to compensate for the gap made.
- A singleton square will not disappear when clicked on.
- If all the squares have been cleared from a particular column, then all of the squares in the columns to the right are shifted to the left to compensate for the gap.
- We gave you SetA.java for a reason... Try using this ADT to organize something.
- Try using a private helper method in your board constructor. You will need the same kind of initialization later...
- Remember that, when a square drops, the 'group' that it is in may change. It may not belong to the group that it was in anymore, and it may have fallen into another group. You can change these groups with the same method you use to initialize t
hem. Any implemented method that is more efficient will be given extra credit.
- Some methods you might find useful:
- smoothMove(int xCoord, int yCoord, int time) - moves a component on the canvas (such as a Rect) from its current position to (xCoord, yCoord) in the amount of miliseconds given.
- remove(Component c) - called on a ViewFrame. Removes the Component c (such as a Rect) from the ViewFrame.
- setRect(double xCoord, double yCoord, double width, double hieght) - will move and resize the Rect. Moves to (xCoord, yCoord), resizes to the specified width and height.
Last modified 21:50:32 CDT 26 August 2000
by Ron K. Cytron