Tiring of being mercilessly beaten by my friends, I decided to seek a nuclear solution and satisfy my curiosity surrounding AI.
The AI is implemented using a reclusive mini-max algorithm which seeks to maximise the payoff of any possible move. This works by iterating through all possible games, selecting the rationally optimal moves for each player to make until the game is over, then selecting the move that has the highest rational payoff for the computer.
This technique creates an unbeatable player, as the algorithm will force a draw before accepting defeat.
While this works for simple games such as tic-tac-toe with 362,880 possible games, Connect 4 provides a greater challenge as it has 3.1x10^35 possible games, a computationally unrealistic task. To remedy this basic “tree pruning” is used which limits how many moves in advance the AI searches. This limit is then increased as the number of possible games decreases, yielding a relatively constant processing or thinking delay.
Not forgetting the task at hand, this AI is deployed in a messenger bot, allowing those around me to be humiliated by this silicon overlord.