public ArrayList<Point> pathFrom(int r, int c) {
		path.add(new Point(r,c));

		int row = r, col = c;

		if(fP.hasExitAt(r, c))
			return path;

		int bestDist = distances[r][c];

		if(isValid(r - 1,c) && distances[r -1][c] < bestDist){
			row = r -1;
			col = c;
		}
		if(isValid(r + 1,c) && distances[r + 1][c] < bestDist){
			row = r + 1;
			col = c;
		}
		if(isValid(r,c - 1) && distances[r][c - 1] < bestDist){
			row = r;
		col = c - 1;
		}
		if(isValid(r,c + 1) && distances[r][c + 1] < bestDist){
			row = r;
		col = c + 1;
		}

	return pathFrom(row, col);

}