Connect 4 Game Mechanics


Connect 4 with AI integration

Connect 4 (aka: Captain's Mistress, Find Four, Four-Up, Four-in-a-Row, Four-in-a-Line, Gravitrips (in Soviet Union) or Plot Four) is a two-player abstract strategy game in which the participants select a team color and then alternate turns dropping their colored discs from the top of the game-board into one of seven-columns of the grid. The pieces fall straight down, occupying the next available space within the six-row column stack. The objective of the game is to be the first player to align four of their discs either horizontally, vertically, or diagonally. Normally, the first player can always win by playing the right moves. The game is a tie if the board fills up with token before either player achieves a four-in-a-row.

Connect 4 is a "solved game" meaning that the outcome — whether win, lose or draw — can be predicted from any position. It is a perfect candidate for `Artificial Intelligence`. The artificial intelligence algorithms capable of solving Connect 4 are minimax or negamax, with some optimization that would include alpha-beta pruning, move ordering (aka Iterative deepening), and transposition tables. The code for solving Connect Four with these methods is also the basis for the Fhourstones integer performance benchmark. If the AI is permitted to move first, it can force a win condition on or before the 41st game turn by placing its first token in the middle column.

Phaser Game Starter Kit Collection on LeanPub.com: for more details and game rules.

Copyright © 2017, Stephen Gose LLC.
All rights reserved.