/reversi

Primary LanguagePythonGNU General Public License v3.0GPL-3.0

OTHELLO

Table of Contents

Game rules and Instructions Rules

image
The board will start with 2 black discs and 2 white discs at the centre of the board.
They are arranged with black forming a North-East to South-West direction.
White is forming a North-West to South-East direction.
Each player gets 32 discs and black always starts the game.
Then the game alternates between white and black until:

one player can not make a valid move to outflank the opponent.
both players have no valid moves. When a player has no valid moves, he pass his turn and the opponent continues.

A player can not voluntarily forfeit his turn.

When both players can not make a valid move the gane ends.

Project Description

This program is an implementation of OTHELLO game with python (Pygame) .
It can be played in Both single-player and Multiplayer mode.
The heart of the AI is an alpha-beta algorithm. you can change Depth in the main function.
Additionally, the Min-Max algorithm is implemented and can be used instead of alpha-beta.

How to Run

At first, it's needed to install pygame library and MachineGunk-nyqg.ttf font as prerequisites. Then, run main.py and enjoy the game.

Heuristics

The value of a node was approximated by our linear value function based on board features:

  1. Corner Disks: number of pieces Which have corner point.
  2. Mobility: number of available moves.
  3. Piece Difference: proportion of the pieces on the board that are yours.
  4. Value Matrix: score based on relative value of positions taken.

Genetic Algorithm

Genetic Algorithm and machine learning was used to make Heuristic parameters better. In the begining

Project Link