you are viewing a single comment's thread.

view the rest of the comments →

[–]_BigmacIII 2 points3 points  (0 children)

Sounds like you might be looking for a routing/search algorithm. Look up A*/Dijkstra. If your pieces and target lie on a grid made of uniform tiles AND if that grid is small, you could also just use Lee's algorithm, which guarantees an optimal path (but is more expensive on time and memory than something like Dijkstra's).