Friday, March 18, 2011

Poker = Tennis: A Categorical Equivalence of Games

Recently, while watching a tennis match, I was chatting with a friend of mine, my first poker teacher.  Back in 2006, after following his online poker play for a semester, my understanding of the game increased dramatically.  I had a breakthrough that I imagine most other beginning poker players have at some point, during which they rapidly realize their previous approach to the game needs to be completely scrapped.  My simplistic method could not accommodate the depth of poker, and so I rebuilt my strategies within a new framework and became much better at the game.  If you're reading, thanks man.

So while we watched Federer demolish some early round opponent at the Australian Open or Dubai, I tried to catch up on my poker gossip, asking about the results of recent tournaments.   Quite naturally, we started comparing what we were talking about (poker) to what we were watching (tennis).  To my surprise, the comparison was quite fruitful: many characteristics of one game had an analogous feature in the other game.  Now, before we get to this likeness of games, I'd like to introduce the theoretical framework which will serve as the language of the comparison: category theory.


[For the tennis/poker fan not at all interested in math, jumping forward to "The Basic Morphism Map" might be readable.  But I recommend the full reading.]

A Bit of Abstract Nonsense

Category theory is a field of abstract mathematics developed in the second half of the 20th century that studies the common structure of various branches of math.  Because these commonalities must relate to algebraic, analytic, and topological objects simultaneously, the terms of category theory are extremely general.  As such, the field is jokingly referred to as "abstract nonsense" among academics, but it has gained a strong foothold as a foundational language for pure math.

The classical foundation for pure mathematics is set theory, whose basic objects are elements and sets.  These are combined by the idea of containment: elements are contained in sets, and two sets are equal if they have the same elements.  There is little doubt that set theory can serve as the base of mathematics, but it was unquestioned as the most natural such choice until the development of category theory.

There are three basic elements of category theory: categoriesobjects, and morphisms.  Categories are the replacement of sets from set theory; they contain objects, the equivalent of elements from set theory.  But the significant advancement of category theory is the inclusion of morphisms (also called arrows), which are simply ways to relate two objects of a category.  This small addition is crucial: it says that the most essential structures in math involve the relationships between objects, rather than the objects themselves.  For example, arithmetic is about numbers (discrete points), but calculus, a more sophisticated area of math, is about the functions defined on numbers (arrows).

For any essential object in mathematics, a category can be defined with those objects and whose morphisms are the natural way to relate two of those objects.  For example, the category of vector spaces over a field (which has linear transformations as morphisms), the category of topological spaces (where morphisms are continuous functions), and the category of finite groups (group homomorphisms).  Then, if two types of objects are representing the same underlying mathematics, their categories can be shown to be equivalent: there is some way to "translate" between the two different objects that respects the morphisms of each category.  This "equivalence of categories" is the sort of mapping I want to observe between poker and tennis.

The Categories of Poker and Tennis

The two games I'll consider, because they match up best in their structure, is heads-up Texas Hold'em poker and singles (men's) tennis.  The team aspect of doubles tennis has no counterpart in poker, and when more than two players are at a poker table, the complex game theory of multi-way pots doesn't exist in tennis.  My examples will come from men's tennis simply because I know it better than the women's game.

So in both categories, the objects will be the players.  In tennis, the most basic morphism f from A to B will be a shot hit by player A against player B.  By concatenating (or linking together into a sequence) these shots we can get more complex morphisms to represent rallies, or even entire points.  In poker, the most basic morphism f from A to B is a bet, raise, check, or fold made by A while playing against B, and concatenation here will give us series of bets, or entire pots.

We see that the morphisms of both categories carry a lot of information.  A single shot in tennis, the "basic morphism" of the category of tennis, must encode the type of stroke, the trajectory of the ball, the position of the hitter, the position of the defender, and the scoreline of the match at the time.  Meanwhile, a single morphism in the category of poker carries with it the type of action, the size of the bet or raise, the hand of player A, the hand of player B, the board and current street of betting, the size of the pot, and the stack sizes of the players at the time.  Since so much data is encoded by the morphisms of our two categories, we start by trying to determine the morphism map, that is, the analogous morphisms between the two games.

The Basic Morphism Map

Let's start with the simplest arrows from each game.  For tennis, the most basic shot is just a forehand or backhand up the center of the court, which continues the point without challenging to win it.  The equivalent of this move in poker is a check, which continues the pot without challenging to win it.

In tennis, there are more aggressive shots, which are designed to put your opponent off balance.  This is achieved by putting pace or spin on the ball, hitting the ball near the sides of the court to get your opponent on the run, or hitting the ball on the rise, which takes time away from the opponent.  All of these shots get mapped to bets and raises in poker.  The more aggressive the shot, the larger the raise.

The similarities of aggression in tennis and poker are rampant.  It makes it more likely for the point or pot to end quickly.  It makes the next few decisions by both players more important than if the aggression hadn't occurred.  The more aggressive player is said to have "control of the point/pot."  Pundits from both games generally agree that optimal play, beyond sound fundamentals, revolves around controlled, well-timed aggression.

To play most aggressively in tennis, a player comes to the net.  This move commits him to winning the point within the next few shots by employing his superior position.  The equivalent of this move in poker is a large, pot-committing bet or raise.  These are risky moves in both games.  Unless a tennis player coming to the net has proper positioning, his attack will backfire by a single well-hit passing shot.  Similarly, if a poker player makes a large bet without a strong hand, the opponent only needs a mediocre hand and a bit of courage to call and counter the bluff.  This hints that the court position of a tennis player is equivalent to the strength of the hand of a poker player.

Passive play also exists in both games.  For tennis, a retrieval of an aggressive shot that simply pushes the ball back into play is passive.  Many players commonly react to an aggressive play by the opponent with this option, to continue the point in the hopes that the opponent will make an error or an opening will emerge.  Translating this to poker, this play becomes the call of a bet or raise: a response to an aggressive action that continues the hand without trying to win it outright.

These are the basic morphisms translated between the two games.  Now let's look at common situations of the two games, to see if the interactions between morphisms also translate.

The Complete Morphism Map

For example, the server in tennis is the favorite to win the point whenever the two players are evenly matched.  In poker, the player on the button replaces the server as the side with a better chance of winning, all other factors being equal.  Just as a server in a tennis point, the player on the button acts first in a hand (remember, this is heads-up).  A strong serve equates to a button raise: it's the first action in the point or hand, and immediately establishes the server or player in position as being in control of the point, or wins it for them outright (as an ace).  Weaker serves may work more like calls of the big blind: they just begin the point without giving the server a significant advantage.

After the serve, there is the return of serve.  The quality of this shot influences how the entire point will play out.  A weak return of serve will not allow the returner a chance to get into the point.  Similarly, the big blind's response to a button raise or call determines the control of the hand in poker.  In general, pre-flop play corresponds to the first 3 to 5 shots of a tennis point.  After these initial exchanges, if the point remains undecided, it usually has settled into a more regular rhythm with the two tennis players knowing better their roles in the point.  These later shots are analogous to post-flop play, because the board better defines the positions of the poker players.  The tennis tactic of the server applying extended pressure through a point is reflected in poker hands as continuation bets.

Also, if either tennis player has control of a point, a common strategy is to hit the ball side-to-side, forcing the opponent to cover more ground and hit shots on the run.  We can translate this into "barreling" in poker, where the player with control of the pot bets larger and larger on each subsequent street, making it more and more difficult for the opponent to keep calling.  Of course, this tactic has a counterstrategy: the slow-play.

If a poker player is being overly aggressive and winning hand after hand with big bets, the opponent will often try to set a trap for him by disguising a very strong hand, slow-playing it.  Then, once the pot has been built by the aggressor, the slow-player raises or calls on the end and wins the bloated pot with his superior hand.  Moving back to tennis, we see that this equates to a counterpunch: a when a player that appears to be retrieving and hitting only defensive, passive shots, suddenly cracks a winner to steal a point from what looked to be a weaker position.  Andy Murray and Gilles Simon make particularly effective use of this ploy.

A more advanced move in poker not yet covered is the check-raise.  This play, usually made with a very strong hand, involves checking, allowing (or even inducing) the opponent to bet, and then raising, swells the pot very quickly and puts a lot of pressure on your opponent.  In tennis, this is equivalent to a move that induces your opponent to act aggressively.  In fact, this play exists, most notably played by Federer: from a comfortable position, Federer sometimes plays a short backhand to the center of the court, obliging his opponent to come to the net.  Then, the opponent ends up coming to net without the dominating position necessary to prevent Federer's passing shot, and Federer takes the point.  This play is called drawing the opponent to net.

The Object Map

The objects of each category are the players.  We can differentiate these players by the types of plays they would make, i.e., which morphisms exist coming from each player.  In essence, a player is defined by his strategy: the sum total of all moves he is capable of (a confirmation of the Yoneda lemma).  So let's define some typical player types from each game and see if they can be translated.

The most canonical strategy for a tennis player is serve-and-volley.  This aggressive style attempts to win points as quickly as possible by coming to the net at every opportunity.  This maps to power poker, a strategy that tries to bully the opponent into giving up pots, usually as early as possible (preflop or on the flop), with big bets.

The counterpoint to a serve-and-volleyer is a baseliner, a tennis player that tries to win points from the back of the court by gradually establishing control.  This slow, calculating play is echoed in poker by small ball.  This strategy tries to see as many flops, turns, and rivers as possible and outplay opponents with intelligent post-flop play.

Between these two tennis strategies lies the all-court player: these players are more aggressive than baseliners but less aggressive than serve-and-volleyers.  They feel comfortable both at the back of the court and at the net, and they can decide to either stay back or come to net depending on the circumstances of each point.  This play resembles the tight-aggressive style of poker.  This style generally waits on good hands (or situations) to aggressively bet at the pot, while not seeing as many flops, turns, or rivers as a small ball player.

Finally, there are players that use defense to their advantage.  In tennis, these are called counterpunchers (or retrievers), which extend points, allowing opponents to hit aggressive shots, until the opponent creates an opening against himself which the counterpuncher can then exploit.  In poker, the strategy of allowing your opponent to bet while you wait to slow-play a monster hand is known as playing trappy.

Even weak, non-profitable strategies are translatable between the games. In tennis, a defensive player without the ability to exploit openings just hopes his opponent makes an error as he defends.  These players are pushers, and they do not measure up well against quality opposition.  The equivalent poker strategy is the calling station, which calls bets without betting or raising himself.  An expert poker player can exploit numerous holes in a calling station's strategy.  Interestingly, both of these strategies are effective against error-prone opponents, and are often employed by amateurs or beginning players in each game.

Special Values of the Object Map

Now, let's just have some fun by asking how the famous professionals in each discipline measure up.

1.) Phil Ivey = Roger Federer

The first, obvious comparison to make.  Phil Ivey is considered the greatest current poker player, and Federer has made his case for the greatest tennis player of all time, so this equivalence could be seen as a just matching the maximal objects in each set, ordered by greatness.  But there are more similarities than this one.

Both Ivey and Federer are great because of their varied play.  They each have a mastery of "every play in the book," and are capable of flipping to any page at any moment.  Also, both carry their title casually and comfortably, Federer perhaps moreso than Ivey.  Finally, it would not surprise me if within the decade, Ivey overtakes Hellmuth, Brunson, and Chan as the leading WSOP bracelet holder.  A changing of the guard will occur in poker, and just like what Federer's 15th slam at Wimbledon in 2009 signified for tennis, the poker's tournament results list will reflect what most fans of poker have suspected for years: Ivey is the greatest in the game.

2.) Phil Hellmuth = John McEnroe

This equality hardly needs explanation.  Both players are known for their bratty, childish behavior as much as their brilliant play. Both players have a completely unique style that relied on their natural talent, and in each case the style looks outdated in the modern version of his game.  But each player was at one point the best in the world.  Each also makes for an excellent commentator on his game, interestingly enough.

3.) Tom Dwan = Andy Roddick

He started playing at the highest level when he was very young.  He's cocky, but likeable.  He's good-looking.  In his break-out year, he took the world by storm.  His playing style is aggressive and relentless, and his natural talent in full force doesn't just put his opponents off their game, it doesn't even let them play the game.  Which of these two am I describing?

4.) Daniel Negreanu = Rafael Nadal

Daniel Negreanu is best known for two things: his great table personality, and his small-ball approach to the game.  As long as he sees enough flops, turns, and rivers, he favors himself to eventually outplay any opponent.  This strategy parallels nicely with Nadal's preference of playing, and winning, from the baseline.  The longer points (or pots) last, the more likely Nadal (or Negreanu) will win them, against virtually any opponent.

Also, it's worth noting that Nadal has a chance to usurp Federer's claim on the "greatest player of all time" title, especially if he continues to win slam events across all surfaces.  This compares well to the rivalry Negreanu and Ivey have: they are the top two earners from live tournament winnings in history, each with about $14M.

5.) Johnny Chan = Pete Sampras

Sampras changed tennis not because of his personality but by his aggressive serve-and-volley style and unreadable serve.  Chan himself attributes part of his success to his unreadable style, which was aided by the fact that he was one of the few Asians playing Hold'em tournaments at the time.  Players simply didn't have practice reading Asian faces for tells.

6.) Erik Seidel = Andre Agassi

Seidel's methodical, relentless style matches well to Agassi's incredible ground game.  Both players play very cleverly but with extremely sound fundamentals, and Agassi's eight slam wins equates to Seidel's eight WSOP bracelets.  Finally, the most famous televised poker moment of all time captures Chan defeating Seidel heads up for the title (featured in the movie Rounders).  These two players map to Sampras and Agassi, on of the most celebrated rivalries in tennis history.

Exercises for the Reader

Leave any answers or thoughts you have about these questions in the comments.

1.) Explain the following equivalences, or give a counterargument.
a.) Phil Laak = Andy Murray
b.) Gus Hansen = Robin Soderling
c.) Alan Cunningham = Nikolai Davydenko
d.) Doyle Brunson = Rod Laver
e.) Antonio Esfandiari = Gilles Simon

2.) Match up the following players with a suitable equivalent in the opposite game.
a.) Patrick Antonius = ??
b.) ?? = Ivo Karlovic
c.) ?? = Novak Djokovic
d.) Stu Ungar = ??
e.) Mike Matusow = ??
f.) ?? = Goran Ivanisevic

3.) Consider the difference between best-of-three and best-of-five tennis matches.  Is there an equivalent to this in the structure of poker tournaments?

4.) Consider the difference of playing on a clay court and a hard court in tennis.  How can this difference be reflected in poker?

5.) Late in an even match, there must still be a winner and a loser.  How does each game force such a decision?  Is either "fairer" than the other?

Warning: the following problems require a bit more category theory knowledge.

6.) What are the identity morphisms in either category?

7.) In a category, if the target of one morphism equals the source of another, the two morphisms may be composed.  Give an example of a pair of such morphisms in either game that cannot be composed.  How can this failure of the composition map be resolved?  Do we need to rehaul our categories?

8.) Are there initial objects in either category?  Are there terminal objects in either category?

9.) Do commuting triangles exist in these categories?  Can you find an example of a commuting square?  Is there a better definition of a quasi-commuting square?

10.) Can we make sense of limits, colimits, products, coproducts, or any other structures from category theory?

2 comments:

  1. I've been thinking about the tennis category example. I like it a lot. Am I correct that you are interested in morphisms only up to homotopy?

    It seems like the biggest drawback to the overall description is that morphisms don't compose well. For instance, say you want to compose A->B->C, where A and C are different players. It doesn't seem like a well-defined composition to me. Could you maybe have a category for each match? Then I'd like there to be 3 objects, one for each player, and something like a "winning shot" final object. (Or maybe a "lost point" final object.) The downside to this is that you lose the beautiful Yoneda lemma argument for showing when two players are equivalent.

    Messi is a dog. Long live Ronaldo, soccernet king.

    ReplyDelete
  2. I'm glad you enjoyed the tennis category. It was fun for me to think about how it could be as 'rigorous' as possible, and your points about composition and homotopy are what I'm getting at in problems 7 and 9, respectively.

    I see two solutions to the failure of composition: either your idea, or introduce a "zero morphism" between any two objects that any nonsensical compositions equal. There are other solutions that involve sacrificing objects = players (encoding more information in the object), which make me not like them as much.

    Your last paragraph is off-topic, so I'll assume it's just your internet signature and not respond. Cheers!

    ReplyDelete