It is recommended that you work in pairs on this problem set
Exercise 5.1.5.
Important: include test cases for your check-color function, for instance:
(check-color 'red 'yellow 'green 'red)
Carefully read the instructions on how to load the teachpack and run the program.
To play the game you need an older version of DrRacket
(version 5.0)
since the
hangman teachpack doesn't work with the current one (5.0.1).
If you would like to use the older version to play/test the game, download it
here: http://download.racket-lang.org/racket-v5.0.html. When installing, make sure that you use
a different folder name. Don't get confused between the two versions.
Testing in the older version is optional. You can just submit your solution
without trying to play the game.
The hangman problem, i.e. exercises 6.7.1, 6.7.2, and 6.7.3 in Section 6.7. Some important notes:
(draw-next-part 'noose)
The second one is the result of a sequence
(draw-next-part 'noose)
(draw-next-part 'head)
(draw-next-part 'body)
(draw-next-part 'right-arm)
(draw-next-part 'left-arm)
The third one is the result of all 7 calls.
word
that
contains three letters (as symbols). Assuming that the first letter field
is called letter1
, one of your test examples may be:
(word-letter1 (make-word 's 'u 'n))
;; expected value
's
Note that it's up to you how you call the three fields, but the structure
itself must be called word
.
reveal
must work with the test examples
in the book. reveal
if your top-level
operation in the function is make-word
. Then you just need to
figure out each letter according to the given rules (use
conditionals). Writing helper functions would make the task easier.
(hangman make-word reveal draw-next-part)
Note: this doesn't work with the current version of DrRacket. See above on
how to fix the issue.