Click here to Skip to main content
13,894,340 members
Click here to Skip to main content
Add your own
alternative version


36 bookmarked
Posted 4 Aug 2004

A C# implementation of Reversi (Othello) Game for PocketPC and Windows

, 4 Aug 2004
Rate this:
Please Sign up or sign in to vote.
A C# implementation of Reversi (Othello) Game for PocketPC and Windows.

Sample Image - PocketReversi.jpg


My initial goal was to port Reversi in C# By BrainJar program to Pocket PC. After some time, I realized that without understanding what and how it happens, there is no chance to make use of the existing program. So, I wrote it myself. I have tried to make it as simple as possible.

The whole game functionality is concentrated in the independent assembly gma.Reversi.dll. There are two different Presentation Layers using the same assembly; the gma.Windows.Reversi for Windows .NET and gam.Mobile.Reversi for PocketPC CF.

The Board class is used to store game information, maintain statistics which are necessary for evaluation, and guarantees game rules. The VirtualPlayer class is a descendant of the Player class and includes evaluation and search algorithms. This is a class that implements "intelligence" to this program. The GUIPlayer class is also descendant of Player and implements interaction with the presentation layer. Both players are interacting with board using same Methods and Events, so there is no difference for Board about which Players are connected.

Game Theory

Very good page to understand programming a Reversi game is "Writing an Othello program" by Gunnar Andersson. Following information will be interesting only if you are familiar with the basics of strategic game programming.


The core of a game is alpha-beta pruning algorithm. My implementation is relatively universal, so it can be used in some other board games as well. I am going to use it in my GO game I am working on currently. Initially, I have implemented brutal minimax search, and after rewriting it into alpha-beta, I had a 70% increase of performance. A heuristic to perform shallow searches was implemented only in VirtualPlayerComplex class, it is basically the only difference between VirtualPlayer and VirtualPlayerComplex classes. It is used only in Windows version and does not bring any real performance improvements.

Position evaluation

This description gives you only an idea of how it works; in some cases, it is a little bit complicated. My evaluation function (Score) is based on the following criteria:

  1. Dominance. It is good to own squares as an opponent.
  2. Mobility. It is good when you have more move alternatives.
  3. Disk-square table. Corners are good and the squares next to corners are bad.
  4. Stability. It is good to capture squares which cannot be converted.

I have assigned some weights to these criteria, but I am sure that verifying them can increase the program's "intelligence".

There are a lot of things to do in order to increase performance (and accordingly search depth), but then you need to make a compromise between performance and code transparency. This program was not written to win Othello world cup, so there are many ways to improve it. For example, Background Analysis (a thread that calculates next moves when a program is waiting for an input from the human player), Knowledge Base for game openings, and Pattern evaluation.


This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


About the Author

George Mamaladze
Software Developer
Germany Germany
Tweeter: @gmamaladze
Google+: gmamaladze

You may also be interested in...

Comments and Discussions

SuggestionMessage Closed Pin
18-Jun-12 20:09
memberybonda18-Jun-12 20:09 
GeneralQuestion .atlapp.h Pin
sima_m29-Dec-08 1:06
membersima_m29-Dec-08 1:06 
GeneralAn urgent help! Pin
Smashing_Blizzard23-Jun-07 9:45
memberSmashing_Blizzard23-Jun-07 9:45 
AnswerRe: An urgent help! Pin
George Mamaladze24-Jun-07 21:57
memberGeorge Mamaladze24-Jun-07 21:57 
Questionhelp Pin
kgopa24-Aug-06 0:45
memberkgopa24-Aug-06 0:45 
QuestionRe: help Pin
George Mamaladze24-Aug-06 1:17
memberGeorge Mamaladze24-Aug-06 1:17 
QuestionRe: help Pin
kgopa24-Aug-06 3:29
memberkgopa24-Aug-06 3:29 
GeneralMulti Person Game Pin
dvadim27-Apr-06 6:40
memberdvadim27-Apr-06 6:40 
GeneralNice article ! Pin
ddmcr10-Jun-05 2:34
memberddmcr10-Jun-05 2:34 
GeneralRe: Nice article ! Pin
George Mamaladze10-Jun-05 2:42
memberGeorge Mamaladze10-Jun-05 2:42 
QuestionSorry, can help me?? Pin
fire8524-May-05 17:19
memberfire8524-May-05 17:19 
AnswerRe: Sorry, can help me?? Pin
George Mamaladze24-May-05 21:41
memberGeorge Mamaladze24-May-05 21:41 
GeneralRe: Sorry, can help me?? Pin
fire8529-May-05 15:34
memberfire8529-May-05 15:34 

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

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

Permalink | Advertise | Privacy | Cookies | Terms of Use | Mobile
Web01 | 2.8.190306.1 | Last Updated 5 Aug 2004
Article Copyright 2004 by George Mamaladze
Everything else Copyright © CodeProject, 1999-2019
Layout: fixed | fluid