Search in sources :

Example 1 with MultiblockShapeInfo

use of com.lowdragmc.multiblocked.api.pattern.MultiblockShapeInfo in project Multiblocked by Low-Drag-MC.

the class ControllerDefinition method autoGenDFS.

private List<MultiblockShapeInfo> autoGenDFS(BlockPattern structurePattern, List<MultiblockShapeInfo> pages, Stack<Integer> repetitionStack) {
    int[][] aisleRepetitions = structurePattern.aisleRepetitions;
    if (repetitionStack.size() == aisleRepetitions.length) {
        int[] repetition = new int[repetitionStack.size()];
        for (int i = 0; i < repetitionStack.size(); i++) {
            repetition[i] = repetitionStack.get(i);
        }
        pages.add(new MultiblockShapeInfo(structurePattern.getPreview(repetition)));
    } else {
        for (int i = aisleRepetitions[repetitionStack.size()][0]; i <= aisleRepetitions[repetitionStack.size()][1]; i++) {
            repetitionStack.push(i);
            autoGenDFS(structurePattern, pages, repetitionStack);
            repetitionStack.pop();
        }
    }
    return pages;
}
Also used : MultiblockShapeInfo(com.lowdragmc.multiblocked.api.pattern.MultiblockShapeInfo)

Aggregations

MultiblockShapeInfo (com.lowdragmc.multiblocked.api.pattern.MultiblockShapeInfo)1