@LuckyCharms
First off, this doesn't really fit into this thread, does it?
Also, you should put your code into code-tags
[ code] ...your code here...[ /code] (without the spaces)
Now, you seem to use WHILE/ENDWHILE a lot even though IF/ELSE/ENDIF would be appropriate. WHILE is used for
loops with a condition, IF-blocks are executed just once if the condition is true.
So the first part of your code should maybe look like this:
PRINT "WHAT IS YOUR NAME?"
INPUT NAME$
CLS
PRINT "HELLO, ";NAME$
PRINT "DO YOU WANT TO PLAY A GAME"
WAIT KEY
INPUT ANS$
CLS
IF ANS$="NO"
PRINT "GOODBYE"
END
ELSE
PRINT "THINK OF A NUMBER, 1 THROUGH 10"
PRINT "PRESS ANY KEY TO START THE GAME"
WAIT KEY
ENDIF
And the rest, I don't know.
...doesn't make much sense. I guess the correct solution would be gue = rnd(9)+1. Any variable ending with an '$' is automatically a string variable (i.e. text), but RND(9)+1 generates an integer (i.e. a number).
Afterwards there's a SELECT but no ENDSELECT anywere.
I guess a good start for you would be to write your program in pseudo-code, that is not as program code but in a more logical form, simply to make sure you get the structure and order of operations right. So your pseudo-code could look somewhat like this:
...
1. set 'random_number' to any integer between 1 and 10
2. Ask User for Number and store in 'user_number'
3. If he got the right number, he won the game, otherwise:
4. If user_number is bigger than random_number then print "Your number is too big!", otherwise:
5. print "Your number is too small!"
6. Go back to 2
...
...which can then be translated to DBP-code rather easily:
...
rem 1:
random_number = rnd(9)+1
rem 2:
start:
input "Your number between 1 and 10>", user_number
rem 3:
if user_number = stored_number
print "You got the right number!"
wait key
end
endif
if user_number > random_number
rem 4:
print "Your number is too big!"
else
rem 5:
print "Your number is too small!"
endif
rem 6:
goto start
...
(Although using 'goto' is certainly not the best idea, usually you'd use some kind of loop here instead, such as repeat..until or while..endwhile, or if you want to set a limit to how often the user can guess a number for..next).