: high|low ( gn-g$ )
  over > [ "high" ] [ "low" ] if ;

: checkGuess ( gn-gf || f )
  2over = [ "You guessed correctly!\n" puts 2drop 0 ]
          [ high|low "Sorry, your guess was too %s.\nTry again.\n" puts -1 ] if ;

: think ( -n )
  random abs 100 mod 1+ ;

: guess ( - )
  "I'm thinking of a number between 1 and 100.\n" puts
  "Try to guess it!\n" puts
  think [ getNumber checkGuess ] while
  "You got it!\n" puts ;

