Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

History

16 Commits

Repository files navigation

Astar

Pathfinding library using the astar algorithm, supports manhhaten and euclidean distance heuristics.

Installation

Add this line to your application's Gemfile:

gem'astar'

And then execute:

bundle

Or install it yourself as:

geminstallastar

Usage

Make sure you have an object that responds to methods x,y and walkable_neighbours

classTileattr_reader:x,:y#returns the surrounding tiles that are walkabledefwalkable_neighboursendend

Pass in your to and from tiles including the heuristic

Astar::FindPath.from(tile1).to(tile,Astar::ManhattenDistance)Astar::FindPath.from(tile1).to(tile,Astar::EuclideanDistance)

The specs also have an example of how to use the lib.

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

About

Pathfinding library using the a* algorithm

Resources

Stars

6 stars

Watchers

2 watching

Forks

Releases

Packages

Used by

Contributors

Languages