How could this be done? Obviously, we have SearchGoal trait which has is_goal function that is going to be called on each node traversed. However, it looks like we'll need to pass &mut SearchGoal or mut SearchGoal instead of SearchGoal to make this work (so it can collect the traversed states)?
I think providing a way to inserting a callbacks into traversal is a very cool idea in general. Any ideas how this should be done?
There's now an example in the tests which verifies correctness of None return value (229d3a702b769411d41f42283cd30efae2d0f66c) -- the trick is to use RefCell in SearchGoal.
@jpastuszek
I was thinking of making a demo visualizing how these algorithms traverse a generated maze (see e.g. http://weblog.jamisbuck.org/2011/2/7/maze-generation-algorithm-recap) -- then printing it to console via
term
crate or maybe even converting it to json and uploading to http://asciinema.org.How could this be done? Obviously, we have
SearchGoal
trait which hasis_goal
function that is going to be called on each node traversed. However, it looks like we'll need to pass&mut SearchGoal
ormut SearchGoal
instead ofSearchGoal
to make this work (so it can collect the traversed states)?I think providing a way to inserting a callbacks into traversal is a very cool idea in general. Any ideas how this should be done?