Dynamic Maze Solver is a Java-based graphical application that demonstrates maze-solving techniques using a backtracking algorithm. This project visualizes the process of solving a maze in real-time, showcasing pathfinding, backtracking, and teleportation mechanics through portals.
- Real-time Visualization: Watch the algorithm solve the maze step by step.
- Backtracking: See the algorithm backtrack from dead ends and visualize the path taken.
- Portals: Experience teleportation through numbered portals.
- Start and End Points: Clearly labeled start (
S
) and exit (E
) points. - Interactive Graphics: Uses Java Swing to provide a graphical representation of the maze.
- Maze Representation: The maze is represented as a 2D grid, read from a text file where each character denotes a wall, path, portal, start, or exit.
- Pathfinding Algorithm: A backtracking algorithm explores the maze, visiting valid paths, utilizing portals, and marking visited and backtracked paths.
- Visualization: The graphical interface updates in real-time to show the current position, visited cells, and backtracked paths.
- Java Development Kit (JDK) 8 or later.
- An IDE or text editor to view and run the Java program.
- Clone the Repository:
git clone https://github.com/Israel-Charles/Dynamic-Maze-Solver.git
- Navigate to the Project Directory:
cd DynamicMazeSolver
- Compile the Java Program:
javac MagicMaze.java
- Run the Program:
-
Create a text file in the project directory to pass it as argument when running the program.
-
Use characters to design your maze:
- '@' for walls
- '*' for paths
- '0-9' for portal pairs
- 'X' for the exit point
java DynamicMazeSolver <mazefile.txt> <# of rows> <# of cols>
Example with a maze file that has 15 rows and 20 columns:
java DynamicMazeSolver maze4.txt 15 20