Click here to Skip to main content
Click here to Skip to main content

Connect4

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

Introduction

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.

Background

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.

History

  • 11th April, 2009: Initial post

License

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
IF YOU WANT TO IMPROVE YOUR SOFTWARE, DON'T TEST MORE; DEVELOP BETTER.
 
http://bishoylabib.blogspot.com

Comments and Discussions

 
GeneralMy vote of 5 PinmemberFiwel16-Feb-12 5:22 
very impressive code. Thank you.
QuestionNo tutorial? Pinmemberelvingpr28-Jan-10 9:01 
GeneralMy vote of 1 PinmemberAlberto Venditti19-Apr-09 22:53 
GeneralLooks good but more is needed Pinmemberspoodygoon11-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 | Mobile
Web03 | 2.8.140721.1 | Last Updated 11 Apr 2009
Article Copyright 2009 by Bishoy Labib
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid