Randomize while avoiding any result already picked in previous sections

I would like to write a "companion software " for a boardgame, like in XCom and Houses of Madness 2ed.
I need a way to simulate the Player picking a card from a shuffled deck. It means that the randomizer must remember which "cards" had already been picked and...avoid them, picking just the cards that were never picked previously in the game.
I'm thinking ways to do it but they are very complex and they would probably not work.
Is there any obvious solution to the problem that didn't come to my mind?


This is interesting. I'm trying to build something similar for a random mission generator... haven't come up with a working code yet though. Probably pretty easy to do if you're good at js!


Don't know what options you have in Squiffy... but
In Quest, you could set-up the deck, or list of missions, in a split "array" variable,
IE:
N2 = Split(" 0, 1, 4, 5, 6, 7, 8, 9,11,12,13,14,15,16,17,18,19,20", ",")
then you can select one from the list and delete it so that it cannot be selected again.
OR:
create a list of the cards, shuffle the list, then select the first one.
You would also need a variable to keep track of how many cards are drawn.
Both methods will only select unselected cards.


This topic is now closed. Topics are closed after 60 days of inactivity.

Support

Forums