Assigned: October 9, 2019
Due: October 16, 2019
In this assignment, start with Programs 1 and 2 from Assignment 1. You will create
Program 3: your-name-happycat.rkt
your-name-happycat.rkt
In Assignment 1's first program, your cat moved from left to right across the empty scene, wrapping around when it reached the right edge, continuing forever. The WorldState
was a number, representing the cat's x-coordinate.
In the second program you created a happiness gauge that diminished with each tick of the clock—unless you made the cat happier by petting it or feeding it (with the “down” or “up” arrows on the keyboard). The WorldState
was also a number, but instead of representing an x-coordinate, it represented the cat's happiness, which ranged in value from 0 to 100.
In this assignment, you will combine these two programs, but to do so, you need a structure to represent the state of the world, because you have two values you need to keep track of simultaneously: the cat's x-coordinate, and the value of the happiness gauge (both are numbers).
Here's the link to the exercises in the text: Section 5.11 More Virtual Pets
Complete Exercises 88–91.
Advice: Remember to test everything with check-expects
. You should have well over 20!
Don't overwrite your working code from last week. Save those files so if you need to start over, you can! We've all done this, but it is so frustrating...
Submit your program with an .rkt extension via Moodle. It will be graded based on the posted assignment grading rubric.