Skip to content

varun-jain03/Terminal-Based-Maze-Solver

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 

Repository files navigation

Terminal_Based_Maze_Solver

Overview

The "Terminal Based Maze Solver" project is a Python implementation of a maze generation and solving algorithm. The project includes a maze generator that creates a random maze with a specified size and starting (S) and ending (E) points. Additionally, it features a depth-first search (DFS) algorithm to find a path from the starting point to the ending point in the generated maze.

Components

Maze Generation

The maze generation utilizes a stack-based algorithm to create a random maze. The algorithm ensures that there is only one path between the starting and ending points, making the maze solvable. The generated maze consists of cells marked as follows:

0: Wall(▓) 1: Open path(◌) 2: Starting point (S) 3: Ending point (E) 4: Path(◍)

Depth-First Search (DFS)

The DFS algorithm is employed to find a path from the starting point to the ending point in the generated maze. The DFS explores possible paths, backtracking when necessary, until it successfully reaches the destination. The path is then displayed, and the maze with the path is printed.

User Interaction

The user can interact with the program through a simple console interface with the following options:

  1. Print the Path: Display the solution path in the generated maze.
  2. Generate Another Puzzle: Create a new random maze.
  3. Exit the Game: Terminate the program.

How to Run

To run the program, execute the Python script. Upon launching, the user will be prompted to enter the size of the maze. The program will then display the maze and provide options for interacting with the generated puzzle.

Dependencies

The project has no external dependencies beyond the standard Python library.

Additional Notes

  1. The maze generator ensures that there is a solvable path from the starting point to the ending point.
  2. The DFS algorithm employs a recursive approach to explore possible paths within the maze.
  3. The solution path is marked with a different symbol ("-1") in the displayed maze.

About

Generates a maze and finds a path from start to end using Depth-First Search.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages