Homework 4
Last updated: Mon, 23 Oct 2023 09:05:09 -0400
Out: Mon Oct 16, 2023, 00:00 EST
Due: Sun Oct 22, 2023, 23:59 EST
Overview
In this assignment, we’ll continue to practice using The Design Recipe to write programs involving lists and other compound data.
This hw will be graded accordingly:
correctness (9 pts)
design recipe (24 pts)
style (8 pts)
README (1 pt)
Setup
Create a new repository for this assignment by going to the CS450 Fall 2023 GitHub Organization page and clicking "New".
Name the repository <YOUR ACCOUNT NAME>-hw4 where <YOUR ACCOUNT NAME> is your GitHub account name.
For example, if my GitHub account is cs450student then I would name my hw4 repository cs450student-hw4.
Mark the repository as Private.
Check "Add a README file".
When done click "Create repository".
Here is the hw4 starter repo. You won’t be able to fork it, but, you can copy the files into your own repo and then edit them.
Submitting
1 Before Submitting
Do not submit until all code has been thoroughly tested, independent of the autograder (if there is one), and you are reasonably sure the assignment is complete and correct.
The autograder is not a software development tool so it should not be used as one.
If you submit and get an autograder error, this means the code you wrote is not complete and correct and it’s up to you to figure out why.
The course staff is here and eager to help, but cannot do so if students don’t explain what they’ve tried first (e.g., "why is the autograder giving an error?" is not something we can help with).
The grading criteria (i.e., test suite) is subject to change. This means that the grade on the preliminary autograder test suite (if one is provided) is not the final grade.
2 Common Problems
3 Files
A submission must have the following files in the repository root:
hw4.rkt: Contains the hw solution code.
All defines should use the name specified in the exercise (ask if you are unsure) and should be provided.
The easiest way to ensure all necessary definitions are provided is to put as the second line in the file:
This automatically provides all definitions in the file. (The first line should be #lang racket)
All code should also follow proper Racket Style.
tests.rkt: This file should require hw4.rkt and define tests for it.
Specifically, it should define a rackunit test-suite which contains sufficient rackunit test cases (e.g., check-equal?, etc.) for each defined function.
README.md: Contains the required README information, including the GitHub repo url.
Also, the repository must have appropriate commit messages. See How to Write a Git Commit Message if you are unsure how to write a commit message.
4 GradeScope
When ready, submit this assignment to Gradescope hw4 using the "GitHub" submission feature with the hw4 repository selected.
HW Tasks
Implement the practice filter functions from lecture 11: smaller-than, larger-than, shorter-than, shorter-than-string.
- Modify the multiple bouncing ball big-bang program from lecture 8 so that on a click, an additional ball is added that has:
UPDATE: The inserted balls should not have random x and y positions. They should be at the mouse cursor.
random center integer x and y position that is the same as the mouse cursor position,random integer x and y velocity, with each between 0 (inclusive) and 10 (exclusive),
a random color, in the RGB representation. Note that an RGB color is represented by three integers, each between 0 (inclusive) and 255 (inclusive), which represent the amount of red, green, and blue in the color, respectively. You may find make-color from 2htdp/image useful.
a random size, i.e., radius between the 8 pixels (inclusive) and 40 pixels (exclusive)
Further, all added balls must always be completely in the scene. If for some reason, the user clicks and tries to add a ball that would be all or partially out of the scene, nothing should happen.
Finally, if the mouse cursor ever leaves the canvas area, then all balls with radius larger than or equal to 20 pixels should be removed from the "world".
Here is an approximation of a correct program running
Do not just "try to get the code working". Doing so will not earn a good grade on this assignment.
All code must follow The Design Recipe. This means that data definitions should be created or updated to properly represent the needed data representations in the program. Further, all functions must have all the required Function Design Recipe components. In particular, you must be able to explain how you arrived at any piece of the code in the program. Also, functions should be split properly according to the kind of data that is processes.