Othello Project
By Robert Lange
Othello (aka Reversi) is a "grown-up" game like chess or go, yet it is easy to program due to its small rule set.
This makes it a good starting point if you want to get into advanced board game programming.
Outline
- Goal: To control the majority of the board by the end of the game.
- Setup: Two-player, turn-based game played on an 8 x 8 board.
Initially the board is set up as shown in Figure 1.
Black always moves first.
- Movement: Moves consist of "outflanking" your opponent's discs, then flipping the outflanked discs to your colour.
To outflank means to place a disc on the board so that your opponent's row of discs is bordered at each end by a disc of your colour (row - one or more adjacend discs in a straight line).
Figure 2 shows an example: The black disc 1 was already in place on the board. The placement of black disc 2 outflanks the row of two white discs.
![[board setup]](images/othello1.gif) Figure 1 |
![[movement]](images/othello2.gif) Figure 2 |
Guidelines
In order to play with resonable strength your AI agent will need to "think" several moves ahead.
Therefore use minimax search, combined with alpha-beta-pruning, in your program.
If you are not yet familiar with these techniques, read these lecture notes on board game programming.
Heuristics you might consider when evaluating moves/board positions:
- Material: Number of your discs vs number of your opponent's discs.
- Mobility: It is usually favourable to have many possible moves to choose.
- Corners: Connected discs at the corners are especially valuable since they cannot be taken.
- Threats: Is somebody going to take a corner?
If sensibly combined these should produce quite a capable opponent.
- Robert Lange
Solutions
othello-av.zip (57Kb) |
Solution submitted by Antoine Villepreux. A Visual C++ 7.0 solution utilizing a minimax tree pruning algorithm. |
Article content copyright © Robert Lange, 2003.
|