/Mancala

A Java-based implementation of the traditional African board game Mancala, featuring AI with Alpha-Beta Pruning, and two-player mode. ๐ŸŽฎ๐Ÿ’ก

Primary LanguageJava

Mancala Game - Java Implementation

Overview ๐Ÿ‘

This project implements the traditional Mancala board game in Java, incorporating advanced features such as AI-based strategies, saved games, and an interactive interface for two-player or single-player modes. Mancala is a centuries-old African game that involves strategy and skill to capture the maximum number of stones.

Mancala gameboard

Project Supervisor:

  • Professor M'hamed AIT KBIR

Table of Contents

  1. Screenshots
  2. Features
  3. Game Rules
  4. Technical Details
  5. Installation
  6. Credits

Screenshots ๐Ÿ“ธ

Home Screen

image

Description: This is the entry point of the game, where users are greeted with a welcome screen and options to proceed.


Configuration Screen

image image

Description: Customize your game settings, including opponent type (human or AI), game complexity, strategy, and heuristic.


Instruction Screen

image

Description: Displays the rules of Mancala, helping new players understand how to play.


Game Screen

image

Description: The main gameplay area. Players can interact with the pits and see their moves visualized.


Features โญ

  • Two-player mode: Play with a friend locally.
  • Single-player mode: Compete against a machine using intelligent strategies.
  • AI assistance: Request hints during the game (limited number of times).
  • Game saving and resuming: Save your game progress and continue later.
  • Replay functionality: Review saved games to analyze strategies.
  • Customizable difficulty: Adjust the AI's complexity to suit your skill level.
  • Multiple heuristics: Implements at least two AI heuristics for enhanced gameplay.

Game Rules ๐Ÿ•น๏ธ

  1. Game Board:

    • The board consists of two rows of six small pits, with a larger "store" pit on each side.
    • Players aim to collect the most stones in their store pit.
  2. Turn Mechanics:

    • Players select one of their pits and distribute its stones clockwise, one at a time.
    • Stones can be placed in the playerโ€™s store but not in the opponent's store.
    • Captures occur if the last stone lands in an empty pit on the playerโ€™s side.
  3. Special Cases:

    • Players earn an extra turn if their last stone lands in their store.
    • The game ends when all pits on one side are empty. Remaining stones go to the respective store pits.
  4. Winning:

    • The player with the most stones in their store wins.

Technical Details ๐Ÿ”Ž

Algorithms

  • Implements adversarial search algorithms like Minimax and Alpha-Beta Pruning for the AI.
  • Two distinct heuristics are available to evaluate game states and enhance the AI's decisions.

Java Design

  • Object-Oriented Programming:
    • Respects principles like inheritance and encapsulation.
    • Utilizes a modular design for board, player, and AI components.
  • Alpha-Beta Pruning:
    • Customized implementation replacing alphaBetaHelper(...) based on course requirements.

File Management

  • Games can be saved and resumed using a structured file format.
  • Saved games can be replayed for analysis.

Installation ๐Ÿ“ฅ

  1. Clone the repository:
    git clone https://github.com/son-of-mountain/mancala-game.git
    cd mancala-game
    
    

Made in Tangier ๐Ÿ˜ by