A simple yet engaging maze game built with HTML, CSS, and JavaScript. Navigate through a dynamically generated maze to find the exit. Each time you play, a new maze is created, ensuring a unique experience. The game is designed to be lightweight and easy to play, making it suitable for all age groups.
- Randomized Maze Generation: Each game loads a new maze, thanks to the Depth-First Search (DFS) and Prim algorithms used for maze generation.
- Player Navigation: Use the arrow keys to move up, down, left, or right within the maze.
- Start and Exit Indicators: The game visually indicates the starting point and the exit. Reach the green block to win.
- Regenerate Maze: A button allows players to generate a new maze at any time without reloading the page.
- HTML: Structure of the game canvas and control elements.
- CSS: Styling of the game canvas and alignment of game elements.
- JavaScript: Game logic, including maze generation, player movement, collision detection, and UI interaction.
- Python: There is also a Python implementation of the maze generation algorithm using the Depth-First Search (DFS) algorithm.
The maze is generated using a randomized version of the Depth-First Search (DFS) & Prim algorithms. This algorithm starts at a random cell, marks it as part of the maze, and recursively explores unvisited neighbors, carving out a path. The process continues until all cells are visited, resulting in a perfect maze with a single solution.
- Clone the repository to your local machine.
- Open the
index.html
file in a modern web browser. - Alternatively, you can run the Python implementation of the maze generation algorithm by executing the
maze.py
file.
python maze-gen.py
Before running the Python script, ensure that you have Python and Pygame installed on your machine.
pip install pygame
- Navigate through the maze using the arrow keys.
- Click the Regenerate Maze button below the canvas to start a new game with a new maze layout.
Feel free to fork the repository and submit pull requests to contribute to the game's development. Whether it's adding new features, improving the maze generation algorithm, or enhancing the game's UI/UX, all contributions are welcome.
This project is open-source and available under the MIT License.
You can reach out to me at [email protected].