Skip to content

An AI to play the game Mancala designed from scratch.

Notifications You must be signed in to change notification settings

PierreNabil/Mancala_AI

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Mancala_AI

An AI to play the game Mancala designed from scratch.

4th year 2nd term AI Project.

Contents

Project Description

Mancala AI is a simple project where 2 players can play Mancala. Both players can be either human players or AI with various levels of difficulty.

The game rules are as explained in this video and it has 2 modes:

  • With Stealing
  • Without Stealing

The Game and its AI are implemented entirely from scratch in python. The AI uses minimax with alpha-beta pruning where the depth of the tree search is given by this formula:

depth = 2 * difficulty_level - 1

Usage

Here's a YouTube video that shows our game in action!

The simplest way to use Mancala AI is to run the binary executable in /dist/mancala/mancala.exe.

You can also run the game by running main.py using python.

Firstly, you'll have to select what type of player do you want player0 to be (either Human h or an AI a) If an AI was selected, you'll have to select a difficulty level for the AI. A good difficulty level to start with is level 5 as it's fast enough to play without any significant delay but is still not too stupid as to not make the game fun. If the AI is too hard for you you can always select a lower difficulty and vice versa.

Repeat for the other player (player1).

Finally, you can select whether you want stealing mode on or off.

You'll find can also use one of the functions given in game.py to skip the UI part of the project.

After selecting the 2 players of the game, the start board state is shown, and the game begins. To enter a move, you can press a number between 0 and 5 which represents the pocket that you will take marbles from. The rest of the rules are applied automatically.

Note that the pockets are numbered on the screen for both players so it should be easy for you to select the move you are looking for.

The game continues for each player until the end state is reached, where all extra marbles are relocated to their respective mancala and the final score for both players is calculated. The Winner of the game is then declared and the game ends.

Team Members

Features

  • An intuitive user interface for ease of use.
  • A binary executable to run on any device without the need to be able to run python code.
  • A DFS implementation of minimax and minimax with alpha-beta pruning that can be easilly used for other games.
  • 2 Game Modes
    • With Stealing
    • Without Stealing
  • Support of various difficulty levels corresponding to different game tree depths. (bonus feature #2)
  • Support a networking mode where 2 instances of an AI player can play the game against each other without any human intervention. (bonus feature #5)

About

An AI to play the game Mancala designed from scratch.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages