Jump to content

Help with Racket language

Ragido

Hello, i have questions about Racket programing language.

 

It's about designing a simulation using DrRacket big-bang environment. I have a structure that got:

; size is the size of shape
; color is color of shape
;type is form of shape
; posn is a posn structure and gives the location of shape

 

;structure:

$ (define-struct shape (size color type posn))

;constructors:

$ (define b1 (make-shape 10 "red" "c" (make-posn 450 350)))

$ (define b2 (make-shape 15 "green" "t" (make-posn 150 150)))

$(define b3 (make-shape 10 "purple" "c" (make-posn 250 200)))

$ (define b4 (make-shape 20 "orange" "s" (make-posn 320 450)))

$ (define b5 (make-shape 20 "blue" "t" (make-posn 280 300)))

  • Design key-f function which takes list-of-shapes and keyEvent and produces a list-of-shapes. The function checks the key event. If keyEvent is "s" then create a new shape as "square" and produce random colored shape with random size (between 0-30) and random position where x is between [0,WIDTH] and y is between [0,HEIGHT]. If keyEvent "c" then create a new shape as "circle" or if keyEvent is "t" then create a new shape as "triangle".

  • Design mouse-f function which takes list-of-shapes, x, y and mouseEventand produces a list-of-shapes on scene. The function checks themouse event. If it is \button-down", change the locations of all theshapes to align through a line around the clicked point

That's all what left from the project, thank you so much guys.

Link to comment
Share on other sites

Link to post
Share on other sites

What have you done so far to achieve the desired results?

Write in C.

Link to comment
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×