The Pleasure of Pattern: Lessons from Poker 3

Studying poker has helped me crack a long-standing (maybe 20-year-old) puzzle for me: why are so many programmers musicians? I’ve sang and played guitar and various other stringed instruments since I was eight and I started programming at 13, so I’ve lived this dual life for a long time, but I’ve never understood it. I’ve heard explanations like “music is mathematical and programming is mathematical”, but I was never satisfied with them because they didn’t match my experience. I don’t think “mathlich” when I’m programming. Here are the three threads–programming, music, and poker–and how they came together for me.

Programming

One of the transformative experiences of my young life came in high school when Mr. Burishkin (hi Dave!) got mad at our algebra class (this was fairly common) and assigned us all 40 trig identities in the book. Usually we’d get half or a third of the exercises in a given set. Here was a big pile of work I couldn’t get out of easily.

For once I did the right thing and decided I would just plow through the whole stack. The first few were hard. I had to sweat to figure out how solve them. Each one posed unique challenges. At this rate the assignment was going to take me hours. Somewhere around half way through the assignment, though, a door opened in my mind. I’d look at a problem and see it in terms of the problems I’d already solved–I can split this in two, transform part 1 into this and part 2 into that and I’m done. I blew through the rest of the assignment in minutes, eager to solve more.

Not could I solve the problems quickly but I enjoyed the process. Every time I transformed the chaos of the original problem into a pattern I knew how to handle, it was intensely satisfying.

I have the same feeling of satisfaction with many programming-related tasks–when I see a big refactoring in terms of a succession of smaller refactorings, when I see a big task in terms of independently verifiable sub-tasks, when I see a big feature in terms of a succession of features each of which delivers value–at all these times I feel good.

Music

For thirty years I’ve played off and on with my musical partner Curtis Wright. We play American folk music. While I’ve enjoyed playing with many people, Curtis and I share a deeper level of musical communication than I’ve experienced with anyone else.

We don’t plan song endings. We end every song differently every time. Here’s how it works. When we’re really “on”, I will hear him play some interesting phrase somewhere in the middle of a song and something will click in my mind. There’s no explicit communication at that moment though–no nod, no eye contact, nothing. When we get to the end of the song, I will play that phrase as a tag and he will too, in perfect time. It is the most exhilarating feeling because we’re so completely at risk. If we chose different phrases to play, it would sound terrible and we’d look like fools. When we re-invent the ending and pull it off, though, it’s absolutely electric, both to play and to hear.

This is the most extreme example I have of matching patterns in music, but music is full of patterns–what makes a phrase, what makes a chord, what rhythm or rhythms are going on, what style should this piece be played in, backing up an unfamiliar tune by ear, and on and on. I enjoy music because I enjoy those moments of discovering the patterns in a piece. When I see a pattern, I feel satisfied. Woodshedding (practicing physical skills) is necessary to be able to take advantage of patterns when I see them, but I don’t enjoy it the way some people do. Experiencing music, for me, is experiencing patterns.

Poker

When I started studying poker I didn’t have any particular expectations, I was just interested. One of the basic problems in poker is having a more accurate belief about your opponent’s hand than they have about your hand. Their patterns of betting give you clues. At some point you say, “He must have just gotten a second queen,” because how he is playing doesn’t make sense otherwise. When I’ve guessed right, I noticed that I have a moment of the same kind of emotional pattern matching satisfaction that I have when I’m playing music or programming. That’s when I made the connection–this feeling is familiar, it happens when I program and when I play music.

There’s my answer: talent for music and programming occur together because accomplishment in each relies on enjoying seeing patterns. See a pattern, feel good, look for more patterns.

The bigger the stakes and the bigger the pattern, the greater the satisfaction. I won’t play poker for much money because I’m not any good at it. However, I experience more satisfaction when I see big patterns in programs (what some people call “architecture”) or big patterns in music (the so-called “long phrase”).

I suspect that my chaotic early life left me with a brain wired to crave moments of order and feel good when I find them. That and the innate ability to see patterns led me to activities where I got frequent mental rewards. I’ve just identified this connection, so I haven’t done any background studies into the neuro-science of pattern matching. From my experience I would guess that the same kind of dopamine release that accompanies other pleasurable activities happens in my brain when I match a pattern, musical or programmatical. I’d also like to see an fMRI to understand the neural activation patterns at such times and see if programming, music, and poker all really have similar physical neurostructures.

My partner Cynthia Andres is also a pattern matcher, but she matches patterns of human behavior. She has a good sense of what people are thinking or feeling based on cues that are totally invisible to me. I wonder if there are any studies correlating skill at reading people with skill at music. Are psychologists musicians the way programmers are musicians, or are musical and programming pattern matching similar in a way that musical and social pattern matching aren’t?

Another question this brings up for me is the evolutionary psychology of this kind of pattern matching. What is the evolutionary advantage of being able to match abstract patterns? Assuming it increases evolutionary fitness, what is the cost of it that kept it from becoming universal (I suppose my kids could provide a long list in answer to this question)?

12 Comments

ChrisJanuary 11th, 2010 at 10:35 am

I am the son of an Architech and a Musician. I too fit into programming as naturally as possible.
I am a programmer, and my wife an Artist and Chef… I’m almost scared of what our kids will be. ;)

adminJanuary 11th, 2010 at 10:46 am

My experience is that you should be frightened of what your kids will be regardless of your background. The good news is that they generally turn out okay in spite of their parents :-)

\m/_('_')_\m/January 11th, 2010 at 11:15 am

I am a father and a programmer and I play guitar so this was the most interesting article that I happened to “stumble upon” and it all makes sense now I have alot of musician friends that are extremely more tech savvy than me so I learn alot from them and they learn some from me and boy o boy am I frightened about what my son is going to be cause his mom is a web architech

Steve HowellJanuary 11th, 2010 at 11:33 am

When I think of music, poker, programming, the common element seems to be language. The language of music has no concrete vocabulary, but you can still express thoughts with it, often in a very abstract way. Poker is all about body language, and while poker rewards our ability to interpret language, it also penalizes us for our tendency to express language, even when we don’t mean it! Programming languages allow for almost infinite abstraction and expression, even though they are generally interpreted by machines that have no capability for nuance or understanding.

Music is probably less essential for the evolutionary survival of humans than it is for other living creatures, notably birds.

The reason that (mostly) non-musical humans seem to be able to thrive and reproduce in modern societies probably has a lot to do with our ability to speak, write, listen, read, and think abstractly. I bet most non-musical humans have ancestors who were highly musical, and even though the musical ability did not carry down through all the generations, the underlying talents did. I’m not great at carrying a tune, but I can perceive tone when people speak, and I can establish a rhythm when I program.

Another interesting connection between music and programming is the extent to which the former can affect the latter. I don’t always program with music in the background, but it’s always funny how it affects your concentration on a programming task. At times music can be simply distracting, but other times it seems to stimulate the brain to make you program faster or better.

Matt SmithJanuary 11th, 2010 at 12:48 pm

Thanks for the interesting article, Kent.

As a musician and programmer, it seems that my motivation for both pursuits is an insatiable desire to create! I get that “electric” feeling (described by Kent) upon completing a new song or an innovative coding project. For me, it is less about pattern matching and more about pattern generating.

Scott LewisJanuary 11th, 2010 at 2:25 pm

Thanks for writing!

We’re all artists. The combination of careers and talents we hold are multiplied more and more these days. The patterns are definitely there. Thanks for sharing this one.

I’m an ex jazz musician, turned programmer, turned CEO. I never play anymore, but I’ve progressed to dancing, which I’ve found helps me think more clearly. Music and poetry lead me more than any other influence and they are, by definition, mathematical in nature.

Giles BowkettJanuary 11th, 2010 at 5:25 pm

I go for Occam’s Razor here. The most effective form of brain exercise is improvising music live. The second most effective is playing music live. Both have measurable intelligence-enhancing effects.

So programmers play music for the same reason athletes go to the gym. They just usually don’t know.

brain training proJanuary 12th, 2010 at 8:47 am

I’ve thought for a long time that music and mathematics are related in that they reflect certain abstract truths about the universe. Although you start out by saying that your music experiences don’t seem math-like, I think this might not be contradictory. Your description of those moments of satisfaction seem to reflect a sense of the abstract truth of the moment coinciding with the actual truth of the moment.

Dave LaribeeJanuary 15th, 2010 at 8:12 am

You’re musical process reminds me of the Sigur Ros performance film which is well worth a viewing ~ http://www.heima.co.uk/

paulJanuary 15th, 2010 at 8:32 am

kent,
I’m a big fan of your work, and actually just finished reading “crossing to safety”, which I loved, on the recommendation of your unit testing book. I find this post very interesting because in addition to being a programmer and a jazz musician/composer, I was a professional poker player.

betting patterns in poker are perhaps the most important component in successful hand reading (trying to figure out what the other guy has), particularly in online poker. in addition to this, almost all super-successful players I know have a really good memory for poker hands, and can recall betting patterns from hands they played years ago. having played hundreds of thousands of hands of online poker, I’ve forgotten most of them, but can still recall the exact action of many hands where I had a particularly good insight or “read”.

in music, pattern recognition feels a lot more subconscious for me, in poker (and programming) it is very common to “step through” a hand or a function, freezing time and going back to see what is happening in each individual step and trying to make some inferences about state, i.e. “ok, he raised half the pot on the turn when the flush card came out and I think he was….”, whereas I can’t really think of an analogous example for music. maybe transcription, but I think it is only a surface similarity.

anyways, just some random thoughts from another coder/musician/grinder.

adminJanuary 15th, 2010 at 8:48 am

Paul,

Thanks for the followup. One of the remaining conundrums for me in thinking about this is the seemingly vast difference between pattern matching when time is a critical factor (as it is in music) and when time isn’t as much of a factor (as it is in programming). One of my early theories was that this was the basis of the correlation between music and programming–in programming my mistakes lasted forever so it was a relief to play music where my mistakes evaporated immediately.

This is still an interesting question to me: how could such seemingly different activities have a common experience? (Assuming that you can establish that there is a common experience.)

BruceMRApril 21st, 2010 at 1:13 pm

2 years after I grarduated from college too long ago, all my rock band contemporaries got together for a dinner. Around the table we went discussing what jobs we had. All were in programming or IT or something related. Now this was during boom times, so there were other factors (available jobs). But we were all musicians. Something about that appealed.

PS: read Douglas Hofstadter and others for more. In Metamagical Themas (I think), he discusses Beethoven’s Transcendental Etude as a remarkably simple pattern. Awesome reveal!

Leave a comment

Your comment