Please enable JavaScript to use CodeHS

Connect Four

In this project, students will build a digital Connect Four game using their skills in data structures.

Hard

15 Hours

High School

Project Description

Background

In this project, you’ll build a digital version of the classic game Connect Four. In this game, two players take turns dropping colored discs into a rack. The first one to connect four of their discs in a row wins!

Can you connect four of your colored discs before your opponent does?

Your Tasks

Make and display a 6X7 grid of “empty” (white) circles on a blue background and keep track of whose turn it is. When a user clicks, add a chip(circle) of the correct color to the bottom-most row of the column where the click occurred. When a player makes a move, check to see if they have four pieces in a row along a column, a row, or a diagonal. If you find a winner, end the game and print a victory message!

Have fun! You’ve just built connect four!

Project Demo

Explore this program before assigning it!

Project Overview

Here is an outline of the project activities: