During one of the hours-long drives across New England that life events have obliged me to make lately, I found myself thinking about Poker. I have enjoyed a new implementation called Prominence Poker on Playstation 4, finding it a fine replacement for Full House Poker back on the Xbox 360, my appreciation for which I have written about before.
I feel a little silly once again using a current-generation video game console to play a low-technology game like Poker. I even feel a little frustrated that playing 90-minute Poker tournaments with silent strangers on my TV represents one of the only consistently engaging and repeatable networked-multiplayer gameplay styles that works for me. But I cannot deny the fun I have with it despite myself, and while the gentle curves and sparse traffic of mid-Maine I-95 lulled me into half-sleep, I wondered why it does work. Could I build something that would isolate and emphasize the attributes of the game I liked the most?
Long story short, I took advantage of a brief respite at home yesterday to create a couple of poker bots that use a rudimentary sort of machine learning to figure out the game for themselves over thousands or millions of hand-iterations. (I used, in part, this excellent Perl module by Nathaniel Graham, one of several related Poker libraries he’s published this year.) Through this work, I understand Poker better, and also can now say that I’ve dipped my toe into machine-learning, even if only a layperson’s interpretation thereof. I began with a degenerate-case robot that bet on only one-card hands, tuning it until I could see its improvement curve over successive games. Before bedtime, I rewrote it to play Straight Poker (the game’s simplest and oldest legitimate variant), and let it play a million games overnight; I woke up to read its report. When the barista in the coffee shop across from my office politely asked me about my weekend, I forgot myself and told them about all this. That’s how right this project feels for me at this moment.
And yet, before I could even begin outlining this work, I had to work through strong internal resistance to spending any time on this project at all. The culture I learned coding within holds unequivocably that few greater sins exist than reinventing the wheel, which is to say creating software for some purpose despite the availability of free alternatives that already adequately fulfill one’s need. Acting under this tenet, part of my near-automatic preparation for this project involved googling around a bit from my hotel bed for existing material on poker and machine learning. Of course I found exactly what you might expect: not only do articles and books on this topic exist aplenty, but celebrated all-pokerbot tournaments happen with some regularity too, and an AI birthed at the University of Alberta’s Computer Poker Research Group — which is a thing — has “weakly solved” two-player Texas Holdem, with essentially guaranteed victory against any human opponent.
So: never mind, right? No reason to write any of this — no matter what I delivered, it would not improve on resources already freely available to the world. I felt rather dejected about it, and stubbornly kept thinking about it in the background. (Not difficult, and I still had a lot of driving to do.) After a couple of days, I saw my category error: the deliverable, in this case, was not the software itself, but the transformations wrought within me by the act of having created it.
The code-culture that surrounds me approves of programming just for its own sake in the specific case of learning a new language or other technology, but it has little to say about using technology you already know to explore a new idea-space unless you have a tangible deliverable in mind: a game, a web app, a work of art that you can share online. In the case of this work — I can’t even call it a project, since it doesn’t even have anything to hang a project name from, with all my work sitting in
~/Desktop/poker/ — all my code and labor exists for purely exploratory reasons, letting myself personally tour the possibilities of a given idea-space, heedless of how well others might have already documented it. I have so seldom thought about writing code for this purpose that, until I thought it through, it simply felt wrong, fit for discarding alongside every other excited-rookie time-wasting exercise.
Fortunately, free-software culture is not the only nerdish sphere I spin in. As my owning a PlayStation at all would suggest, I also have invested a certain portion of my life’s energy into video games, and from this fact a comparison emerged: Why does it seem normal to spend 100 hours exploring a single-player video-game world with an ultimately predetermined outcome, but incorrect to spend half as long messing around with code with no goal in mind? This proved the koan I needed to see my own mistaken assumptions. Programming culture wasn’t actively holding me back; it just didn’t have much to say on the topic. Meanwhile, video game culture loves deep immersion into artificial experiences for its own sake. Pouring enthusiasm from one vessel into the other wasn’t something I’d knowingly tried before, but once I did, I found nothing in the way, and certainly not regret.
The one caveat I’d add: a dozen years ago, I followed a similar thread and ended up with Volity. I don’t regret that either, per se, but it still represented years spent chasing ever-more-abstract unicorns instead of just making a thing. I am building these poker bots with the soft but finite goals of discovering a thing or two about machine learning via hands-on work, and maybe also figuring out what within Poker keeps reigniting my interest in the game. Maybe I can pipe the discoveries I make into future projects with shareable deliverables; maybe not. Either way, if I start talking about reinventing games again, please politely direct me to re-watch my own five-minute talk on the topic.