Skip to content

CygnusRoboticus/pathfinding

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Pathfinding

Pathfinding is a simple package for performing 2D A-star pathfinding in square- and hex-based tile grids.

Installation

Available in Hex, the package can be installed by adding pathfinding to your list of dependencies in mix.exs:

def deps do
  [
    {:pathfinding, "~> 0.1.0"}
  ]
end

Basic Usage

grid = %Pathfinding.Grid{
  tiles: [
    [1, 1, 0, 1, 1],
    [1, 1, 0, 1, 1],
    [1, 1, 0, 1, 1],
    [1, 1, 1, 1, 1],
    [1, 1, 1, 1, 1]
  ],
  walkable_tiles: [1]
}

Pathfinding.find_path(grid, 1, 2, 3, 2) == [
  %{x: 1, y: 2},
  %{x: 1, y: 3},
  %{x: 2, y: 3},
  %{x: 3, y: 3},
  %{x: 3, y: 2}
]

API Documentation

Documentation can be found at https://hexdocs.pm/pathfinding.

About

Tile-based A* pathfinding in elixir

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages