Skip to main content

A Python package implementing various search algorithms for maze solving

Project description

PathFinder

PathFinder is a Python package that provides classic pathfinding algorithms such as:

  • Breadth-First Search (BFS)

  • Depth-First Search (DFS)

  • Uniform Cost Search (UCS)

  • A-Star Search (A*)

These algorithms work on 2D mazes represented as grids, and are designed to help with visualization, teaching, or solving pathfinding problems programmatically.

💾 Installation

pip install PathWise

📝 Features

  • Supports 2D grid mazes with customizable start, goal, and wall positions

  • Clear API to run any algorithm and get the path, cost, and visited nodes

  • Easily extendable for diagonal movement or custom cost functions

  • Suitable for AI projects, teaching, and maze-solving

⚖️ Algorithms Included

BFS

  • Explores nodes level by level

  • Guarantees shortest path if all moves have equal cost

DFS

  • Explores deep into one branch before backtracking

  • May not find the shortest path

UCS

  • Uses a priority queue (cost-based)

  • Always finds the lowest-cost path

A*

  • Uses cost + heuristic (e.g. Manhattan distance)

  • Highly efficient for large or complex mazes

💡 Usage

1. Representing the Maze

A maze is a 2D list of characters:

maze = [ ["S", " ", " ", "#", "G"], ["#", "#", " ", "#", " "], [" ", " ", " ", " ", " "], [" ", "#", "#", "#", " "], [" ", " ", " ", " ", " "] ]

S = Start

G = Goal

# = Wall (Represented by 1)

' ' = Open path (Represented by 0)

2. Running an Algorithm

from pathfinder import Pathfinder

solver = Pathfinder(maze)
path, visited = solver.bfs()  # or dfs(), ucs(), astar()

print("Path:", path)
print("Visited:", visited)

📁 Project Structure

pathfinder/
├── algorithms/
│   ├── bfs.py
│   ├── dfs.py
│   ├── ucs.py
│   ├── __init__.py
    └── astar.py

📃 License

This project is licensed under the MIT License.

Author

Developed by Mahdi Jaffery

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pathwise-1.0.0.tar.gz (4.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pathwise-1.0.0-py3-none-any.whl (5.6 kB view details)

Uploaded Python 3

File details

Details for the file pathwise-1.0.0.tar.gz.

File metadata

  • Download URL: pathwise-1.0.0.tar.gz
  • Upload date:
  • Size: 4.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.3

File hashes

Hashes for pathwise-1.0.0.tar.gz
Algorithm Hash digest
SHA256 8c9faaa8e21e94a7b6bd55b506cca88ac47b6f04c1f58862d7ebde5707d4f12b
MD5 3d3aa61e8fb00a7b5c98185a4faa8c29
BLAKE2b-256 dce13591174a9a533fdbcd876f24cc1d19417069439477ea6ee0a266f54282a9

See more details on using hashes here.

File details

Details for the file pathwise-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: pathwise-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 5.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.3

File hashes

Hashes for pathwise-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ae69b2ad06251a1193223910f66eccf09ce698e5341028d6438f33be147ade92
MD5 8b7e6215982d87a3e33e4d87037ed861
BLAKE2b-256 a9d888c65a6ca76e8e2394b571bf00abb90a65626c9426c3e8bba7dd4262a642

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page