Skip to content
imSaDyPublic

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

2 Commits

Folders and files

Repository files navigation

Othello 6x6 AI Engine ⚫⚪

A high-performance, hybrid 6x6 Othello (Reversi) engine built with a blisteringly fast C++ backend and a responsive, modern Python (Tkinter) Graphical User Interface.

This project demonstrates advanced game-tree search algorithms, bitwise board representations, and seamless cross-language communication.

✨ Key Features

🧠 The C++ Engine

  • Bitboard Representation: The board is strictly represented using 64-bit integers (uint64_t), allowing for lightning-fast move generation and state evaluation using bitwise operations.
  • Alpha-Beta Pruning & Iterative Deepening: Efficiently searches the game tree, prioritizing the most promising moves and strictly respecting dynamic time limits.
  • Transposition Table (Zobrist Hashing): Caches previously evaluated board states to prevent redundant calculations, massively increasing search depth.
  • Game-Phase Tapering: The evaluation heuristic dynamically shifts. It prioritizes mobility and frontier-disc minimization in the midgame, and switches to a pure mathematical solver in the endgame to guarantee forced wins.

🖥️ The Python GUI

  • Real-time Evaluation Bar: Visually tracks the AI's internal evaluation score and maximum depth reached during its calculation phase.
  • 20 Granular Difficulty Levels: Scales from beginner-friendly (shallow searches) to a "Master" level that utilizes infinite midgame search depths and perfectly solves the final 22 moves.
  • Standalone Executable: Fully packaged using PyInstaller for one-click launching without needing a Python environment.

📂 Project Architecture

The project maintains a strict separation of concerns between the compiled engine and the frontend UI:

Othello/
├── assets/                 # Icons and visual resources
├── engine_src/             # Pure C++ engine source code
│   ├── main.cpp
│   ├── OthelloAI.cpp
│   └── OthelloBoard.cpp
├── pages/                  # Modular Tkinter UI frames
├── archive/                # Deprecated scripts and backups
├── board_ui.py             # Main game board logic
├── engine_proxy.py         # Subprocess bridge for C++ to Python communication
└── main.py                 # Application entry point

🚀 How to Build and Run

This project includes an automated PowerShell script that compiles the C++ engine and packages the Python GUI into a single standalone directory.

Prerequisites

  • MinGW / g++ (For compiling the C++ engine)
  • Python 3.x
  • PyInstaller (pip install pyinstaller)

Build Instructions

  1. Clone the repository:
    git clone [https://github.com/YOUR_USERNAME/Othello.git](https://github.com/YOUR_USERNAME/Othello.git)
    cd Othello
    
2. Run the automated build script (Windows):
   ```powershell
   .\build.ps1
  1. Play the game: Navigate to the newly generated dist/main/ folder and run main.exe.

⚙️ How the AI Works

The difficulty curve (Levels 1-20) controls two distinct parameters:

  1. Midgame Depth (mid_depth): The maximum depth the AI will search while using its positional/mobility heuristics.
  2. Endgame Depth (end_depth): The exact number of empty cells remaining before the AI drops all heuristics and attempts to mathematically solve the rest of the game. This is strictly capped at 22 to ensure the engine never "times out" and falls victim to the horizon effect during pure disc-counting.

📄 License

This project is open-source and available under the MIT License.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages