Skip to content

A recursive pathfinding algorithm that finds the shortest way through a labyrinth.

Notifications You must be signed in to change notification settings

jkuhlemann/Labyrinth

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Labyrinth Pathfinding in Java

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.

Features

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.

How to Run

  1. Clone the repository:
git clone https://github.com/yourusername/labyrinth-solver.git
  1. Navigate to the repository:
cd labyrinth-solver
  1. Compile the Java files:
javac Labyrinth.java Testklasse.java
  1. Run the test cases:
javac Labyrinth.java Testklasse.java

Example Output

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.

Requirements

  • Java 17 or later

License

This project is licensed under the MIT License.

About

A recursive pathfinding algorithm that finds the shortest way through a labyrinth.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages