Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/cygnusroboticus/pathfinding
Tile-based A* pathfinding in elixir
https://github.com/cygnusroboticus/pathfinding
elixir map pathfinding tile
Last synced: about 2 months ago
JSON representation
Tile-based A* pathfinding in elixir
- Host: GitHub
- URL: https://github.com/cygnusroboticus/pathfinding
- Owner: CygnusRoboticus
- License: mit
- Created: 2018-12-15T06:16:06.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2019-02-24T20:37:33.000Z (almost 6 years ago)
- Last Synced: 2024-03-14T19:34:46.226Z (9 months ago)
- Topics: elixir, map, pathfinding, tile
- Language: Elixir
- Homepage: https://hexdocs.pm/pathfinding
- Size: 30.3 KB
- Stars: 4
- Watchers: 2
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Pathfinding
Pathfinding is a simple package for performing 2D [A-star](https://en.wikipedia.org/wiki/A*_search_algorithm) pathfinding in square- and hex-based tile grids.
## Installation
[Available in Hex](https://hex.pm/packages/pathfinding), the package can be installed
by adding `pathfinding` to your list of dependencies in `mix.exs`:```elixir
def deps do
[
{:pathfinding, "~> 0.1.0"}
]
end
```## Basic Usage
```elixir
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](https://hexdocs.pm/pathfinding).