So, I was playing connect4 with some friends at the bar, and wondered how I would program an AI to play, so I wrote this and found out. The original software is written in JS, and uses bitfields to represent the board and memoization to speed up a minmax search. I then rewrote the software again in Python and just used a 2D int array to represent the board. To my surprise the Python software find the next move more quickly that the JS. Just goes to show how cleaner code is usually faster code.
To run
python:
ATTENTION: YOU NEED python 2.7, which can be found here: https://www.python.org/download/releases/2.7.8/
python connect.py
nodejs:
npm install
node connect.js
Log in or sign up for Devpost to join the conversation.