Four in a Row

Four in a Row is the classic two player game where you take turns to place a counter in an upright grid and try and beat your opponent to place 4 counters in a row.


At the start of the game you are assigned a disc colour either yellow or red. The game is played with a seven-column and six-row grid, which is arranged upright. The number of columns may be changed from six to ten, creating a greater variety of the game, but the number of rows is usually seven. The starting player is randomly choosen and can place a disc in any row. Each player then alternately takes a turn placing disc in any column that is not already full. The disc falls down straight and will only be stopped by another piece. The aim is to be the first of the two players to connect four discs of the same colour vertically, horizontally or diagonally, an example is shown below:


Connecting five or six instead of four pieces in a row is a different version of this game and is played with a bigger grid. If each cell of the grid is filled and no player has already connected four discs, the game ends drawn, so no player wins.

Useful Links

Use the links below to get a working example that randomly selects a column to place a disc:

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License