This is a simple maze solver implemented in HTML and JavaScript. It allows you to visualize and solve a maze using a depth-first search (DFS) algorithm.
The maze solver uses a 12x12 grid to represent the maze. The maze is defined as a 2D array of numbers, where 0
represents a wall and 1
represents a path. The starting position is denoted by [4, 11]
, and the ending position is denoted by [10, 0]
.
The solver algorithm recursively explores the maze using DFS. It marks visited nodes as 8
and wrong paths as -8
. The solved path is marked as 8
.
To use the maze solver:
- Open the
index.html
file in a web browser. - The maze will be displayed on the screen.
- Click the "Solve This MAZE !!!" button to start the solving process.
- The maze will be solved, and the correct path will be highlighted in green (
8
), while wrong paths will be highlighted in red (-8
). - You can hover over the legend items to see the corresponding cells highlighted in the maze.
You can customize the maze by modifying the maze
variable in the JavaScript code. The maze is defined as a 2D array, where 0
represents a wall and 1
represents a path. Adjust the array values to create your own maze.
The maze solver code is based on the DFS algorithm and the HTML/CSS structure provided.
You can see a live demo of the maze solver here.