Search in sources :

Example 1 with Coordinates

use of bomb.tools.Coordinates in project GradleCenturion by Ultraviolet-Ninja.

the class OldMazeRunner method startingPointCalculator.

private static void startingPointCalculator(int location) {
    if (location < 4)
        currentLocation = new Coordinates(0, location);
    else if (location < 9)
        currentLocation = new Coordinates(1, location - 4);
    else if (location < 15)
        currentLocation = new Coordinates(2, location - 9);
    else if (location < 22)
        currentLocation = new Coordinates(3, location - 15);
    else if (location < 28)
        currentLocation = new Coordinates(4, location - 22);
    else if (location < 33)
        currentLocation = new Coordinates(5, location - 28);
    else
        currentLocation = new Coordinates(6, location - 33);
}
Also used : Coordinates(bomb.tools.Coordinates)

Example 2 with Coordinates

use of bomb.tools.Coordinates in project GradleCenturion by Ultraviolet-Ninja.

the class OldMazeRunner method popMoveOff.

private static void popMoveOff() {
    historyStack.pop();
    currentLocation = new Coordinates(historyStack.getTopKey());
}
Also used : Coordinates(bomb.tools.Coordinates)

Example 3 with Coordinates

use of bomb.tools.Coordinates in project GradleCenturion by Ultraviolet-Ninja.

the class OldMazeRunner method findExit.

private static LinkedList<Coordinates> findExit(HexGrid gatedGrid, final String wallOrder) {
    Hex.HexNode playerPosition = gatedGrid.retrieveNode(currentLocation);
    historyStack.push(new Coordinates(currentLocation), playerPosition.checkExits() + 1);
    return traverseStartingNode(gatedGrid, wallOrder);
}
Also used : Coordinates(bomb.tools.Coordinates)

Example 4 with Coordinates

use of bomb.tools.Coordinates in project GradleCenturion by Ultraviolet-Ninja.

the class HexamazeController method fillHexTiles.

private static void fillHexTiles(List<HexTile> tileList, List<Coordinates> coordinatesList, int colorValue) {
    Color color = RED;
    for (Map.Entry<Color, Integer> entry : COLOR_MAP.entrySet()) {
        if (entry.getValue() == colorValue)
            color = entry.getKey();
    }
    for (HexTile hexTile : tileList) hexTile.setBackgroundFill(DEFAULT_BACKGROUND_COLOR);
    BufferedQueue<BufferedQueue<HexTile>> tileQueues = HexagonalPlane.convertFromList(tileList);
    Color finalColor = color;
    coordinatesList.stream().map(c -> tileQueues.get(c.x()).get(c.y())).forEach(tile -> tile.setBackgroundFill(finalColor));
}
Also used : Alert(javafx.scene.control.Alert) Color(javafx.scene.paint.Color) Grid(bomb.modules.dh.hexamaze.hexalgorithm.storage.Grid) Label(javafx.scene.control.Label) Resettable(bomb.abstractions.Resettable) MazeComponent(bomb.components.hex.MazeComponent) GET_TOGGLE_NAME(bomb.tools.pattern.facade.FacadeFX.GET_TOGGLE_NAME) HexagonalPlane(bomb.modules.dh.hexamaze.hexalgorithm.storage.HexagonalPlane) RED(javafx.scene.paint.Color.RED) HexNode(bomb.modules.dh.hexamaze.hexalgorithm.storage.HexNode) Coordinates(bomb.tools.Coordinates) FXML(javafx.fxml.FXML) Quartet(org.javatuples.Quartet) ToggleGroup(javafx.scene.control.ToggleGroup) List(java.util.List) RadioButton(javafx.scene.control.RadioButton) Map(java.util.Map) DEFAULT_BACKGROUND_COLOR(bomb.components.hex.HexTile.DEFAULT_BACKGROUND_COLOR) HexTile(bomb.components.hex.HexTile) FacadeFX(bomb.tools.pattern.facade.FacadeFX) COLOR_MAP(bomb.modules.dh.hexamaze.Hexamaze.COLOR_MAP) BufferedQueue(bomb.tools.data.structures.queue.BufferedQueue) BufferedQueue(bomb.tools.data.structures.queue.BufferedQueue) HexTile(bomb.components.hex.HexTile) Color(javafx.scene.paint.Color) Map(java.util.Map)

Example 5 with Coordinates

use of bomb.tools.Coordinates 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)

Aggregations

Coordinates (bomb.tools.Coordinates)16 Grid (bomb.modules.dh.hexamaze.hexalgorithm.storage.Grid)4 List (java.util.List)4 HexNode (bomb.modules.dh.hexamaze.hexalgorithm.storage.HexNode)3 BufferedQueue (bomb.tools.data.structures.queue.BufferedQueue)3 Pair (org.javatuples.Pair)3 NotNull (org.jetbrains.annotations.NotNull)3 HexagonalPlane (bomb.modules.dh.hexamaze.hexalgorithm.storage.HexagonalPlane)2 Maze (bomb.modules.dh.hexamaze.hexalgorithm.storage.Maze)2 Quartet (org.javatuples.Quartet)2 DefaultEdge (org.jgrapht.graph.DefaultEdge)2 SimpleGraph (org.jgrapht.graph.SimpleGraph)2 Resettable (bomb.abstractions.Resettable)1 HexTile (bomb.components.hex.HexTile)1 DEFAULT_BACKGROUND_COLOR (bomb.components.hex.HexTile.DEFAULT_BACKGROUND_COLOR)1 MazeComponent (bomb.components.hex.MazeComponent)1 COLOR_MAP (bomb.modules.dh.hexamaze.Hexamaze.COLOR_MAP)1 AbstractHexagon.calculateColumnLengthArray (bomb.modules.dh.hexamaze.hexalgorithm.storage.AbstractHexagon.calculateColumnLengthArray)1 GRID_SIDE_LENGTH (bomb.modules.dh.hexamaze.hexalgorithm.storage.Grid.GRID_SIDE_LENGTH)1 HexWall (bomb.modules.dh.hexamaze.hexalgorithm.storage.HexNode.HexWall)1