public double GridDistance(CCell p_goalCell) { int dx = Math.Abs(X - p_goalCell.X); int dy = Math.Abs(Y - p_goalCell.Y); return(Math.Max(dx, dy)); }
public double EuclideanDistance(CCell p_goalCell) { int dx = X - p_goalCell.X; int dy = Y - p_goalCell.Y; return(Math.Sqrt(dx * dx + dy * dy)); }
public double ManhattanDistance(CCell p_goalCell) { int dx = Math.Abs(X - p_goalCell.X); int dy = Math.Abs(Y - p_goalCell.Y); return(dx + dy); }
protected void BuildGrid() { m_cells = new CCell[m_width, m_height]; for (int x = 0; x < m_width; x++) { for (int y = 0; y < m_height; y++) { CCell c = new CCell(this, x, y); m_cells[x, y] = c; } } }