Online Poker in a Document
--
Over the winter holidays, I found some time to work on improving my poker game, reading a couple great books and then applying their theories into practice. While there is no substitute for playing in a casino or at someone’s house, one of the quickest ways to get into a game is to play online poker. There are hundreds of platforms out there, and after playing on a few I thought it would be a fun learning experience to create my own, but with a twist: what if you could have a doc that lets you play poker? Our goal at Coda is to precisely to facilitate that: creating docs as powerful as apps (with the help of formulas, not code), so I set out on an attempt. Read on to see the result and go behind the scenes.
Without further ado, here’s the doc: coda.io/@osv/poker (open on a desktop for the best experience). Get a game going, and it will look something like this:
No team of engineers behind it. No long release cycle or lots of code to maintain. And while there are also no pleasant poker table graphics or pretty animations when someone bets, at the end of the day, this whole game is really just a super-document put together by a single hobbyist with some free time over a few days.
So what did it take? If you’ve used Coda before, you’ll likely be familiar with some of these concepts. But if not, I hope to show that creating apps and games like this is no longer reserved for folks with a computer science degree: anyone who’s written a few formulas in Excel can figure it out.
Getting started
The first step to putting together a doc like this is to think through the schema, i.e., the different kinds of data or entities that comprise a poker game, which in Coda are collected into tables.
Cards
Naturally the first thing my mind jumped to when putting together a poker game was the deck. After finding a set of public domain card images online, I added a table of 52 rows, corresponding to each of the cards. The crucial things to know here about each card are its rank and suit (for identifying different hands later on) as well as the location of each card: whether it’s in the deck, dealt out on the table, or in a player’s hand.