Skip to content

epieffe/jwalker-examples

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

JWalker Examples

Apache-2.0 Java 11

This repository contains example projects for JWalker, to show how it can be used to solve any search problem.

🖥️ How to run

Each example project can be executed with the Exec Maven Plugin, or it can be packaged into an executable jar.

Run with the Exec Maven Plugin

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

Package into an executable jar

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

📂 Example projects

Here we describe the example projects included in this repository.

Maze

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.

Maze

N-Puzzle

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.

N-Puzzle

N-Queens

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.

N-Queens

About

Example projects for JWalker

Resources

License

Stars

Watchers

Forks

Languages