This project implements a labyrinth solver in Java. The labyrinth is represented as a 2D array of characters, where walls, open paths, and exit points are defined. A recursive algorithm is used to find a path from a starting point to an exit. The solution is demonstrated through test cases that showcase different labyrinth structures.
Represents the labyrinth as a 2D character array. Uses recursion to search for an exit from a given starting point. Provides visual output of the labyrinth and the path found (if any). Includes test cases to validate the solution against multiple labyrinth configurations.
- Clone the repository:
git clone https://github.com/yourusername/labyrinth-solver.git
- Navigate to the repository:
cd labyrinth-solver
- Compile the Java files:
javac Labyrinth.java Testklasse.java
- Run the test cases:
javac Labyrinth.java Testklasse.java
For each labyrinth, the output shows the layout and whether a path was found.
Labyrinth 1:
X X X X X X X X * X
X X X X X X X X * X
X * * * * * * * * X
X * X X X X X X X X
X * X X * * * * * X
X * X X X X X X * X
X * X X X X X X * X
X * X X X X X X * X
X * * * * * * * * X
X X X X X X X X X X
Weg gefunden.
- Java 17 or later
This project is licensed under the MIT License.