Name: Anonymous 2011-11-05 23:37
Any language that allows shit like this should be outlawed.
IF choice$ = "YES" OR choice$ = "Y" THEN ' and decides whether or not they want to play:
guesses% = 5 ' Set up number of guess remaining
RANDOMIZE TIMER ' Sets up the random number generator
target% = INT(RND * 10) + 1 ' Picks a random number between 1 and 10 (inclusive)
won% = 0 ' Sets up a flag called 'won%' to check if user has won
PRINT "The number is between 1 and 10."
WHILE guesses% > 0 AND won% = 0 ' Enters a loop until the user wins or runs out of chances
INPUT "Enter your guess: ", guess% ' Takes user input (the guess)
IF guess% = target% THEN ' Determines if the guess was correct
PRINT "Correct, the answer was"; target%; "!"
won% = 1 ' Sets a flag to indicate user has won
ELSE
guesses% = guesses% - 1 ' Deducts one chance
PRINT "Sorry, please try again. You have"; guesses%; "guesses left."
END IF
WEND ' End of guessing loop
IF won% = 0 THEN PRINT "You ran out of guesses, the number was"; target%; "."
END IF