Question: a . Question : Design a simulation using DrRacket big-bang environment and ensure that your pro- grams are fully documented, using comments. Define a structure

 a . Question : Design a simulation using DrRacket big-bang environmentand ensure that your pro- grams are fully documented, using comments. Define

a . Question : Design a simulation using DrRacket big-bang environment and ensure that your pro- grams are fully documented, using comments. Define a structure named shape which has three fields: size is the size of shape ; color is color of shape pos is a posn structure and gives the location of shape keyEvent can be one of the following: 30 for orange T for red ;p for pink ;b for blue g for green 1. (25 points) Design tick-f function which takes list-of-shapes and produces a list-of-shapes. The function add the y position of shapes by one. 2. (25 points) Design key-f function which takes list-of-shapes and keyEvent and produces a list-of-shapes. The function checks the key event. If key event is; o then add a new orange shape with random size (SIZE) and random position where x is between [0,W] and y is between [0.H] to the list-of-shapes. I then add a new red shape with random size (SIZE) and random position where x is between [0, W] and y is between (0.H] to the list-of-shapes. ip then add a new pink shape with random size (SIZE) and random position where x is between [0,W] and y is between [0,H] to the list-of-shapes. ;b then add a new blue shape with random size (SIZE) and random position where x is between [0,W) and y is between (0.H] to the list-of-shapes. g then add a new green shape with random size (SIZE) and random position where x is between [0,W] and y is between [0.H] to the list-of-shapes. else do not add any shape and show list-of-shape itself 3. (25 points) Design mouse-f function which takes list-of-shapes, x, y and mouseEvent and produces a list-of-shapes on scene. The function checks the mouse event. If it is button-down, then add a new shape with random color (C), random size (SIZE) and random position where x is between (0,W) and y is between [0,H] to the list-of-shapes. 4. (25 points) Design draw-f function which takes list-of-shapes and produces images on scene. The function draws shape using size, color and location of given shapes. constants size of the shape (define SIZE 25) ;width of the scene (define W 500) ;height of the scene (define H 500) max color range (define C 255) ;list-of-shapes -> list-of-shapes (define (main wo) (big-bang wo (on-tick tick-f) (on-key key-f) (on-mouse mouse-f) (to-draw draw-f))) (define bl (make-shape (random SIZE) (make-color (random C)(random C)(random C)) (make- posn (random W) (random H)))) (define b2 (make-shape (random SIZE) (make-color (random C)(random C)(random C)) (make- posn (random W) (random H)))) (define b3 (make-shape (random SIZE) (make-color (random C)(random C)(random C)) (make- posn (random W) (random H)))) (define b4 (make-shape (random SIZE) (make-color (random C)(random C)(random C)) (make- posn (random W) (random H)))) (define b5 (make-shape (random SIZE) (make-color (random C)(random C)(random C)) (make- posn (random W) (random H)))) (define b6 (make-shape (random SIZE) (make-color (random C)(random C)(random C)) (make- posn (random W) (random H)))) (define b7 (make-shape (random SIZE) (make-color (random C)(random C)(random C)) (make- posn (random W) (random H)))) (define b8 (make-shape (random SIZE) (make-color (random C)(random C)(random )) (make- posn (random W) (random H)))) (define b9 (make-shape (random SIZE) (make-color (random C)(random C)(random C)) (make- posn (random W) (random H)))) (define bio (make-shape (random SIZE) (make-color (random C)(random C)(random C)) (make-posn (random W) (random H)))) (define losl (list bl b2 b3 b4 b5 b6 b7b8 b9 b10)) main losl)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!