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)


' FB 1.05.0 Win64
 
Randomize
Dim n As Integer = Int(Rnd * 20) + 1
Dim guess As Integer
 
Print "Guess which number I've chosen in the range 1 to 20"
Print
Do
  Input " Your guess : "; guess
  If guess > n AndAlso guess <= 20 Then
    Print "Your guess is higher than the chosen number, try again "
  ElseIf guess = n Then
    Print "Correct, well guessed!"
    Exit Do
  ElseIf guess < n AndAlso guess >= 1 Then
    Print "Your guess is lower than the chosen number, try again"
  Else
    Print "Your guess is inappropriate, try again"   
  End If
Loop
End