Coder Social home page Coder Social logo

trinonandi / path-visualizer Goto Github PK

View Code? Open in Web Editor NEW
3.0 1.0 0.0 51.08 MB

A visualizer for various path finding algorithms on 3 different grid sizes, with custom maze building feature, made with pure python and pygame.

Python 97.80% C 2.03% HTML 0.01% PowerShell 0.15% Batchfile 0.01%
heuristic pathfinding-algorithms pygame python

path-visualizer's Introduction

Path-Visualizer

A pathfinding algorithm visualizer made with Python and Pygame

Inspiration

I was studying various pathfinding algorithms as a part of my 5th semester B-tech subject Artificial Intelligence. But I did not have any hands-on lab to try out those algorithms and analyze the results. So I decided to build this application that visualizes them on three different sized grids with custom maze.

How I made it

I used a simple python game development module called Pygame to design the GUI. Then I created 3 square grids of size

  1. 20 x 20 (small)
  2. 28 x 28 (standard)
  3. 35 x 35 (large)

After that, I designed the wall, start and goal node distinctions and implemented the following algorithms:

  • Depth First Search
  • Breadth First Search
  • Bidirectional Search (non heuristic)
  • Dijkstra's Algorithm
  • Greedy Best First Search (heuristic)
  • A* search (heuristic)
  • Bidirectional Greedy Best First Search (heuristic)
  • Bidirectional A* search (heuristic)

For the heuristic function, I chose the Manhattan Distance. Assumption : Each node in the grid can be traversed only Left, Right, Up and Down. No diagonal movement is allowed

How to run

There are three ways to run the application. Download the files as zip or clone the directory, then follow any of the three processes

  1. Install Python 3 and download Pygame as pip install pygame. Then run the main.py file as python main.py
  2. On a Windows PC double click on the Visualizer.exe file
  3. On a Windows PC install the setup.exefile and then execute the Visualizer.exe file from the installed directory

Instructions

All these application related Instructions can be found inside the info tab on the app main menu.

Left Click on a node to make it Start, Goal or Wall. The first clicked node will be set to Start, the next one will be set to Goal. After that the clicked nodes will be set to Walls. Right Click on a node to clear it.

Start Start Node Goal Goal Node Path Path Node Wall Wall Node Traversable Traversable Node Start Open Node Start Closed Node

Press The ARROW UP or ARROW LEFT key to decrease the grid size. Press The ARROW DOWN or ARROW RIGHT key to increase the grid size. Press The SPACE key to start the algorithm. Press The R key to clear the grid. Press The ESC key to return to main menu.

Demo

path-visualizer's People

Contributors

trinonandi avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.