Search in sources :

Example 1 with HexNode

use of bomb.modules.dh.hexamaze.hexalgorithm.storage.HexNode in project GradleCenturion by Ultraviolet-Ninja.

the class MazeSearch method moveToNextSegment.

private static void moveToNextSegment(BufferedQueue<BufferedQueue<HexNode>> pillar, HexagonalPlane copy) {
    BufferedQueue<BufferedQueue<HexNode>> copiedQueues = copy.getBufferedQueues();
    for (BufferedQueue<HexNode> column : copiedQueues) column.removeFirst();
    int index = 0;
    for (BufferedQueue<HexNode> column : pillar) {
        HexNode nextNode = column.removeFirst();
        copiedQueues.get(index++).add(nextNode);
    }
}
Also used : BufferedQueue(bomb.tools.data.structures.queue.BufferedQueue) HexNode(bomb.modules.dh.hexamaze.hexalgorithm.storage.HexNode)

Example 2 with HexNode

use of bomb.modules.dh.hexamaze.hexalgorithm.storage.HexNode in project GradleCenturion by Ultraviolet-Ninja.

the class MazeRunner method findStartingLocation.

private static Coordinates findStartingLocation(Grid grid) {
    BufferedQueue<BufferedQueue<HexNode>> gridQueues = grid.getHexagon().getBufferedQueues();
    int size = gridQueues.size();
    for (int x = 0; x < size; x++) {
        BufferedQueue<HexNode> column = gridQueues.get(x);
        for (int y = 0; y < column.size(); y++) {
            HexNode currentNode = column.get(y);
            if (currentNode.getColor() != -1)
                return new Coordinates(x, y);
        }
    }
    throw new RuntimeException("Failed to find start position");
}
Also used : BufferedQueue(bomb.tools.data.structures.queue.BufferedQueue) HexNode(bomb.modules.dh.hexamaze.hexalgorithm.storage.HexNode) Coordinates(bomb.tools.Coordinates)

Example 3 with HexNode

use of bomb.modules.dh.hexamaze.hexalgorithm.storage.HexNode in project GradleCenturion by Ultraviolet-Ninja.

the class ExitCheckerTest method setPegLocations.

public static void setPegLocations(@NotNull Grid grid, Set<Integer> locations) {
    BufferedQueue<BufferedQueue<HexNode>> gridQueues = grid.getHexagon().getBufferedQueues();
    int locationCounter = 0;
    for (BufferedQueue<HexNode> column : gridQueues) {
        for (HexNode node : column) {
            if (locations.contains(locationCounter++))
                node.setColor(RED_PEG_VALUE);
        }
    }
}
Also used : BufferedQueue(bomb.tools.data.structures.queue.BufferedQueue) HexNode(bomb.modules.dh.hexamaze.hexalgorithm.storage.HexNode)

Example 4 with HexNode

use of bomb.modules.dh.hexamaze.hexalgorithm.storage.HexNode in project GradleCenturion by Ultraviolet-Ninja.

the class MazeRunner method mapSingleNode.

private static void mapSingleNode(Grid grid, Graph<Coordinates, DefaultEdge> graph, HexWall correspondingWall, Coordinates from, Coordinates to) {
    HexNode currentNode = grid.getAtCoordinates(from);
    HexNode checkExists = grid.getAtCoordinates(to);
    if (checkExists == null || currentNode.isPathBlocked(correspondingWall))
        return;
    graph.addVertex(from);
    graph.addVertex(to);
    graph.addEdge(from, to);
}
Also used : HexNode(bomb.modules.dh.hexamaze.hexalgorithm.storage.HexNode)

Aggregations

HexNode (bomb.modules.dh.hexamaze.hexalgorithm.storage.HexNode)4 BufferedQueue (bomb.tools.data.structures.queue.BufferedQueue)3 Coordinates (bomb.tools.Coordinates)1