Page 1 of 1

more than one catch on random numbers

Posted: Sun Oct 22, 2006 2:00 pm
by jetq111
hey.
Im making a RPG (my first) where you walk throu a maze and end at one random tile. Dont get it? Example
123456789
1 "#######"
2 "# # # # #"
3 "#--------#"
4 "######"
say you end at row two, but u could exit the maze at either 2,2 2,4 2,6 or 2,8
If i want this to be random (I.E. the computer randomly chooses which of the exits you go to), is their a way to only chose one of those coridantes,
and not one that has a "#" at it? this code wouldnt work:

exitrow: 1
exitcolumn: INT(9*RND)+1
END

this wouldnt work cuz it could chose a number with a # on it. So does anybody know how to make a random number only chose numbers 2, 4, 6, 8
out of my maze?

thnxs

PS srry if this was confusing
PPS the --- in the example are just their so the maze looks right, they wont be their in the end

Re: more than one catch on random numbers

Posted: Sun Oct 22, 2006 3:29 pm
by bungytheworm
jetq111 wrote:So does anybody know how to make a random number only chose numbers 2, 4, 6, 8
out of my maze?
Im not 100% sure are you behind what i think but here is my solution.
It's pure mathematics ;)

Code: Select all

Randomize Timer

For Counter = 1 TO 10
	a = (INT(RND * 4) * 2) + 2 ' 2, 4, 6, 8 are possible values.
	Print a 
	a = 0
Next Counter
Let us know how your project is goin :)
If this was totally wrong answer to your question, sorry. Try explain again.

Posted: Wed Oct 25, 2006 4:00 pm
by jetq111
thanks
I was under the impression that if you did somthing like
INT(RND * 30 (.5)) + 1 ' 2 etc would not work.
thanks for the advice.
jetq111

ps
Ill post my game when its done.
thanks

Posted: Thu Oct 26, 2006 6:25 am
by bungytheworm
Glad your problem solved.
Yes, post game here when it's done. New qb games are allways nice to see coming up.