I'm trying to create an AI for a game I develop but I run into the problem of trying to figure out how to calculate probability. The probability I'm trying to calculate is what is the probability that a given card can win the current book/hand?

The game in question is a simplified version of Spade where the goal is to get as many Spade as possible.

Spade > Club > Diamond > Heart.

My current thought process is that if I have a given card like say a 10 of Club. Then I can can say that there are(ignoring all other suit except for Club) 4 card that can beat my card. now assuming I have the King of Club and knowing that the Queen up to Ace of Club haven't been played. Is it safe to say that the probability that my 10 of Club win is the:

Num of card that can beat my given card / the total card in my enemy hand?

For example with the above example it would be 3/5 if we ignore 3 card to have an even hand 5 for me and 5 for the other player.

Or is there something I'm overlooking?

i.e- There are 2 player in this example.

  • $\begingroup$ No. I don't think that would be correct. You are looking for the probability that your opponent's hand contains any of the three cards that can beat you. which is a little more complicated. An easier approach is to calculate the probability that it only has cards that cannot beat you and subtract that from 1. $\endgroup$ – turkeyhundt Jan 2 '16 at 8:33
  • $\begingroup$ The odds depend on how big the deck is, among other things. Suppose you play with the Euchre deck, which is the standard deck minus the 2's,3's,4's and 5's. Your odds of winning with a 10 are then much less. $\endgroup$ – DanielWainfleet Jan 2 '16 at 10:38
  • $\begingroup$ @turkeyhundt I see so it wasn't just me overthinking thing when it got confusing. So instead find all the card that can't beat the Ten of Club and subtracted it from 1? I don't understand why I must subtract from 1. $\endgroup$ – J Scott Anderson Jan 2 '16 at 20:28
  • $\begingroup$ @user254665 Currently I'm using a standard 52 card but out of curiously what do you mean by odd? Isn't that different from probability? $\endgroup$ – J Scott Anderson Jan 2 '16 at 20:30
  • $\begingroup$ ODDS in everyday speech means probability. Odds of 2 to 1 means a prob. of 2/3 $\endgroup$ – DanielWainfleet Jan 3 '16 at 2:54

Depending on the rules of the game there may be cards,other than the 10 of clubs, that you know your opponent does not have, e.g. other cards you are holding, cards from previous plays, that have been seen and are no longer part of the play,etc. Let $X$ be the number of cards whose location is unknown to you,and let $Y$ be the number of cards held by your opponent,with $X\geq Y>0.$ Obviously if $X-Y<4$ then your opponent has at least one of the 4 clubs higher than the 10. If $X-Y\geq 4,$ observe that there are $A=\binom {X-4}{Y}$ equally likely hands, with $Y$ cards per hand,that your opponent may hold, that do NOT include a club higher than a 10. And there is a total of $B=\binom {X}{Y}$ equally likely hands your opponent may have.So the probability that he cannot beat you when $X-Y\geq 4$ is $A/B=\prod_{i=0}^{i=3}(X-Y-i)/(X-i)$.

  • $\begingroup$ I have to ask what does the pi symbol at the bottom mean? $\endgroup$ – J Scott Anderson Jan 4 '16 at 4:16
  • $\begingroup$ $\prod$ is short for product : $\prod_{i=0}^{i=3}f(i)=f(0).f(1).f(2).f(3).$ Similarly, $\sum$ is short for sum :$\sum_{i=0}^{i=3}f(i)=f(0)+f(1)+f(2)+f(3).$ $\endgroup$ – DanielWainfleet Jan 4 '16 at 11:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.