Monday, August 22, 2016

How Many Hands of Euchre Can Be Played? Part 2

I had posted this regarding the number of possible hands of euchre:

https://plus.google.com/+DenisMcLaughlin/posts/eFzsnEBS3T7

At the end, there is this calculation regarding the number of possible ways a (4 player) euchre hand can be played:
1*(5^4) * 4*(4^4) * 4*(3^4) * 4*(2^4) * 4*(1^4))
This was an overestimate, however, since it assumes that players following the lead can play any of the cards in their hand. In reality, players can only follow with a subset of their cards, since they must follow the lead suit if they can. So, for example, while the above calculation shows the number of ways to play the first trick as:
1*(5^4)
meaning that there is a fixed leader and each of the 4 players can play any of their 5 cards, a more accurate representation of the number of ways to play the first trick would be:
1*(5*(5*R1)^3)
which says that there is a fixed leader who can play any of their 5 cards, followed by the remaining 3 players who can play one of 5*R1 of their cards, where R1 is the ratio of cards in their hand which can be legally played. So if, on average, a following player can only choose from half of the cards in their hand to legally follow in the first trick, R1 would be 0.5.

We can extend this to the second trick in the hand with this:
4*(4*(4*R2)^3)
This says the second hand can be lead by any one of 4 players, that leader can freely play one of their 4 remaining cards, and each of the other 3 players can choose from 4*R2 of their cards. As with R1, R2 is the ratio of playable cards in the second trick. Similarly, we can set up an equation for the third trick, with R3 representing the ratio of playable cards, and an equation for the fourth trick, with R4 representing the ratio of playable cards. For the fifth trick the ratio will be R5, but in practice this will always be 1 since there is only card left to play in the final trick. Altogether, the equation showing the number of ways a 4 player euchre hand can be played is:
1*(5*(5*R1)^3) * 4*(4*(4*R2)^3) * 4*(3*(3*R3)^3) * 4*(2*(2*R4)^3) * 4*(1*(1*R5)^3)
Determining the values of R1 through R5 analytically is difficult, but it's possible to Monte Carlo this calculation by simply playing a large number of games and measuring the ratio of playable cards for each following player in each trick. The euchre player software discussed here does this:
https://plus.google.com/+DenisMcLaughlin/posts/g6yk6Gehnxr
That code currently only implements random (legal) play, so it is not playing strategically. However, based on the random play, the measured ratio of playable cards in each trick for following players can be seen with the --stats option:
Follow Ratio (by trick)
0.47 / 0.57 / 0.68 / 0.82 / 1.00
This shows that the ratio of cards that can be played in the first trick is 0.47 of the total: since there are 5 cards in the hand at that point, that means the average number of playable cards in a following hand in the first trick is (5*0.47) or 2.35. Similarly for the second trick, an average of 0.57 of the 4 cards in players' hands can be played, 0.68 of the 3 cards on the third trick, 0.82 of the 2 remaining cards on the fourth trick, and 1.00 of the last card on the fifth trick.

Substituting these ratios for R1 through R5 in the above equation gives:
1*(5*(5*0.47)^3) * 4*(4*(4*0.57)^3) * 4*(3*(3*0.68)^3) * 4*(2*(2*0.82)^3) * 4*(1*(1*1)^3)
This Google spreadsheet uses these values to recalculate the number of playable hands of euchre here:
https://docs.google.com/spreadsheets/d/1KNStpy2w9dmemeT1gfbHMtncN1WTM9G5L7fw0VdxXoY
With these ratios, it reduces the total number of euchre hands that can be played from 5.35e25 to 1.89e23, which is a reduction by about 300.

The statistical computation of R1 through R5 via the Monte Carlo method is compromised by the mechanism, since the player strategy in the euchre software is random. A more intelligent player algorithm would strategically discard specific cards to reduce the probability that they will have to follow suit and can instead play trump on a non-trump lead. However, this would only adjust the R2, R3, and R4 values (since no strategy can affect R1, and R5 is always 1), and the biggest reduction in possible plays comes from the R1 factor. When a more intelligent player algorithm is developed, these values can be revisited to compare.

Blog Archive