Predator: A Framework for Developing Programmatic Players for Complex Board Games

Ravi Mohan
CEO at AxiomChoice

Summary: An Experience Report on How I'm using Erlang and PureScript to create programmatic opponents aka 'bots' for complex boardgames I love to play but I can't find people to play with!

The number of boardgames that you can whip out at a gathering and expect people to want play is very small.. Monopoly, Snakes and Ladders, and maybe, if you are *very* lucky, Settlers of Catan. And that's about it.

Getting people to play these games is relatively easy.

However the world of boardgames is *much* wider.

There are literally tens of thousands of boardgames that simulate everything from very abstract geometry puzzles to ones that simulate complex economies and political situations.

Some of the latter are used in very unexpected ways, e.g to train spies and military officers.

Here is an example of an interesting game.

A Distant Plain (by GMT Games) is a boardgame for 4 players that put them in the roles of the US military forces, the Afghan government, the Taliban, and Warlords/drug dealers, all competing for power in Afghanistan.



Here is another
The War of the Ring, a game for 2 players.

"In War of the Ring, one player takes control of the Free Peoples (FP), the other player controls Shadow Armies (SA). Initially, the Free People Nations are reluctant to take arms against Sauron, so they must be attacked by Sauron or persuaded by Gandalf or other Companions, before they start to fight properly ...."


And one more

"The battle of Sekigahara, fought in 1600 at a crossroads in Japan, unified that nation under the Tokugawa family for more than 250 years.

Sekigahara allows you to re-contest that war as Ishida Mitsunari, defender of a child heir, or Tokugawa Ieyasu, Japan's most powerful daimyo (feudal lord)."


What these games have in common
1. They are wonderful games, immersing you into their respective worlds. 
2. They have (relative to Snakes and Ladders or Monopoly) complex rulesets, which take effort and time to master.
3. They are rarely played in India.
4. Even when people own them, opponents are almost impossible to find and schedule.

Which means that if you own these games and live in India, getting to actually play these games is close to impossible. 

Which is a problem.

Being a programmer, I solve this problem by writing programmatic opponents (aka 'bots') to take the place of other players. This involves all kinds of interesting sub problems - game representation, logic processing for rules, building AI 'smarts' for your opponents, gui and event handling etc.

Since I am doing this in my non existent spare time, I use time and effort saving languages with good capabilities for abstraction(aka functional languages!),

In this case I use Erlang (originally Haskell, I'm using this project to learn Erlang) for the backend and PureScript for the front end.

This talk is about the many challenges I faced in building automated game players (and extracting common frameworks/libraries) from them, while simultaneously learning two FP languages.

Since this is an experience report, it is basically a list of lessons learned, victories *and defeats*, what worked *and what didn't work*.

If you can't use FP at work, but are considering doing so on a personal project, or want to learn how to get going on an FP learning effort, you might benefit from my experience - both successes and failures

I am "just a developer" who is "stuck in code" (see this for an explanation) with about 20 years experience. 

For the first 10 of those years, I built cryptography systems (at Cybercash) then enterprise services (Aztec and ThoughtWorks). Then I built production machine learning systems for a decade. These days I am working on a stealth startup that will hopefully come to life soon.

Twitter: @ravi_mohan

Back to conference page