[racket] Exercise 5.1.3 HTDP
On Jan 30, 2011, at 1:05 PM, Jeremy Duenas wrote:
> Exercise 5.1.3. Develop the function check-guess3. It implements a larger portion of the number guessing game of exercise 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?
Have you taken a look at exercise 2.2.4? It's closely related.
John Clements
> 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.
>
>
>
>
> _________________________________________________
> For list-related administrative tasks:
> http://lists.racket-lang.org/listinfo/users
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 4669 bytes
Desc: not available
URL: <http://lists.racket-lang.org/users/archive/attachments/20110130/d98fe8d3/attachment.p7s>