Sign in to follow this  
mr BiCEPS

Card probabilities

Recommended Posts

Hello! I am making a poker game, and for that I will have a computerized player. I want the computerized player to sometimes calculate the probability that the hand he has is the best hand in the game. I have come up with the following: float prc = (num - pos) / num; prc = pow(prc, numopponents); Num is the number of possible hands, pos is the "goodness position" of that hand - 0 would be the best possible hand and higher numbers worse. numopponents is the number of opponents (not including self). The final result is prc. Am I completely off base with this?

Share this post


Link to post
Share on other sites
Thanks, but none of that is related to my question. It is a simple mathematic question about probability, and is not really very related to poker at all, except for the fact that I will be using it for that.

The questions asked and answered in the three threads linked ask and answer completely different questions.

Share this post


Link to post
Share on other sites
What I said might have been confusing. I will elaborate.

These numbers I am certain I have correctly:
num - The number of hands that exist.
pos - The position relative to other hands, the lower the number, the better the hand.

Then, I figure, (num - pos)/num will give the probability that the hand is better than another random hand (distribution of hands is uniform).

Then, p^n, where p is the above discussed probability and n is the number of opponents will give the probability that more than one player has a hand as good as or better than self.

Still, somehow I think I am missing something (It's been a while since I took stats & probability and it makes me uncertain), which is why I am posting here.

Share this post


Link to post
Share on other sites
Ok then.

You want to know the probability that your hand if the best hand in the game.

Sorry that the links didn't work... theres a thread somewhere which would be really helpful. i thought it was one of those.....

Ok, you've got 5 cards per hand per person

So you've got 52^5*numberofpeople card combinations. (its either 52*5 or 52^5)
thats 380204032*numpeople combonations.

You assign each of them a score. you then sort them by the score. you store them all in an array, with the score as the index (like a giant hash-table with the score as the hash).

Want to know your probability of winning?

Find the amount of cards that would beat your score (you find your score, add the amount of cards there, keep going until you reach the best hand).

Probability of winning = Numberofcardsabovecard / 52^5*numpeople * 100

Good? thanks.

Its been a while since i looked at that thread.

From,
Nice coder

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
First of all, there's a lot more to poker than just calculating probabilities. Your computer player will be weak if this is all you base the betting on.

Regarding the probabilities, your algorithm doesn't seem to take into account the cards already used. There are a lot of hands your opponents can't have, because of the cards you already have. Also, when there are more than one opponent their probabilities won't be independant of each other, so just taking the probability for one player to the power of the number of players isn't correct.

Share this post


Link to post
Share on other sites
Quote:
Original post by Anonymous Poster
First of all, there's a lot more to poker than just calculating probabilities. Your computer player will be weak if this is all you base the betting on.

Yes, this is of course just a little part of the whole puzzle.
Quote:

Regarding the probabilities, your algorithm doesn't seem to take into account the cards already used. There are a lot of hands your opponents can't have, because of the cards you already have. Also, when there are more than one opponent their probabilities won't be independant of each other, so just taking the probability for one player to the power of the number of players isn't correct.


Is it close enough to be useable?

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
It depends on the situation and how accurate you need it to be to consider it useful. In general your approach should be less accurate the more opponents you've got, but I can't give you any numbers.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
I have modified my algorithm a little, so that it at least takes into account what hands the opponents can't have because of the cards that are already in the hand. You have been very helpful!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this