Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers DBPro Corner / Guessing Game D=

Author
Message
BMX1997
14
Years of Service
User Offline
Joined: 12th Jan 2010
Location:
Posted: 11th Jun 2010 01:39
Hi, I've been working on this guessing game for awhile now and I've ran into a problem. Here's whats not working.. If Spacekey()=1
_GameStart:
CLS
Print "I'm guessing of a number between 1 and 10. Can you guess which number ",name$;"?"

Randomize (Timer())
MyRandomNumber=RND (10)

Input "Guess: ",my_guess$
Endif

If my_guess$ > MyRandomNumber
Print "You guessed too high. Try again ",name$;"."
Goto _GameStart
Endif

If my_guess < MyRandomNumber
Print "You guessed too high. Try again ",name$;"."
Goto _GameStart
Endif

If my_guess$ = MyRandomNumber
Print " You guessed correct!"
Print "Press the Spacebar to continue"
Endif

What's not working are the 'If my_guess$ </>/= MyRandomNumber'. I'm not exactly sure what's wrong with it.
xxelixx
15
Years of Service
User Offline
Joined: 6th Dec 2008
Location: CodeLand
Posted: 11th Jun 2010 03:32
You should have you're "my_guess" as an integer instead of a string. You also have an endif after "Input "Guess: ",my_guess$"
that souldn't be there.

Here's your fixed code:



I added the waits in there so it doesn't go awway in an instant.
BMX1997
14
Years of Service
User Offline
Joined: 12th Jan 2010
Location:
Posted: 11th Jun 2010 04:15
Thank you very much. Tough trying to learn this stuff lol.
xxelixx
15
Years of Service
User Offline
Joined: 6th Dec 2008
Location: CodeLand
Posted: 11th Jun 2010 07:45
You're welcome, and I know what you mean.

Login to post a reply

Server time is: 2024-09-28 18:28:06
Your offset time is: 2024-09-28 18:28:06