This is a question related to another question where you helped me a lot.
My new question is, is there a way to print the found path from the source
cell to the target
cell? Or, is there a way to get only the first move from pred
without iterating all of it?
In the (Very helpful) answer I received in the other question I was suggested to get the path from target
to source
, that is very useful but in order to improve my code I'd the path from source
to target
.
My problem is that I'm trying to write a rogue-like game and I have to tell a monster which will be his next move and I think iterating all of the pred
array in order to get a single move it's a waste of resources.
Thank you in advance for the help.