예제 #1
0
        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));
                }
            }
        }
예제 #2
0
        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));
                }
            }
        }