Due date: 4/4 @ 4:30 pm
This problem set is optional. You will not get any credit for completing
the problem set, but you are encouraged to do so and to check with the TAs
when you encounter problems.
The goal of this problem set is to understand accumulators with some
small problems and, as it is more common, in the context of somewhat
larger problems. As you will see, in the context of real problems
accumulators often show up inside of data representations of problem
data instead of extra arguments to functions.
HtDP Problems:
31.3.3, 31.3.4, 31.3.7
Plus one of the following two problems:
The "Missionaries and Cannibals" Problem:
Solve all problems in section 32.2 of HtDP. Also design a function that
creates an image from a given state representation. Use it to illustrate
the problem solving process, once you know that the problem is tested
and runs. Hint: you may want to turn the states of the solution into a
movie and use run-movie
from world.ss to show how to solve
the problem.
This section shows you how you can design data representations
that include accumulated information.
The "Peg Solitaire" Problem:
Solve all problems in section 32.3 of HtDP.
Also design a function that
creates an image from a given state representation. Use it to illustrate
the problem solving process, once you know that the problem is tested
and runs. Hint: you may want to turn the states of the solution into a
movie and use run-movie
from world.ss to show how to solve
the problem.
Optional:
Please explain any problems you had completing this assignment in no more than 30 words.