Connect 4

Connect4

At my internship at CR games the first small project they set me on was to create connect4 in their proprietary engine. My programming abaility was then gauged depending on how long it took for me to complete.

Required Features

The features in the required in the game were:

  1. An initial two player version of connect 4 where players would take turns to select the column they wanted to go in.
  2. Counters would drop into the correct space when used.
  3. Implentations of horizontal, vertical and diagonal checks for four in a row.
  4. When a four in a row was found the counters in the row would flash to indicate where it is.
  5. Implemented the game using a class based approach so that four instatiations of the game could be played at the same time.
  6. An implementation of an Ai which would actively try and block the player and would think multiple turns ahead.

Ai

For the ai in the game, I wrote a version of the MiniMax algorithim, commonly used for two player board games. It used recursion to perform a depth-first search down each possible move and returned a positive score when it found a move that won it the game and negative score when it found a move that lost it the game. This ai was able to make it’s own four in a row, block players and predict forks.

Multiple Games and Threading

One of the requirements was to have four games be playable at once, however since the ai regularly took quite some time to make a move players couldn’t do anything on any game when this was happening. So each game was put on a seperate thread. This allowed players to perform their moves on one game whilst the ai did their’s on another.

Project Details

Date: Jun 19, 2019

Author: Evan Diamond

Categories: project

Tagged: C++, Internship

Client:

Website:

Related Works.

About

Gamers developing new games.

Social Links

Our Bunker

University of the West of England,
Frenchay Campus, Bristol, BS16 1QY,
United Kingdom.