It happened last month, but a giant in the math world passed away. He had a really compelling life story beyond just being a leader in his area of expertise. Sad to see him go.
Texas Hold’em is bloodsport, primarily because of its computational complexity which requires you to guess probabilities that are not easy to estimate. The “blood” part comes from the consequences of making uninformed bets, which can get you into big trouble – if you don’t know which guy at the table is the mark, then its always you. Poker is not meant to be kind to the beginner.
I used to write pokerbots. For the flop, turn and river rounds the ease of calculating hand odds by computer in real time is pretty straightforward with a bit of pre-calculation. The hard part was dealing with bluffing and adjusting the hand odds accordingly. The University of Alberta’s pokerbot program did a really good job figuring that out – I usually wrote my bots to combat theirs.
The hardest part – and the most computationally intensive – was figuring out proper bets during the ante. You had your 2 cards, you faced a table holding their cards – and you had to properly guess the odds. I saw lots of opening round strategies but didn’t see anyone making a simple table with the probabilities of winning or losing. So – I wrote a quick program to figure that out.
The first step is to show the “base” probabilities. This is the chance of a win or a draw if you go right to the river card – it’s not odds as we would need to know the size of the pot etc, but you can use this info to figure out the odds pretty easily from there. I simplified things (for reasons that will be clear later) by reducing openning cards to suited or not suited for me versus my opponent. Here’s the table showing that result:
You use it by looking at your hand and reading off the table. Let’s say I was dealt 10-H and A-D. That’s an offsuit pair, so I’m looking at the upper part of the triangle (note that all pairs are necessarily offsuit), specifically at the cell for TAd (T=10, A=Ace, d=offsuit portion of the grid). In this case, it gives me a probability of 65%. That means playing against every other hand combination and assuming that all those hand combinations appear equally, I would have a 65% chance of winning. That means against 22d (pair of 2’s), AAd (pair of Aces), 27s (2,7 same suit) etc. – all 169 combinations (13 x 13).
This grid would be good for figuring out your chances against the blinds if no one raised during the ante – but not good for much else.
Things get more complicated if you are figuring out the probability of a win against other players who have to bet money in order to stay in the game (or if the blinds raised or called to a raise). In that case, the likelihood of your TDd playing against an opponents 27d is zero: that’s literally the worst hand and no one is going to bet money on that. So, we need to weight the hands of your opponents in order to come up with a more realistic estimate of what your winning odds are. In this case, I used the odds from the base table to help me figure it out – anything with less than a 50% base chance of winning isn’t going to get played by an opponent, while anything with 70% or over base chance will get play 100%. All numbers in between are simply copied. When I use this weighting, I come up with a new table:
For the record, here’s the probabilities I use to calculate table 3:
I’m trying to put this into a spreadsheet so that you can make your own probabilities based on your own estimates. The code used to calculate this was a separate program I wrote that did a couple of days of calculations to come up with the base cases I use to calculate the estimates – I need to clean it up before releasing it to the world, so I’ll probably post that later. I originally did this years ago in C but for simplicity I just wrote this version in Java – oddly enough, running highly optimized C code on a machine from 10 years ago versus unoptimized Java code on a modern laptop (and not even the fastest one out there – I probably could have multithreaded it to take advantage of the multiple cores on my i5) took about the same length of time.
Finally, for the record, even this is a simplification. Given, TAd, there are actually twelve combinations of cards which would match that pattern (10 hearts – Ace diamonds, 10 spades – Ace hearts etc.). The issue lies in the base program I use to calculate the odds of various match ups like TAd versus 27s. If the 10 in TA is a hearts and both of the 27s are hearts, then the chance of a flush resulting in a tie is greater than if the two sets of cards have different suits. Still, flushes are relatively rare and don’t change the percentages by much – you can get a sense of the effect by looking at the relative win percentages for, say, TAs versus TAd – it’s a delta of 1-2%. I figured that was a fine margin of error if it meant I could fit everything into a 13×13 table.
Years ago when I started my career as an equity analyst, I had no idea what they actually did or how they did it. Thankfully, someone sat down and wrote a great description of how equity analysts actually do their work and why. It’s a worthwhile read.
I’ve been playing around with the International Database at the US Census Bureau. They provide population estimates broken down by country, age and year for essentially every country. More importantly, they keep it updated every 6 months.
One area I’m interested in for my economics research is population growth rates – or more importantly, shifts in population makeup over time. I’ve created a few interesting graphs to show the expected shifts over the next 35 years. It’s actually pretty terrifying.
The first item of note is the changes in the dependency ratio. This is the ratio of dependents (people aged 0-14 and those over 65) versus “working aged folks (people aged 15-65). It’s not a precise measurement, and from personal experience I know that 15 year olds are not very productive – but it’s a decent starting point.
Here’s the change in the ratio between 2013 and 2030. The dots are individual countries, colour coded by continent. I’ve put some labels on some of the more familiar ones:
Perhaps more illustrative is the actual shifts in composition by age for various countries. Here I’ve built histograms for each country (male and female). Note the shifts in the 25th, 50th and 75th percentile over time – almost every country is getting older over time – but for some its truly terrifying (I’m looking at you Germany and Japan).
I think that one consequence of this is that Europe better get used to more African immigration if it wants to keep its social safety net – it needs the tax base and all the young folks are coming from Africa in the future. But more importantly, I’m sure that policy makers have in the back of their heads these graphs as they realize that they’d better start saving today, because tomorrow looks worse.
A few points: the top graph for each country shows the breakdown for men and women of their relative populations. The black outlines show the population breakdowns for 2013. The bottom graph shows the estimated population over time, with the red dot showing the current year demonstrated by the upper graph.
A really good read on failure modes in complex systems:
Summer is a great time to relax and “get out of your own head” – and there is no better way to do this than to get into the head of someone completely unlike yourself. Hagakure is a book about the thoughts of a samurai written in the early 1700’s. That was a time of relative peace in Japan and the samurai were challenged by having no significant battles to fight. For a warrior trained in bushido (the way of the samurai) as being the “Way of Dying”, living in peace time is a bit of a letdown.
After his master died, the bushido code demanded that the samurai commit ritual suicide – however this practice had been recently outlawed by the Shogun, so instead our hero retired to go live in the hills as a hermit in a pique. The author was his friend (for want of a better word) who interviewed him and wrote down his sayings. The book is his attempt to explain through simple stories how to maintain the mindset of a fierce warrior, ready to die at a moment’s notice for his master, in a time where that discipline simply isn’t needed.
It’s a very easy read – the stories and saying are each a few paragraphs long and the book is slim enough to fit into your pocket. It’s great to pull it out when waiting in line, or makes the ideal bathroom book because you can pick it up and put it down inside of 4 minutes and still profit from the time. The stories themselves range from the eminently practical to the sublime. It’s like a book of Zen koans from an alternate dimension where the Buddha was a sociopathic killer.
The bushido is an exceedingly harsh code – stories abound of harsh penalties for, among other things, getting into a bar fight but failing to fight to the death (crucifixion), separating combatants in a bar before they could kill each other (banishment), drinking too loudly and telling everyone you are going to kill them (ritual suicide), along with failing to die in battle (go fight another battle to try again) etc. A representative quote is “if you are slain in battle, you should be resolved to have your corpse facing the enemy.” The frustration of the author to have NOT died in battle comes through in every page. He’s desperate for an excuse to die well but lives in an age when his honour cannot be satisfied.
As you read your other summer beach material about samurai and other fighters, its easy to be thrilled by the action. This book has no action but you will come away from it understanding why they think as they do. There are a lot of business books that try to convince you to “be like a samurai” in the sense that there is an emphasis on total dedication to the task and a bias towards action – but that’s a very superficial take on the whole samurai schtick. It’s sometimes presented in the west as a kind of “you only live once” approach to life (as one wag put it: #YOLO = “carpe diem” for poor people) – but that’s missing the point. Samurai don’t live – they die. They are just trying to make sure its a good death – whether it was a meaningful or accomplished one is beside the point.
You can read the thoughts of great men to glean what you can from them; but there is always the temptation to treat their ideas like a grand buffet – select the noble as worthy of emulation and rejecting the unsavory bits as being outdated or ridiculous. It is folly to do this: rather, these books are a record of a complete philosophy of life and it is critical to realize that at some point in time, a real human being honestly considered that all those pieces to fit together as a unified, consistent whole – unlike heads from bodies, the noble and ridiculous parts cannot be separated. It is better to marvel that an intelligent person truly embraced all these things and to understand how inaccessible those thoughts are to us – no matter what you do, you could not be them. Summer is a great time to relax and “get out of your own head” – and there is no better way to do this than to get into the head of an 18th century samurai. Four (ninja) stars.