Click here to Skip to main content
11,805,035 members (56,627 online)
Click here to Skip to main content

Tagged as


, 11 Apr 2009 CPOL 33.8K 1.2K 19
Rate this:
Please Sign up or sign in to vote.
The turn based classic game Connect4 with computer AI


This is a Connect 4 game based on Silverlight. It contains computer AI that uses the Alpha Beta algorithm (a better alternative of Min Max algorithm).

Play the game here.


The Alpha beta algorithm can be used in any turn based strategy game. A detailed explanation of these algorithms can be found in the following articles:

Using the Code

The solution contains the following projects:

  • GameThinking

    A class library that contains the alpha beta algorithm. It’s implemented using generics so that this algorithm could be used with any game in the future.

  • Connect4Core

    This is a library for connect4 games. It only contains data and logic and doesn't contain anything specific to Silverlight. It could be useful if you want to port it to another platform.

    Contains the following classes:

    • Game: The main class that represent the connect4 game which contains a main board, thinking board for computer AI usages and list of players.

    • Board: It’s the class that contains a board state with the current turn and moves history.

  • Connect4

    This is the main Silverlight application. It has Silverlight user controls that provide the presentation logic of the above data classes.


  • 11th April, 2009: Initial post


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Bishoy Labib
Team Leader Link Development
Egypt Egypt

You may also be interested in...

Comments and Discussions

GeneralMy vote of 5 Pin
Fiwel16-Feb-12 5:22
memberFiwel16-Feb-12 5:22 
QuestionNo tutorial? Pin
elvingpr28-Jan-10 9:01
memberelvingpr28-Jan-10 9:01 
GeneralMy vote of 1 Pin
Alberto Venditti19-Apr-09 22:53
memberAlberto Venditti19-Apr-09 22:53 
GeneralLooks good but more is needed Pin
spoodygoon11-Apr-09 14:42
memberspoodygoon11-Apr-09 14:42 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Terms of Use | Mobile
Web03 | 2.8.151002.1 | Last Updated 11 Apr 2009
Article Copyright 2009 by Bishoy Labib
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid