It may need it's own class...
but it can be a function of the map. (It's not that hard)
Basically, you use Dijkstra's (or Floyd's) algorithm to find the shortest path - with movement modifiers representing the resistance.
But I'd probably put it in it's own class - only because you want to pass into it the movement types available to the unit so that it can compute shortest possible distance regardless of the type of the unit.
It may need it's own class...
but it can be a function of the map. (It's not that hard)
Basically, you use Dystra (or the other guy..damn, need to look it up) algorithm to find the shortest path - with movement modifiers representing the resistance.
It may need it's own class...
but it can be a function of the map. (It's not that hard)
Basically, you use Dijkstra's (or Floyd's) algorithm to find the shortest path - with movement modifiers representing the resistance.