Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

question?: May I ask for your formula for the probability that a card is in hand? #1697

Closed
ttowncompiled opened this issue Nov 4, 2015 · 4 comments

Comments

@ttowncompiled
Copy link

I have also calculated this probability and I think that our results differ. I'm curious to see what your formula is, if I may.

And also, do you take into consideration the changes that occur over time such as cards being played from hand and cards being pulled from the deck by effects such as Mad Scientist?

@Eldenroot
Copy link

I am interested too 👍

@azeier
Copy link
Member

azeier commented Nov 4, 2015

var holdingNextTurn = Math.Round(100.0f * Helper.DrawProbability(1, (cardsLeftInDeck + handWithoutCoin), handWithoutCoin + 1), 1);

public static double DrawProbability(int copies, int deck, int draw)
{
    return 1 - (BinomialCoefficient(deck - copies, draw) / BinomialCoefficient(deck, draw));
}

public static double BinomialCoefficient(int n, int k)
{
    double result = 1;
    for(var i = 1; i <= k; i++)
    {
        result *= n - (k - i);
        result /= i;
    }
    return result;
}

It does not account for anything happening on the next turn other than the first draw, nor the time of cards being in hand or anything of that nature.

@azeier azeier closed this as completed Nov 4, 2015
@ZergShadow
Copy link

can you explain all numbers and var in formula?cant understand this.

@r3lik
Copy link

r3lik commented Jan 17, 2017

I too would appreciate it if you explained it a bit more.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

5 participants