An open API service indexing awesome lists of open source software.

https://github.com/psvensson/easystar-st

A port of the JS EasyStar (A* - Dijkstra) package to Smalltalk
https://github.com/psvensson/easystar-st

astar-pathfinding dijkstra-shortest-path pharo-smalltalk smalltalk

Last synced: 6 months ago
JSON representation

A port of the JS EasyStar (A* - Dijkstra) package to Smalltalk

Awesome Lists containing this project

README

          

# Easystar-st
A port of the JavaScript [EasyStar](https://github.com/prettymuchbryce/easystarjs) package (A* - Dijkstra) package to Smalltalk.

# Loading
```
Metacello new
repository: 'github://psvensson/Easystar-st:master';
baseline: 'Easystar';
load
```

# Using

Here is a unit test that show how to set up and call Easystar (For more complex examples see the other unit tests in the package);
```Smalltalk
testFindPath
| easyStar map |
easyStar := EasyStar new.
map := #((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)).
easyStar setGrid: map.
easyStar acceptableTiles: { 1 }.
easyStar avoidAdditionalPointX: 3 y: 4.
easyStar findPathFrom: 2@3 to: 4@3 onPathFound: [ :path |
self assert: path isNotNil.
self assert: path size equals: 7.
self assert: (path at: 1) x equals: 2.
self assert: (path at: 1) y equals: 3.
self assert: (path at: 3) x equals: 2.
self assert: (path at: 3) y equals: 5 ].
easyStar calculate.
```