12-20-2005, 07:40 AM
My mom wanted to see how well I could make a guessing game with 1-15. My ONLY problem is somewhere in my code. Could someone check it?
Code:
start:
CLS
COLOR 7
RANDOMIZE TIMER
D1234 = INT(RND * 15) + 1
INPUT "Guess a number between one and fifteen"; num1$
IF num1$ = "D1234" THEN GOTO onetry
IF num1$ < "D1234" THEN PRINT "Your number was too low."
IF num1$ > "D1234" THEN PRINT "Your number was too high."
INPUT "Guess a different number between one and fifteen"; num2$
IF num2$ = "D1234" THEN GOTO twotries
IF num2$ < "D1234" THEN PRINT "Your number was too low."
IF num2$ > "D1234" THEN PRINT "Your number was too high."
INPUT "Guess one more number between one and fifteen"; num3$
IF num3$ = "D1234" THEN GOTO threetries
IF num3$ <> "D1234" THEN GOTO ending
onetry:
PRINT "WOW! ONLY ONE TRY!"
INPUT "Play again (y/n)"; yesorno$
IF yesorno$ = "y" THEN GOTO start ELSE END
twotries:
PRINT "Pretty Good! Two tries."
INPUT "Play again (y/n)"; yesorno2$
IF yesorno2$ = "y" THEN GOTO start ELSE END
threetries:
PRINT "Hey, at least you won. By the skin of your teeth, but you won!"
INPUT "Play again(y/n)"; yesorno3$
IF yesorno3$ = "y" THEN GOTO start ELSE END
ending:
PRINT "IT WAS THE NUMBER "; D1234; "!!"
INPUT "Play again (y/n)"; yesorno4$
IF yesorno4$ = "y" THEN GOTO start ELSE END
END
y name is Nobody, and nobody's perfect. So now I am perfect
98% of the teenage population smokes or has smoked pot. If you're one of the 2% who hasn't, copy and paste this in your signature.
98% of the teenage population smokes or has smoked pot. If you're one of the 2% who hasn't, copy and paste this in your signature.