[racket] Exercise 5.1.3 HTDP
*Exercise 5.1.3.* Develop the function check-guess3. It implements a
larger portion of the number guessing game of exercise
5.1.2<http://htdp.org/2003-09-26/Book/curriculum-Z-H-8.html#node_thm_5.1.2>
than
the function check-guess. Now the teachpack hands over the digits that the
user guesses, not the number that they form.
To simplify the problem a little bit, the game works with only three
numbers. Thus, check-guess3 consumes three digits and a number. The first
digit is the least significant, the third one is the most significant. The
number is called target and represents the randomly chosen number. Depending
on how guess, the number determined by the three digits, relates to target,
check-guess3 produces one of the following three answers: 'TooSmall, '
Perfect, or 'TooLarge.
The rest of the game is still implemented by *guess.ss*. To play the game
with check-guess3, evaluate
(guess-with-gui-3 check-guess3)
What number is determined by the 3 digits? If the 3 digits were 1 2 and 3,
does it mean that the number would then be 123? If that is the case how do
you go about doing that? Because the initial set I thought would look like
(define (check-guess3 a b
c target)
but then it say depending on how *guess *relates to target, so it should
still look like
(define (check-guess3 guess
target)
and the variable *guess *should hold the number created by the 3
digits?!?!?!? Am I even close? I did 5.1.2 just fine, but this one is really
confusing me. Any help is appreciated.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20110130/d1534ed3/attachment.html>