basic-pathfinding 0.2.0

Tile-based A* pathfinding in Rust
Documentation

πŸ—ΊοΈ basic-pathfinding

Pathfinding is a simple package for performing 2D A-star pathfinding in square- and hex-based tile grids.

Java/TypeScript Usage

const { findPath } = await import('pathfinding');

const grid: Grid = {
  tiles: [
    [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]
  ],
  walkableTiles: [1]
};

const path = findPath(grid, { x: 1, y: 2 }, { x: 3, y: 2 });
// [
//   { x: 1, y: 2 },
//   { x: 1, y: 3 },
//   { x: 2, y: 3 },
//   { x: 3, y: 3 },
//   { x: 3, y: 2 }
// ]

🚴 Rust Usage

πŸ› οΈ Building

wasm-pack build

πŸ”¬ Testing

cargo test
wasm-pack test --headless --firefox