a-star_traitbased 0.1.3

Implemetaion of A* useful for stuct, based on train implementation
Documentation
  • Coverage
  • 0%
    0 out of 7 items documented0 out of 6 items with examples
  • Size
  • Source code size: 13.57 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 1.38 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 9s Average build duration of successful builds.
  • all releases: 9s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • Homepage
  • Dah-phd/a-star_traitbased
    0 1 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • Dah-phd

A* for stuctures

This is a barebone implementation of A* that uses a structure as a base. It can be vary useful if you have already a structure that includes movement, being a game, animation, or some form of structe that is alredy able to determine possilbe path.

Implementation:

  • implement the PathGenerator train on the structure;
  • call AStar::run(from_struct: Box<&T: PathGenerator>, start: (usize, usize), target: (Option, Option)) -> Option<Vec<(usize, usize)>>

Notes:

Expected struct should work with 2D positional arguments (x, y), that are numeric. PathGenerator will requite the implementation of:

  • generate_paths -> logic used to generate possible path from positions (here is the place to inclde road blocks and additional logic);
  • calculate_cost -> logic used to derive cost of transfer from position to next position;
  • calculate_heuristic_cost -> logic used to derive relative cost to the target;

AStar::run takes a target that can have either both x and y (or exact point of arival) or only one (x or y), reaching a side of the map.

AStar::run returns Option for a Vector of position leading from the target back to the start or None if there is no path available.

  • This is an implemetaion that I use in a project but could be useful to other, so I decided to share it.