Go to the download directory on nike, and download the lab2_programs folder to your desktop.
By repeatedly invoking the drawPattern() method you wrote for the prelab, you can draw the following checkboard pattern using methods.
Modify the checkers.java file in the lab2_programs folder to solve the problem.
The following overlapping squares, rectangles, and triangles can be drawn by defining methods which draw the invidual geometric shapes, and invoking those methods in the correct order.
The problem can be broken down even further than into individual shape methods. Since each geometric shape is essentially rows of painted squares, it is possible to define an even simpler method which draws a row with a certain number of painted squares. Then, each method for the individual geometric shapes (square,rectangle,triangle) can repeatedly call the simpler row method to draw its shape.
Modify the shapes.java file in the lab2_programs folder to solve the problem, using methods as described above.
TetrisWorld0 |
|
TetrisWorld2 |
TetrisWorld3 |