public Maze(int size,int startCellRow,int startCellColumn) { this.Size = size; this.maze = new char[this.size, this.size]; this.startCell=new Cell(startCellRow,startCellColumn,0); this.maze[startCellRow,startCellColumn]='*'; this.path = new List<Cell>(); }
public void AddParent(Cell c) { this.parentCell = c; }
public Cell(Cell c) : this(c.row, c.column, c.distance) { }
private void VisitedCell(Queue<Cell> visitedCells, int row, int column, int distance,Cell parent) { if (this.maze[row, column] != 'x' && this.maze[row,column]!='v') //'v' marks visited cells { this.maze[row, column] = 'v'; Cell cell = new Cell(row, column, distance); cell.AddParent(parent); visitedCells.Enqueue(cell); } }
private List<Cell> getPath(Cell c) { List<Cell> path=new List<Cell>(); Cell currentCell = c; while (currentCell.parentCell != null) { path.Add(currentCell.parentCell); currentCell = currentCell.parentCell; } return path; }