예제 #1
0
    private OperationOutput.Episode DoRefill()
    {
        var ret = new OperationOutput.Episode(OperationOutput.EpisodeType.REFILL);

        ret.refillFlow  = refillRule.Apply(foreground);
        ret.refillSlots = new SlotAttribute[foreground.Height, foreground.Width];

        foreground.ForeachSlot((x, y, slot) => {
            if (null == foreground.WrapperRect[y, x])
            {
                background.ClearSlot(x, y);
                background.FillSlot(x, y);
            }
        });
        MakeContainerStable(background);
        background.ForeachSlot((x, y, slot) => {
            if (slot.slotAttribute.category != SlotAttribute.Category.INSULATOR)
            {
                foreground.SetSlot(x, y, slot);
            }
        });
        background.FlushAsFirmware();
        foreground.ForeachSlot((x, y, slot) => {
            ret.refillSlots[y, x] = slot.slotAttribute;
        });
        return(ret);
    }
예제 #2
0
    private void MakeContainerStable(Container2D_Rectangular container)
    {
        var lmRecords = SeekContainerLM(container);

        if (lmRecords.Count <= 0)
        {
            return;
        }
        var sandbox = CollectContainerEliminate(container, lmRecords);

        container.ForeachSlot((x, y, slot) => {
            if (sandbox[y, x])
            {
                container.ClearSlot(x, y);
                container.FillSlot(x, y);
            }
        });
        MakeContainerStable(container);
    }