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
- Host: GitHub
- URL: https://github.com/psvensson/easystar-st
- Owner: psvensson
- Created: 2020-01-06T18:18:56.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2020-01-19T08:44:34.000Z (over 6 years ago)
- Last Synced: 2025-02-18T11:14:14.194Z (over 1 year ago)
- Topics: astar-pathfinding, dijkstra-shortest-path, pharo-smalltalk, smalltalk
- Language: Smalltalk
- Size: 31.3 KB
- Stars: 4
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
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.
```