I have a side project: a four-in-a-row board game where the opponent is a neural network I trained myself. It has been on Google Play for a while, and last week I shipped a browser version of it.
The interesting constraint was this: the browser version had to be a folder of static files. No backend, no database, no serverless functions, no analytics, no accounts. Partly to keep hosting at the price of a shared plan, partly because a game that phones home to score your moves is not a game I want to ship.
That means the neural network has to run on the player's machine, in the browser, and it has to make the same moves as the native engine. This post is about how that worked out, and where it got uncomfortable.
Why a 9x8 board
Almost every four-in-a-row game uses 7 columns by 6 rows. Mine uses 9 by 8. That is not a cosmetic change:






