'Mr. M
'October 18, 2000
'Poor style example of guessing game using goto
'id est, it works, but it isn't efficient or in good style.  See while loop example

RANDOMIZE TIMER   'Setup for random number generation
CLS               'Clear the screen
c = 0             'Setup a counter for the number of guesses

'Display instructions for playing the game
PRINT             'Print a blank line
PRINT "I, the all knowing computer, shall obtain a number between 1 and 100."
PRINT "Your job is to guess that number.  I will advise you if you are"
PRINT "too high or too low.  Enter a guess when prompted to do so."
PRINT             'Print a blank line for aesthetic reasons

x = INT(RND * 100)       'Computer chooses a number and stores it in x
start:                   'Label for additional tries (Poor form)
PRINT
INPUT "Enter a guess, o psychic one!"; guess

IF (x = guess) THEN      'Guess is correct routines
  PRINT : PRINT "Absolutely correct!  You win!"
  PRINT "With your amazing mind reading abilities, you only took "; c; " tries."
END IF

IF (x < guess) THEN      'Guess is too high routines
  PRINT "Your guess is too high.  Try again": PRINT
  c = c + 1              'Add one to the guess counter
  GOTO start             'GOTO the start label to get another guess (Poor style)
END IF

IF (x > guess) THEN       'Guess is too low routines
  PRINT "Your guess is too low.  Try again": PRINT
  c = c + 1               'Add one to the guess counter
  GOTO start              'GOTO the start label for another guess (Poor style)
END IF




