Home CPSC 414

Connect Four Game


Due: April 16



To create a complete client/server application, and design a protocol from scratch.



For this project you will create a networked version of the Connect 4 game. This will involve writing a client and a server. When using the client, a user will be able to play a game of Connect 4 against the computer. You don't need to match up multiple human players, just play against an AI.



Connect 4 is a popular game consisting of a grid of spaces. The grid has 7 columns and 6 rows. Players take turns placing colored pieces into a column of their choice. When a player puts a piece into a column, the piece will fall down until it lands on another piece in that column. The game is over when one player has four of their colored pieces in a row (horizontally, vertically or diagonally).

The game Connect 4



Your networked version of this game should do the following things:

  1. The server should wait for a client to connect when it is started.
  2. The client should connect to the server, and begin a game.
  3. The client should show the current state of the board to the user, and wait for them to choose a column.
  4. The client should send this choice to the server which will make the computer's choice.
  5. The AI does not have to be very smart - it can simply choose any open column.
  6. The above process (steps 3 and 4) should repeat until one side has 4 in a row (horizontally, vertically or diagonally).
  7. At that point, the client should print the winner and disconnect.
  8. The server should go back to waiting for a client to connect.


Extra Credit

There are a few opportunities for extra credit:


General Requirements

When writing your program, also be sure to:



For this project, you can work with a partner. You are free to choose your partner yourself. If you would like a partner but don't have one, email me and I will match you up with someone else who wants a partner.

You are also free to work alone if you prefer.



To submit your program, email the program file to ifinlay@umw.edu.

Copyright © 2022 Ian Finlayson | Licensed under a Attribution-NonCommercial 4.0 International License.