Screenshot of Connect Four Java applet.
Download standalone version: ConnectFour.jar
Connect Four is a two-player game in which each player chooses a color and then drops checkers of that color into a grid. The checkers fall straight down and come to rest in the first available cell within the column. The object of the game is to be the first player to position four checkers in a row, column, or diagonal.
This Java applet offers the traditional two-player mode as well as the option to play against the computer. The player can choose whether or not to go first. The AI engine is based off the minimax algorithm with alpha-beta pruning. Strictly speaking, the computer first looks for a winning move. If no winning move is found, it blocks the opponent's winning move, if one exists. If the opponent has no winning move, it runs the minimax algorithm up to the designated depth. Beginner, intermediate, advanced, and expert levels correspond to a depth-first search of 2, 4, 6, and 8 levels, respectively.
Overall, the AI engine is a strong (though not perfect) opponent when searching 8 levels ahead. It analyzes several hundred thousand board configurations in a fraction of a second, so you're not waiting around for the computer to make its move. Have fun playing!