This repository contains example projects for JWalker, to show how it can be used to solve any search problem.
Each example project can be executed with the Exec Maven Plugin, or it can be packaged into an executable jar.
To run a project with the Exec Maven Plugin, supply its subproject name to the -pl option.
For example, to run the Maze project, run the following command:
./mvnw compile exec:java -pl maze
The package goal produces an executable jar with all the necessary dependencies included.
For example, to create an executable jar for the N-Puzzle project, run the following command:
./mvnw clean package -pl npuzzle
Then, you can execute the previously created jar with the following command:
java -jar npuzzle/target/npuzzle.jar
Here we describe the example projects included in this repository.
The Maze project generates a random maze on a 2D grid, then it uses the Best‑first Search algorithm to find a path to the exit.
The generated maze and the path to the exit are printed to the console.
The N‑Puzzle project generates a random 15‑Puzzle configuration, then it uses the A* algorithm to find a reasonably short sequence of moves that solve the puzzle.
The sequence of moves to solve the puzzle from the initially generated configuration is printed to the console.
The N‑Queens project uses the Steepest descent algorithm to solve the 8‑Queens problem, which consists in placing eight chess queens on a 8x8 chess board so that no two queens threaten each other.
Note that the Steepest descent algorithm is not guaranteed to always find an optimal node. Sometimes it might happen that, in the found configuration, there are still some queens threatening each other.
The found configuration and its number of threats between queens are printed to the console.


