JavaScript HTML CSS
Latest commit 18e0cb8 Mar 17, 2016 @kenrick95 Update
Failed to load latest commit information.
.gitattributes new repo Dec 27, 2013
.gitignore update gitignore Dec 27, 2013
LICENSE Create LICENSE Apr 24, 2015 Update Mar 17, 2016
index.html stylize demo Nov 30, 2014
script.js fixes #2 ; edit code to fulfil JSLint (although I ignored some errors) May 24, 2015
style.css stylize demo Nov 30, 2014


c4, stands for Connect Four, is a browser game in JavaScript using HTML5 features (canvas). I also incorporate an AI using 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.


How to Play?

In each turn, drop a piece in one of the seven column.


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

More info

Read Wikipedia page on Connect Four


Tested in latest Firefox (27), Chrome (31), and IE (11). Turn on browser console to see the "value" of the move chosen by AI.


This work is licensed under MIT License.