Assignment 6
Due Date Mon 1/30 at 11:59pm
Possible Points 53
Purpose To begin working with unions and use them in a big-bang program.
(define-struct circl [radius mode c]) (define-struct squar [side-length mode c]) (define-struct triangl [side-length mode c]) ; A Shape is one of: ; - (make-circl Number Mode Color) ; - (make-squar Number Mode Color) ; - (make-triangl Number Mode Color) ; A Mode is one of: ; - "solid" ; - "outline"
Exercise 1 Design a function that given a Shape will output a drawing of that shape.
Exercise 2 Design a function that given a Shape will change its mode.
Exercise 3 Design a simple game that that starts with a blank screen. When someone enters "s", if the screen was blank, a circle is now drawn at the center of the screen. At every tick, a circle will change to a square, a square will change to a triangle, and a triangle will change to a circle. When someone enters "m", the mode of the shape (if any) will change. The shapes should never change their color or their radius/side-length. The game stops and displays a blank screen when someone presses "q".