seminar
Class ObjectCreationPractice

java.lang.Object
  extended by seminar.ObjectCreationPractice

public class ObjectCreationPractice
extends Object

ObjectCreationPractice is a game that someone beginning to learn ObjectDraw can use to familiarize themselves with the basic object types and how to create them. The method ObjectCreationPractice.show() displays a pattern of five objects on the screen for the programmer to try to write instructions to match. The method ObjectCreationPractice.test() will actually verify whether the objects currently on the canvas match the desired pattern.

Each of these methods takes an int parameter specifying which pattern to show or test. The pattern that you are trying to match from show() should be the same number you ask the program to test. The number of the pattern also controls the difficulty:

All coordinates will always be in multiples of 10. Arc widths for rounded rects are in multiples of 20. Angles for arcs are in multiples of 30. Keeping this in mind dramatically reduces the amount of guesswork needed.

Author:
Russell Zahniser (russell@zahniser.net)

Nested Class Summary
static class ObjectCreationPractice.Pulsar
           
 
Constructor Summary
ObjectCreationPractice()
           
 
Method Summary
static void show(int n, DrawingCanvas canvas)
          Display a pattern of five objects that you can then attempt to write code to match.
static void test(int n, DrawingCanvas canvas)
          Test to see whether the objects on the given canvas match a particular test pattern.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ObjectCreationPractice

public ObjectCreationPractice()
Method Detail

show

public static void show(int n,
                        DrawingCanvas canvas)
Display a pattern of five objects that you can then attempt to write code to match.

Parameters:
n - pattern to display
canvas - canvas to draw the pattern on

test

public static void test(int n,
                        DrawingCanvas canvas)
Test to see whether the objects on the given canvas match a particular test pattern. Objects will be marked in one of three ways:The test objects that do not match are made to flash in and out of transparency to make it easier to see through them to the objects that you had actually placed. Note that even a very small difference between an object on the canvas and one in the test set will result in the one on the canvas being outlined in blue and the one in the test set appearing flashing and in red.

Parameters:
n - Pattern that you are attempting to match - the same number you would pass to show()
canvas - canvas which should be tested to see if its objects match the test set.