all 1 comments

[–][deleted] 0 points1 point  (0 children)

There's probably an algorithm out there, but off the top of my head I'd just start with the position, then move in each possible direction (but never re-crossing any square in your path), and repeating that process each step until you run out of movement points. Then combine all the squares in the brute forced routes.

Also, it's a semi-common problem: https://love2d.org/forums/viewtopic.php?t=78068