Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/cygnusroboticus/basic-pathfinding
Tile-based A* pathfinding in Rust
https://github.com/cygnusroboticus/basic-pathfinding
map pathfinding rust tile webassembly
Last synced: 2 months ago
JSON representation
Tile-based A* pathfinding in Rust
- Host: GitHub
- URL: https://github.com/cygnusroboticus/basic-pathfinding
- Owner: CygnusRoboticus
- License: mit
- Created: 2019-05-27T01:29:46.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2022-12-29T02:26:37.000Z (about 2 years ago)
- Last Synced: 2024-10-08T00:27:56.008Z (3 months ago)
- Topics: map, pathfinding, rust, tile, webassembly
- Language: Rust
- Homepage:
- Size: 748 KB
- Stars: 6
- Watchers: 2
- Forks: 2
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# πΊοΈ `basic-pathfinding`
Pathfinding is a simple package for performing 2D [A-star](https://en.wikipedia.org/wiki/A*_search_algorithm) pathfinding in square- and hex-based tile grids.
## π΄ Rust Usage
```rust
let grid = Grid {
tiles:
vec![
vec![1, 1, 0, 1, 1],
vec![1, 1, 0, 1, 1],
vec![1, 1, 0, 1, 1],
vec![1, 1, 1, 1, 1],
vec![1, 1, 1, 1, 1]
],
walkable_tiles: vec![1],
grid_type: GridType::Cardinal,
..Default::default()
);
let start = Coord::new(1, 2);
let end = Coord::new(3, 2);
let path = find_path(&grid, start, end, None);path == Some(vec![
Coord { x: 1, y: 2 },
Coord { x: 1, y: 3 },
Coord { x: 2, y: 3 },
Coord { x: 3, y: 3 },
Coord { x: 3, y: 2 },
]);
```### π οΈ Building
```
cargo build
```### π¬ Testing
```
cargo test
```