Assignment 2 - Spring 2021

Assigned: Wed, Mar 17
Due: Mon, Mar 29 Tue, Mar 30, 11:59pm

1. Open a browser and copy/paste this URL: https://classroom.github.com/a/C1szqbGi

2. Login to Github and you will be prompted to accept this assignment
1. After you click on the [Accept this assignment] button, you will see a new page display in your browser with the message:
1. You accepted the assignment, Assignment 2. We're configuring your repository now. This may take a few minutes to complete. Refresh this page to see updates.
2. After you refresh the page you should see a page with the message: “You're ready to go!”
3. Note: this will create your own copy of Assignment 2 for you to work on, but it's not on your computer yet.

3. Click on the URL where your assignment repository has been created: https://github.com/Vassar-cs101-mlsmith/assignment-2-yourGitHubID
1. you are now on the GitHub page for your Assignment 2 repository

4. Click on the green button to download your [Code]
1. a “Clone” dialog box will appear, with the HTTPS tab underlined in red (if not, click on the HTTPS tab to select it)
2. select the last option labeled “Download ZIP” and save it on your computer
3. move the Assignment 2 zip file from its download location to your cs101 course folder.
4. extract the contents of the zip file either by double-clicking on it or control-clicking on it and selecting the appropriate option to extract its contents
5. navigate into your assign1 folder and confirm you see the happy-cat.rkt file there.

This assignment begins where assignment 1 left off. As I demonstrated in class, for assignment 2 you will combine your two separate big-bang programs for the cat and the happiness gauge into one big-bang program. This new program will display the cat moving across the screen, and below the cat, the happiness gauge will be decreasing with each tick of the clock, unless the user presses the up/down arrow keys to feed/pet the cat.

happy-cat.rkt

Now you will combine the first two big-bang programs you wrote for assignment 1 into a single big-bang program.

The first program you wrote had a cat move from left to right across the empty scene, wrapping around when it reached the right edge, continuing forever. The state of this world was a number, representing the cat's x-coordinate in the empty scene.

The second program you wrote 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 state of this world was also a number, but this time it represented the value of the happiness gauge, which ranged in value from 0 to 100.

Now you get to put these two programs together into a single program, but to do so, you will 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

You will complete Exercises 88–91.

• One function, one purpose (or, don't try to do too much in a single function)
• Do the exercises in order, following the Design Recipe as you go (i.e., Hand-in artifacts)
• Do not begin Exercise 89 before you have completed Exercise 88, etc.
• Exercise 91 is more work, and requires more thinking, than 88–90.
• Save a backup copy of your happy-cat.rkt, and call it happy-cat-90.rkt. This accomplishes two things:
• You have a working copy of the program through Exercise 90 (you don't want to lose your hard work), and
• If you make changes and completely break the program beyond salvation while working on Exercise 91, you can always reference/grab a fresh copy of happy-cat-90.rkt and start again.

In case you're curious, I had over 25 tests in my solution. You should have at least that many in your solution.

• From your browser on the GitHub page for your Assignment 2 repository, click on the [Add file] drop-down button and select “Upload files”
• From your assign2 folder on your desktop, click and drag the happy-cat.rkt file onto your browser where it says, “Drag files here to add them to your repository”
• just below the region of the webpage you should see both files appear; they'll be just above the Commit Changes section of the page.
• You are now ready to commit changes! Click on the green [Commit changes] button.
• Your updated happy-cat.rkt file file should now be in your Assignment 2 GitHub repository.