pathfinder
Version, currently master branch1 version
- master branchlatestFeb 24, 2017
github.com/schoening/pathfinder
A simple pathfinding class for games; written in Crystal
5 stars
0 dependents
License: MIT
Installation
# Add this to your shard.yml
dependencies:
pathfinder:
github: schoening/pathfinder
branch: mastermaster is a branch, not a release, so this tracks it rather than pinning a version.
Then run:
shards installshard.yml
- Crystal
0.21.0- License
- MIT
- Author
- oliver schoening
Dependencies
This version declares no dependencies.
README
Pathfinder
A simple pathfinding class for games; written in Crystal.
How to use
require "./pathfinder.cr"
# 0 = wall
# 1 = walkable
grid = [
[1, 1, 1],
[1, 0, 0],
[1, 1, 1],
]
pf = Pathfinder.new(grid)
pf.start(0, 0)
pf.dest(2, 2)
result = pf.search
puts result # [{x: 0, y: 1}, {x: 0, y: 2}, {x: 1, y: 2}, {x: 2, y: 2}]
Accessing/modifying the grid
Pathfinder keeps a reference to the grid passed in. You can change the grid like this:
pf.grid[0][0] = 0 # set to wall.
Or by changing the grid that was passed in to the Pathfinder class at initializaton directly.
grid[0][0] = 1 # changes the pf.grid[0][0] to 1 too!
Documentation
Built from the current release. The first visit to a release nobody has asked for starts its build.
Links
This branch
- Branch
master- Seen
- Feb 24, 2017
- Crystal
0.21.0- Indexed
- yes
Dependents
No indexed shard depends on this one yet.
Repository
github.com/schoening/pathfinder
Metadata
- Created
- Aug 12, 2026
- Updated
- Aug 12, 2026
- Synced
- Aug 12, 2026
- Versions
- 1