Coders Packet

Othello Game in C++

By G V Ganesh Maurya

Othello is a board game and is played by 2 players at a time. Each player chooses a color (black or white) and prepares to overturn the opponent's coins in order to win. We will use C++ for making Othello Game.

Rules:

1. The board has a dimension of 8x8. Each player has 30 coins of the colour that they choose as they prepare to play. 

2. The game starts off with the board looking as shown in the figure below with black playing first.

Board initial look

3. The player must place a disc in such a way that he/she has to flip at least one of the opponent's coins. All the opponent's discs in between the player's discs must be flipped.

4. Few examples of how the coins can be placed can be shown in the figure:

Ex: Game ex1 positions where white can place his/her coins

Board ex2positions where black can place his/her coins

5. The player can capture the opponent's coins either horizontally, vertically or diagonally.

6. When neither player can make any further play then the game is over.

7. Each player counts the number of spaces occupied by their colour. The highest count is the winner. If the count is equal, then the game is a draw. The game can end even before all the spots are filled. 

Note: The rules can also be looked up online.

 

Code:

The game was coded in C++ language using object-oriented concepts

Download Complete Code

Comments

No comments yet