This Python script generates random mazes, allows users to find a path from the start to the end, and displays the result in the terminal. The maze elements are color-coded for a visually appealing display. Users can choose to generate a path and print the maze, generate another puzzle, or exit the game.
No installation is required. Just make sure you have Python installed on your system.
-
Run the script using Python:
python maze_solver.py
-
Enter the size of the maze (n x n) and the percentage of walls.
-
Choose an option:
- P (Generate path and Print)
- G (Generate another puzzle)
- E (Exit)
-
If you choose to generate a path and print the maze, the script will display the generated maze and the found path.
-
Optionally, you can generate another puzzle or exit the program.
- Maze Generation: Randomly generates mazes with specified size and wall percentage.
- Pathfinding: Uses BFS to find the optimal path from the start to the end in the generated maze.
- User Interaction: Provides a simple terminal interface for users to navigate through the maze-solving process.
- Wall: Red (▓)
- Open Space: Blue (◌)
- Start: Default (S)
- End: Default (E)
- Path: Green (◍)
Satyam Kumar