Computing Texas hold 'em

A computer scientist goes all in for poker.

House of Cards

Credit: Eda Akaltun

Avi Rubin looks at his cards. Looks at his chips. Ponders his options. He has made it to the last table of a poker tournament at Delaware Park Casino, near Wilmington, Delaware, but he is perilously close to elimination. Stacked before him now is $8,000 worth of chips—the chips are merely to keep score; he bought into the tournament for only $65—and his eight remaining adversaries have among them $298,500. To win the event he must win all of their chips, too, and he is tired, worn down by the struggle this tournament has been. The game is Texas Hold 'em, the most popular poker variant, and the two cards in Rubin's hand are the ace and 4 of spades. Not the strongest hand, but he has $13,000 already invested in this pot. He thinks some more. Then he shoves his remaining chips into the center of the table. He is all in. If he wins the hand, he keeps going. If he loses, he goes home.

Image credit: Eda Akaltun

Rubin does not play poker for a living. He is a 44-year-old professor of computer science in the Whiting School of Engineering, plus technical director of the Johns Hopkins University Information Security Institute, plus director of the Health and Medical Security Lab at the same institution, plus a well-paid computer security consultant. If his name seems familiar, it is probably because in July 2003, he gave a technical paper he had co-written to a New York Times reporter. The paper proved that a Diebold Election Systems touchscreen voting machine that had been adopted by 38 states in time for the 2004 U.S. presidential election was so insecure a clever teenager could hack it and subvert its vote tally. Much to Diebold's annoyance, Rubin soon was in major newspapers and on CNN explaining why a supposedly tamper-proof voting machine was anything but.

After his family and his work, poker became Rubin's main interest, displacing pocket billiards, his previous obsession.

About five years ago, Rubin's father mentioned that Avi's younger brother, Yaacov, had been winning money playing poker online. Soon after, Avi suggested to Yaacov that they play sometime. "He kind of laughed at me and started asking a few questions about hands and situations," Rubin recalls. "He said, 'You know so little about poker, you don't realize that you don't know anything about poker.'" Rubin thought his little brother was just being arrogant, but when Yaacov recommended a poker book called Harrington on Cash Games: Volume I, Rubin read it at a few sittings, highlighting the text, making notes, utterly engrossed. "It was probably the most fascinating experience I've ever had, to read that book and understand the science and the math behind poker and to realize that a game I'd considered fun my whole life actually had more depth than I'd ever considered," he says. After his family and his work, poker became Rubin's main interest, displacing pocket billiards, his previous obsession. He is a man of strong enthusiasms, serially all in, you might say, and now he bought every poker book he could find and studied them for hours, rereading the best ones. He started seeking out games with better players, learning by losing until he began to win. And he set a goal—to play his way into the World Series of Poker in Las Vegas, the biggest poker tournament in the world, by the time he was 50.

Rubin is so young in appearance, he once had a Las Vegas casino question the validity of his photo ID, and there is something childlike in his enthusiasm for poker. On the day we went to Delaware Park, when I arrived at his house I found him already in his car, sitting impatiently at the end of the driveway. Once we were at the casino, the closer he got to the poker room the faster he walked. I half expected him to break into a trot.

His plan was to play a cash game in the morning, then enter the casino's noon tournament. In a tournament, the entrants vie for prizes awarded to the top finishers. Prize money in most daily tournaments is modest and the players risk no more than the entrance fee, so tournaments tend to attract more casual participants and poker tourists. But in a cash game, the players vie for each other's money, and because there is no limit to how much can be won (or lost), cash games attract professionals for whom a casino is the office. Soon after Rubin sat down at one of the cash games in progress at 9:30 a.m., a pro in a black T-shirt quit, holding more than $4,000 in chips. Rubin was happy to see him go. You don't win that much money at a small-stakes table unless you really know what you're doing.

Texas Hold 'em is the game you see on cable television poker shows. In Hold 'em, each player tries to make the best five-card hand out of two cards dealt facedown and a set of five communal cards faceup in the center of the table. The cards are dealt in four rounds—first each player's facedown cards, then three communal cards (called "the flop"), followed by a fourth ("the turn"), and finally a fifth ("the river")—with betting after each round. Texas Hold 'em rewards a good head for odds and a good memory for what everyone else does in the course of the game. Cautious at first, Rubin spent several hands sizing up the other players. He guessed that at least three were professionals. They had substantial chip stacks and cool, appraising faces, and they were not making mistakes. Still, after about 45 minutes he began winning some pots and seemed to be holding his own. He played well for another 45 minutes, until he tried to bluff with a weaker hand, failed to fold when he should have, and lost $240 to one of the pros. On a break soon after, he said of the player who'd just beaten him, "I should have realized he was strong. But every time I bet, the pros on the other side of the table were raising me and I was folding, and I was getting a little fed up. So they got in my head a little." He checked his iPhone. Years ago, he had made a substantial investment in Apple stock at a great price. Now he noted that the company was up $5 per share in morning trading. He chuckled. "The good news is I've made more on Apple this morning than I've lost here."

Between the cash game and the tournament, Rubin wolfs down a sandwich at the casino's On a Roll Deli. While he eats, he enters the morning's results on his phone, using an app that lets him record and chart his earnings and losses. He says that over the long haul he is ahead, this morning's $240 blunder notwithstanding.

When he began studying poker, Rubin frequently thought in terms of how a computer might model the game. Several disciplines were applicable—game theory, expert systems, machine learning, combinatorics. The latter is a branch of mathematics concerned with finite countable structures. The various combinations of cards in a poker hand are finite countable structures. As he trained himself to be a better player, Rubin would make up combinatorics poker problems, then solve them on a computer. He has considered studying the game by creating decision trees, branching diagrams that plot a chain of if-then options and are routine for a computer scientist. For example, he could start with a single hand, then chart all the variables—his position in a round of betting, the texture of the flop (that is, does it have potential to create strong hands like straights or flushes), whether he is playing against three others or heads-up against a single remaining opponent—to see what might happen. "For any given spot in the decision tree," he says, "I could come up with a probability distribution of different plays. Then I could write a learning program that I could use as a simulator on the computer and play a thousand times with particular settings, then tweak the settings and run it again to see if I do better, and work backward from it to infer why that was a better play in that situation. The thing is, there are so many variables and so many factors you rarely find yourself in a precise situation that you've studied. What you have to do is abstract out the reasoning used to get to that decision, then apply that logic and process to whatever situation you're in."

In his regular Monday night games with friends—his wife, Ann, got him to agree to limit poker to one night a week—Rubin plays against lawyers and doctors. "The lawyers tend to be better," he says. "The math in poker is basic arithmetic, it's not that hard. But you still have people, like a lot of the doctors that I play with, who'd rather not bother with all the math. They feel that they have enough intuition for the game." Rubin is pleased to point out that they're frequently wrong. "The fundamental math is much more important. If you're a solid mathematical player, in the long run you're going to kill the intuitive player.

"I think what really helps me is being a computer security guy. In security, we think of everything in terms of adversaries and action-and-response. You're worried about hackers and always trying to stay one step ahead, trying to predict what they will do if you take this defense measure, and in poker, you always have to stay a few steps ahead. It's almost exactly the same threat model that you have in network security."

At noon, the Delaware Park tournament begins with 43 entrants dispersed to four tables. Everyone starts with $7,500 in chips. Lose all of your chips and you are out of the tourney, which goes on until there's one man standing. (And it will be one man. The only women involved on this day are dealers.) The top five finishers will win cash prizes, with $723 for first. (Prizes at the daily casino tournaments are calculated by a formula and tied to the number of entries.)

Soon it becomes apparent that Rubin's initial table will be an action table, with people playing a lot of hands instead of cautiously folding. Early on, he gets ace-king, a strong hand that he bets. But he does not get the cards he needs on the flop and loses. Not much later, he's dealt a pair of jacks. This is also a good hand, so when someone raises him, Rubin raises back. The flop comes up king-7-4. Rubin now has to worry that the one player still in is holding a king. When that player bets, Rubin is forced to fold. No more than 20 minutes into the tournament, he has lost half his chips. He's not playing badly, but he's not getting the cards he needs to win.

Some of the casino's video monitors show data from the tournament: how many players started, how many are still playing, and the average number of chips held by each. Rubin's chip stack quickly falls below the average and he will spend the day clawing back from the edge of oblivion. At 12:54 p.m., he's dealt a pair of kings and bets the hand. One of his opponents refuses to fold, and Rubin goes all in. If he loses the hand, he's out of the tournament in less than an hour. The players turn over their cards and the opponent has only king-jack. Rubin survives.

Twenty-seven years ago, Rubin entered the University of Michigan with no intent to become a computer scientist and security expert. As a freshman he was premed. But he harbored a strong interest in applying computers to medicine, so he listed computer science as his major while he embarked on the premed curriculum. Starting at a sprint, he enrolled in six classes for his first college semester, and got five As and a B+. The B+ was in chemistry, a class he hated so much it drove him out of medicine. "I told my parents that if I had to take another chemistry course, it wouldn't be worth it to be a doctor." He would concentrate on computers.

He stayed in Ann Arbor for his graduate degrees, and one year the university offered an intersession course on pool, taught by a pro who was ranked 17th in the United States at the time. Most of the students were merely amusing themselves between semesters. Not Rubin. Taken with the complexities of what seemed like a simple game, he practiced diligently, studied books and videos, watched every Hollywood film that involved pool players, and found himself improving quickly, which fueled his desire to get even better. Years later, when he and Ann were looking for a house in Baltimore, he rejected a few because they didn't have any rooms big enough to accommodate the tournament-size pool table he wanted. Once they had the house and he had the table, he practiced in the evenings and on weekends. He converted a competitive friend to the game, and they would play until 1 or 2 in the morning. "That was before either of us had kids."

Ann says that early in their relationship, Avi's capacity for obsession was not so apparent, perhaps because they had little money and he was busy finishing his doctorate. Ann is a lawyer, smart, patient, and bemused by life with a husband who does not seem to grasp the everyday meaning of "casual pursuit." She can tick off other examples of his tendency to go all in. When the two of them decided that sailing might be fun, she had in mind occasionally going out in a rented boat. But it wasn't long before they were taking lessons and the owners of their own sailing vessel. The Rubins have three children, and when the oldest brought home her annual school photos one day, Avi was unhappy with the quality and decided he could do better. There ensued the purchase of cameras, lenses, lights, backgrounds, and books; a period of study and practice; the setting up of a home studio; and the establishment of an annual photo shoot in which the kids dress up and Rubin takes hundreds of pictures to get portraits that satisfy him.

"He's fortunate that his interests coincide with mine," Ann says. "Except for the poker one." Rubin calls poker the biggest source of friction in his marriage. Ann seems more good-humored about it than her husband would suggest but admits, "Poker became an annoyance, really, because it was much more of an obsession than anything else. Part of this obsessiveness is he wants to talk about it." She does not share his enthusiasm for analyzing poker situations. Nor is she comfortable with the amount of money that can change hands. "I don't like gambling," she says. "Mah-jongg I play for quarters. To go to a game and potentially lose hundreds of dollars in an evening? I don't know. It bothers me. He's ahead, but still."

Nevertheless, for one birthday she took him to Atlantic City and turned him loose to play while she shopped, and for another birthday took him out to dinner while friends slipped into the house and set up a surprise tournament for her to bring him home to. The Rubins are building a new house, and the basement, with her blessing, will include a poker room with three tables. Avi has urged Ann to play more, and says he thinks she could be the better player if she worked at it. She's not much drawn to that idea but has suggested that he take cooking lessons. Her calculation is that if he dives into that like he dives into everything else, by the time the house is done he'll be able to cook some very good food whenever he hosts a Monday night game. She might not play, but she'll be happy to eat.

A little more than an hour after the start of the tournament, five players have gone broke and are out. At 1:45 p.m., Rubin, down to less than half of his initial stake, goes all in again, and his two opponents fold. He starts to rebound, winning a couple of hands. He doesn't say much, and his right foot jiggles constantly. Half an hour later, with only 29 players left in the tournament, he's all in yet again. His two pair, aces and queens, beats a pair of 7s. Each hour, the tourney breaks for 10 minutes, and on one of these breaks Rubin says, "This is what you call grinding it out." By 2:30, the field is down to 20 players and Rubin folds a pair of 3s. It's the right play for such a weak hand, but he then has to watch as the pot grows large and the other two 3s turn up in the flop. Had he stayed in the hand, he'd have won big with four of a kind. All he can do is shake his head.

Three hours into the tournament, he's forced to go all in yet again, but wins when everyone else folds. By 3:30, for the first time all day he has clawed back to holding what the video monitor says is the average number of chips. Ten minutes later, he's all in for the fifth time today, and again he wins.

He makes it to the final table. When another player crashes out, Rubin is only four places out of the money. At 4 p.m., he peeks at his cards and sees ace-4 of spades. Not a great hand. Still, all but one other player has folded, and that one just lost $6,000 when confronted by an all-in raise. Rubin knows that the by-the-book play with ace-4 is to fold. That's what a computer scientist's grasp of the probabilities says, that's what all the poker manuals he has studied for months say, that's what cold logic says. But he looks at his chips, ponders his options, and convinces himself that on the previous hand his adversary displayed a tendency to back down against a show of strength and might do that now. Or he might be upset enough to play a losing hand out of frustration. Either way, Rubin wins. He pushes forward $10,000 in chips, adding to the $3,000 he already has at stake.

Three hours into the tournament, he's forced to go all in yet again, but wins when everyone else folds.

The other man raises and goes all in—the one possibility Rubin hadn't considered. Now he is backed into a corner. He is "pot committed," meaning it no longer makes mathematical sense to fold. So he, too, must go all in, hoping he hasn't blundered. Maybe he'll get an ace on the flop. Or three spades, which would give him a flush. But sensing imminent demise, he looks back at me and says, "Let's go home," as he pushes his remaining $8,000 in chips into the center of the table. He does not get the ace. Nor does he get the spades. His opponent beats him with a pair of 9s and Rubin is out. He finishes the tournament eighth. Only the top five finishers earn prize money.

In a conversation two weeks earlier, he had said, "Sometimes when I leave a poker game I'm lost. I have this really terrible feeling inside. I can't stand it if I leave a tournament because I did something really foolish." On the drive home now, he has 90 minutes to brood over that last hand. "That was a bad play. I should have given more thought to the position pre-flop. Maybe it was the strain of playing that long." Twenty minutes later: "Oh, I'm kicking myself for that play. Kicking and kicking." Half an hour after that: "Definitely misplayed that hand. But in my defense, I was exhausted." He does note one benefit. Because of his early exit from the tournament, he will be home in time to take his son to soccer practice. That will make Ann happy.

He could buy his way into the World Series of Poker simply by showing up and handing over $10,000. But he doesn't want to do that. He wants to bring his skill up to where he can qualify by playing his way in. Ann believes he could do it. She says, "When Avi sets his mind on something, there's no stopping him." Right now, though, he just keeps replaying that last hand. Turning onto his street, he sighs loudly.

Dale Keiger, A&S '11 (MLA), is associate editor of Johns Hopkins Magazine. Thanks to Ann Rubin for relaxing her one-poker-game-a-week rule for this story.