PROG5-- ALIEN DRAWINGS

logo5q.jpg (10688 bytes)Your job is to write a program to help some scientists manipulate (change) an alien drawing they have just received from outer space. The drawing is of 4 lines as a shape inside 4 lines as a shape inside 4 lines as a shape.

First: Draw the picture of 12 lines as shown by the example. The judges are not too worried about the actual size of the shapes as long as they are different.

Next ask the judges for a number. They might respond by typing in numbers such as 3 or 13 or even 323. These numbers have a special meaning as they explain which DRAWING RULES to apply. Here are the rules

UNDRAW means -- make the line disappear without changing any other line in the picture. This means you can't just clear the screen and redraw the shape without one of the lines. (HINT: What happens if you draw a line in the background colour? -- The answer is one way of solving this problem)

If the judges give 1 number -- apply the rule to be used on the OUTSIDE shape

3 -- means RULE 3 on outside shape -- remove the bottom line

If the judges give 2 numbers -- the first number means the rule to be used on the OUTSIDE shape -- the second number is the rule for the MIDDLE shape

13 -- means RULE 1 on outside shape -- remove the top line and then RULE 3 on the middle shape -- remove the bottom line

If the judges give 3 numbers -- the first number is for the OUTER shape, the second number is for the MIDDLE shape and the third number is for the inner shape

323 -- means RULE 3 for outer shape -- REDRAW the bottom line as it was undrawn and then RULE 2 for the middle shape -- remove the right side and then RULE 3 for the inner shape -- remove the bottom line

The drawing up the side show what happens from the following set of scientist rules

Here are the original shapes
What do you want changed: 2 (means rule 2 outer)
What do you want changed: 23 (means rule 2 outer, rule 3 middle)
What do you want changed: 312 (means rule 3 outer, rule 1middle, rule 2 inner)
What do you want changed: 015 (means rule 0 outer, rule 1middle, rule 5 inner)
Do you want to try again? N
BYE

Copyright Calgary Programming Society -- Last Modified:- 1999, February 11, 03:38 PM by M. Smith