Dynamic Maze with Interactive Search Algorithms Visualization

A dynamic maze was created to allow users to experiment with different search algorithms. The maze is randomly generated by the user, and they can choose a start and an end point. Then, they can select a search algorithm, such as breadth-first search, depth-first search, A* search, etc.

As the search progresses, the path taken is highlighted with different colors. This allows users to clearly and interactively visualize the search process.

Course: SINF0042 - ARTIFICIAL INTELLIGENCE (2022.2 - TIND01)

iavideo.mp4

Search Algorithm Visualizations

Q-Learning

Q-Learning is a reinforcement learning algorithm that learns the value of actions in a given state to maximize the total reward over time.

Depth-First Search

Depth-First Search (DFS) explores a graph or tree by starting at the root and exploring as far as possible along each branch before backtracking.

Breadth-First Search

Breadth-First Search (BFS) traverses or searches tree or graph data structures by exploring all the neighbor nodes at the present depth prior to moving on to nodes at the next depth level.

Greedy Best-First Search

Greedy Best-First Search expands the most promising node according to a specified rule, aiming to reach the goal by always expanding the node that appears to be closest to the goal.

Uniform Cost Search

Uniform Cost Search extends the breadth-first search to handle varying edge costs, always expanding the node with the lowest path cost.

A-star Search

A-star (A*) Search combines elements of both uniform cost search and greedy best-first search to find the most efficient path to the goal using both the cost to reach the node and an estimated cost to reach the goal.


Graphs generated based on the paths traversed by the chosen algorithm in the maze.

Breadth-First Search Graph

BuscaLargura

Depth-First Search Graph

BuscaProfundidade

A* Search Graph

Caminho_A_Estrela

Imagem Docker

Running AI-Maze-Game with Docker and Xming on Windows

This guide provides step-by-step instructions for running the AI-Maze-Game application using Docker and Xming on a Windows machine.

Prerequisites

Before you begin, make sure you have the following installed:

Instructions

  1. Install Xming by running the Xming-6-9-0-31-setup.exe installer.
  2. Open a terminal where the Dockerfile is located.
  3. Build the Docker image by running the following command: docker build -t projetoia .
  4. Run the Docker container with Xming by running the following command: docker run -it --name projetoia -e DISPLAY=host.docker.internal:0 projetoia
    • Note: Make sure to replace projetoia with the name of your Docker image if you used a different name in step 3.
  5. Navigate to the Maze-IA directory by running the following command: cd AI-Maze-Game/ && cd Maze-IA && ls
  6. Run the AI-Maze-Game application by running the following command: python3 game.py

Img fedora

Install on Fedora

Install the necessary dependencies to install Miniconda

  1. sudo dnf install -y wget bzip2 ca-certificates curl glib2 libXext libSM libXrender

Download the Miniconda .sh file

  1. wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh

Install Miniconda in /home/youruser/miniconda3

  1. bash Miniconda3-latest-Linux-x86_64.sh -b -p /home/youruser/miniconda3

add Miniconda's bin directory to your PATH:

  1. echo 'export PATH="/home/youruser/miniconda3/bin:$PATH"' >> ~/.bashrc

Activate the Conda base environment by running the following command:

  1. source /home/youruser/miniconda3/bin/activate
  2. (base) [youruser]$ conda install -y -c conda-forge graph-tool
  3. (base) [youruser]$ conda install -y -c conda-forge pygame
  4. (base) [youruser]$ conda install -y numpy

make the clone: git clone https://github.com/NathanaelSantos/AI-Maze-Game.git

(base) [nathan]$ cd AI-Maze-Game/ (base) [nathan AI-Maze-Game]$ cd Maze-IA/ (base) [nathan Maze-IA]$ python3 game.py


Img fedora

Installation and Execution of AI-Maze-Game on Ubuntu

Prerequisites

Before starting, make sure you have the following prerequisites:

  • Ubuntu (any recent version)
  • Internet access

Passos para Instalação

1. Install Necessary Dependencies

First, we need to install some necessary dependencies for the installation of Miniconda.

sudo apt-get update
sudo apt-get install -y wget bzip2 ca-certificates curl libglib2.0-0 libxext6 libsm6 libxrender1

2. Download Miniconda

Download the Miniconda installer using the wget command.

wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh

3. Install Miniconda

Run the Miniconda installation script and install it in the /home/yourusername/miniconda3 directory.

bash Miniconda3-latest-Linux-x86_64.sh -b -p /home/youruser/miniconda3

4. Configure the PATH

Add the Miniconda bin directory to your PATH so that Conda commands are recognized.

echo 'export PATH="/home/youruser/miniconda3/bin:$PATH"' >> ~/.bashrc
source ~/.bashrc

5. Activate the Conda Environment

Activate the base Conda environment.

source /home/youruser/miniconda3/bin/activate

6. Install Necessary Packages

Use Conda to install the necessary packages: graph-tool, pygame, and numpy.

conda install -y -c conda-forge graph-tool
conda install -y -c conda-forge pygame
conda install -y numpy

7. Clone the AI-Maze-Game Repository

Clone the AI-Maze-Game repository from GitHub.

git clone https://github.com/NathanaelSantos/AI-Maze-Game.git

8. Run the Game

Navigate to the game directory and run it.

cd AI-Maze-Game/
cd Maze-IA/
python3 game.py

Reconnecting to the Environment

If you disconnect from the session, you can reconnect to the Conda environment by running:

source /home/youruser/miniconda3/bin/activate

How to Play

  • Press the B key to activate or deactivate the "paint mode" (activated by default).
  • You can draw new walls in the maze by clicking with the left button of the mouse, while the paint mode is activated.
  • Press the S key to save a maze file. You can open it in the option "Import save".
  • After drawing your maze, press the SPACE key to show the search algorithm menu.
  • Select the algorithm by clicking with the left button of the mouse.
  • Enjoy watching.

Creators

Guilherme Santos Costa Jose Nathanael Santos Matos Pedro Antonio Santos Lima
Guilherme Santos Costa
Bacharel em Sistemas de Informação
José Nathanael Santos Matos
Bacharel em Sistemas de Informação
Pedro Antonio Santos Lima
Bacharel em Sistemas de Informação

Disciplina: SINF0042 - INTELIGÊNCIA ARTIFICIAL (2022.2 - TIND01)

Professor:

ALCIDES XAVIER BENICASA
ALCIDES XAVIER BENICASA
Departamento: Sistemas de Informação - DSI/UFS

License

This project is licensed under the MIT License.

Remember to replace the example information with relevant information for your project.