Those who playes Badugi know the basic rules:
- You have 4 cards.
- The more distinct cards both in suit and number, the better hand it is.
- Among the same number of distinct cards, the worse bust (being Ace the lower card) is winner (this means: KQJT of different suits are better than A23, KQJ all ofsuit better than A2, and KQ better than A; The best hand is A234 and the worse hand is K, from KKKK).
My question could be answered in two different ways:
Could someone lead me to an opensource calculator for Badugi? The calculator should satisfy the need of, given a random hand of 4 cards from a 52-card deck, determine the % of winning, losing, tying (in the theoretical scenario that I kept that hand until the showdown).
Could someone help me with the math to make this calculator by myself?
If chosing alternative 2, this is what I currently have, And I'll state what part do I need help with:
Population
You have 52c4 (52*51*50*49 / 4*3*2*1)
possible hands to keep for the showdown.
Reference system
Initially, the hands are ranked from A to K. I will assume A is 0 and K 12 for this calculations to be clean.
4 fully distinct cards
The best scenario here is A234 offsuit. We could say this is a bust, except that we also need different suits. For a specific cards arrangement, you have 24 (4!) combinations of different suits for the busted cards. The upper-value busts for a given WXYZ combinations of cards (assuming it is sorted W > X > Y > Z) is:
(12-Z)C4 + (12-Y)C3 + (12-X)C2 + (12-W)
You get, there, the amount of hands of the same type (4-distinct / badugi) that are beaten by the current hand.
The full population for badugi hands is 13C4 * 4!
. So your current badugi is beaten by other badugis like this:
4! * (13C4 - ((12-Z)C4 + (12-Y)C3 + (12-X)C2 + (12-W)) - (1))
.
Now I have, given your WXYZ:
- # of badugi hands that beat my WXYZ.
- # of badugi hands that tie my WXYZ.
- By subtraction: # of badugi hands that lose to my WXYZ.
- Total population of badugi (full-distinct WXYZ cards) hands.
So far If your only chance was to draw badugis and no other hands, calculating your hand strength is taking the first expression and dividing by 13C4 / 4!
. This is just so you can understand what I need. However, since it is not the whole case, I will proceed with the remaining hands.
1 fully-distinct cards
I know nobody in their sane mind would reach the showdown with this hand unless having a really good reason, but let's calculate this as well.
If you have just 1 card it is because:
- You have 4 of a kind.
- You have a flush.
Then you always take the lowest hand. If your final value is K, Q, or J, is because you have KKKK, QQQQ, or JJJJ. For 10 and lower, you could be having TTTT or KQJT. From there, cases from having flush (like KQJT) appear.
So if you have 1 card, there are many cases you can tie with:
1 + 4 * (amount of flushes with greater cards but same lower card)
The last part can be calculated like (12-Z)C3
because that is the amount of combinations of cards greater than Z, which make you complete an infamous flush that do not improve the value of Z. The remaining 1
is for getting a 4-oak (ZZZZ).
What hands can beat me?
- "4 of a kinds" of a lower value:
Z
. - "Flushes" featuring a lower card: I simply calculate
4 * [(13C4) - (12-Z)C3 - (12-Z)C4]
, where we can understand4 * (all flushes in a suit - all flushes withe same lower card - all flushes with greater lower card)
.
So the amount of hands that beat me is: Z + 4 * [(13C4) - (12-Z)C3 - (12-Z)C4]
As I said before, the last subterm (12-Z)C4
is the amount of flushes featuring a lower card greater than Z. Example: If I have a flush with lower card 8, I will beat flushes: KQJ9 KQT9 KJT9 QJT9 KQJT (8 is normalized to 7, and 5C4 is 5).
Let's see what I have right now:
- # of hands that beat my WXYZ (second calculation).
- # of badugi hands that tie my WXYZ (first calculation in this section).
- By subtraction: # of badugi hands that lose to my WXYZ.
- Total population of these hands:
13 + 13C4 * 4
. The first term is the amount of 4oaks. The second the amount of flushes.
Could you help me stating the 4 sub-answers for the cases of 2-cards and 3-cards?