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)


       IDENTIFICATION DIVISION.
       PROGRAM-ID. Guess-With-Feedback.
 
       DATA DIVISION.
       LOCAL-STORAGE SECTION.
       01  Seed       PIC 9(8).
       01  Random-Num PIC 99.
       01  Guess      PIC 99.
 
       PROCEDURE DIVISION.
           ACCEPT Seed FROM TIME
           COMPUTE Random-Num =
               FUNCTION REM(FUNCTION RANDOM(Seed) * 1000, 10) + 1
 
           DISPLAY "Guess a number between 1 and 10:"
 
           PERFORM FOREVER
               ACCEPT Guess
 
               IF Guess > Random-Num
                   DISPLAY "Your guess was too high."
               ELSE IF Guess < Random-Num
                   DISPLAY "Your guess was too low."
               ELSE
                   DISPLAY "Well guessed!"
                   EXIT PERFORM
           END-PERFORM
 
           GOBACK
           .