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).
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).
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:
Specifically:
(random 3)
returns 0, 1, or 2 with equal probabilities.
Make sure you set the goat door only once in the beginning of
your program so that it doesn't get reset in the middle. 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.
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.