Skip to content

azizi-zahra/xoshift-ai-agent

Repository files navigation

XOShift AI Agent

Introduction

This project implements an AI agent to play the board game XOShift using Python.
The agent leverages a minimax algorithm with alpha-beta pruning, iterative deepening, and a heuristic evaluation function to make optimal moves within a set time limit.
The repository also includes the XOShift game logic, a performance evaluation script, and a simple UI.

Table of Contents

Game Preview

XOShift Game in action
Figure: The XOShift game environment with the AI agent making moves.
Note: The GIF playback speed has been increased for better loading performance.

Features

  • Minimax search with alpha-beta pruning.
  • Iterative deepening with time limit control.
  • Heuristic-based board evaluation (mobility, threats, forks, open twos).
  • Performance evaluation via evaluate_performance.py.
  • Complete XOShift rules implemented in game.py.

Installation

  1. Clone the repository:

    git clone https://github.com/azizi-zahra/xoshift-ai-agent.git
    cd xoshift-ai-agent
  2. Install dependencies:

    pip install -r requirements.txt
  3. Ensure you are using Python 3.10+.

Usage

  • Run the game with UI:

    python main.py
  • Run performance evaluation:

    python evaluate_performance.py
  • Adjust agent settings (time limit, depth) in your_agent.py under the CONFIGURATION section.

Project Structure

  • game.py → XOShift game logic and rules.

  • your_agent.py → AI agent implementation (minimax + heuristics).

  • evaluate_performance.py → Script to test agent performance.

  • ui.py → Simple game interface.

  • agent_loader.py, agent_utils.py, utils.py → Supporting utilities.

  • assets/ → Fonts and other resources.

License

This project is licensed under the MIT License.

About

AI Project - An AI agent for playing XOShift with Python (Spring 2025)

Topics

Resources

License

Stars

Watchers

Forks

Contributors

Languages