// Adds all trees that are adjacent to a burning cell to the list of cells to burn private void SpreadFire(Cell cell) { foreach (Cell neighbour in cell.FindNeighbours()) { if (neighbour.GetStatus() == '&') { cellsToBurn.Add(neighbour); } } }
// Only used in the calculation of NumberOfIslands() // Change all trees in the island to empty cells private void WipeNeighbours(Cell cell) { cell.SetStatus(' '); foreach (Cell neighbour in cell.FindNeighbours()) { if (neighbour.GetStatus() == '&') { WipeNeighbours(neighbour); } } }