Skip to content

Commit 3de044a

Browse files
committed
clarify astar heuristic rules
1 parent d18d3a3 commit 3de044a

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/primitive/defs.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2440,6 +2440,8 @@ primitive!(
24402440
/// - An array of the neighboring nodes must always be returned.
24412441
/// - An array of costs may be returned above the nodes array on the stack. If ommitted, all costs are assumed to be 1.
24422442
/// The second function should return a heuristic cost to reach the goal node.
2443+
/// - The heuristic may return a value [less or equal] the actual cost
2444+
/// - It must *never* overestimate the cost, or the algorithm may not find the shortest path
24432445
/// The third function should return whether or not the goal node has been reached.
24442446
///
24452447
/// When called, [astar] will pop any additional arguments its functions need from the stack.

0 commit comments

Comments
 (0)