Loading AI ...

|

Connect 4 with Adversirial AI

Connect 4 is a classic game 2-player game, where players alternate dropping their checkers in each individual column. The first player to make 4 in a line (either horizontally, vertically or diagonally) wins the game!. The game is over when either you or your opponent get 4 in a row, or there are no longer available moves to play. When a new game is started, the opposing player gets to start.

AI Opponent

The foundation of the AI bot behind the opponent is a Alpha-beta pruning Algorithm that is built on top of the Minimax algorithm. The Minimax algorithm explores every possible moves until it reaches a terminal node or a terminal state where Evaluation Functions are used to compute the score of each player for a specific board position. Given enough computation power, the best Minimax Algorithm would reach until the end of the game, and then select the best winning option everytime. However, with each iteration, the amount of computation that the algorithm would have to do is 7^n (over 4 trillion moves). Thus, instead, the algorithm will look 4 steps ahead, and then use heuristic Functions to calculate the score of each player 4 steps ahead, and pick the best move.