views:

318

answers:

4

I'm coding a board game where there is a bag of possible pieces. Each turn, players remove randomly selected pieces from the bag according to certain rules.

For my implementation, it may be easier to divide up the bag initially into pools for one or more players. These pools would be randomly selected, but now different players would be picking from different bags. Is this any different?

If one player's bag ran out, more would be randomly shuffled into it from the general stockpile.

+1  A: 

My intuition tells me that dividing a random collection of things into smaller random subsets would remains equally random... doesn't matter if a player picks from a big pool or a smaller one (that in turns, feed itself into the big one)

For a game it is enough random IMHO!

Mike Gleason jr Couturier
-1: It's not that simple. There's a big difference between having a small chance of getting a piece, and having *no* chance (because it's in a different bag, available only to another player). Depending on the nature of the game, this could be absolutely critical.
ire_and_curses
I would add to my answer that, making smaller bags is just the same thing as "pre-picking" random pieces at the start of the game. The problem is just moved in time so I guess it stays random. The order the player will really pick them will be decided during the game.
Mike Gleason jr Couturier
"There's a big difference between having a small chance of getting a piece, and having no chance" If you have 8 pieces for 4 players and make 4 bags, you have 1 chance out of 2 of getting a particular piece in your bag... I'm not good enough to calculate the chances if you go with just 1 bag, but I would be surprised if the chances of getting a particular piece was greater than .5! I think you only move forward in time the act of picking them.
Mike Gleason jr Couturier
Intuition and Probability rarely go hand in hand: see the Monty Hall problem for an example!
Mitch Wheat
There's a gap between rarely and never... and that gap is different for each problem :) I'm in line with mjv, in case if everyone stops reading at ire_and_curses's comment...
Mike Gleason jr Couturier
@Mike not sure who "minus-ed" you but I'll go ahead and "plus" you instead. You response is _generally_ correct. I suggest you stress that A) the items are effectively removed from the bag(s) never to be drawable again; this seems implied from the question's text, but what goes without saying ;-) and B) remove or qualify the "enough random IMHO" bit. For a game one needs to know that both situtations are exactly identical in terms of the odds even though the process may vary. The "random enough" gives it an edge of "I'm not so sure" and this may be what warranted you the minus.
mjv
This is correct, @ire_and_curses is incorrect, and your analogy of "moving the calculations forward" is basically accurate.
Rudedog
@Mike, in view of Mitch W's remark to you, he too was keying on these "intuition" and maybe "random enough" terms, which do make your response weak even though it is [AFAIK] factually correct.
mjv
Thanks mjv, you're answer was far more explicit and deserves the answer mark. I skipped some details. My opinion is that unless it is a poker game like involving money, randomness in board games is subject to interpretation as we can question ourselves: are rolling a dice or shuffling cards truly random?
Mike Gleason jr Couturier
Thanks guys, I'll pay attention, I'm glad you pointed it out.
Mike Gleason jr Couturier
+5  A: 

So long as:

  • the partition into "pool" bags is random
  • the assignment of players to a given pool bag is random
  • the game is such that items drawn by the players are effectively removed from the bag (never returned to the bag,or any other bag, for the duration of the current game)
  • the players are not cognizant of the content of any of the bags

The two approaches ("original" with one big common bag, "modified" with one pool bag per player are equivalent with regards to probabilities.

It only gets a bit tricky towards the end of the game, when some of players' bags are empty. The fairest to let pick from 100% of the items still in play, hence, they should both pick from which bag they pick and [blindly,of course] pick one item from said bag.

This problem illustrate an interesting characteristic of probabilities which is that probabilities are relative to the amount of knowledge one has about the situation. For example the game host may well know that the "pool" bag assigned to say player X does not include any say Letter "A" (thinking about scrabble), but so long as none of the players know this (and so long as the partitions into pool bag was fully random), the game remains fair, and player "X" still has to assume that his/her probably of hitting an "A" the next time a letter is drawn, is the same as if all remaining letters were available to him/her.

Edit:
Not withstanding the mathematical validity of the assertion that both procedures are fully equivalent, perception is an important factor in games that include a chance component (in particular if the game also includes a pecuniary component). To avoid the ire of players who do not understand this equity, you may stick to the original procedure...

mjv
Hey mjv, tell'em to give my point back!
Mike Gleason jr Couturier
Nice point on the psychological aspects.
Jim Ferrans
+2  A: 

Depending on the game rules, @mjv is right, the initial random division doesn't affect the probabilities. This is analogous to a game where n players draw cards in turn from a face down deck: the initial shuffle of the deck is the random division into the "bags" of cards for each player.

But if you replace the items after each draw, it does matter if there is one bag or many. With one bag any particular item will eventually be drawn by any player with the same probability. With many bags, that item can only be drawn by the player whose bag it was initially placed in.

Popping up to the software level, if the game calls for a single bag, I'd recommend just programming it that way: it should be no more difficult than n bags, and you don't have to prove the new game equivalent to the old.

Jim Ferrans
A: 

Depending on how crucial security is, it might be okay (if money is involved (you or them) DO NOT DO THAT). I'm not entirely sure it would be less random from the perspective of an ignorant player.

a) Don't count on them being ignorant, your program could be cracked and then they would know what pieces are coming up

b) It would be very tricky to fill the bags in such a way that you don't introduce vulnerabilities. For instance, let's take the naive algorithm of picking one randomly and putting it in a the first bucket, taking it out, and then doing the same for the second bucket and so on. You just ensured that if there are N pieces, the first player had a probability of 1/N of picking a given piece, the second player had a 1/(N-1), the third had 1/(N-3) and so on. Players can then analyze the pieces already played in order to figure out the probabilities that other players are holding certain pieces.

I THINK the following algorithm might work better, but almost all people get probability wrong the first time they come up with a new algorithm. DON'T USE THIS, just understand that it might cover the security vulnerability I talked about:

  1. Create a list of N ordered items and instantiate P players
  2. Mark 1/P of the items randomly (with replacement) for each player
  3. Do this repeatedly until all N items are marked and there are an equal number of items marked for each player (NOTE: May take much longer than you may live depending on N and P)
  4. Place the appropriate items in the player's bucket and randomly rearrange (do NOT use a place swapping algorithm)

Even then after all this, you might still have a vulnerability to someone figuring out what's in their bucket from an exploit. Stick with a combined pool, it's still tricky to pick really randomly, but it will make your life easier.

Edit: I know the tone sounds kind of jerky. I mostly included all that bold for people who might read this out of context and try some of these algorithms. I really wish you well :-)

Edit 2: On further consideration, I think that the problem with picking in order might reduce to having players taking turns in the first place. If that's in the rules already it might not matter.

SapphireSun