Chain Reversi

This started with the original Chain Reversi by a friend (who actually came up with the game) which is a modification of the game Reversi. Unfortunately the code was messy, failed to have well defined modules and suffered from tight coupling between the GUI code and the code that dealt with the rules of the game. The original version had an AI which was particularly easy to beat, since it only prioritized the number of squares to be taken rather than having a particular strategy. It was also very slow, because the calculation of each move involved actually creating a graphical board and drawing to it, due to the aforementioned lack of modules.

Interested in achieving better performance and a more advanced AI, I modified the AI to perform calculations on an array in memory, rather than performing wasteful graphics operations. The AI was also designed to preference corner squares and would always try to prevent the opponent from taking the corners, which I had found to be a good strategy in Chain Reversi. The result was that the AI seemed to make its move instantaneously, and that if two instances of the AI played each other, the game would also appear to be finished instantaneously. The AI was also much harder to beat, achieving victory against humans almost all of the time.

It was later that I actually built my own GUI for Chain Reversi, using SFML rather than SDL, so that I could play the neural networks I was training directly, and watch two instances of the neural network AI play each other. The interface was similar to the original interface, except that it would show you which moves you could make, so your options were clearer and you could play more efficiently.

Up-to-date Loci implementation available in Loci Compiler Tools repository; there’s also an old C++ implementation here.

Chain Reversi

Chain Reversi

Chain Reversi (after blue has won)

Chain Reversi (after blue has won)