Poll: Are you bored?
You do not have permission to vote in this poll.
Yes
100.00%
7 100.00%
No
0%
0 0%
Total 7 vote(s) 100%
* You voted for this item. [Show Results]

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
I'm having trouble...
#1
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 Tongue

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.
Reply
#2
I THINK IT IS THIS

IF num1$ = "D1234"

d1234 IS YOUR VARIABLE NAME SO IT SHOULD NOT BE IN QUOTES

ALSO BECAUSE NUM1$ IS A STRING YOU PROBABLY NEED TO MAKE IT A NUMBER BEFORE COMPARING, I THINK IT WOULD BE

iF vAL(NUM1$) = d1234 tHEN
EVEN MEN OF STEEL RUST.
[Image: chav.gif]
Reply
#3
i JUST THREW THIS TOGETHER. HOPE IT HELPS

Code:
Cls
Color 7
Randomize Timer

num = INT(RND * 15) + 1

Print
Print "Guessing game."
Print "The number is in the range 1-15"

Do
  Print "Your guess?"
  Print ">";
  Input guess
  numguess = numguess + 1
  If guess = num Then
    Print "Well done, the number was " + str(num)
    Print "You took " + str(numguess) + " guess's"
    Exit Do
  Else
    If guess > num Then Print "Lower"
    If guess < num Then Print "Higher"
  End If
  If numguess = 5 Then
    Print "You've had 5 guess's, sorry"
    Print "The number was " + str(num)
    Exit Do
  End If
Loop

Sleep
End
EVEN MEN OF STEEL RUST.
[Image: chav.gif]
Reply
#4
man, turn off the fucking damned caps. It's very annoying.
SCUMM (the band) on Myspace!
ComputerEmuzone Games Studio
underBASIC, homegrown musicians
[img]http://www.ojodepez-fanzine.net/almacen/yoghourtslover.png[/i
Reply
#5
OOT:
it's interesting to see that most QB newbie programmer always turn their CAPS LOCK ON. I know this since I teach a bunch of them :lol:
Reply
#6
i love turning on caps lock once in a while, then i sit back and laugh hard as people start screaming 'TURN THE FUCKING CAPS LOCK OFF YOU TURD!", some people get upset over the simplest things
EVEN MEN OF STEEL RUST.
[Image: chav.gif]
Reply
#7
Quote:i love turning on caps lock once in a while, then i sit back and laugh hard as people start screaming 'TURN THE @£$£ CAPS LOCK OFF YOU TURD!", some people get upset over the simplest things
Some people are amused by the simplest things. You realize you're admitting to purposefully trying to be irritating?

People never cease to amaze me.
stylin:
Reply
#8
its the fact that people get so easily irritated that amuses me, some people are too serious. I used to be admin on a forum where people would keep complaining about this one guy who would only type in caps. i always felt more inclined to ban the whingers than the caps guy (but i had a strict policy of no bans, no deleting, no locked threads etc)
EVEN MEN OF STEEL RUST.
[Image: chav.gif]
Reply
#9
People will get irrited if what you do is irritating.

I don't get mad, I just don't read stuff written in caps as it is uncomfortable and stresses me.
SCUMM (the band) on Myspace!
ComputerEmuzone Games Studio
underBASIC, homegrown musicians
[img]http://www.ojodepez-fanzine.net/almacen/yoghourtslover.png[/i
Reply
#10
Quote:stresses me.

you should see a doctor if something this simple stress you, it could be a serious condition
EVEN MEN OF STEEL RUST.
[Image: chav.gif]
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)