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)


include get.e
 
constant lower_limit = 0, upper_limit = 100
 
integer number, guess
number = rand(upper_limit-lower_limit+1)+lower_limit
 
printf(1,"Guess the number between %d and %d: ", lower_limit & upper_limit)
while 1 do
    guess = floor(prompt_number("", lower_limit & upper_limit))
    if number = guess then
        puts(1,"You guessed correctly!\n")
        exit
    elsif number < guess then
        puts(1,"You guessed too high.\nTry again: ")
    else
        puts(1,"You guessed to low.\nTry again: ")
    end if
end while