drawPath method

void drawPath(
  1. List<List<int>>? maps,
  2. DFAStarNode? end
)

在二维数组中绘制路径

Implementation

void drawPath(List<List<int>>? maps, DFAStarNode? end) {
  if (end == null || maps == null) return;
  print("总代价:" + end.G.toString());
  while (end != null) {
    DFTilePosition c = end.position!;
    maps[c.y][c.x] = PATH;
    end = end.parent;
    _pathList.add(DFTilePosition(c.x, c.y));
  }
}