A port of the JavaScript EasyStar package (A* - Dijkstra) package to Smalltalk.
Metacello new
repository: 'github://psvensson/Easystar-st:master';
baseline: 'Easystar';
load
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);
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.