Task

Write a game (computer program) that follows the following rules:

 The computer chooses a number between given set limits.
 The player is asked for repeated guesses until the the target number is guessed correctly
 At each guess, the computer responds with whether the guess is:
 higher than the target,
 equal to the target, 
 less than the target,   or
 the input was inappropriate. 


Related task

   Guess the number/With Feedback (Player)


; guess-number-feedback.lsp
; oofoe 2012-01-19
; http://rosettacode.org/wiki/Guess_the_number/With_feedback
 
(seed (time-of-day)) ; Initialize random number generator from clock.
(setq low  -5
      high 62 
      number (+ low (rand (- high low)))
      found nil
)
 
(print "I'm thinking of a number between " low " and " high ".")
 
(while (not found)
  (print " What's your guess? ")
  (setq guess (int (read-line) 'bad))
  (print (cond ((= 'bad guess) "That's not a number! Try again!")
               ((or (< guess low) (> guess high))
                (string "My number is between " low
                        " and " high ". Try again!"))
               ((< number guess) "Try a little lower...")
               ((> number guess) "Maybe a bit higher...")
               ((= number guess) (setq found true) "Exactly right!")))
  )
 
(println "\nWell guessed! Congratulations!")
 
(exit)