CSC 160 Spring 2006 - Homework 3
Assigned Feb 9, due SUNDAY Feb 19


Read Section 1.2 of this draft chapter.

Type at the top of the Definitions Window:
(1 point)   A) First and Last Name
(2 points)  B) The code from the Shot-X and Shot-Y functions from HW2.
(2 points)  C) The triangle-draw program from class on Feb 16.

Do exercise 1.2.1
In the Definitions Window:
(5 points)    A) Create a canvas of 100 by 200 pixels.
(10 points)  B) Draw a shot close to the bottom of the canvas. (For now, use thin, tall rectangles to depict shots.)
(10 points)  C) Draw a second shot.
(25 points)  D) Define the function shot-draw0, which -- like ufo-draw -- consumes t and draws a shot. It computes the X and Y coordinates of the shot using the functions shot-X and shot-Y.
In the Interactions Window:
(10 points)   E) Do at least three tests of the shot-draw0 function.

Finish exercise 1.2.2
In the same Definitions Window as 1.2.1:
(25 points)   A) Define the function shot-draw, which draws a shot as a triangle. It consumes a single number, the time t, and draws a triangle on the canvas:
;; given: t
(define (shot-draw t)
...)
Use the functions shot-X and shot-Y to determine where the top point is. Hint: You should use triangle-draw.
In the same Interactions Window as 1.2.1:
(10 points)   B) Do at least two tests of the shot-draw function.



Last Modified: 2/16/06