Four Field Kono, take 1

Four Field Kono game in progress

I’ve added another game at long last. I’m calling it Take 1 because I can think of numerous ways to improve it. I’m posting it as Take 1 because A) there’s no reasonable way forward without refactoring from the ground up, B) while none of my AI are terrifically difficult, they can be lively, and C) I have other projects in the works and no timeline for getting back to this one.

The story: once upon a time, I became very interested in games that can be played on some arrangement of up to four 4×4 boards. That is, if you cut a checkers or chess board into quarters and use one or more pieces in some configuration, how many games can you play? A lot, as it turns out, especially if you’re a little loose in how you use the squares (e.g. to envision a mancala board out of a 4×8 board, ignore all non-edge-squares and collect the 4 squares on each end into a single location).

My research brought up numerous board games I was unfamiliar with. When I decided to start implementing existing games on the way to designing my own, I went to that list and chose a game from Korea called Four Field Kono. The rules are simple: you have a 4×4 board and begin by filling half of it with light pieces and half with dark. All moves are orthogonal, and there are two types: slide a piece into an empty adjacent square, or jump a piece over another one of your own pieces onto an enemy piece, capturing that enemy piece. You win when there is no way your opponent could make another capture, which will either be because your opponent has only one piece remaining or because your opponent has no more legal moves.

This was a challenge mostly because it was my first significant AI. I had been thinking it was my first AI at all, but technically tic-tac-toe had an AI opponent. The manner in which the AI makes its decisions is similar for both games; there’s a “preference chain” of moves/tactics and it executes the first one it can. Tic-tac-toe’s AI was simplistic: win, block, center, random. Also, tic-tac-toe strategy was well known to me in advance.

Four Field Kono is much more sophisticated and I started much more blind. I ended up with four AI opponents, each using 6 or 7 of 8 tactics (including making a random move) in some order. You can read the source code for the strategy; no spoilers here.

If you’d like to try it out I’ve put it in my webspace: play Four Field Kono.

Leave a Reply

Your email address will not be published. Required fields are marked *