public void PropagateGlobally() { Stack <WfcCell <TModule, TPosition> > updateStack = new (GetCells()); while (updateStack.Any()) { WfcCell <TModule, TPosition> currentCell = updateStack.Pop(); var wereElementsRemoved = currentCell.RemoveInvalidModules(this); if (wereElementsRemoved) { GetNeighbors(currentCell).ForEach(wfcCell => updateStack.Push(wfcCell)); } } }
protected virtual void PropagateResult(WfcCell <TModule, TPosition> cell) { Stack <WfcCell <TModule, TPosition> > updateStack = new (GetNeighbors(cell)); while (updateStack.Any()) { WfcCell <TModule, TPosition> currentCell = updateStack.Pop(); var wereElementsRemoved = currentCell.RemoveInvalidModules(this); if (wereElementsRemoved) { GetNeighbors(currentCell).ForEach(wfcCell => updateStack.Push(wfcCell)); } } }