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)


PROC Main()
  BYTE x,n,min=[1],max=[100]
 
  PrintF("Try to guess a number %B-%B: ",min,max)
  x=Rand(max-min+1)+min
  DO
    n=InputB()
    IF n<min OR n>max THEN
      Print("The input is incorrect. Try again: ")
    ELSEIF n<x THEN
      Print("My number is higher. Try again: ")
    ELSEIF n>x THEN
      Print("My number is lower. Try again: ")
    ELSE
      PrintE("Well guessed!")
      EXIT
    FI
  OD
RETURN