*Author

Offline Keeps

  • Full Member
  • ***
  • Posts: 440
  • Reputation Power: 9
  • Keeps is a Spark waiting for a buff.
  • New to Elements
Re: Probabilities and Combinations https://elementscommunity.org/forum/index.php?topic=50769.msg1115983#msg1115983
« Reply #60 on: December 17, 2013, 11:27:24 pm »
So nothing wrong with it, it's just harder than what you put down...

Glad I'm not totally useless.

Offline Savage

  • Jr. Member
  • **
  • Posts: 133
  • Country: us
  • Reputation Power: 2
  • Savage is a Spark waiting for a buff.
  • Elements Veteran
Re: Probabilities and Combinations https://elementscommunity.org/forum/index.php?topic=50769.msg1116011#msg1116011
« Reply #61 on: December 18, 2013, 02:59:46 am »
If X and Y both have 1 copy in a 60 card deck, the probability of drawing X and Y in the opening hand is
P(X)+P(Y)-P(X∨Y)
(1-(53!59!)/(60!52!))+(1-(53!59!)/(60!52!))-(1-(53!58!)/(60!51!))=1.19%.


Ok, before I go any further, please explain because this first part. I want to take your work step by step.

Offline CuCN

  • Hero Member
  • *****
  • Posts: 1756
  • Reputation Power: 25
  • CuCN is a proud Wyrm taking wing for the first time.CuCN is a proud Wyrm taking wing for the first time.CuCN is a proud Wyrm taking wing for the first time.CuCN is a proud Wyrm taking wing for the first time.CuCN is a proud Wyrm taking wing for the first time.
  • Toxic
  • Awards: Slice of Elements 5th Birthday CakeSlice of Elements 4th Birthday Cake
Re: Probabilities and Combinations https://elementscommunity.org/forum/index.php?topic=50769.msg1116014#msg1116014
« Reply #62 on: December 18, 2013, 03:24:33 am »
If X and Y both have 1 copy in a 60 card deck, the probability of drawing X and Y in the opening hand is
P(X)+P(Y)-P(X∨Y)
(1-(53!59!)/(60!52!))+(1-(53!59!)/(60!52!))-(1-(53!58!)/(60!51!))=1.19%.


Ok, before I go any further, please explain because this first part. I want to take your work step by step.
We are looking for P(X∧Y). The principle of inclusion and exclusion states that P(X∧Y)=P(X)+P(Y)-P(X∨Y).
The single-event probability formula is 1-(((D-H)!(D-T)!)/(D!(D-H-T)!)). For this example, D=60 and H=7.
To find P(X), we use 1 for T because there is only one copy of X. This gives P(X)=1-(53!59!)/(60!52!)=1-53/60=7/60. This makes sense, because there are 60 places in the deck that X could be, and 7 of them are in the opening hand. Similarly, P(Y)=7/60.
To find P(X∨Y), we use 2 for T because there are two cards in the deck that are either X or Y. This gives P(X∨Y)=1-(53!58!)/(60!51!)=1-(53*52)/(60*59)=196/885.
Substituting these values into the expression given by the inclusion-exclusion principle, P(X∧Y)=7/60+7/60-196/885=1.19%.

Spoiler for Extension: including the mulligan:
The calculations I posted previously don't include the mulligan. Now, to account for the mulligan, we need to define P'(Z) as the probability of event Z happening, including the mulligan. P(M)P(Z) is the probability that Z happens after a mulligan, and P(Z∧¬M) is the probability that Z happens without a mulligan, so
P'(Z)=P(M)P(Z)+P(Z∧¬M)
=P(M)P(Z)+1-P(¬Z)-P(M)+P(¬Z∧M)
=1+P(¬Z∧M)-(1+P(M))P(¬Z)

If the 20 towers are the only zero-cost cards in the deck, M=¬A.
We can still break up the total probability into two cases, P'(X∧Y) and (1/53)P'(A∧B∧((X∧¬Y)∨(¬X∧Y))). However, the probabilities are different because of the mulligan.
P'(X∧Y)
=1+P(¬(X∧Y)∧M)-(1+P(M))P(¬(X∧Y))
=1+P(¬(X∧Y)∧¬A)-(1+P(¬A))P(¬(X∧Y))
=1+(P(¬X∧¬A)+P(¬Y∧¬A)-P(¬X∧¬Y∧¬A))-(1+P(¬A))(P(¬X)+P(¬Y)-P(¬X∧¬Y))
Spoiler for Probabilities to substitute in:
P(¬A)=(53!40!)/(60!33!)
P(¬X)=P(¬Y)=(53!59!)/(60!52!)=53/60
P(¬X∧¬A)=P(¬Y∧¬A)=(53!39!)/(60!32!)
P(¬X∧¬Y)=(53!58!)/(60!51!)=689/885
P(¬X∧¬Y∧¬A)=(53!38!)/(60!31!)
=1+(53!39!)/(60!32!)+(53!39!)/(60!32!)-(53!38!)/(60!31!)-(1+(53!40!)/(60!33!))(53/60+53/60-689/885)
=1.11%

Now for the second portion of the probability (this is actually not quite correct because the EtG mulligan leaves the original hand on top of the deck, as I recently learned; a corrected value is calculable but hard):
P'(A∧B∧((X∧¬Y)∨(¬X∧Y)))
=P(M)P(A∧B∧((X∧¬Y)∨(¬X∧Y)))+P(A∧B∧((X∧¬Y)∨(¬X∧Y))∧¬M)
=P(¬A)P(A∧B∧((X∧¬Y)∨(¬X∧Y)))+P(A∧B∧((X∧¬Y)∨(¬X∧Y))∧A)
=(1+P(¬A))P(A∧B∧((X∧¬Y)∨(¬X∧Y)))

P(A∧B∧((X∧¬Y)∨(¬X∧Y))) was already calculated to be 9.46% in my previous post, so this is (1+(53!40!)/(60!33!))*9.46%=9.91%.

Putting the probabilities together,
P'(X∧Y)+(1/53)P'(A∧B∧((X∧¬Y)∨(¬X∧Y)))
=1.11%+(1/53)9.91%=1.30%.
Spoiler for Exact value:
22,550,793,002,311/1,733,608,905,254,820
That's 1.7 (short scale) quadrillion in the denominator.
« Last Edit: January 09, 2014, 02:14:25 am by CuCN »

Offline LeodipTopic starter

  • Sr. Member
  • ****
  • Posts: 786
  • Country: it
  • Reputation Power: 11
  • Leodip is taking their first peeks out of the Antlion's burrow.Leodip is taking their first peeks out of the Antlion's burrow.
  • Go home Homura, you're drunk.
  • Awards: Slice of Elements 5th Birthday CakeSlice of Elements 4th Birthday Cake
Re: Probabilities and Combinations https://elementscommunity.org/forum/index.php?topic=50769.msg1117028#msg1117028
« Reply #63 on: December 23, 2013, 10:47:40 pm »
Finally updated the first post. It has some little policy about how to post formulas and my own mulligan-less formula.
I ask of you to post a nice paragraph explaining your way into this (mainly referring to CuCN who looks like has its own defined idea, but anyone who wants to go outside the original idea, like considering the next draws or SoB or likes, like rob did), possibly using the variables I named (m, s, r, d, h, p).

Offline LeodipTopic starter

  • Sr. Member
  • ****
  • Posts: 786
  • Country: it
  • Reputation Power: 11
  • Leodip is taking their first peeks out of the Antlion's burrow.Leodip is taking their first peeks out of the Antlion's burrow.
  • Go home Homura, you're drunk.
  • Awards: Slice of Elements 5th Birthday CakeSlice of Elements 4th Birthday Cake
Re: Probabilities and Combinations https://elementscommunity.org/forum/index.php?topic=50769.msg1122444#msg1122444
« Reply #64 on: January 21, 2014, 10:02:05 pm »
About mulligan, this is getting harder.
It has been (relatively) recently revealed that the mulligan isn't as simple as "draw 7 cards, if no zero-cost cards, shuffle, draw 7 again" but it is "draw 7 cards, if no zero-cost cards, put those cards aside, draw 7 cards and put the cards you have casted aside on top of the deck". This means that mulligan may cast aside one, two, three, four, five or even six copies of the card we want to draw into, making it a lot harder on the calculations. We should get back at considering a case of only one card with mulligan and then go on with the combinations.

Offline LeodipTopic starter

  • Sr. Member
  • ****
  • Posts: 786
  • Country: it
  • Reputation Power: 11
  • Leodip is taking their first peeks out of the Antlion's burrow.Leodip is taking their first peeks out of the Antlion's burrow.
  • Go home Homura, you're drunk.
  • Awards: Slice of Elements 5th Birthday CakeSlice of Elements 4th Birthday Cake
Re: Probabilities and Combinations https://elementscommunity.org/forum/index.php?topic=50769.msg1125691#msg1125691
« Reply #65 on: February 10, 2014, 03:16:29 pm »
Although an easy formula, given that I used it, I figured I should write this here for reference:
Probability of zero-costing cards including mulligan:
Let's say we want to get a card N in our first draw (of h cards). N is a zero-cost card. N is played in n copies and it is found in a deck with d cards and p zero-cost cards (including N itself). How do we get that?
Pi+Pm=P, where Pi is the probability of drawing into it instantaneously and Pm is the probability of drawing into it including mulligan.
Given that N is a zero-cost card, if you draw into it there's no way that a mulligan can occur, so it simply is:
Pi=1-((d-n)!/((d-n-h)!*h!))/(d!/((d-h)!*h!))

Pm, on the other side, needs you NOT to draw into any zero-cost card at all, and then draw into it.
Pm is then:
Pm=Zp*Pi', where Zp is it the probability of NOT drawing into a zero-cost card and Pi' is the probability of drawing into N after the mulligan.
Zp=((d-p)!/((d-p-h)!*h!))/(d!/((d-h)!*h!))
Pi'=1-((d-n-h)!/((d-n-2h)!*h!))/((d-h)!/((d-2h)!*h!))
Pm=((d-p)!/((d-p-h)!*h!))/(d!/((d-h)!*h!))*(1-((d-n-h)!/((d-n-2h)!*h!))/((d-h)!/((d-2h)!*h!)))

Putting this in a formula:
P=(1-((d-n)!/((d-n-h)!*h!))/(d!/((d-h)!*h!)))+((d-p)!/((d-p-h)!*h!))/(d!/((d-h)!*h!))*(1-((d-n-h)!/((d-n-2h)!*h!))/((d-h)!/((d-2h)!*h!)))





Damn long.

Offline CrockettRocket

  • Hero Member
  • *****
  • Posts: 1522
  • Country: us
  • Reputation Power: 30
  • CrockettRocket is a Ghost, obsessed with their Elemental pursuits.CrockettRocket is a Ghost, obsessed with their Elemental pursuits.CrockettRocket is a Ghost, obsessed with their Elemental pursuits.CrockettRocket is a Ghost, obsessed with their Elemental pursuits.CrockettRocket is a Ghost, obsessed with their Elemental pursuits.CrockettRocket is a Ghost, obsessed with their Elemental pursuits.
  • I'd like to achieve silence for eternity.
  • Awards: Slice of Elements 6th Birthday CakeBrawl #3 Winner - Divine LightSlice of Elements 5th Birthday Cake
Re: Probabilities and Combinations https://elementscommunity.org/forum/index.php?topic=50769.msg1125775#msg1125775
« Reply #66 on: February 10, 2014, 11:36:08 pm »
Did zanz tell us that mulligan is cast 7 cards aside, draw 7 more, put original 7 back on deck? Or did someone prove it? If so, how did they prove it? Have link towards the proof?
A world war? Am I invited?
Thanks to skotadi for saying this in chat. Made me laugh pretty hard, and fits with me not getting drafted. :silly:

Offline the dictator

  • Hero Member
  • *****
  • Posts: 1261
  • Country: nl
  • Reputation Power: 17
  • the dictator is a Blue Crawler starting to think about his first run.the dictator is a Blue Crawler starting to think about his first run.the dictator is a Blue Crawler starting to think about his first run.
  • There are no dumb questions, only dumb answers
  • Awards: Slice of Elements 5th Birthday CakeWeekly Tournament Winner
Re: Probabilities and Combinations https://elementscommunity.org/forum/index.php?topic=50769.msg1125791#msg1125791
« Reply #67 on: February 11, 2014, 06:11:06 am »
I don't think it was ever 'proven', but I first noticed it when I was playing loads of games with VDB (I think it was still shak'ars back then, so with precog, but that doesn't matter) before my hiatus. So I started recording my draws whenever I had a pendulum free starting hand, and it did confirm my suspicions. I think I had approximately 30 games on there (with a pendulumfree starting hand), and not once did I draw a pendulum in the first 7 draws (I did log 2 after that, but usually you die before getting those 7 draws). I never posted those results, and during my break I switched computers 2 times, so those results are lost, but when I returned I was surprised to see that nobody had noticed. So I talked about it in chat, and CG ran a quick test in trainer to confirm, after which it was considered proven (test was 3 pillars in a 30 card deck, vs. 30 pillar deck I think).

If you want your own proof, go take said deck in trainer, and note down the first 7 draws whenever you get a mulligan hand. If you want to speed it up a bit, take lots of cheap cards, include shard of bravery/precognition, and go in with some starting quanta (to both power the shards/precogs and to be able to empty your hand so you can use them).
« Last Edit: February 11, 2014, 10:37:11 am by the dictator »
[18:28:55] Acsabi44: grinding is about pwning the AI as fast as possible
Back from a long break.
:water War Veteran - 4 times
Because inverted art is awesome - Looking for a tool for gather stats for arena, look no further

Offline LeodipTopic starter

  • Sr. Member
  • ****
  • Posts: 786
  • Country: it
  • Reputation Power: 11
  • Leodip is taking their first peeks out of the Antlion's burrow.Leodip is taking their first peeks out of the Antlion's burrow.
  • Go home Homura, you're drunk.
  • Awards: Slice of Elements 5th Birthday CakeSlice of Elements 4th Birthday Cake
Re: Probabilities and Combinations https://elementscommunity.org/forum/index.php?topic=50769.msg1125814#msg1125814
« Reply #68 on: February 11, 2014, 03:34:17 pm »
As of now, I checked it 12 times and it looks like it's like that. What's more, reading Elements 1.21 release note, it looks like Zanz is talking about this method.

Running some math, after 6 times it happens (and there's no contradiction, which would nullify it) the probability of it being a coincidence is under 1%, so it looks like it's true.

Offline antiaverage

  • Administrator
  • ********
  • ********
  • Posts: 1496
  • Reputation Power: 36
  • antiaverage is a Gargoyle, dangerous and everlasting.antiaverage is a Gargoyle, dangerous and everlasting.antiaverage is a Gargoyle, dangerous and everlasting.antiaverage is a Gargoyle, dangerous and everlasting.antiaverage is a Gargoyle, dangerous and everlasting.antiaverage is a Gargoyle, dangerous and everlasting.antiaverage is a Gargoyle, dangerous and everlasting.
  • HTML5-hipster-sloth.bunchie();
  • Awards: Slice of Elements 12th Birthday CakeSlice of Elements 10th Birthday CakeSlice of Elements 9th Birthday CakeRaise the Banners...AgainSlice of Elements 6th Birthday CakeSlice of Elements 5th Birthday CakeMS Paint Card Art #7 WinnerSlice of Elements 4th Birthday CakeSlice of Elements 3rd Birthday Cake
Re: Probabilities and Combinations https://elementscommunity.org/forum/index.php?topic=50769.msg1205558#msg1205558
« Reply #69 on: September 14, 2015, 09:36:08 pm »
There was always proof in the code, so I'll just post that here:

Code: [Select]
totcost = 1;
for (i = 1; i <= 7; i++) {
    set("h" + i + "._visible", true);
    totcost = totcost * (eval("h" + i + ".cost"));
}
h8._visible = true;
if (totcost != 0) {
    trace ("mulligan!");
    for (i = 1; i <= 7; i++) {
        set("h" + i + ".cardmulligan", deckx[deckn - 1]);
        deckx[deckn - 1] = 0;
        deckn = deckn - 1;
    }
    for (i = 1; i <= 7; i++) {
        deckx[deckn] = eval("h" + i + ".card");
        deckn = deckn + 1;
    }
    for (i = 1; i <= 7; i++) {
        set("h" + i + ".card", eval("h" + i + ".cardmulligan"));
        eval("h" + i).gotoAndPlay(2);
    }
}

So yes, if you draw your first 7 cards and none of them are zero cost, it draws the next 7 cards and places your first draw back on top of the deck.
Developer of http://dek.im - a Deck Image generator with rollover to view full cards, current to version 1.327

Thanks to Amashi for my avatar!

Offline Keeps

  • Full Member
  • ***
  • Posts: 440
  • Reputation Power: 9
  • Keeps is a Spark waiting for a buff.
  • New to Elements
Re: Probabilities and Combinations https://elementscommunity.org/forum/index.php?topic=50769.msg1221717#msg1221717
« Reply #70 on: January 31, 2016, 04:11:52 am »
Holy shit antiaverage.. really, are there any other things like this.  I've often suspected of some type of collision or at least not straight handling of probabilities in this game.  I thought it was from some bugs before, there were just too man 'coincidences'.  But this is fantastic knowledge.

 

blarg: Amashi