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)


 
procedure main()
    smallest := 5
    highest := 25
    n := smallest-1 + ?(1+highest-smallest)
    repeat {
      writes("Pick a number from ", smallest, " through ", highest, ": ")
      guess := read ()
 
      if n = numeric(guess) 
        then { 
          write ("Well guessed!")
          exit ()
        }
      else if n < numeric(guess)
        then write ("Your guess is too high")
      else if n > numeric(guess)
        then write ("Your guess is too low")
      else write ("Did you enter a number?")
    }
end
 