Since late 2020, I’ve been spending many a weekend working on my own software implementation of Othello, a well-known Japanese board game. This post

Nadim Kobeissi: Adventures in Writing Othello Software for iOS and macOS

submited by
Style Pass
2021-06-20 08:00:04

Since late 2020, I’ve been spending many a weekend working on my own software implementation of Othello, a well-known Japanese board game. This post will attempt to go into significant detail regarding how this weekend curiosity ballooned to become, I kid you not, the #1 game on the Japanese Mac App Store for April, May and June 2021 — dethroning Asphalt 9 and Steam Link, both of which I assume are multi-million dollar initiatives — and being downloaded roughly 500 times a day worldwide.

One fair warning: nothing in this post discusses achievements that should be considered technically impressive or potentially even interesting. This is a tale of a nice and rewarding personal adventure that I embarked upon, nothing more.

On a Saturday morning in August 2020, I suddenly wondered how come I had never written any meaningful software that employed AI. I had written a toy Connect Four webpage in college, but I wanted to program something that could surprise me the way that Stockfish and other good chess engines pull off strategies never conceived by human players. I chose Othello because of its simple rules, its clean aesthetic, and the fact that I had been playing it on and off since my teenage years, and set about learning the basics of AI algorithms in order to make an Othello AI that was respectable in its own right.

The first thing I had to do was learn the standard algorithm for AI decision-making in board games, which turned out to be the Minimax algorithm. This YouTube video was the most useful explanation and the one that made things click in my head enough for me to implement minimax with alpha-beta pruning (an optimization), which I did in Go. Optimizing the implementation required improving my discipline when dealing with Go structures, pointers and arrays to a high level. Sadly, I couldn’t employ Go’s excellent concurrency features because parallelizing Minimax is arguably more trouble than it’s worth.

Leave a Comment