Using breadthfirst, the program show how to explore all positions of the grid. It’s a good start for a pathfinding algorithm.
I think i need it
I hope the code and comment are clear enough. My source is https://www.redblobgames.com/pathfinding/a-star/introduction.html