Games · Project
Build Four in a Row in Python
A game for two: counters drop down the columns of a board, and four in a line wins.
You write: The whole program, from a description: the falling counters, the full columns, the turns and the search for four in a line.
Loading the game…
What to build
Two players, red and yellow, take turns dropping a counter into one of the seven columns of a board six rows high. A counter falls to the lowest empty place in its column. A full column takes no more. The first player with four counters in a line, across, up or on a slant, wins, and the game stops. Show whose turn it is, and who has won.
A click on a column drops a counter there. Red plays first.
Not sure where to start?
This game is part of “Build a Game”, a lesson of Build with Python. The lesson builds up to it, and the course before it starts from zero. Both are free.
Read the lessonSee the courseMore games
- Hit the Target: A first click game: every click lands a dot, green inside the target and red outside.
- Tic-Tac-Toe: A two-player Tic-Tac-Toe you can play in the page: turns, a win in any line, and a draw.
- Lights: A puzzle on a five-by-five grid: a click switches a light and its neighbours, and the goal is to turn every light off.
- Pairs: A memory game: sixteen face-down cards hide eight pairs, and a turn flips two.