[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Question on HtDP Exercise




>From the released HtDP: 


  Exercise 5.1.2 

  Develop the function check-guess. It consumes two numbers, guess and
  target. Depending on how guess relates to target, the function produces
  one of the following three answers: 'TooSmall, 'Perfect, or 'TooLarge.

  The function implements one part of a two-player number guessing
  game. One player picks a random number between 0 and 99999. The other
  player's goal is to determine this number, called target, with the least
  number of guesses. To each guess, the first player responds with one of
  the three responses that check-guess implements.

  The function check-guess and the teachpack guess.ss implement the first
  player. The teachpack picks the random number, pops up a window in which
  the second player can choose digits, and hands over the guess and the
  target to check-guess. To play the game, set the teachpack to guess.ss
  using the Language|Set teachpack option. Then evaluate the expression

  (guess-with-gui check-guess)

  after check-guess has been thoroughly tested. 

The function is called guess-with-gui in 103dX. More generally, the
teachpacks in 103dX are consistent with htdp.org, and the teachpacks 
in release 103 are consisten with an old version of the book somewhere
in the rice Web tree. 

-- Matthias