#pathfinding #square #basic

basic-pathfinding

Tile-based A* pathfinding in Rust

13 releases

βœ“ Uses Rust 2018 edition

0.2.8 Aug 10, 2019
0.2.7 Aug 10, 2019
0.2.6 Jul 30, 2019
0.2.1 Jun 30, 2019
0.1.3 Jun 23, 2019
Download history 16/week @ 2019-11-04 1/week @ 2019-11-11 41/week @ 2019-11-18 26/week @ 2019-11-25 26/week @ 2019-12-02 150/week @ 2019-12-09 1/week @ 2019-12-16 13/week @ 2019-12-23 42/week @ 2020-01-13 79/week @ 2020-01-20 2/week @ 2020-01-27 1/week @ 2020-02-03 16/week @ 2020-02-10

125 downloads per month
Used in web_wars_engine

MIT and maybe MPL-2.0

18KB
538 lines

πŸ—ΊοΈ basic-pathfinding

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

🚴 Rust Usage

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

Dependencies

~2.3–3.5MB
~81K SLoC