Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

THIS EXERCISE SHOULD BE DONE IN BEGINNING STUDENT LANGUAGE IN DR RACKET. Functions to Avoid equal? equal~ ? eq ? eqv? assq assoc assv member

THIS EXERCISE SHOULD BE DONE IN BEGINNING STUDENT LANGUAGE IN DR RACKET. Functions to Avoid
equal?
equal~?
eq?
eqv?
assq
assoc
assv
member
member?
memq
remove
remove-all Unless otherwise stated, for all function design problems you must provide (i) a signature, (ii) a purpose statement, (iii) check-expects, and (iv) the actual code, in the language specified at the top of this page.
Unless otherwise stated, for all data design problems you must provide (i) a definition, (ii) an interpretation, (iii) examples, and (iv) a template.
Some exercises may require you to design additional data for full credit, even if this isn't made explicit in the question. A Simple Game
Work on designing a small program which allows you to move a dot by clicking the mouse. The program should display a black background with a white dot at some given initial location and then when the user clicks the dot should appear at the mouses location instead. To do this, we will follow the same steps for designing programs as we did in the previous lab.
Remember to do the full function design recipe for every big-bang handler, including check-expects.
Step 1: What stays the same?
Exercise 6 Define some constants to describe what stays the same throughout the game. What images will you need in order to draw the program?
Step 2: What changes?
The only thing that changes in this program is the location of the dot. How can we best represent this? Think about the types of data you know and choose one that represents a location in 2d space. This will be your world state.
Step 3: Which handlers do we need?
Exercise 7 Write the signature and purpose statements for the handler functions you will need. Recall that big-bang always requires a to-draw clause. Which other clauses will you need based on the program description? If you are having trouble take a look at the documentation, and if you are still confused, ask a tutor or TA for assistance.
Step 4: Main Function
Now that weve decided on our handler functions, we can put together our main function which will call big-bang. Recall that we write this function first because in this course we follow a top down programming approach. That means larger functions go at the top of our program and smaller functions go underneath.
Exerddot, starts up the big-bang program.
Step 5: Design your handlers
Exercise 9 Design the handlers you decided on in step 3.
Give your program a try! Recall that the dot should only change positions when the mouse is clicked, and not every time the mouse moves.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

Presentations Approaches to Conveying Information

Answered: 1 week ago