Pick a random number with no repeat.
I want to pick a random number between 1 and 9, but I have some issues.
A passenger will appear randomly on pad 1 - 9, but only one time on each pad.
And when I pick up the passenger on for example pad 1, the passenger will ask me to fly to another pad, for exampel 5, but he will never ask for the same pad he appears on.
After I leave the passenger on pad 5, a new passenger will appear on another pad. The passenger will never appear on the same pad more than one time.
I can't get this to work properly. Any ideas?
If anyone is familiar with a game called Space Taxi from the 80s, then you know what I'm talking about.
I add a link to Space Taxi, so you can see.
https://www.youtube.com/watch?v=cEcxgPvmQqU
-
In the video at 0:44, someone appeared on the same pad the taxi was already on. So that should be okay, right?
-
Hi!
Yes, that's okay.
Aecert mentioned that I could use Exclusive Gates to make this perfectly, but I'm not sure how I should set up the logic.
-
You can use a randomiser gadget in "shuffle" mode. That will sort the order randomly, but not repeat any of the channels until it's gone through all of them. So that should be about right for choosing which place a new pickup appears.
Then to choose where to take them, a simple way would be to use a randomiser on the default "no repeat" mode to get where to take them. If it's the same place as they came from, send them to a set place. So technically, that set place will be slightly more likely to be picked for the destination of that place. But probably not an issue for the gameplay.
https://www.youtube.com/watch?t=133&v=GyA5TZ1dBK8&feature=youtu.be&ab_channel=TAPgiles
-
Shuffle could work in this case, but I another thing, after I pick up a passenger, I need to subtract 1 from Randomiser. So it will never pick the same pad twice.
-
That's what the second paragraph would solve, in my previous comment. If it randomises the destination to the place they're already at, it would pick a specific pad you set up in advance for that starting point to go to.
But that's a fair alternative; add or subtract 1 if it randomised to the place you started at. Though be careful about picking a number which has no pad for it.
Please sign in to leave a comment.