This is an algorithm (Minimax) who plays at Connect 4 / 4 in a row You should use the deep of 4, because 5 and 6 are very slow, but theoretically you could set it to 42 and wait (a few days), and it would play the best moves Go on Turbowarp to better performance (up to a deep of 6) https://turbowarp.org/1210953847?turbo