Skip to content

sparemind/PathfindingComparison

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Pathfinding Visual Comparison

This project provides a visual side-by-side comparison of several common pathfinding algorithms.

Pathfinding Comparison

Overview

The comparison window consists of several grids, each displaying the execution of one algorithm. These grids can be edited by clicking and dragging on their contents, with changes being synchronized across all grids.

Buttons at the bottom of the window can be used to play an animation of all algorithms running, advance each algorithm a single step, or clear/reset the grids.

Features include:

  • Comparing multiple algorithms side-by-side in one window
  • Grid editing: Placing obstacles and moving start and target points to create custom scenarios
  • Weighted graphs: Adding a travel cost to certain cells
  • Preset setups (seedable):
    • Mazes
    • Randomized grids
    • Weighted gradients
  • Step-by-step viewing of algorithm procedure
  • Adjustable run speed

Included Algorithms:

Running

Option 1: Run from .jar

Just run the precompiled PathfindingComparison.jar.

Option 2: Compile and run

Compile the contents of src/ and run Main:

cd src
javac *.java
java Main

Editing

Most settings can be changed by editing the class constants at the top of Main.java. Additional pathfinders can be added by implementing the Pathfinder interface and then loading the pathfinder in the main method of Main.java with:

loadedPathfinders.add(new MyPathfinder());

Useful Editable Constants

  • GRID_WIDTH, GRID_HEIGHT -- The size of the grids in cells.
  • CELL_SIZE -- The size of each grid cell in pixels.
  • GRIDS_HORZ, GRIDS_VERT -- The number of grids per row and per column in the window. GRIDS_HORZ * GRIDS_VERT is the number of pathfinding algorithms that will be shown simultaneously.
  • MAX_COST -- Determines the max weight a cell can have. Note that the "Toggle Cell Costs" button will only show the first digit of the weight (e.g. a weight of 15 will display as '1').
  • DEFAULT_STEP_DELAY -- The default delay between steps when running.

Presets

Several randomly generated presets are available. Examples of them are:

Presets

License

This project is licensed under the MIT license. See LICENSE for details.

About

A visual side-by-side comparison of common pathfinding algorithms.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages