1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
use crateGetRangeTo;
/// Helper function to create a heuristic cost function closure for a single goal node.
///
/// This heuristic cost is simply the range between the provided node and the goal node.
///
/// If using the convenience functions for common pathfinding use-cases,
/// you will not normally need to use this function.
///
/// # Examples
/// ```rust
/// use screeps::RoomXY;
/// use screeps_pathfinding::utils::goals::goal_exact_node;
/// use screeps_pathfinding::utils::heuristics::heuristic_get_range_to;
///
/// let start = RoomXY::checked_new(24, 18).unwrap();
/// let goal = RoomXY::checked_new(34, 40).unwrap();
/// let cost_fn = |_| Some(1);
/// screeps_pathfinding::algorithms::astar::shortest_path_roomxy(
/// start,
/// &goal_exact_node(goal),
/// cost_fn,
/// &heuristic_get_range_to(goal),
/// );
/// Helper function to create a heuristic cost function closure for multiple goal nodes.
///
/// This heuristic cost is simply the minimum range between the provided node and each of the goal nodes.
///
/// If using the convenience functions for common pathfinding use-cases,
/// you will not normally need to use this function.
///
/// # Examples
/// ```rust
/// use screeps::RoomXY;
/// use screeps_pathfinding::utils::goals::goal_exact_node_multigoal;
/// use screeps_pathfinding::utils::heuristics::heuristic_get_range_to_multigoal;
///
/// let start = RoomXY::checked_new(24, 18).unwrap();
/// let goal_a = RoomXY::checked_new(34, 40).unwrap();
/// let goal_b = RoomXY::checked_new(34, 45).unwrap();
/// let goals = &[goal_a, goal_b];
/// let cost_fn = |_| Some(1);
/// screeps_pathfinding::algorithms::astar::shortest_path_roomxy(
/// start,
/// &goal_exact_node_multigoal(goals),
/// cost_fn,
/// &heuristic_get_range_to_multigoal(goals),
/// );
+ '_