Skip to content

Adversarial search methods for a two-player board game (18 Ghosts), using Python and AI algorithms.

Notifications You must be signed in to change notification settings

DiogoSilva11/18Ghosts-IA

Repository files navigation

IA Project 1 - 18 Ghosts

img


Compilation and Execution of the Program

This game was programed in Python. If you don't already have Python installed, you can proceed as follows:

Windows:

  • Download the Python installer from the official Python website (https://www.python.org/downloads/windows/)
  • Run the installer and follow the on-screen instructions
  • During the installation process, make sure to select the option to add Python to the PATH environment variable

Linux:

  • Open a terminal window
  • Use your system's package manager to install Python; for example, on Ubuntu or Debian-based systems, run the following command in the terminal:
    sudo apt-get install python3
    
  • Once Python is installed, you can start the Python interpreter in the console by running the "python" command

macOS:

  • Open a Terminal window
  • Install Homebrew (if you don't already have it) by running the following command in the Terminal:
    /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
    
  • Install Python 3 by running the following command in the Terminal:
    brew install python
    

Now, you'll need to install some libraries (pygame and numpy) by writing these commands in the console:

// for python3
pip3 install pygame
pip3 install numpy

// for python
pip install pygame
pip install numpy

Once you've followed all these instructions you are ready to run the program. Simply type in the console:

// for python3
python3 main.py

// for python
python main.py

This will execute the program and now you can play 18 Ghosts.
All actions in the interface are performed using the left mouse button (clicks), except for the ENTER key that makes the artificial intelligence apply its move on each play and the ESC key which makes you leave the game.


How to play

Read the game instructions here: [Game Rules]

Additional notes:

  • Mirror chambers are instead represented as neutral tiles with no special interaction; ghosts cannot be initially placed there but they can later move normally to those tiles
  • To respawn one of your ghosts, instead the ghost will be placed in the tile of the corresponding color furthest from the portal (of the same color) assuming the tyle is empty; otherwise, the action cannot take place
  • A player loses if there are no possible moves (including respawns) left at the moment or the opponent has one ghost of each color outside the castle

How to configure

In the file defines.py you will find a section named "Game Definitions". There you will be able to choose the bot type between minimax and monte carlo, the depth to the minimax algorithm (either 2 or 4), the number of iterations to the mcts algorithm and the difficulty of the bots (either easy, medium or hard). This allows you to run your own experiments if you want to.


Project done by (Group 19):

  • Diogo Silva (up202004288)
  • Henrique Silva (up202007242)
  • Tiago Branquinho (up202005567)

About

Adversarial search methods for a two-player board game (18 Ghosts), using Python and AI algorithms.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages