Before we begin working on the AI that plays Connect4, let's briefly understand the game and its dynamics. Connect 4, also sometimes known as Four in a row, Four in a line, Four up, and so on, is one of the most popular board games among children all over the world. We can also understand it as a more advanced version of the Tic-Tac-Toe game, where you have to place three markers of the same type either horizontally, vertically, or diagonally. The board is generally a 6x7 grid, and two players play with a marker each.
The rules of Connect 4 can vary, so let's lay down some concrete rules for the version of the rules that our AI will learn to play:
- The game is simulated as being played on a vertical board that has seven hollow columns and six rows. Each column has an opening on top of the board, which is where pieces can be dropped in...