Dominion Strategy Forum

Please login or register.

Login with username, password and session length
Pages: [1]

Author Topic: Math question: probability and non-whole-number hand sizes  (Read 8432 times)

0 Members and 1 Guest are viewing this topic.

Toskk

  • Young Witch
  • ****
  • Offline Offline
  • Posts: 132
  • Respect: +44
    • View Profile
Math question: probability and non-whole-number hand sizes
« on: April 18, 2012, 10:31:58 pm »
0

Ok, this question is for anyone better at math than I.. what I'm hoping to find is a formula that can approximate the probability of, for example, Moneylender pairing up with a Copper (but it could be any card that cares about another specific card) when you also have something like a Laboratory in your deck.

Using a whole number value for hand size, calculating the odds of the event above is trivial.. and it's also trivial to calculate your average hand size based on the composition of your entire deck (e.g. including all Laboratories you have).. but does anyone happen to have a good method for approximating both at once?

For example, with a deck of 13 cards including one Laboratory, you will go through your deck in 2.4 turns, or have an average hand size of 5.4167 cards. But with 5.4167 cards in any given hand, how would you go about approximating the odds of having both Moneylender and at least one Copper in said hand? Note: yes, in this particular case, the odds are probably 100% (unless you happen to have a Silver in those 13 cards too, in which case you could have Moneylender + EEES).. I'm wanting a formula that can compute this, rather than the specific answer for this case. ;)

Thanks in advance to anyone who can suggest a reasonable method for averaging this. For reference, I'm working on a Dominion model (not Simulator) (I posted about it a while back) again. ;)
« Last Edit: April 18, 2012, 10:59:27 pm by Toskk »
Logged

blueblimp

  • Margrave
  • *****
  • Offline Offline
  • Posts: 2849
  • Respect: +1559
    • View Profile
Re: Math question: probability and non-whole-number hand sizes
« Reply #1 on: April 18, 2012, 11:15:21 pm »
0

For example, with a deck of 13 cards including one Laboratory, you will go through your deck in 2.4 turns, or have an average hand size of 5.4167 cards.

This seems wrong to me. First, if I have a deck of 12 treasures and 1 cantrip, then it takes 12/5 = 2.4 turns to get through my deck. A lab cycles faster than a cantrip, so 2.4 can't be right.

A naïve modification to this would be to have the lab subtract one from your effective terminal count (since it draws 2), so we'd estimate that with a deck of 12 treasures and 1 lab, it'd take (12-1)/5 = 2.2 turns to get through the deck. This is wrong too, though, because a lab is going to miss the reshuffle more often than a typical card: if the lab is in the bottom 6 cards of the deck, it misses the reshuffle, whereas with a normal treasure, it needs to be in the bottom 4 (unless it's in a lab hand).
Logged

Young Nick

  • Minion
  • *****
  • Offline Offline
  • Posts: 561
  • Respect: +274
    • View Profile
Re: Math question: probability and non-whole-number hand sizes
« Reply #2 on: April 18, 2012, 11:15:38 pm »
0

Ahh I have tried to calculate this using simple combinatorics 3 times and failed at each. I know that there is at least a 4/39 chance that you don't see your Baron until turn 5 assuming you somehow open Estate/Baron/Laboratory. If I can finish it off, I'll post later.
Logged

Young Nick

  • Minion
  • *****
  • Offline Offline
  • Posts: 561
  • Respect: +274
    • View Profile
Re: Math question: probability and non-whole-number hand sizes
« Reply #3 on: April 18, 2012, 11:22:56 pm »
0

Also, there is a 3/13 chance that you have 3 cards in your draw pile (one necessarily being the Lab) after two turns. There is a 10/13 chance that there is only 1 card left in your draw pile. With 13 cards, you cycle on average every 13/5. With 11 cards, you cycle on average every 11/5 turns. Thus, neglecting the next reshuffle, the odds for a given draw pile NOT CONSIDERING THE EFFECTS OF PREVIOUS SHUFFLES is 3/13*13/5 + 10/13*11/5 = 3/5 + 22/13 = 39/65 + 110/65 = 149/65. So you cycle every 2.292 turns with that restraint.
Logged

Toskk

  • Young Witch
  • ****
  • Offline Offline
  • Posts: 132
  • Respect: +44
    • View Profile
Re: Math question: probability and non-whole-number hand sizes
« Reply #4 on: April 18, 2012, 11:26:55 pm »
0

For example, with a deck of 13 cards including one Laboratory, you will go through your deck in 2.4 turns, or have an average hand size of 5.4167 cards.

This seems wrong to me. First, if I have a deck of 12 treasures and 1 cantrip, then it takes 12/5 = 2.4 turns to get through my deck. A lab cycles faster than a cantrip, so 2.4 can't be right.

A naïve modification to this would be to have the lab subtract one from your effective terminal count (since it draws 2), so we'd estimate that with a deck of 12 treasures and 1 lab, it'd take (12-1)/5 = 2.2 turns to get through the deck. This is wrong too, though, because a lab is going to miss the reshuffle more often than a typical card: if the lab is in the bottom 6 cards of the deck, it misses the reshuffle, whereas with a normal treasure, it needs to be in the bottom 4 (unless it's in a lab hand).

Hi Blueblimp,

*bleh* yeah you're correct it should be 2.2 turns. As for the missing reshuffle, do we have some method for approximating the frequency of missing a reshuffle (based again on a non-whole-number value for hand size)? If not, I was honestly going to simply ignore that possibility.. definitely not the most accurate, but attempting to evaluate the entire deck as a whole (rather than as a deck, hand, and discard pile, with a discrete number of hands and reshuffling) is going to be subject to some amount of error anyway..
Logged

Toskk

  • Young Witch
  • ****
  • Offline Offline
  • Posts: 132
  • Respect: +44
    • View Profile
Re: Math question: probability and non-whole-number hand sizes
« Reply #5 on: April 18, 2012, 11:32:38 pm »
0

Just looking a little more at the reshuffle problem.. I'm really feeling like it should be ignored. After all, it would apply to all cards, not just the Laboratory. For example, the Silver could miss the reshuffle too, as could any other card in the deck. So all cards are ultimately going to be subject to missing a reshuffle chance.. I'm not sure if any method of using averages is going to be able to handle that.. *hmm*

Edit: Adding a little more to this.. as the ultimate objective is to be able to directly compare the relative buying power of, for example, adding a Silver to the deck vs. adding a Laboratory to the deck, if we're really going to deal with the reshuffle, we'd need to look at the relative value difference for missing a reshuffle for the Silver vs. the Laboratory, and only apply the difference of the two to the Laboratory's relative value.. i.e. if the Silver is contributing less than the full $2 to the deck treasure value due to missing reshuffles, and the Laboratory is contributing less than 2 cards due to missing reshuffles, the impact of missing a reshuffle on the relative value difference of the two *should* be near-zero.. right? :P
« Last Edit: April 19, 2012, 12:10:13 am by Toskk »
Logged

eHalcyon

  • Adventurer
  • ******
  • Offline Offline
  • Posts: 8689
  • Respect: +9187
    • View Profile
Re: Math question: probability and non-whole-number hand sizes
« Reply #6 on: April 19, 2012, 04:03:54 am »
0

But as blueblimp pointed out, Lab misses the shuffle MORE often than other cards -- that's why you need to account for it.  It misses more often because it draws cards.  It gets even messier when you stack multiple labs, since chaining them could trigger a reshuffle that causes all of them to miss, if you aren't careful.
Logged

qmech

  • Torturer
  • *****
  • Offline Offline
  • Posts: 1918
  • Shuffle iT Username: qmech
  • What year is it?
  • Respect: +2320
    • View Profile
Re: Math question: probability and non-whole-number hand sizes
« Reply #7 on: April 19, 2012, 05:06:38 am »
0

For the specific Lab/Moneylender example, it's easy to calculate the probability that you match Copper with Moneylender on any given turn given the composition of the deck: you know the probability of drawing a Lab in your first 5 cards, and the probabilities of matching Copper with Moneylender from 5 and 6 card hands, which is enough.  Up to awkwardness with the reshuffle, that will give you an expected number of matches, which in this case (only one Moneylender) is the same as the probability of a match.

With more Labs or Moneylenders, things would get more complicated.  For more Labs you get a greater variety of effective hand sizes, with a not too simple distribution.  It would be easy to calculate the distribution for a given number of Labs and cards in deck exactly using a computer (think roughly of splitting the non-lab cards into 5 card hands, then throwing down extra cards from the labs at random, with the probability of a card landing in a particular hand proportional to its size, except that you can do it deterministically).  You can then use this distribution and the fixed hand size probabilities to get an expected number of collisions.

This relies heavily on the fact that we can ignore actions.  Adding in cantrips wouldn't cause any more difficulties, but something like Village/Smith would be much harder.
Logged

DStu

  • Margrave
  • *****
  • Offline Offline
  • Posts: 2627
  • Respect: +1490
    • View Profile
Re: Math question: probability and non-whole-number hand sizes
« Reply #8 on: April 19, 2012, 05:27:54 am »
0

After qmech's answer, I'm afraid the best answer to this...
what I'm hoping to find is a formula that can approximate the probability of, for example, Moneylender pairing up with a Copper (but it could be any card that cares about another specific card) when you also have something like a Laboratory in your deck.
... is as so often
Code: [Select]
1/N * sum_{i=1}^N  f(X),
where N is large, X is a random hand of your deck after you played all of your Labs, and f is 1 if you have a Moneylender and a Copper in hand and zero if not...

Edit: But let's try the analytic way. Say you have L Labs, 1 Moneylender, C Coppers and a total of N cards.
You want to either collide the ML with the Copper directly while having no Labs in hand,
XOR collide with having exactly 1 Lab in the first 5 cards,
XOR collide in 6 cards with having exactly 1 Lab in the first 5 and exactly 1 Lab in the first 7 cards,
XOR collide in 7 cards with having exactly 1 Lab in the first 5 and exactly 1 Lab in the first 7 and 1 Lab in the first 9 cards
...
XOR collide in 5+L with having exactly 1 Lab in the first 5, and ..., and 1 Lab in the first 5+(L-1)*2 cards.

Hope I didn't forgot something or counted something twice.
The probability to collide in i cards with having exactly 1 Lab in 5, ...., 1Lab in 5+(i-1)*2 cards is.... ... ....
The Labs is I think 5 positions for the first, 6 for the second etc until 4+i for the ith, times permutations should be
Code: [Select]
L!*5*6*...*(4+i)/(N*(N-1)*...(N-i+1)) * ADDITIONAL FACTORS BECAUSE OF "EXACT i LABS"
Colliding in 5+i positions is 5+i positions for the M.
Code: [Select]
(5+i)/(N-i)
Copper is probably now easier to calculate that it will not collide, therefor all C Coppers must stay out of the 4+i remaining cards of my hand, that means they have to be in the remaining N-2i-5-1 cards out of N-i(Labs)-1(ML) remaining
Code: [Select]
(N-5-2*i)/(N-i) * (N-5-2i-1)/(N-i-1) * ... * (N-5-2i-C+1)/(N-i-C+1)
so that althogethe we come to
Code: [Select]
L!*5*6*...*(4+i)/(N*(N-1)*...(N-i+1)) * (5+i)/(N-i) * (1 - (N-5-2*i)/(N-i-1) * (N-5-2i-1)/(N-i-2) * ... * (N-5-2i-C+1)/(N-i-C) )
... and sum this for i from 1 to L.

Probably with some error somehow, someone please iterate.

If some of the brackets (N-2i) or whatever is negative, it is defined to be zero, and 0/0:=1

Edit: Forgot about the "EXACT" above for the Labs, but no time to correct
« Last Edit: April 19, 2012, 07:26:18 am by DStu »
Logged

bozzball

  • Bishop
  • ****
  • Offline Offline
  • Posts: 102
  • Respect: +68
    • View Profile
Re: Math question: probability and non-whole-number hand sizes
« Reply #9 on: April 19, 2012, 07:15:28 am »
0

My calculations say that you will shuffle your deck during the 3rd, 5th, 7th, 9th hands etc and that 11/28th of hands will be 6-card hands, with the rest being 5-card hands.



For example, with a deck of 13 cards including one Laboratory, you will go through your deck in 2.4 turns, or have an average hand size of 5.4167 cards. But with 5.4167 cards in any given hand, how would you go about approximating the odds of having both Moneylender and at least one Copper in said hand? Note: yes, in this particular case, the odds are probably 100% (unless you happen to have a Silver in those 13 cards too, in which case you could have Moneylender + EEES).. I'm wanting a formula that can compute this, rather than the specific answer for this case. ;)
Logged

Toskk

  • Young Witch
  • ****
  • Offline Offline
  • Posts: 132
  • Respect: +44
    • View Profile
Re: Math question: probability and non-whole-number hand sizes
« Reply #10 on: April 19, 2012, 12:14:58 pm »
0

But as blueblimp pointed out, Lab misses the shuffle MORE often than other cards -- that's why you need to account for it.  It misses more often because it draws cards.  It gets even messier when you stack multiple labs, since chaining them could trigger a reshuffle that causes all of them to miss, if you aren't careful.

Hmm.. do we have any reasonable method for calculating just how much more often the Laboratory is to miss the reshuffle than the average card in the deck (when the 'deck' could be anything)?
Logged

Toskk

  • Young Witch
  • ****
  • Offline Offline
  • Posts: 132
  • Respect: +44
    • View Profile
Re: Math question: probability and non-whole-number hand sizes
« Reply #11 on: April 19, 2012, 12:21:00 pm »
0

My calculations say that you will shuffle your deck during the 3rd, 5th, 7th, 9th hands etc and that 11/28th of hands will be 6-card hands, with the rest being 5-card hands.

Hi Bozzball,

Hmm.. by those values, the average hand size would be roughly 5.3928. I'll see if I can find something that can closely approximate that. :)
Logged

DStu

  • Margrave
  • *****
  • Offline Offline
  • Posts: 2627
  • Respect: +1490
    • View Profile
Re: Math question: probability and non-whole-number hand sizes
« Reply #12 on: April 19, 2012, 12:26:07 pm »
0

Hmm.. do we have any reasonable method for calculating just how much more often the Laboratory is to miss the reshuffle than the average card in the deck (when the 'deck' could be anything)?
Don't think so.
In a N card deck, a "usual" card misses the reshuffle if it is in the last (N - N div 5) cards of the stack. A single Lab misses the reshuffle like every other card, or additionally if it's in the last 'real' hand of the reshuffle and triggers the shuffle. That is the case if N mod 5 <= 1, and you have 5 positions for the Lab.

So it depends on the size on the deck. If your decksize N is a multiple of 5, the probability rises from 0 to 5/N. If your decksize is 2 mod 5, the probability is constant, as you can not trigger the reshuffle by playing the Lab, so you only miss it the way every other card does. Note that playing the Lab also influences the probability for "usual" cards to miss the reshuffle. In the 2mod5 case, if your Lab doesn't miss the reshuffle, no other card will, because it draws 2 cards and the last hand will exactly finish the drawpile. If it misses the shuffle, 2 cards remain, 1 of them a Lab, so one other card will miss the shuffle.
« Last Edit: April 19, 2012, 12:28:44 pm by DStu »
Logged

Rabid

  • Jester
  • *****
  • Offline Offline
  • Posts: 840
  • Shuffle iT Username: Rabid
  • Respect: +643
    • View Profile
Re: Math question: probability and non-whole-number hand sizes
« Reply #13 on: April 19, 2012, 01:00:51 pm »
+1

I would have thought the best way to solve this is via simulation.
Calculation is going to get really complicated.
Logged
Twitch
1 Day Cup #1:Ednever

Toskk

  • Young Witch
  • ****
  • Offline Offline
  • Posts: 132
  • Respect: +44
    • View Profile
Re: Math question: probability and non-whole-number hand sizes
« Reply #14 on: April 19, 2012, 01:03:33 pm »
0

Well, I have something.. I tried a slightly different approach, and just used a deck of Baron + 3 Estates + 7 Coppers, with hand sizes between 2 and 8, and then checked those probabilities against various functions. A perfect match came out at:

x = hand size
y = probability of having zero Estates

y = -0.00138889 x^3  +  0.0375 x^2  +  -0.336111x + 1

So it feels like this really should be possible (providing we can deal with the other issues mentioned in this thread).. although this particular one only deals with a 3:7 ratio..
Logged

Toskk

  • Young Witch
  • ****
  • Offline Offline
  • Posts: 132
  • Respect: +44
    • View Profile
Re: Math question: probability and non-whole-number hand sizes
« Reply #15 on: April 19, 2012, 01:07:36 pm »
0

I would have thought the best way to solve this is via simulation.
Calculation is going to get really complicated.

Simulation is definitely the *easier* and *more accurate* way to solve this.. however it's also very slow, and gets very complicated with developing mid-game buying rules and complete Kingdoms. What I'm looking for is something much quicker, able to guide buying decisions at any point in the development of the deck. I have a preliminary version of such a model already.. it has some glaring bugs, which is why I'm working on a totally different method (discussed in this thread), but if you'd like to see the old model, that thread is here:

http://forum.dominionstrategy.com/index.php?topic=943.0
Logged

timchen

  • Minion
  • *****
  • Offline Offline
  • Posts: 704
  • Shuffle iT Username: allfail
  • Respect: +234
    • View Profile
Re: Math question: probability and non-whole-number hand sizes
« Reply #16 on: April 19, 2012, 01:24:33 pm »
0

I think the conceptual question without reshuffle can be read this way: suppose we draw 5 cards from the deck and play the labs. In the end if the moneylender is in hand, what is the chance for a moneylender to pair up with a copper? Note that we escape from the question of reshuffle by just draw from the deck randomly again and again.

So with the starting deck and a lab and a moneylender, the chance is
(chance to start with 5)*(chance to have a moneylender and a copper in 5)/(chance to have a moneylender in 5)+(chance to start with 6)*(chance to have a moneylender and a copper in 6)/(chance to have a moneylender in 6)

So basically the conceptual question of how to calculate the probablilty of collision with some non-integer hand is that you calculate the probability of collision of each hand with integer cards then average over them.
Logged

Toskk

  • Young Witch
  • ****
  • Offline Offline
  • Posts: 132
  • Respect: +44
    • View Profile
Re: Math question: probability and non-whole-number hand sizes
« Reply #17 on: April 19, 2012, 01:28:27 pm »
0

I think the conceptual question without reshuffle can be read this way: suppose we draw 5 cards from the deck and play the labs. In the end if the moneylender is in hand, what is the chance for a moneylender to pair up with a copper? Note that we escape from the question of reshuffle by just draw from the deck randomly again and again.

So with the starting deck and a lab and a moneylender, the chance is
(chance to start with 5)*(chance to have a moneylender and a copper in 5)/(chance to have a moneylender in 5)+(chance to start with 6)*(chance to have a moneylender and a copper in 6)/(chance to have a moneylender in 6)

So basically the conceptual question of how to calculate the probablilty of collision with some non-integer hand is that you calculate the probability of collision of each hand with integer cards then average over them.

Hi Timchen,

I'd looked into that method before, but unfortunately determining the 'chance to start with x cards in hand' gets absolutely impossible to calculate once you throw in terminal draws, chances of terminal collisions, etc. Really, the best a model can do is determine an average hand size, rather than a breakdown of the percentage chances of any given whole-number hand size. :P There's definitely going to be some error built into it.. but if it's going to attempt to do more than just encompass non-terminal draws, I don't see any feasible way around it. :P
Logged

timchen

  • Minion
  • *****
  • Offline Offline
  • Posts: 704
  • Shuffle iT Username: allfail
  • Respect: +234
    • View Profile
Re: Math question: probability and non-whole-number hand sizes
« Reply #18 on: April 19, 2012, 01:39:45 pm »
+1

I don't see how determining an average hand size is easier. Note that the method (total cards without labs)/(total cards without labs-labs)*5 is a different measure and inherently has something to do with reshuffle.

That being said, it is pretty easy to get a rough idea in simulation. For both cases I think.
Logged

qmech

  • Torturer
  • *****
  • Offline Offline
  • Posts: 1918
  • Shuffle iT Username: qmech
  • What year is it?
  • Respect: +2320
    • View Profile
Re: Math question: probability and non-whole-number hand sizes
« Reply #19 on: April 19, 2012, 05:28:25 pm »
0

I wrote a program to calculate the distribution of effective hand sizes when you draw from a deck with a specified number of labs, under the assumption that there aren't enough labs that you can run out of cards to draw.  It's in Haskell.  For the uninitiated, you can run it here (although I don't know how long that link will stay valid).  Change the top line ("main = print $ distribution 10 2") to run the program with different parameters.  I'll explain what they are and how it works below.

Code: [Select]
-- i = number of labs left in deck
-- j = number of cards left to draw to make up hand
g 0 _ = delta 0 -- when i gets to zero there are no labs left
g i 0 = delta i -- when j gets to zero we've drawn enough cards so stop and record that we had i labs left in deck
g i j = zipWith (+) (g i (j-1)) (g (i-1) (j+1)) -- either draw a non-lab, or draw a lab

-- number of ways to arrange remaining cards for each possible number of remaining labs
weights nonLabs labs = [choose (nonLabs - 5 - labs + 2 * labsLeft) labsLeft | labsLeft <- [0,1..labs]]

-- distribution of hand sizes
distribution nonLabs labs = reverse $ zipWith (*) (weights nonLabs labs) (g labs 5)

-- infinite list of zeroes except for 1 at ith position
delta i = replicate i 0 ++ [1] ++ repeat 0

-- binomial coefficient n choose k
choose n k = rows !! n !! k
rows = iterate f (1 : repeat 0) where
    f r = zipWith (+) r (0:r)

The model is that we draw cards from the top of the deck until we see 5 more non-Labs than Labs.  The function g counts the number of times we have 0, 1, 2, ... Labs left in deck if we try to do this all possible ways.  The weights function gives the number of possible arrangements for the rest of the cards in deck (the remaining Labs and n-5-(# played Labs) non-Labs) for each number of remaining Labs.  The distribution function multiplies the frequencies from g by the weights, then turns the list round to get it in order of increasing hand size.  The parameters to distribution are the numbers of non-Labs and Labs (in that order).  The linked example calculates distribution 10 2 which returns [21,25,20], meaning that in a deck containing 2 Labs and 10 other cards the probabilities of an effective hand size of 5, 6 or 7 are 21/66, 25/66 and 20/66 respectively.
Logged

bozzball

  • Bishop
  • ****
  • Offline Offline
  • Posts: 102
  • Respect: +68
    • View Profile
Re: Math question: probability and non-whole-number hand sizes
« Reply #20 on: April 20, 2012, 03:49:55 am »
0

Here's my reasoning:
After you have dealt the first hand, you are in one of the following two situations:
 (A) Eight cards left in the deck, including a Laboratory
 (B) Seven cards left in the deck, not including a Laboratory

After you deal from A, you get to one of the following two situations:
 (C) Three cards left in the deck, including a Laboratory
 (D) Two cards left in the deck, not including a Laboratory

After you deal from (B), you get to (D).

After you deal from (C), you get to (B).

After you deal from (D), you get to either (A) or (B).

The probabilities of the interchange are:
A -> C with probability 3/8 and A->D with probability 5/8
B -> D with probability 1
C -> B with probability 1
D -> A with probability 8/11 and D->B with probability 3/11

The initial probabilities are A with probability 8/13 and B with probability 5/13.

... Maths stuff ...
Logged

Tables

  • Margrave
  • *****
  • Offline Offline
  • Posts: 2816
  • Build more Bridges in the King's Court!
  • Respect: +3347
    • View Profile
Re: Math question: probability and non-whole-number hand sizes
« Reply #21 on: April 20, 2012, 06:40:53 am »
0

Ooh, that's quite a good way of doing it. Markov Chains, I believe. I haven't learnt them in detail, but I think we should be able to use them and probabilities are easy to calculate from them.
Logged
...spin-offs are still better for all of the previously cited reasons.
But not strictly better, because the spinoff can have a different cost than the expansion.

Toskk

  • Young Witch
  • ****
  • Offline Offline
  • Posts: 132
  • Respect: +44
    • View Profile
Re: Math question: probability and non-whole-number hand sizes
« Reply #22 on: April 20, 2012, 11:37:18 am »
0

Well, I had a friend (better at math than I) take a look at the problem (not the reshuffle problem, the original one), and here was his suggestion:

Quote
Your deck consists of d cards, m of type M and d-m of type not-M.  You can easily substitute d for the number of cards remaining in the deck at the turn you start calculating and m for the type of card that you want to draw every turn (remaining in the remaining deck).  IE if you actually want to draw the cards of type n, then just call m = d-n, or if you want to draw not n, then call m = d-(d-n) = n.

So you draw a single card and you want it to be M.  The odds are m/d.  Lets assume you succeed.  The deck is now d-1, and the number of viable cards is now m-1.

Then you want to draw a second card and you also want it M.  The odds are (m-1)/(d-1).  The odds of you succeeded both times is the first times the second.

Repeat k times, and the problem is that k can be a non whole number (but its no greater than m).

So the overall equation is generalized as
(m*(m-1)*(m-2)*...*(m-k)) / (d*(d-1)*...*(d-k))
Note that
j*(j-1)*...*(j-k) = j!/(j-k-1)!
Fortunately, any scientific calculator can do non whole number factorials.  So the overall equation is
((m!)*(d-k-1)!)/((d!)*(m-k-1)!)

So provided we can get an accurate average for hand size for the deck, calculating the probability of events like Baron and Estate or Copper and Moneylender lining up shouldn't be an issue. :D
Logged

DStu

  • Margrave
  • *****
  • Offline Offline
  • Posts: 2627
  • Respect: +1490
    • View Profile
Re: Math question: probability and non-whole-number hand sizes
« Reply #23 on: April 20, 2012, 11:52:57 am »
0

So provided we can get an accurate average for hand size for the deck, calculating the probability of events like Baron and Estate or Copper and Moneylender lining up shouldn't be an issue. :D
I would not expect that using an average handsize in the formula for fixed handsizes to give you anything meaningfull. The formula is highly non-linear, so you can't just use an average in the formula. If you want to calculate the expectation value of a function, you usually can't just evaluate the function at the mean value. Except for linear functions, which you will not have here.

:e What you should do is I think is to calculate the probability that your handsize will be m (because you played m-5 Labs), use the formula to calculate the probability of collisison given you drew m cards, and than sum the weigthed average. Calculating the probability i started above, formula is not complete, but I don't really want to do the formula again.
« Last Edit: April 20, 2012, 12:03:24 pm by DStu »
Logged

Toskk

  • Young Witch
  • ****
  • Offline Offline
  • Posts: 132
  • Respect: +44
    • View Profile
Re: Math question: probability and non-whole-number hand sizes
« Reply #24 on: April 20, 2012, 01:08:55 pm »
0

So provided we can get an accurate average for hand size for the deck, calculating the probability of events like Baron and Estate or Copper and Moneylender lining up shouldn't be an issue. :D
I would not expect that using an average handsize in the formula for fixed handsizes to give you anything meaningfull. The formula is highly non-linear, so you can't just use an average in the formula. If you want to calculate the expectation value of a function, you usually can't just evaluate the function at the mean value. Except for linear functions, which you will not have here.

:e What you should do is I think is to calculate the probability that your handsize will be m (because you played m-5 Labs), use the formula to calculate the probability of collisison given you drew m cards, and than sum the weigthed average. Calculating the probability i started above, formula is not complete, but I don't really want to do the formula again.

Well *bleh*.. unfortunately you are quite right. From some quick testing on using averaged hand size vs. probability of 5 and 6 card hands (i.e. a deck of 1 Lab, 1 Baron, 3 Estates, and 7 Copper), the averaging method does not produce results at all similar. :( Ultimately, though.. any method of dealing with calculating the percentage distribution of various hand sizes is also going to need to take into account terminal draws and the possibility of drawing actions dead. :P With that added complexity (especially with +card/+action chains), I don't see any reasonable method of calculating the percentage distribution of hand sizes. :P
Logged
Pages: [1]
 

Page created in 0.428 seconds with 21 queries.