# Best way to randomise whether a card is drawn face up?

I have 16 cards, 4 sets of 4. Each set of 4 has a unique front and back. I want to deal a certain number of them to certain locations, and randomise whether they are face up or face down. After setup, no more cards will be drawn for the duration of the game.

The only way I have figured out to do this is to have 32 pieces (or cards), 8 sets of 4, with the “front” and “back” pairs in 4 different always shuffled decks. From each deck, 4 pieces are sent to another always shuffled draw deck. This step randomises the “facing”. Then X pieces are dealt to the board.

This works fine, right? Is there a better or easier way to do it?

That sounds fine to me. If you were absolutely committed to having only 16 cards exist, you could use a BeanShell expression to use the java random number generator, but honestly if you’ve already done what you describe just stick with that.

Can you explain how that would work? It sounds useful for other situations too.

(and no, I’m still planning, nothing made yet - but as you are probably aware, I’ll probably be better of not trying to work with double-sided cards for this particular module)

I agree, sounds like a good solution.

I am looking at adding BeanShell functions

RandNumber(x) - Return a random integer between 1 and x inclusive
RandNumber(x, y) - Return a random integer between x and y inclusive.

Which would allow you you to put {RandNumber(2) > 1} into the Trigger Action properties match box.

Perhaps also
Random(x) - Return true randomly x% of the time.

Which would allow {Random(50)} as the property match expression to make a 50/50 selection on execution.

These are trivial to add and I think will be extremely useful.

Those would be super-useful, as a lot of random applications currently have to be steered toward the antiquated Deck mechanics.

One note – given that so many of the games we do here are dice-related, and that “rolling a die” and acting on the result is such a fundamental game feature, it seems like (at least for Vassal 4) some improvements are in order along that line:

• “Dice” buttons able to fire GKC’s
• Dice buttons able to specify properties for their results to be written into (so a piece could fire a die roll, the die roll would appear in the log, and the piece could process the result)

Brian

If you don’t need masking and used layers instead, then what you want to do is easy.

In the latest modules I’ve made, I’ve drifted away from using the dice button on the toolbar. Instead, I create dice pieces via the layer trait, and I find them to be much more dramatic and pleasant. Because a die roll in my world is a random layer, the “roll” is exposed as a property, so I can already do much of what you propose.

Yes, I cannot believe I forgot that, I’ve used this many times before, thank you!