Skip to content

Implementation of the classic board game Othello (also known as Reversi). It features a full graphical user interface (GUI) built with Pygame and an intelligent AI opponent powered by the Alpha-Beta Pruning algorithm.

Notifications You must be signed in to change notification settings

AhmedShaaban11/othello

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Othello Game

Othello is a classic strategy board game implemented using Python and Pygame. This project recreates the traditional game experience with engaging graphics and smooth gameplay mechanics.

WATCH THE OVERVIEW VIDEO

Features

  • Player vs Computer Mode: Play against ai using alpha-beta pruning algorithm
  • Player vs Player Mode: Play against a friend on the same machine.
  • Valid Move Highlighting: Shows the possible moves for the current player.
  • Score Tracking: Displays real-time scores for both players.

Technologies Used

  • Python: Core programming language.
  • Pygame: Game development library for rendering graphics and managing game states.

Setup Instructions

  1. Clone the Repository:

    git clone https://github.com/AhmedShaaban11/othello.git
  2. Go to the game directory

    cd othello
  3. Create a Virtual Environment (Recommended):

    python -m venv venv
    source venv/Scripts/activate  # On Windows with bash
    # or
    venv\Scripts\activate.bat     # On Windows with cmd
  4. Install Dependencies:

    • Ensure Python 3.x is installed.

    • Install dependencies using the requirements file:

      pip install -r requirements.txt
    • If you encounter path issues, use the full Python path:

      venv/Scripts/python.exe -m pip install -r requirements.txt
  5. Run the Game:

    python main.py
    • If you encounter "Unable to create process" errors, use the full Python path:

      venv/Scripts/python.exe main.py

How to Play

  • Players take turns placing their pieces on the board.
  • A valid move must capture at least one opponent piece.
  • The game ends when neither player can make a valid move.
  • The winner is the player with the most pieces on the board at the end.

Troubleshooting

Issue: "Unable to create process" or Python not found error

  • Make sure you have activated your virtual environment first

  • If using a virtual environment, you can also run the game directly with:

    venv/Scripts/python.exe main.py  # On Windows

Issue: ModuleNotFoundError for pygame

  • Ensure you have installed the dependencies:

    pip install -r requirements.txt
  • If the above fails, try using the full Python path:

    venv/Scripts/python.exe -m pip install -r requirements.txt

Issue: Virtual Environment Path Mismatch

If you encounter errors like "Fatal error in launcher: Unable to create process", this usually means your virtual environment has path issues:

  1. Deactivate and recreate the virtual environment:

    deactivate
    rm -rf venv  # Remove the old virtual environment
    python -m venv venv
    source venv/Scripts/activate
    pip install -r requirements.txt
  2. Alternative: Use absolute paths without activating:

    # Install dependencies
    ./venv/Scripts/python.exe -m pip install -r requirements.txt
    
    # Run the game
    ./venv/Scripts/python.exe main.py

Issue: Permission Errors on Windows

If you encounter permission errors, try running your terminal as administrator or use:

python -m pip install --user -r requirements.txt

About

Implementation of the classic board game Othello (also known as Reversi). It features a full graphical user interface (GUI) built with Pygame and an intelligent AI opponent powered by the Alpha-Beta Pruning algorithm.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages