CSci 1301: Takehome 1

Due: Wednesday, October 14 at 11:59pm by e-mail (no late work accepted)

Total: 28 points

This is individual work. You are not allowed to spend more than 6 hours on this test. This includes any reading that you do to help you solve the problems.

Use helper functions as needed. All your functions (including all those you use in big-bang) must have documentation with the types of parameters and results, a function description, and, whenever possible, check-expect tests.
When defining your own structures, clearly explain what all the fields mean.
Comments, helpful variable names, and good code style and formatting are a very important part of your grade. You don't have to look for the shortest solution, but you should eliminate unnecessary code repetition if possible (use helper functions).

Task 1 (8 points): position on diagonal

Write a function on-diagonal? that consumes a posn structure and the size of square canvas (a positive integer) and and returns #true if the coordinates given by the position are on either one of the diagonals of the canvas (the one from left upper corner to the right lower one, or the one from the left lower corner to the right upper one) and #false otherwise. Write the contract and your own check-expects. You don't need to do any drawing, although you may draw the scene and the dot at the given position to check your answer (just for yourself).

Task 2 (20 points): a world problem

Your goal is to implement a simple game in which players are presented with three doors, one of which has a goat behind it. They open doors until they find a goat or there is only one closed door left.
Below are some sample images of the game: Doors and a goat

You may use this picture of a goat: The color of the doors is "tan", the canvas are 400 by 200 pixels, the doors are 100 by 120 pixels.

You need to clearly describe what your world state is at the beginning of your file.

Happy programming!

What to submit

Submit all your files as attachements in an email to me. Please include your name and a task number at the beginning of each file, in a comment. In your email message please include any comments about what works and what doesn't, as well as thoughts on how you would've continued if you had more time (if you run out of time). Also please include the total time you spent on the test.

CSci 1301 course web site.

The views and opinions expressed in this page are strictly those of the page author. The contents of this page have not been reviewed or approved by the University of Minnesota.