Open Side Menu Go to the Top
Register
Badugi calculator available Badugi calculator available

05-13-2008 , 04:03 AM
My first pass attempt at a monte carlo simulator for Badugi is done. It is available from here. I promise it isn't a virus.

Behold... TROUTULATOR!


If anyone who is familiar with Badugi math notices any dodgy results coming out of this thing, please let me know, it is very easy for me to make a small mistake that completely screws up results in some cases. I think it's pretty stable now.

As I mention in the readme, I will be updating this to simulate multiple draws, given some simple criteria for what to keep/discard between draws based on hand strength only. The next update is likely to be a simple hand vs range simulator for stud hi.
Badugi calculator available Quote
05-13-2008 , 10:03 AM
Badugi sim, 1000000 trials:
Dead cards: none

Hand 0: Ah 2c 3d -- : EV 20.0% - WIN/LOSE/TIE %: total 20.0/80.0/0.0 - badugi 20.0/0.0/0.0 - 3 cards 0.0/80.0/0.0 - 2 or 1 card 0.0/0.0/0.0
Hand 1: Kc Qs Jd Th : EV 80.0% - WIN/LOSE/TIE %: total 80.0/20.0/0.0 - badugi 80.0/20.0/0.0 - 3 cards 0.0/0.0/0.0 - 2 or 1 card 0.0/0.0/0.0

These hands should be close to 50/50, its clearly wrong in some way. The problem with a badugi equity calculator is we have to agree on drawing assumptions, which isn't easy. For instance in my example here, the A23 is about even money vs the worst badugi with 3 draws to go if we assume he keeps any badugi. If he throws a jack or worse and keeps drawing he is a much more substrantial dog (this is maybe how your code works and would explain the resulting equity). Subtle variations of this problem make a calculator like this impossible.

-DeathDonkey
Badugi calculator available Quote
05-13-2008 , 10:17 AM
DeathDonkey: As far as I understood the post the calculator only calculates equity for a single draw. While a horrible pat badugi is around 50:50 to a one card draw before the first draw IIRC it surely isn't if you only consider a single draw to come, in which case the 20% equity is totally spot on (there are precisely 9 spades that make the best hand and 45 unseen cards).
Badugi calculator available Quote
05-13-2008 , 02:52 PM
Yes, this is based on one draw right now, I will be updating it to support multiple draws eventually. This will work by allowing you to specify the highest card rank you will keep, e.g. if drawing 1, what is the worst badugi you will stand on. If drawing 2, what is the worst 3 card hand AND what is the worst badugi you will keep? You will be able to set these separately for the 2nd and 3rd draw.
Badugi calculator available Quote
05-13-2008 , 08:12 PM
Quote:
Originally Posted by DeathDonkey
Badugi sim, 1000000 trials:
Dead cards: none

Hand 0: Ah 2c 3d -- : EV 20.0% - WIN/LOSE/TIE %: total 20.0/80.0/0.0 - badugi 20.0/0.0/0.0 - 3 cards 0.0/80.0/0.0 - 2 or 1 card 0.0/0.0/0.0
Hand 1: Kc Qs Jd Th : EV 80.0% - WIN/LOSE/TIE %: total 80.0/20.0/0.0 - badugi 80.0/20.0/0.0 - 3 cards 0.0/0.0/0.0 - 2 or 1 card 0.0/0.0/0.0

These hands should be close to 50/50,
Indeed they should:
1-35/44*34/43*33/42 =
1-0.49418605 = 0.50581395.
Assuming the Kc Qs Jd Th hand stands pat, the Ah 2c 3d nb hand has to draw. ("nb" is any non-badugi card). There's about a 50.6% probability the
A,2,3,nb hand will make a badugi in three draws.
Quote:
its clearly wrong in some way.
Agreed.

badooooogi!

Buzz
Badugi calculator available Quote
05-13-2008 , 08:13 PM
Quote:
Originally Posted by LLCoolDave
DeathDonkey: As far as I understood the post the calculator only calculates equity for a single draw. While a horrible pat badugi is around 50:50 to a one card draw before the first draw IIRC it surely isn't if you only consider a single draw to come, in which case the 20% equity is totally spot on (there are precisely 9 spades that make the best hand and 44 unknown cards).
fixed your post.
Badugi calculator available Quote
05-13-2008 , 08:17 PM
Quote:
Originally Posted by RubbishCards
Yes, this is based on one draw right now, I will be updating it to support multiple draws eventually. This will work by allowing you to specify the highest card rank you will keep, e.g. if drawing 1, what is the worst badugi you will stand on. If drawing 2, what is the worst 3 card hand AND what is the worst badugi you will keep? You will be able to set these separately for the 2nd and 3rd draw.
I think it's neat that you're trying to do this.

Death Donkey thinks it's impossible, and he's usually correct.

I don't know if there's some way around the dilemma or not. Seems at least very difficult to me.

Good luck.

Buzz

badooooogi
Badugi calculator available Quote
05-13-2008 , 08:26 PM
Surely the twodimes sim for 2-7 draw is only doing 1 draw also? Otherwise how does it know what you're going to keep between draws?

Either way, it's useful for me even only doing 1 draw right now. I am terrible at doing all the math by hand and I don't yet have a feel for the equity values when it comes to things like 2 card draws vs 1 card draw, or multiway hands, which I imagine must be a real pig to figure out manually.
Badugi calculator available Quote
05-13-2008 , 09:00 PM
Quote:
Originally Posted by RubbishCards
Surely the twodimes sim for 2-7 draw is only doing 1 draw also? Otherwise how does it know what you're going to keep between draws?

Either way, it's useful for me even only doing 1 draw right now. I am terrible at doing all the math by hand and I don't yet have a feel for the equity values when it comes to things like 2 card draws vs 1 card draw, or multiway hands, which I imagine must be a real pig to figure out manually.
The problem is, when you start with
A,2,3,nb, you're more or less planning on making three draws (assuming you miss on the first two).

You can maybe get an approximation that would be useful by assuming Hero will draw three cards, only needing one of them to be one of the nine non-pairing spades not held by Villain (assuming Villain has a badugi).

I'm not sure how you could do that and come close to the true 50.6% probability, or even to 51%.

But you have to somehow account for three draws for the badugi calculator to be very useful.

Note that 1-0.80*0.80*0.80 = 0.488. In other words, if you take the 80% result for Villain and cube it (because there are three draws), you're just a couple of per cents off the true value.

I don't know if you can do something with that, perhaps refine it in some way, or not.

Buzz
Badugi calculator available Quote
05-13-2008 , 09:27 PM
Quote:
Originally Posted by Buzz
Death Donkey thinks it's impossible, and he's usually correct.
It's not impossible; in fact, it's fairly straightforward. All that is needed is to assign each of the sim's agents (players) a value for what they will draw to, and stand on, for each round. The sim will already come close to doing this when it selects its discard(s).
Badugi calculator available Quote
05-13-2008 , 10:07 PM
Quote:
But you have to somehow account for three draws for the badugi calculator to be very useful.
Well right now it's like a holdem calculator that only handles equity on the turn. Obviously it will be better if it does preflop and flop, but it's not like you ONLY care about preflop.

I would think it would be most useful when you can do the sim over 2 draws, for cases after the first draw when you have a lot more information for putting people on hand ranges. On the first draw, you're making your betting decision based on betting action only, you don't actually know for sure if anyone is pat until the next round.

Quote:
It's not impossible; in fact, it's fairly straightforward. All that is needed is to assign each of the sim's agents (players) a value for what they will draw to, and stand on, for each round. The sim will already come close to doing this when it selects its discard(s).
Yes that is exactly what I intend to make it do. It's going to be a little bit trickier than just comparing hands and seeing who wins because deciding which card to discard gets a little bit dicey in cases where a hand contains 1 or more pairs and a mish-mash of different suits. It's very easy to make a small mistake here and screw up the results.
Badugi calculator available Quote
05-13-2008 , 10:29 PM
My bad I downloaded it this morning before going to sleep and didn't read carefully or understand I guess. It would be very cool to have a simulator that functionally works for all 3 draws, but off to a good start!

-DeathDonkey
Badugi calculator available Quote
05-14-2008 , 12:40 AM
Quote:
Originally Posted by Buzz
fixed your post.
Except you didn't. There were no discards or dead cards selected in the example so there are 45 unknown cards. Maybe the poor guy was only dealt 3 cards, or maybe he just blindly discarded his 4th card when looking down on A23? Who knows? We obviously don't.
Badugi calculator available Quote
05-14-2008 , 08:43 AM
Quote:
Originally Posted by LLCoolDave
Except you didn't. There were no discards or dead cards selected in the example so there are 45 unknown cards.
Hi Dave - I understand. However, Hero has to have been dealt four cards.

He's only keeping three of them, but there has to be that fourth card he's discarding.

Anything else is illogical.
Quote:
Maybe the poor guy was only dealt 3 cards,
Not logical.
Quote:
or maybe he just blindly discarded his 4th card when looking down on A23? Who knows? We obviously don't.
Since we can see four cards in hand A and three cards in the hand B, obviously a fourth card in hand B must have been discarded.

Nothing else makes sense. (Think about it).

And although we don't know specifically what the discarded card is, it doesn't really matter. We presume it's not one of the nine non-pairing spades that are still unseen. (Otherwise, why would Hero be drawing - and if it is one the the nine non-pairing spades, then Hero is drawing for one of eight cards).

Buzz
Badugi calculator available Quote
05-14-2008 , 10:43 AM
Quote:
Originally Posted by Buzz
Hi Dave - I understand. However, Hero has to have been dealt four cards.

He's only keeping three of them, but there has to be that fourth card he's discarding.

Anything else is illogical. Not logical.
Since we can see four cards in hand A and three cards in the hand B, obviously a fourth card in hand B must have been discarded.

Nothing else makes sense. (Think about it).

And although we don't know specifically what the discarded card is, it doesn't really matter. We presume it's not one of the nine non-pairing spades that are still unseen. (Otherwise, why would Hero be drawing - and if it is one the the nine non-pairing spades, then Hero is drawing for one of eight cards).

Buzz
Nothing else makes sense within the logic of the game, yes, that's true. However it is the responsibility of the calculator user to specify dead and discarded cards as there is no way the calculator can know how many cards have been discarded before that situation came up. Thus it obviously takes all remaining 45 cards as possible outcomes and therefore yields the correct 20% winning chance, even if that figure is bound to be wrong under any actual game situation.
Badugi calculator available Quote
05-14-2008 , 02:45 PM
From the readme:
Quote:
Note that you don't actually have to specify discards,
although this will lead to slightly incorrect results. For example if you
just specify a hand as As 2h with no dead cards, you are actually going to get
a result for As 2h with 2 random cards discarded, which includes cards that
could have helped this hand, therefore this hand's EV will be lower than it
would be if the proper discards were specified.
Badugi calculator available Quote
05-14-2008 , 04:45 PM
Quote:
Originally Posted by LLCoolDave
Nothing else makes sense within the logic of the game, yes, that's true. However it is the responsibility of the calculator user to specify dead and discarded cards as there is no way the calculator can know how many cards have been discarded before that situation came up. Thus it obviously takes all remaining 45 cards as possible outcomes and therefore yields the correct 20% winning chance, even if that figure is bound to be wrong under any actual game situation.
Hi Dave - I see that 9/45 =0.2000. But that's the wrong answer!

The correct probability for one draw, if you're only drawing one card one time (and if you know Villain has a KQJT badugi) is 9/44.

I thought I was being helpful when I emboldened a response (fixed your post) to reflect the correct probability for one draw. Sorry if you took it some other way.

RubbishCards wrote:
Quote:
Note that you don't actually have to specify discards,
although this will lead to slightly incorrect results.
Exactly.

Buzz

Last edited by Buzz; 05-14-2008 at 06:09 PM.
Badugi calculator available Quote
05-14-2008 , 04:52 PM
Since this thread is getting some hits, I thought I'd post a problem I came upon a few years back. I wrote a badugi sim that used specified drawing parameters for the different player-agents. It used (Ta Da!) LISt Processing. It would take a player's hand, rank it as pat and identify its 1-card, 2-card and 3-card draws, and then play or fold it. The draws were identified and then rated by comparing them to the lists of all possible draws, with the "best" draw being selected.

Here's an example:

A 233 would have for 2-card draws A2, A3, A3 and 23. If the player-agent's parameters allowed, the A2 would be selected as the best draw from the ranking list that went something like: A2, A3, 23, A4, 24, 34 ... QK.

But in the above example, which is the best 2-card draw? My guess is that the A3 might prove better than the A2. How do you program something like that? The only way I know would be to brute-force it -- have it run out all possible combinations and select the best one, with a reporting mechanism for anything it considered an anomaly.
Badugi calculator available Quote
05-14-2008 , 06:22 PM
Is there a case where you would have this problem where you are also not doing something you'd never actually do, i.e. breaking A23?
Badugi calculator available Quote
05-14-2008 , 08:06 PM
When the 2 and 3 are of the same suit, I am assuming there would be a break.
Badugi calculator available Quote
05-15-2008 , 12:25 AM
Why don't you just keep the 3s then? Are you allergic to spades in some way?
Badugi calculator available Quote
05-15-2008 , 02:14 AM
OK, now I get it. Let's make it A233.
Badugi calculator available Quote
05-19-2008 , 03:39 AM
Quote:
Originally Posted by Phat Mack
OK, now I get it. Let's make it A233.

I dont understand why A3 would ever be better than A2 here?! Either way there are two deuces (2s, 2d) that will help or two threes (3s, 3d) that will help our hand.
Badugi calculator available Quote
05-19-2008 , 03:43 AM
I haven't done much more work on the calculator yet, but this seems a good a place as any to post a bit of badugi trivia I just came up with:

Obviously when someone has a badugi, their range of possible badugis is wider/worse the more cards they drew. We know that the median dealt badugi is Q752 (357 out of 715 possible, ignoring suit combinations), therefore if someone is pat on the first round and we assume they are not breaking any badugi, then 50% of the time they have a Q7 or worse.

If someone is drawing 1 with A23, then there are 10 badugis they can make, so the median would be between an 8 and 9, i.e. 50% of the time they have an 8 or better, 50% of the time they have a 9 or worse.

So what if they draw 3 or 2?
According to a dodgy bit of code I just wrote:

Axxx drawing 3: median is J97A (110 out of 220)
A2xx drawing 2: median is T92A (27 out of 55)

That's it...
Badugi calculator available Quote
05-19-2008 , 09:00 AM
Quote:
Originally Posted by RubbishCards
Obviously when someone has a badugi, their range of possible badugis is wider/worse the more cards they drew. We know that the median dealt badugi is Q752 (357 out of 715 possible, ignoring suit combinations),
Correct.
Quote:
therefore if someone is pat on the first round and we assume they are not breaking any badugi, then 50% of the time they have a Q7 or worse.
But I don't think you can make that assumption. If I break the median badugi, say 2,5,7,Q, then I have three draws to catch an ace, three, four, six, eight, nine, ten, or jack of spades (a total of eight cards). I'm going to improve more often than two times out of five:
8/48+40/48*8/47+40/48*39/47*8/46=
0.167+0.142+0.120=0.429
And I'm going to improve to an eight or better more often than one time out of four:
5/48+43/48*5/47+43/48*42/47*5/46=0.286.

The last time I stood pat on a ten badugi (let alone a queen badugi), I got badly burned when someone caught an eight badugi on the third draw. It was a pot limit game and cost me all my chips. I don't think I want to do that again. That queen is going into the muck, badugi or not.
Quote:
If someone is drawing 1 with A23, then there are 10 badugis they can make, so the median would be between an 8 and 9, i.e. 50% of the time they have an 8 or better, 50% of the time they have a 9 or worse.
Yes, that's true if they make a four card badugi. But they're not guaranteed of making a four card badugi if they draw. The probability of making any four card badugi in three draws, if drawing one card each time, is:
10/48+38/48*10/47+38/48*37/47*10/46=0.512
Thus it looks like the median hand they'll make if they draw is some badugi. But since the probability of missing any badugi about 0.488, I'm guessing the median hand they'll make if they draw is a king badugi.
Quote:
So what if they draw 3 or 2?
According to a dodgy bit of code I just wrote:

Axxx drawing 3: median is J97A (110 out of 220)
A2xx drawing 2: median is T92A (27 out of 55)

That's it...
Interesting, but they're not guaranteed of making any four-card badugi, even if they only draw one card, and they're even less likely to make a four-card badugi if they draw more than one card.

Don't give up.

Buzz
Badugi calculator available Quote

      
m