A downloadable game

This implementation of a Connect-4 game uses a minimax algorithm for the bot AI. The depth is 4 moves (approx. 7^4 = 2401 future states calculated), because any higher makes the decision time a couple minutes at best. Using the Connect-4 Starter Code and these Images for the Pieces to start, I coded the minimax algorithm using a rather basic evaluation function: I assigned the player's piece a value of 1, the AI's piece a value of -1, and empty a value of 0. The value of a line (four in a row) is the sum of the pieces in the line, and the value of a state would be the sum of all the possible lines. That's it! Then I added some cute customization like the pieces' looks and their random rotations, and here we are.


Resources:

Connect-4 Starter Code
Images for the Pieces

Download

Download
ConnectFourGame.zip 18 MB

Leave a comment

Log in with itch.io to leave a comment.