Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Please solve with DrRacket BSL. 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
Please solve with DrRacket BSL.
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 C)) (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 los1 (list bl b2 b3 b4 b5 b6 b7b8 bg b10)) (main losl)Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started