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 a Number with feedback.
target = random[1,100] // Min and max are both inclusive for the random function
guess = 0
println["Welcome to guess a number! I've picked a number between 1 and 100. Try to guess it!"]
while guess != target
{
   guessStr = input["What is your guess?"]
   guess = parseInt[guessStr]
   if guess == undef
   {
      println["$guessStr is not a valid guess. Please enter a number from 1 to 100."]
      next
   }
   if guess < target
      println["My number is higher than $guess."]
   if guess > target
      println["My number is lower than $guess."]
   if guess == target
      println["$guess is correct! Well guessed!"] 
}
 