Hello steamgifters, it's been a lot since i used the website, i had a lot going on and the university + part time job taking my time.

I have a project in Racket programing language, i tried to solve it but i wasn't able to, i am so desperate about it that's why i am posting it here.
Thanks in advance for passing by, here take this small gift

-----Questions----------

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.

5 years ago*

Comment has been collapsed.

I can't help you with that, but have a beump.

5 years ago
Permalink

Comment has been collapsed.

Thanks!

5 years ago
Permalink

Comment has been collapsed.

oh i thought you meant rocket language T_T

View attached image.
5 years ago
Permalink

Comment has been collapsed.

It would be better than Racket to be honest.

5 years ago
Permalink

Comment has been collapsed.

42, that is usually the answer.

5 years ago
Permalink

Comment has been collapsed.

Didn't work :D

5 years ago
Permalink

Comment has been collapsed.

Bump. Though here we might not have anyone having the ability to help you.

5 years ago
Permalink

Comment has been collapsed.

Thanks for the help!

5 years ago
Permalink

Comment has been collapsed.

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".

Don't know anything about that language but this sounds like you just have a list with all the shapes to draw and keep adding randomly generated ones when any one of those 3 keys is pressed. I suppose that you can make lists in that language, or use classes and manually build some double linked list structures that contain those "shape" structs and pointers to other elements.

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

The first part sounds like displaying the content of the list near where the mouse button is being held down.
The second part is too vague.

Best of luck.

5 years ago
Permalink

Comment has been collapsed.

Thank you so much Avantyr, i knew about the logic of it but sadly i wasn't able to write the function correctly, but i found somehelp and it's all clear now :)

5 years ago
Permalink

Comment has been collapsed.

I hope you don't me entering despite my inability to help you in Racket!
Bump! 😊 👍
🎅🎄🎁 𝓜𝓮𝓻𝓻𝔂 𝓒𝓱𝓻𝓲𝓼𝓽𝓶𝓪𝓼 🎁🎄🎅

5 years ago
Permalink

Comment has been collapsed.

Of course not, and Merry Christmas to you too!

5 years ago
Permalink

Comment has been collapsed.

I'm afraid that I have no knowlegde of racket.

Have you tried posting your question on stackoverflow? That's usually where I go to when stuck on something stupid code-wise.

5 years ago
Permalink

Comment has been collapsed.

Yes i tried to, but i didn't get any answer, but now everything is fine, with somehelp i was able to do it.

5 years ago
Permalink

Comment has been collapsed.

Ah, a little tip with stackoverflow. If it's a college project, they won't help you if you haven't posted enough info to prove that you've made a decent attempt to solve it yourself. Then they'll look at your code and tell you where you're going wrong. They won't give you the answer if you just post a question. That's generally how I get help if I'm stuck, otherwise, your question generally gets ignored. XD

5 years ago
Permalink

Comment has been collapsed.

I think you are right, i posted about the question but i didn't post the codes i wrote. I almost wrote everything but there was somethings that wouldn't work with each other. For example, when i run the app the first function wont' work with the last function, and it got me crazy :D -- i had some help and now the project is completed :D

5 years ago
Permalink

Comment has been collapsed.

Oh, I know how you feel. I had to do my final project in React Native to create a cross-platform iOS/Android app. I never actually used it before. Professor was like "well, you might as well learn something new while you're doing this." It wrecked my head, but it was fun at the same time. lol.

Some of the people on stackoverflow are teachers themselves. They just want people to learn and don't want to give answers without you first proving what you did. That is understandable. It doesn't help the student if they can just get the answer online. :)

5 years ago
Permalink

Comment has been collapsed.

That's true, this is my first time i post about my code. Lesson learned!

5 years ago
Permalink

Comment has been collapsed.

Damn I don't know anything about it. But thanks for the giveaway

5 years ago
Permalink

Comment has been collapsed.

No problem, you're welcome!

5 years ago
Permalink

Comment has been collapsed.

Bump!

5 years ago
Permalink

Comment has been collapsed.

i came for ga cuz i am bad with coding. Thanks and sorry!

5 years ago
Permalink

Comment has been collapsed.

No problem :) Thanks for passing by!

5 years ago
Permalink

Comment has been collapsed.

This is above my head, but have a bump so someone who knows might see.

5 years ago
Permalink

Comment has been collapsed.

Thanks a lot L31FY!

5 years ago
Permalink

Comment has been collapsed.

Closed 5 years ago by Ragido.