Closed TheCGDF closed 1 month ago
The successors
function is a FnMut
and can capture a counter, you can use it to limit find steps. For example:
let mut steps = 0; // steps will be captured in the lambda and will be incremented at each step
let successors = |n| {
if steps > 100 { vec![] } else { steps += 1; real_successors_in_vec(n) }
}
let … = astar(…, successors, …);
…
Okay, this is a solution.
Actually, I asked ChatGPT
and he told me I must remove pathfinding
and implement astar
from zero by myself.🥲
I'm using
astar()
but I find it does not have a parameter to stop finding when meet some conditions (and returnNone
) ?Is it possible to do it?