use of bomb.modules.dh.hexamaze.hexalgorithm.storage.HexagonalPlane in project GradleCenturion by Ultraviolet-Ninja.
the class MazeSearch method searchPillar.
private static Grid searchPillar(BufferedQueue<BufferedQueue<HexNode>> pillar, Grid grid) {
int gridSideLength = grid.getHexagon().getSideLength();
trimPillar(pillar);
HexagonalPlane copiedHexagon = new HexagonalPlane(createInitialCopy(pillar, gridSideLength), gridSideLength);
HexagonalPlane originalGrid = grid.getHexagon();
Grid output = compareFullRotation(originalGrid, copiedHexagon);
while (output == null && isNotColumnEmpty(pillar)) {
moveToNextSegment(pillar, copiedHexagon);
output = compareFullRotation(originalGrid, copiedHexagon);
}
return output;
}
use of bomb.modules.dh.hexamaze.hexalgorithm.storage.HexagonalPlane in project GradleCenturion by Ultraviolet-Ninja.
the class Hexamaze method solve.
@NotNull
public static Quartet<@NotNull Grid, @Nullable String, @Nullable Integer, @Nullable List<Coordinates>> solve(@NotNull List<HexNode> nodeList) throws IllegalArgumentException, IllegalStateException {
Maze maze = new Maze();
Grid original = new Grid(new HexagonalPlane(nodeList));
Grid found = MazeSearch.search(maze, original).orElseThrow(() -> {
throw new IllegalArgumentException("Could not find maze from given shapes");
});
int colorValue = copyPegLocation(original, found);
Optional<Pair<String, List<Coordinates>>> exitInfoOptional = ExitChecker.findPossibleExits(found);
if (exitInfoOptional.isEmpty())
return new Quartet<>(found, null, null, null);
Pair<String, List<Coordinates>> exitInfo = exitInfoOptional.get();
return new Quartet<>(found, exitInfo.getValue0(), colorValue, MazeRunner.runMaze(found, exitInfo.getValue1()));
}
Aggregations