Home

Connect5 was programmed in Python using the Flask web development framework. It uses weighted pattern matching to determine the most desireable move. The board is analysed as a series of overlapping 9x9 squares. Each square is compared to a pattern database, and the weights for any matching patterns are totaled for that square. A lower level heuristic is then applied to assign additional weight based on proximity to other Xs and Os, and the computer moves on the highest weighted square.

I selected initial pattern weights based on my own understanding of the game. I then set the program to play different versions of itself with randomly modified values and used the results to progressively refine the initial weights. This technique, borrowed from evolutionary computing strategies, was able to provide some initial improvements, but quickly became computationally expensive as the weights improved.

Future additions might include a look-ahead funtion and the option to set the difficulty level.