Closed Horned-Nonsense closed 8 months ago
Hi @Horned-Nonsense ! Thanks so much for contributing! Some times we want not diagonal movement. Why did you remove withDiagonal param?
Hello @RafaelBarbosatec. Perhaps I was a little hasty in deleting it. After submitting the PR, I thought that not having diagonal transitions makes sense, for example if it's an obstacle in the game like a diagonal wall, so I could leave the diagonal clearance check. But if we consider the algorithm abstractly, then the possibility of diagonal moves should be preserved without taking into account the walls in the neighborhood.
@RafaelBarbosatec I return it back.
LGTM! Thanks for contributing!
This allows us to move diagonally directly and makes the algorithm more versatile and also reduces the number of iterations. Exmpl grid:
XOOXE XXOOX XOOXX XOXXO SXOOX
Where: S - start, E - end, X - barrier, O - free space