Chapter 3. Connect Four

Connect Four is a two player turn-based game played on a vertical six row seven column grid. At the beginning of the game, the grid is empty and each player has 21 discs of the same color, normally red or yellow. At each turn a player drops a disc from the top of the grid in a column of his choice, making it fall straight down and occupying the lowest available space in the column. Then it's the other player's turn to move. The aim of the game is connecting four discs of the same color next to each other horizontally, vertically or diagonally. The first player to connect four discs wins. If the board is filled without there being any winning matches then the game is a draw.

Through this chapter, you will create a fully ...

Get Flash Game Development by Example now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.