c4 – Connect Four

samuel Games 341 , , , , ,


c4, stands for Connect Four, is a browser game written in TypeScript and utilizes HTML’s canvas. Player is playing against an AI that uses Minimax algorithm and alpha-beta pruning. The evaluation function is hard-coded, and hence the AI may not be moving using the most optimal move.




Connect four of your game pieces vertically, horizontally, or diagonally before the other player do so.

How to move?

At each turn, player will drop a game piece in one of the seven columns by clicking on the chosen column.

More info

Read Wikipedia page on Connect Four

Browser compatibility

  • Require browser that supports ES2015’s Promise.
  • Should be good in latest Firefox, Edge, Chrome, Opera, Safari, and IE.


Contributions are welcome! I’m happy to accept any kind of contributions, pull requests, or bug reports.


  1. Fork and clone this repository
  2. Install dependencies
yarn install
  1. Start local development server
yarn start
  1. Make your changes at src/
  2. Test it out at http://localhost:1234/
  3. After you are happy with your changes, please submit your Pull Request!


This work is licensed under MIT License.

Related Post

Four Seasons Platformer Tileset [16x16][FREE] a downloadable asset pack SCREENSHOTS LICENSE: This asset pack can be used in both free Read more

Avabranch Avabranch (source on Github) is my entry for the github gameoff web-game challenge. It's built using Node.js and the Express framework, though most of the code Read more

ArashiJS ArashiJS is a (work-in-progress) Tempest-clone written in JavaScript and HTML5. ArashiJS is adapted from Project ARASHI for the Apple Read more

Alien Invasion This is the sample game that is built in the first three Chapter of mobile HTML5 Game Development. Read more

Planck.js is a 2D JavaScript physics engine for cross-platform HTML5 game development. Features: Taking advantage of Box2D's efforts and achievements Read more

Sketch.js is an easy-to-use jQuery plugin that allows you to create canvases upon which visitors can draw. It supports multiple browsers Read more

Lena.js is a javascript library for image processing. Current filters:gaussian, grayscale, highpass, invert, laplacian, prewitt, rgb, roberts, saturation, sepia, sharpen, Read more