static void Main(string[] args) { Console.WriteLine(ConvertMinH(1, 0)); ManhatanGrid c = new ManhatanGrid(60, 60); ManhatanGrid v = new ManhatanGrid(40, 40); Console.WriteLine(manhattanD(c, v)); Console.ReadLine(); }
public static int manhattanD(ManhatanGrid x1, ManhatanGrid x2) { int x = 0; if (x1.Heightpos > x2.Heightpos) { x = x + diff(x1.Heightpos, x2.Heightpos); } else { x = x + diff(x2.Heightpos, x1.Heightpos); } if (x1.Widthpos > x2.Widthpos) { x = x + diff(x1.Widthpos, x2.Widthpos); } else { x = x + diff(x2.Widthpos, x1.Widthpos); } return(x); }