There are various points in a Grid.
Say (x,y) can be reached from (x-1,y+1) in a single unit of time. then what would be the general formula for finding distance between a point (x1,y1) to (x2,y2).
say for (0,0) to (-2,-1) i.e. coordinate can be negative too.
I could not think of general formula.
If I understand the question correctly, and diagonal movements have the same cost as “manhattan” movements, it’s cheaper than the manhattan distance in most cases — only the maximum of the x and y distances is relevant:
max(abs(x1 – x2), abs(y1 – y2))
Basically you move diagonally at cost 1 per unit until you have reached x2 or y2, then along the grid.