Maze-Maker is a Python script that generates random mazes using a recursive backtracking algorithm. The maze is represented as a 2D grid where walls are denoted by 1
and paths by 0
.
- Generates mazes with customizable width and height.
- Uses recursive backtracking to carve out paths.
- Displays the maze in the console with
#
as walls and spaces as paths.
- The grid is initialized with walls.
- A random starting point is selected.
- The recursive backtracking algorithm is applied to carve out paths in the maze.
- Directions (up, down, left, right) are randomly shuffled and processed.
To generate a 42x22 maze, run the following command:
python maze_maker.py
To customize the size of the maze, modify the width and height in the create_maze function:
maze = create_maze(50, 30) # Generates a 50x30 maze
Python 3.x
Contributions are welcome! If you'd like to contribute to Maze-Maker, follow these steps:
- Fork the repository.
- Create a new branch:
git checkout -b my-feature
. - Make your changes and commit them:
git commit -m 'Add my feature'
. - Push to the branch:
git push origin my-feature
. - Submit a pull request.
This project is licensed under the MIT License. See the LICENSE file for more details.
Amir Mahdi Zare
mahnaznamani007@gmail.com