From 504d80dead54986c2f7c194c1f148ae1776fe789 Mon Sep 17 00:00:00 2001 From: jasmine-jragon Date: Sun, 2 Jan 2022 19:54:19 -0600 Subject: [PATCH 01/86] Uncommented the timer --- src/main/java/bomb/ManualController.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/bomb/ManualController.java b/src/main/java/bomb/ManualController.java index 0f17e857..7ea24729 100644 --- a/src/main/java/bomb/ManualController.java +++ b/src/main/java/bomb/ManualController.java @@ -85,10 +85,10 @@ public void initialize() throws ExecutionException, InterruptedException { ); ObserverHub.addObserver(FORGET_ME_NOT_TOGGLE, new ForgetMeNotToggleObserver(forgetMeNot)); ObserverHub.addObserver(SOUVENIR_TOGGLE, new SouvenirToggleObserver(souvenir)); -// long start = System.nanoTime(); + long start = System.nanoTime(); regionMap = setupRegionMap().get(); -// long stop = System.nanoTime(); -// System.out.printf("Timer: %,d%n", stop - start); + long stop = System.nanoTime(); + System.out.printf("Timer: %,d%n", stop - start); } private CompletableFuture> setupRegionMap() throws ExecutionException, InterruptedException { From e2622e838d572acb5cf8479f9bc2ee79f4a80025 Mon Sep 17 00:00:00 2001 From: "Mr. J" <45538844+Ultraviolet-Ninja@users.noreply.github.com> Date: Sat, 8 Jan 2022 14:40:34 -0600 Subject: [PATCH 02/86] Completed the rewrite of Hexamaze --- .../components/hex/HexMazePanel.java | 0 .../journals/old_code/hexamaze/Hexamaze.java | 171 ++++++++++++++ .../old_code/hexamaze/HexamazeController.java | 171 ++++++++++++++ .../hexalgorithm/AbstractHexagon.java | 0 .../hexamaze/hexalgorithm/HexGrid.java | 0 .../hexalgorithm/HexNodeProperties.java | 0 .../hexalgorithm/HexagonDataStructure.java | 0 .../old_code}/hexamaze/hexalgorithm/Maze.java | 0 .../maze_finding/HexHashLibrary.java | 0 .../pathfinding/HexPanelFiller.java | 0 .../hexalgorithm/pathfinding/MazeRunner.java | 199 ++++++++++++++++ .../tests}/maze_finding/MazeFinderTest.java | 0 .../java/bomb/components/hex/HexTile.java | 14 +- .../bomb/components/hex/MazeComponent.java | 16 +- .../bomb/modules/dh/hexamaze/Hexamaze.java | 206 ++++++---------- .../dh/hexamaze/HexamazeController.java | 156 ++---------- .../hexalgorithm/factory/MazeFactory.java | 27 +-- .../hexalgorithm/maze_finding/MazeSearch.java | 14 +- .../hexalgorithm/pathfinding/ExitChecker.java | 34 +-- .../hexalgorithm/pathfinding/MazeRunner.java | 223 +++++------------- .../hexalgorithm/storage/AbstractHexagon.java | 2 +- .../hexalgorithm/storage/Grid.java | 2 +- .../hexalgorithm/storage/HexNode.java | 2 +- .../hexalgorithm/storage/HexagonalPlane.java | 32 +-- .../hexalgorithm/storage/Maze.java | 4 +- .../dh/hexamaze_redesign/Hexamaze.java | 91 ------- .../hexamaze_redesign/HexamazeController.java | 60 ----- .../hexalgorithm/pathfinding/MazeRunner.java | 94 -------- src/main/java/module-info.java | 4 +- src/main/resources/bomb/fxml/dh/hexamaze.fxml | 51 +--- .../resources/bomb/fxml/dh/new_hexamaze.fxml | 26 -- .../hexalgorithm/{ => factory}/maze.csv | 0 .../hexalgorithm/factory/maze.csv | 23 -- .../maze_finding/MazeRunnerTest.java | 14 +- .../pathfinding}/ExitCheckerTest.java | 14 +- .../pathfinding/MazeSearchTest.java | 16 +- src/test/resources/suites/suiteOne.xml | 6 +- 37 files changed, 807 insertions(+), 865 deletions(-) rename {src/main/java/bomb => documentation/journals/old_code}/components/hex/HexMazePanel.java (100%) create mode 100644 documentation/journals/old_code/hexamaze/Hexamaze.java create mode 100644 documentation/journals/old_code/hexamaze/HexamazeController.java rename {src/main/java/bomb/modules/dh => documentation/journals/old_code}/hexamaze/hexalgorithm/AbstractHexagon.java (100%) rename {src/main/java/bomb/modules/dh => documentation/journals/old_code}/hexamaze/hexalgorithm/HexGrid.java (100%) rename {src/main/java/bomb/modules/dh => documentation/journals/old_code}/hexamaze/hexalgorithm/HexNodeProperties.java (100%) rename {src/main/java/bomb/modules/dh => documentation/journals/old_code}/hexamaze/hexalgorithm/HexagonDataStructure.java (100%) rename {src/main/java/bomb/modules/dh => documentation/journals/old_code}/hexamaze/hexalgorithm/Maze.java (100%) rename {src/main/java/bomb/modules/dh => documentation/journals/old_code}/hexamaze/hexalgorithm/maze_finding/HexHashLibrary.java (100%) rename {src/main/java/bomb/modules/dh => documentation/journals/old_code}/hexamaze/hexalgorithm/pathfinding/HexPanelFiller.java (100%) create mode 100644 documentation/journals/old_code/hexamaze/hexalgorithm/pathfinding/MazeRunner.java rename {src/test/java/bomb/modules/dh/hexamaze/hexalgorithm => documentation/journals/old_code/tests}/maze_finding/MazeFinderTest.java (100%) rename src/main/java/bomb/modules/dh/{hexamaze_redesign => hexamaze}/hexalgorithm/factory/MazeFactory.java (55%) rename src/main/java/bomb/modules/dh/{hexamaze_redesign => hexamaze}/hexalgorithm/maze_finding/MazeSearch.java (90%) rename src/main/java/bomb/modules/dh/{hexamaze_redesign => hexamaze}/hexalgorithm/pathfinding/ExitChecker.java (80%) rename src/main/java/bomb/modules/dh/{hexamaze_redesign => hexamaze}/hexalgorithm/storage/AbstractHexagon.java (95%) rename src/main/java/bomb/modules/dh/{hexamaze_redesign => hexamaze}/hexalgorithm/storage/Grid.java (95%) rename src/main/java/bomb/modules/dh/{hexamaze_redesign => hexamaze}/hexalgorithm/storage/HexNode.java (97%) rename src/main/java/bomb/modules/dh/{hexamaze_redesign => hexamaze}/hexalgorithm/storage/HexagonalPlane.java (82%) rename src/main/java/bomb/modules/dh/{hexamaze_redesign => hexamaze}/hexalgorithm/storage/Maze.java (77%) delete mode 100644 src/main/java/bomb/modules/dh/hexamaze_redesign/Hexamaze.java delete mode 100644 src/main/java/bomb/modules/dh/hexamaze_redesign/HexamazeController.java delete mode 100644 src/main/java/bomb/modules/dh/hexamaze_redesign/hexalgorithm/pathfinding/MazeRunner.java delete mode 100644 src/main/resources/bomb/fxml/dh/new_hexamaze.fxml rename src/main/resources/bomb/modules/dh/hexamaze/hexalgorithm/{ => factory}/maze.csv (100%) delete mode 100644 src/main/resources/bomb/modules/dh/hexamaze_redesign/hexalgorithm/factory/maze.csv rename src/test/java/bomb/modules/dh/{hexamaze_redesign => hexamaze}/hexalgorithm/maze_finding/MazeRunnerTest.java (63%) rename src/test/java/bomb/modules/dh/{hexamaze_redesign/hexalgorithm/maze_finding => hexamaze/hexalgorithm/pathfinding}/ExitCheckerTest.java (80%) rename src/test/java/bomb/modules/dh/{hexamaze_redesign => hexamaze}/hexalgorithm/pathfinding/MazeSearchTest.java (74%) diff --git a/src/main/java/bomb/components/hex/HexMazePanel.java b/documentation/journals/old_code/components/hex/HexMazePanel.java similarity index 100% rename from src/main/java/bomb/components/hex/HexMazePanel.java rename to documentation/journals/old_code/components/hex/HexMazePanel.java diff --git a/documentation/journals/old_code/hexamaze/Hexamaze.java b/documentation/journals/old_code/hexamaze/Hexamaze.java new file mode 100644 index 00000000..1df38d84 --- /dev/null +++ b/documentation/journals/old_code/hexamaze/Hexamaze.java @@ -0,0 +1,171 @@ +package bomb.modules.dh.hexamaze; + +import bomb.Widget; +import bomb.components.hex.HexMazePanel; +import bomb.modules.dh.hexamaze.hexalgorithm.HexGrid; +import bomb.modules.dh.hexamaze.hexalgorithm.HexNodeProperties.HexShape; +import bomb.modules.dh.hexamaze.hexalgorithm.HexagonDataStructure.HexNode; +import bomb.modules.dh.hexamaze.hexalgorithm.Maze; +import bomb.modules.dh.hexamaze.hexalgorithm.maze_finding.HexHashLibrary; +import bomb.modules.dh.hexamaze.hexalgorithm.pathfinding.HexPanelFiller; +import bomb.modules.dh.hexamaze.hexalgorithm.pathfinding.MazeRunner; +import bomb.modules.s.souvenir.Souvenir; +import bomb.tools.Coordinates; +import javafx.scene.paint.Color; + +import java.util.ArrayList; +import java.util.List; + +import static bomb.modules.dh.hexamaze.hexalgorithm.HexagonDataStructure.nodalArea; +import static javafx.scene.paint.Color.BLUE; +import static javafx.scene.paint.Color.CYAN; +import static javafx.scene.paint.Color.GREEN; +import static javafx.scene.paint.Color.RED; +import static javafx.scene.paint.Color.YELLOW; + +public class Hexamaze extends Widget { + private final static List HEX_SHAPE_TRACKER; + + private static List panelList; + private static Color pegFillSelector, currentPegColor; + private static HexShape currentSelector; + private static int currentPegLocation; + private static HexGrid grid; + + static { + currentPegLocation = -1; + HEX_SHAPE_TRACKER = new ArrayList<>(); + setToNull(); + HexHashLibrary.initialize(new Maze(), (2 * HexGrid.STANDARD_SIDE_LENGTH) - 1); + } + + /** + * Sets all elements of the representation to null + */ + private static void setToNull() { + int nodalArea = nodalArea(HexGrid.STANDARD_SIDE_LENGTH); + for (int i = 0; i < nodalArea; i++) + HEX_SHAPE_TRACKER.add(null); + } + + /** + * Sets up the variables for the Hexamaze. This includes setting up the full maze, the Defuser's grid + * and an ArrayList representation of the grid + */ + public static void setupVariables(List panelArray) { + grid = new HexGrid(); + panelList = panelArray; + } + + /** + * Sets the selector to the shape corresponding ToggleButton + * + * @param button The name of the currently toggled ToggleButton + */ + public static void setShapeSelector(String button) { + switch (button) { + case "Erase" -> currentSelector = null; + case "Circle" -> currentSelector = HexShape.Circle; + case "Hexagon" -> currentSelector = HexShape.Hexagon; + case "Left Triangle" -> currentSelector = HexShape.LeftTriangle; + case "Right Triangle" -> currentSelector = HexShape.RightTriangle; + case "Up Triangle" -> currentSelector = HexShape.UpTriangle; + default -> currentSelector = HexShape.DownTriangle; + } + } + + public static void setPegFillSelector(Color fillColor) { + pegFillSelector = fillColor; + if (isSouvenirActive) { + Souvenir.addRelic("Hexamaze Pawn Color", getColorName(fillColor)); + } + } + + private static String getColorName(Color color) { + if (color == RED) return "Red"; + if (color == YELLOW) return "Yellow"; + if (color == GREEN) return "Green"; + if (color == CYAN) return "Cyan"; + if (color == BLUE) return "Blue"; + return "Pink"; + } + + /** + * Finds the HexMazePanel that's being hovered over to be filled with the currentShapeSelector + */ + public static void setShapeFill() { + for (int i = 0; i < panelList.size(); i++) { + if (panelList.get(i).isHover()) { + toFill(panelList.get(i), i); + i = panelList.size(); + } + } + } + + /** + * Sets the given HexMazePanel with the current Shape in the {@link Hexamaze currentSelector} + * + * @param panel The current HexMazePanel + * @param index Where it'll show up in array representation + */ + private static void toFill(HexMazePanel panel, int index) { + panel.setup(new HexNode(currentSelector, null)); + HEX_SHAPE_TRACKER.set(index, currentSelector); + } + + public static void setPegFillSelector() { + for (int i = 0; i < panelList.size(); i++) { + if (panelList.get(i).isHover()) { + if (currentPegLocation != -1) + deselectPreviousFill(panelList.get(currentPegLocation)); + toColorFill(panelList.get(i)); + currentPegLocation = i; + } + } + } + + private static void toColorFill(HexMazePanel panel) { + currentPegColor = pegFillSelector; + panel.fillPeg(currentPegColor); + } + + private static void deselectPreviousFill(HexMazePanel panel) { + panel.fillPeg(new Color(0.776, 0.766, 0.776, 1.0)); + } + + /** + * Fills the HexGrid with the array and sends it to the HexComparator to find the section of the maze + * + * @throws IllegalArgumentException No sub-maze was found in the maze + */ + public static void compareToFullMaze() throws IllegalArgumentException { + grid.fillWithShapes(HEX_SHAPE_TRACKER); + grid.resetColorRing(); + MazeRunner.getPegInformation(currentPegColor, currentPegLocation, grid.sideLength()); + HexGrid result = HexHashLibrary.find(grid); + if (result != null) decipherResults(result); + else throw new IllegalArgumentException("No resulting maze was found"); + } + + /** + * Outputs the discovered location to the HexMazePanels to show the wall locations + * + * @param hexGrid The discovered location of the HexGrid + */ + private static void decipherResults(HexGrid hexGrid) { + clearPreviousLines(); + List exitOrder = MazeRunner.runMaze(hexGrid); + List stream = hexGrid.hexport().exportToList(); + for (int i = 0; i < stream.size(); i++) panelList.get(i).setup(stream.get(i)); + if (exitOrder != null) HexPanelFiller.fillPanels(exitOrder, panelList, currentPegColor, grid.sideLength()); + } + + private static void clearPreviousLines() { + for (HexMazePanel hexMazePanel : panelList) + hexMazePanel.makeWallsTransparent(); + } + + public static void resetHexPanelList() { + for (HexMazePanel hexMazePanel : panelList) hexMazePanel.reset(); + } +} diff --git a/documentation/journals/old_code/hexamaze/HexamazeController.java b/documentation/journals/old_code/hexamaze/HexamazeController.java new file mode 100644 index 00000000..2a917a66 --- /dev/null +++ b/documentation/journals/old_code/hexamaze/HexamazeController.java @@ -0,0 +1,171 @@ +package bomb.modules.dh.hexamaze; + +import bomb.abstractions.Resettable; +import bomb.components.hex.HexMazePanel; +import bomb.modules.dh.hexamaze.hexalgorithm.pathfinding.MazeRunner; +import bomb.tools.pattern.facade.FacadeFX; +import javafx.fxml.FXML; +import javafx.scene.control.Alert; +import javafx.scene.control.Label; +import javafx.scene.control.RadioButton; +import javafx.scene.control.ToggleGroup; +import javafx.scene.paint.Color; + +import java.util.ArrayList; +import java.util.List; + +public class HexamazeController implements Resettable { + @FXML + private ToggleGroup hexGroup, hexColorGroup; + + @FXML + private HexMazePanel oneOne, oneTwo, oneThree, oneFour, + twoOne, twoTwo, twoThree, twoFour, twoFive, + threeOne, threeTwo, threeThree, threeFour, threeFive, threeSix, + fourOne, fourTwo, fourThree, fourFour, fourFive, fourSix, fourSeven, + fiveOne, fiveTwo, fiveThree, fiveFour, fiveFive, fiveSix, + sixOne, sixTwo, sixThree, sixFour, sixFive, + sevenOne, sevenTwo, sevenThree, sevenFour; + + @FXML + private RadioButton redButton, yellowButton, greenButton, cyanButton, blueButton, pinkButton; + + @FXML + private Label exitDirectionLabel; + + public void initialize() { + Hexamaze.setupVariables(transportPanels()); + } + + @FXML + private void setShape() { + toggleColorControl(); + if (!FacadeFX.getToggleName(hexGroup).equals("Peg")) + Hexamaze.setShapeSelector(FacadeFX.getToggleName(hexGroup)); + } + + private void toggleColorControl() { + boolean toggle = !FacadeFX.getToggleName(hexGroup).equals("Peg"); + if (toggle) + FacadeFX.disableMultiple(redButton, yellowButton, greenButton, cyanButton, blueButton, pinkButton); + else + FacadeFX.enableMultiple(redButton, yellowButton, greenButton, cyanButton, blueButton, pinkButton); + } + + @FXML + private void setPegFill() { + Hexamaze.setPegFillSelector(colorPicker(FacadeFX.getToggleName(hexColorGroup))); + } + + private Color colorPicker(String strColor) { + return switch (strColor) { + case "Red" -> Color.RED; + case "Yellow" -> Color.YELLOW; + case "Green" -> Color.GREEN; + case "Cyan" -> Color.CYAN; + case "Blue" -> Color.BLUE; + case "Pink" -> Color.PINK; + default -> HexMazePanel.DEFAULT_PEG_COLOR; + }; + } + + @FXML + private void plotShape() { + if (FacadeFX.getToggleName(hexGroup).equals("Peg") && FacadeFX.getToggleName(hexColorGroup) != null) + Hexamaze.setPegFillSelector(); + else + Hexamaze.setShapeFill(); + } + + @FXML + private void mazeCompare() { + try { + Hexamaze.compareToFullMaze(); + String sideToExit = MazeRunner.getExitDirection(); + if (sideToExit != null) + exitDirectionLabel.setText("Exit out of the " + sideToExit + " side"); + else + FacadeFX.clearText(exitDirectionLabel); + } catch (IllegalArgumentException ex) { + FacadeFX.setAlert(Alert.AlertType.ERROR, ex.getMessage()); + } + } + + private List transportPanels() { + List output = new ArrayList<>(); + fillOne(output); + fillTwo(output); + fillThree(output); + fillFour(output); + fillFive(output); + fillSix(output); + fillSeven(output); + return output; + } + + private void fillOne(List out) { + out.add(oneOne); + out.add(oneTwo); + out.add(oneThree); + out.add(oneFour); + } + + private void fillTwo(List out) { + out.add(twoOne); + out.add(twoTwo); + out.add(twoThree); + out.add(twoFour); + out.add(twoFive); + } + + private void fillThree(List out) { + out.add(threeOne); + out.add(threeTwo); + out.add(threeThree); + out.add(threeFour); + out.add(threeFive); + out.add(threeSix); + } + + private void fillFour(List out) { + out.add(fourOne); + out.add(fourTwo); + out.add(fourThree); + out.add(fourFour); + out.add(fourFive); + out.add(fourSix); + out.add(fourSeven); + } + + private void fillFive(List out) { + out.add(fiveOne); + out.add(fiveTwo); + out.add(fiveThree); + out.add(fiveFour); + out.add(fiveFive); + out.add(fiveSix); + } + + private void fillSix(List out) { + out.add(sixOne); + out.add(sixTwo); + out.add(sixThree); + out.add(sixFour); + out.add(sixFive); + } + + private void fillSeven(List out) { + out.add(sevenOne); + out.add(sevenTwo); + out.add(sevenThree); + out.add(sevenFour); + } + + @Override + public void reset() { + FacadeFX.clearText(exitDirectionLabel); + Hexamaze.resetHexPanelList(); + FacadeFX.resetToggleGroups(hexGroup, hexColorGroup); + FacadeFX.disableMultiple(redButton, yellowButton, greenButton, cyanButton, blueButton, pinkButton); + } +} diff --git a/src/main/java/bomb/modules/dh/hexamaze/hexalgorithm/AbstractHexagon.java b/documentation/journals/old_code/hexamaze/hexalgorithm/AbstractHexagon.java similarity index 100% rename from src/main/java/bomb/modules/dh/hexamaze/hexalgorithm/AbstractHexagon.java rename to documentation/journals/old_code/hexamaze/hexalgorithm/AbstractHexagon.java diff --git a/src/main/java/bomb/modules/dh/hexamaze/hexalgorithm/HexGrid.java b/documentation/journals/old_code/hexamaze/hexalgorithm/HexGrid.java similarity index 100% rename from src/main/java/bomb/modules/dh/hexamaze/hexalgorithm/HexGrid.java rename to documentation/journals/old_code/hexamaze/hexalgorithm/HexGrid.java diff --git a/src/main/java/bomb/modules/dh/hexamaze/hexalgorithm/HexNodeProperties.java b/documentation/journals/old_code/hexamaze/hexalgorithm/HexNodeProperties.java similarity index 100% rename from src/main/java/bomb/modules/dh/hexamaze/hexalgorithm/HexNodeProperties.java rename to documentation/journals/old_code/hexamaze/hexalgorithm/HexNodeProperties.java diff --git a/src/main/java/bomb/modules/dh/hexamaze/hexalgorithm/HexagonDataStructure.java b/documentation/journals/old_code/hexamaze/hexalgorithm/HexagonDataStructure.java similarity index 100% rename from src/main/java/bomb/modules/dh/hexamaze/hexalgorithm/HexagonDataStructure.java rename to documentation/journals/old_code/hexamaze/hexalgorithm/HexagonDataStructure.java diff --git a/src/main/java/bomb/modules/dh/hexamaze/hexalgorithm/Maze.java b/documentation/journals/old_code/hexamaze/hexalgorithm/Maze.java similarity index 100% rename from src/main/java/bomb/modules/dh/hexamaze/hexalgorithm/Maze.java rename to documentation/journals/old_code/hexamaze/hexalgorithm/Maze.java diff --git a/src/main/java/bomb/modules/dh/hexamaze/hexalgorithm/maze_finding/HexHashLibrary.java b/documentation/journals/old_code/hexamaze/hexalgorithm/maze_finding/HexHashLibrary.java similarity index 100% rename from src/main/java/bomb/modules/dh/hexamaze/hexalgorithm/maze_finding/HexHashLibrary.java rename to documentation/journals/old_code/hexamaze/hexalgorithm/maze_finding/HexHashLibrary.java diff --git a/src/main/java/bomb/modules/dh/hexamaze/hexalgorithm/pathfinding/HexPanelFiller.java b/documentation/journals/old_code/hexamaze/hexalgorithm/pathfinding/HexPanelFiller.java similarity index 100% rename from src/main/java/bomb/modules/dh/hexamaze/hexalgorithm/pathfinding/HexPanelFiller.java rename to documentation/journals/old_code/hexamaze/hexalgorithm/pathfinding/HexPanelFiller.java diff --git a/documentation/journals/old_code/hexamaze/hexalgorithm/pathfinding/MazeRunner.java b/documentation/journals/old_code/hexamaze/hexalgorithm/pathfinding/MazeRunner.java new file mode 100644 index 00000000..0d02b9c1 --- /dev/null +++ b/documentation/journals/old_code/hexamaze/hexalgorithm/pathfinding/MazeRunner.java @@ -0,0 +1,199 @@ +package bomb.modules.dh.hexamaze.hexalgorithm.pathfinding; + +import bomb.modules.dh.hexamaze.hexalgorithm.AbstractHexagon; +import bomb.modules.dh.hexamaze.hexalgorithm.HexGrid; +import bomb.modules.dh.hexamaze.hexalgorithm.HexNodeProperties.HexWall; +import bomb.modules.dh.hexamaze.hexalgorithm.HexagonDataStructure.HexNode; +import bomb.tools.Coordinates; +import bomb.tools.data.structures.queue.BufferedQueue; +import javafx.scene.paint.Color; +import org.jgrapht.Graph; +import org.jgrapht.alg.shortestpath.DijkstraShortestPath; +import org.jgrapht.graph.DefaultEdge; +import org.jgrapht.graph.SimpleGraph; + +import java.util.ArrayList; +import java.util.Comparator; +import java.util.List; +import java.util.stream.Collectors; + +import static bomb.modules.dh.hexamaze.hexalgorithm.HexNodeProperties.HexWall.Bottom; +import static bomb.modules.dh.hexamaze.hexalgorithm.HexNodeProperties.HexWall.BottomLeft; +import static bomb.modules.dh.hexamaze.hexalgorithm.HexNodeProperties.HexWall.BottomRight; +import static bomb.modules.dh.hexamaze.hexalgorithm.HexNodeProperties.HexWall.Top; +import static bomb.modules.dh.hexamaze.hexalgorithm.HexNodeProperties.HexWall.TopLeft; +import static bomb.modules.dh.hexamaze.hexalgorithm.HexNodeProperties.HexWall.TopRight; + +public class MazeRunner { + private static String exitDirection; + private static Color currentPegColor = null; + private static Coordinates currentLocation = null; + + //Movement Vectors + private static final Coordinates MOVE_DOWN = new Coordinates(0, 1), MOVE_RIGHT = new Coordinates(1, 0), + LEFT_SIDE_MOVE_DOWN_RIGHT = new Coordinates(1, 1), + RIGHT_SIDE_MOVE_TOP_RIGHT = new Coordinates(1, -1); + + /** + * Don't let anyone instantiate this class + */ + private MazeRunner() { + } + + public static void getPegInformation(Color pegColor, int location, int gridSideLength) { + currentPegColor = pegColor; + startingPointCalculator(location, gridSideLength); + } + + private static void startingPointCalculator(int location, int gridSideLength) { + boolean found = false; + int[] columnLengths = AbstractHexagon.calculateColumnLengths(gridSideLength); + + for (int k = 0; !found && k < columnLengths.length; k++) { + if (location < columnLengths[k]) { + found = true; + currentLocation = new Coordinates(k, location); + } + location -= columnLengths[k]; + } + if (!found) throw new IllegalStateException("This should be impossible"); + } + + public static List runMaze(HexGrid grid) { + if (currentPegColor == null || currentLocation == null) return null; + + List possibleExits = getPossibleExits(grid, grid.getRing().findRelativeIndex(currentPegColor)); + + Graph mappedGraph = mapToGraph(grid); + List> options = new ArrayList<>(); + + for (Coordinates exit : possibleExits) { + DijkstraShortestPath shortest = + new DijkstraShortestPath<>(mappedGraph); + options.add(shortest.getPath(currentLocation, exit).getVertexList()); + } + options.sort(Comparator.comparingInt(List::size)); + + return options.get(0); + } + + private static List getPossibleExits(HexGrid grid, int sideToExit) { + List output = switch (sideToExit) { + case 0 -> getTopLeftSideExits(grid); + case 1 -> getTopRightSideExits(grid); + case 2 -> getRightSideExits(grid); + case 3 -> getBottomRightSideExits(grid); + case 4 -> getBottomLeftSideExits(grid); + default -> getLeftSideExits(grid); + }; + return filterBlockedExits(grid, output, sideToExit); + } + + private static List getTopLeftSideExits(HexGrid grid) { + exitDirection = "Top Left"; + List output = new ArrayList<>(); + for (int i = 0; i < grid.sideLength(); i++) { + output.add(new Coordinates(i, 0)); + } + return output; + } + + private static List getTopRightSideExits(HexGrid grid) { + exitDirection = "Top Right"; + List output = new ArrayList<>(); + for (int i = grid.sideLength() - 1; i < grid.getSpan(); i++) { + output.add(new Coordinates(i, 0)); + } + return output; + } + + private static List getRightSideExits(HexGrid grid) { + exitDirection = "Right"; + List output = new ArrayList<>(); + BufferedQueue> internals = grid.exportTo2DQueue(); + int lastIndex = internals.getCapacity() - 1; + for (int i = 0; i < internals.get(lastIndex).getCapacity(); i++) { + output.add(new Coordinates(lastIndex, i)); + } + return output; + } + + private static List getBottomRightSideExits(HexGrid grid) { + exitDirection = "Bottom Right"; + List output = new ArrayList<>(); + BufferedQueue> internals = grid.exportTo2DQueue(); + for (int i = grid.sideLength() - 1; i < grid.getSpan(); i++) { + output.add(new Coordinates(i, internals.get(i).getCapacity() - 1)); + } + return output; + } + + private static List getBottomLeftSideExits(HexGrid grid) { + exitDirection = "Bottom Left"; + List output = new ArrayList<>(); + BufferedQueue> internals = grid.exportTo2DQueue(); + for (int i = 0; i < grid.sideLength(); i++) { + output.add(new Coordinates(i, internals.get(i).getCapacity() - 1)); + } + return output; + } + + private static List getLeftSideExits(HexGrid grid) { + exitDirection = "Left"; + List output = new ArrayList<>(); + for (int i = 0; i < grid.sideLength(); i++) { + output.add(new Coordinates(0, i)); + } + return output; + } + + private static List filterBlockedExits(HexGrid grid, List list, int sideToExit) { + HexWall[] wallsToFind = switch (sideToExit) { + case 0 -> new HexWall[]{TopLeft, Top}; + case 1 -> new HexWall[]{TopRight, Top}; + case 2 -> new HexWall[]{TopRight, BottomRight}; + case 3 -> new HexWall[]{BottomRight, Bottom}; + case 4 -> new HexWall[]{Bottom, BottomLeft}; + default -> new HexWall[]{TopLeft, BottomLeft}; + }; + return list.stream().filter(coords -> grid.retrieveNode(coords).isPathClear(wallsToFind[0].ordinal()) || + grid.retrieveNode(coords).isPathClear(wallsToFind[1].ordinal())) + .collect(Collectors.toList()); + } + + private static Graph mapToGraph(HexGrid grid) { + BufferedQueue> internals = grid.exportTo2DQueue(); + Graph graph = new SimpleGraph<>(DefaultEdge.class); + for (int x = 0; x < internals.getCapacity(); x++) { + for (int y = 0; y < internals.get(x).getCapacity(); y++) { + mapAdjacentNodes(grid, graph, new Coordinates(x, y)); + } + } + return graph; + } + + private static void mapAdjacentNodes(HexGrid grid, Graph graph, Coordinates location) { + boolean notHalfWay = location.x() < grid.sideLength() - 1; + mapSingleNode(grid, graph, TopRight, location, location.add(notHalfWay ? + MOVE_RIGHT : RIGHT_SIDE_MOVE_TOP_RIGHT)); + mapSingleNode(grid, graph, BottomRight, location, location.add(notHalfWay ? + LEFT_SIDE_MOVE_DOWN_RIGHT : MOVE_RIGHT)); + mapSingleNode(grid, graph, Bottom, location, location.add(MOVE_DOWN)); + } + + private static void mapSingleNode(HexGrid grid, Graph graph, + HexWall correspondingWall, Coordinates from, Coordinates to) { + HexNode currentNode = grid.retrieveNode(from); + HexNode checkExists = grid.retrieveNode(to); + + if (currentNode.isPathClear(correspondingWall.ordinal()) && checkExists != null) { + graph.addVertex(from); + graph.addVertex(to); + graph.addEdge(from, to); + } + } + + public static String getExitDirection() { + return exitDirection; + } +} diff --git a/src/test/java/bomb/modules/dh/hexamaze/hexalgorithm/maze_finding/MazeFinderTest.java b/documentation/journals/old_code/tests/maze_finding/MazeFinderTest.java similarity index 100% rename from src/test/java/bomb/modules/dh/hexamaze/hexalgorithm/maze_finding/MazeFinderTest.java rename to documentation/journals/old_code/tests/maze_finding/MazeFinderTest.java diff --git a/src/main/java/bomb/components/hex/HexTile.java b/src/main/java/bomb/components/hex/HexTile.java index 33b683b5..400c71f5 100644 --- a/src/main/java/bomb/components/hex/HexTile.java +++ b/src/main/java/bomb/components/hex/HexTile.java @@ -1,9 +1,9 @@ package bomb.components.hex; import bomb.abstractions.Resettable; -import bomb.modules.dh.hexamaze_redesign.hexalgorithm.storage.HexNode; -import bomb.modules.dh.hexamaze_redesign.hexalgorithm.storage.HexNode.HexShape; -import bomb.modules.dh.hexamaze_redesign.hexalgorithm.storage.HexNode.HexWall; +import bomb.modules.dh.hexamaze.hexalgorithm.storage.HexNode; +import bomb.modules.dh.hexamaze.hexalgorithm.storage.HexNode.HexShape; +import bomb.modules.dh.hexamaze.hexalgorithm.storage.HexNode.HexWall; import bomb.tools.pattern.facade.FacadeFX; import javafx.fxml.FXML; import javafx.fxml.FXMLLoader; @@ -16,8 +16,8 @@ import java.util.EnumSet; -import static bomb.modules.dh.hexamaze_redesign.Hexamaze.COLOR_MAP; -import static bomb.modules.dh.hexamaze_redesign.Hexamaze.PEG_COLOR; +import static bomb.modules.dh.hexamaze.Hexamaze.COLOR_MAP; +import static bomb.modules.dh.hexamaze.Hexamaze.PEG_COLOR; public class HexTile extends Pane implements Resettable { public static final Color DEFAULT_BACKGROUND_COLOR = new Color(0.0195, 0.0195, 0.0195, 1.0); @@ -40,6 +40,10 @@ public HexTile() { FacadeFX.loadComponent(loader); } + public void initialize() { + scanWalls(); + } + public HexNode getInternalNode() { return internalNode; } diff --git a/src/main/java/bomb/components/hex/MazeComponent.java b/src/main/java/bomb/components/hex/MazeComponent.java index bb51c460..53cdf122 100644 --- a/src/main/java/bomb/components/hex/MazeComponent.java +++ b/src/main/java/bomb/components/hex/MazeComponent.java @@ -1,7 +1,7 @@ package bomb.components.hex; import bomb.abstractions.Resettable; -import bomb.modules.dh.hexamaze_redesign.hexalgorithm.storage.HexNode.HexShape; +import bomb.modules.dh.hexamaze.hexalgorithm.storage.HexNode.HexShape; import bomb.tools.event.HoverHandler; import bomb.tools.pattern.facade.FacadeFX; import javafx.fxml.FXML; @@ -13,13 +13,13 @@ import java.util.List; import java.util.function.Consumer; -import static bomb.modules.dh.hexamaze_redesign.Hexamaze.PEG_COLOR; -import static bomb.modules.dh.hexamaze_redesign.hexalgorithm.storage.HexNode.HexShape.CIRCLE; -import static bomb.modules.dh.hexamaze_redesign.hexalgorithm.storage.HexNode.HexShape.DOWN_TRIANGLE; -import static bomb.modules.dh.hexamaze_redesign.hexalgorithm.storage.HexNode.HexShape.HEXAGON; -import static bomb.modules.dh.hexamaze_redesign.hexalgorithm.storage.HexNode.HexShape.LEFT_TRIANGLE; -import static bomb.modules.dh.hexamaze_redesign.hexalgorithm.storage.HexNode.HexShape.RIGHT_TRIANGLE; -import static bomb.modules.dh.hexamaze_redesign.hexalgorithm.storage.HexNode.HexShape.UP_TRIANGLE; +import static bomb.modules.dh.hexamaze.Hexamaze.PEG_COLOR; +import static bomb.modules.dh.hexamaze.hexalgorithm.storage.HexNode.HexShape.CIRCLE; +import static bomb.modules.dh.hexamaze.hexalgorithm.storage.HexNode.HexShape.DOWN_TRIANGLE; +import static bomb.modules.dh.hexamaze.hexalgorithm.storage.HexNode.HexShape.HEXAGON; +import static bomb.modules.dh.hexamaze.hexalgorithm.storage.HexNode.HexShape.LEFT_TRIANGLE; +import static bomb.modules.dh.hexamaze.hexalgorithm.storage.HexNode.HexShape.RIGHT_TRIANGLE; +import static bomb.modules.dh.hexamaze.hexalgorithm.storage.HexNode.HexShape.UP_TRIANGLE; import static javafx.scene.paint.Color.BLUE; import static javafx.scene.paint.Color.CYAN; import static javafx.scene.paint.Color.GREEN; diff --git a/src/main/java/bomb/modules/dh/hexamaze/Hexamaze.java b/src/main/java/bomb/modules/dh/hexamaze/Hexamaze.java index 1df38d84..ef71d806 100644 --- a/src/main/java/bomb/modules/dh/hexamaze/Hexamaze.java +++ b/src/main/java/bomb/modules/dh/hexamaze/Hexamaze.java @@ -1,171 +1,109 @@ package bomb.modules.dh.hexamaze; import bomb.Widget; -import bomb.components.hex.HexMazePanel; -import bomb.modules.dh.hexamaze.hexalgorithm.HexGrid; -import bomb.modules.dh.hexamaze.hexalgorithm.HexNodeProperties.HexShape; -import bomb.modules.dh.hexamaze.hexalgorithm.HexagonDataStructure.HexNode; -import bomb.modules.dh.hexamaze.hexalgorithm.Maze; -import bomb.modules.dh.hexamaze.hexalgorithm.maze_finding.HexHashLibrary; -import bomb.modules.dh.hexamaze.hexalgorithm.pathfinding.HexPanelFiller; +import bomb.components.hex.HexTile; +import bomb.modules.dh.hexamaze.hexalgorithm.maze_finding.MazeSearch; +import bomb.modules.dh.hexamaze.hexalgorithm.pathfinding.ExitChecker; import bomb.modules.dh.hexamaze.hexalgorithm.pathfinding.MazeRunner; -import bomb.modules.s.souvenir.Souvenir; +import bomb.modules.dh.hexamaze.hexalgorithm.storage.Grid; +import bomb.modules.dh.hexamaze.hexalgorithm.storage.HexNode; +import bomb.modules.dh.hexamaze.hexalgorithm.storage.HexagonalPlane; +import bomb.modules.dh.hexamaze.hexalgorithm.storage.Maze; import bomb.tools.Coordinates; +import bomb.tools.data.structures.queue.BufferedQueue; import javafx.scene.paint.Color; +import org.javatuples.Pair; +import org.jetbrains.annotations.NotNull; -import java.util.ArrayList; +import java.util.HashMap; import java.util.List; +import java.util.Map; -import static bomb.modules.dh.hexamaze.hexalgorithm.HexagonDataStructure.nodalArea; +import static bomb.components.hex.HexTile.DEFAULT_BACKGROUND_COLOR; +import static java.util.stream.Collectors.toList; import static javafx.scene.paint.Color.BLUE; import static javafx.scene.paint.Color.CYAN; import static javafx.scene.paint.Color.GREEN; +import static javafx.scene.paint.Color.PINK; import static javafx.scene.paint.Color.RED; import static javafx.scene.paint.Color.YELLOW; public class Hexamaze extends Widget { - private final static List HEX_SHAPE_TRACKER; - - private static List panelList; - private static Color pegFillSelector, currentPegColor; - private static HexShape currentSelector; - private static int currentPegLocation; - private static HexGrid grid; + public static final Map COLOR_MAP = new HashMap<>(); + public static final Color PEG_COLOR = new Color(0.65, 0.65, 0.65, 1.0); static { - currentPegLocation = -1; - HEX_SHAPE_TRACKER = new ArrayList<>(); - setToNull(); - HexHashLibrary.initialize(new Maze(), (2 * HexGrid.STANDARD_SIDE_LENGTH) - 1); - } - - /** - * Sets all elements of the representation to null - */ - private static void setToNull() { - int nodalArea = nodalArea(HexGrid.STANDARD_SIDE_LENGTH); - for (int i = 0; i < nodalArea; i++) - HEX_SHAPE_TRACKER.add(null); - } - - /** - * Sets up the variables for the Hexamaze. This includes setting up the full maze, the Defuser's grid - * and an ArrayList representation of the grid - */ - public static void setupVariables(List panelArray) { - grid = new HexGrid(); - panelList = panelArray; + COLOR_MAP.put(PEG_COLOR, -1); + COLOR_MAP.put(RED, 0); + COLOR_MAP.put(YELLOW, 1); + COLOR_MAP.put(GREEN, 2); + COLOR_MAP.put(CYAN, 3); + COLOR_MAP.put(BLUE, 4); + COLOR_MAP.put(PINK, 5); } - /** - * Sets the selector to the shape corresponding ToggleButton - * - * @param button The name of the currently toggled ToggleButton - */ - public static void setShapeSelector(String button) { - switch (button) { - case "Erase" -> currentSelector = null; - case "Circle" -> currentSelector = HexShape.Circle; - case "Hexagon" -> currentSelector = HexShape.Hexagon; - case "Left Triangle" -> currentSelector = HexShape.LeftTriangle; - case "Right Triangle" -> currentSelector = HexShape.RightTriangle; - case "Up Triangle" -> currentSelector = HexShape.UpTriangle; - default -> currentSelector = HexShape.DownTriangle; - } + public static String solve(@NotNull List tileList) throws IllegalArgumentException { + Maze maze = new Maze(); + List nodeList = tileList.stream() + .map(HexTile::getInternalNode) + .collect(toList()); + Grid original = new Grid(new HexagonalPlane(nodeList)); + + Grid found = MazeSearch.search(maze, original); + if (found == null) + throw new IllegalArgumentException("Could not find maze from given shapes"); + + int colorValue = copyPegLocation(original, found); + setHexTileWalls(tileList, found); + Pair> exitInfo = ExitChecker.findPossibleExits(found); + if (exitInfo == null) + return ""; + + List resultingPath = MazeRunner.runMaze(found, exitInfo.getValue1()); + fillHexTiles(tileList, resultingPath, colorValue); + return exitInfo.getValue0(); } - public static void setPegFillSelector(Color fillColor) { - pegFillSelector = fillColor; - if (isSouvenirActive) { - Souvenir.addRelic("Hexamaze Pawn Color", getColorName(fillColor)); - } - } - - private static String getColorName(Color color) { - if (color == RED) return "Red"; - if (color == YELLOW) return "Yellow"; - if (color == GREEN) return "Green"; - if (color == CYAN) return "Cyan"; - if (color == BLUE) return "Blue"; - return "Pink"; - } + private static int copyPegLocation(Grid original, Grid found) { + List originalList = original.getHexagon().asList(); + List foundList = found.getHexagon().asList(); + int size = originalList.size(); - /** - * Finds the HexMazePanel that's being hovered over to be filled with the currentShapeSelector - */ - public static void setShapeFill() { - for (int i = 0; i < panelList.size(); i++) { - if (panelList.get(i).isHover()) { - toFill(panelList.get(i), i); - i = panelList.size(); + for (int i = 0; i < size; i++) { + int currentNodeColorValue = originalList.get(i).getColor(); + if (currentNodeColorValue != -1) { + foundList.get(i).setColor(currentNodeColorValue); + return currentNodeColorValue; } } + return -1; } - /** - * Sets the given HexMazePanel with the current Shape in the {@link Hexamaze currentSelector} - * - * @param panel The current HexMazePanel - * @param index Where it'll show up in array representation - */ - private static void toFill(HexMazePanel panel, int index) { - panel.setup(new HexNode(currentSelector, null)); - HEX_SHAPE_TRACKER.set(index, currentSelector); - } + private static void setHexTileWalls(List tileList, Grid found) { + List foundNodes = found.getHexagon().asList(); - public static void setPegFillSelector() { - for (int i = 0; i < panelList.size(); i++) { - if (panelList.get(i).isHover()) { - if (currentPegLocation != -1) - deselectPreviousFill(panelList.get(currentPegLocation)); - toColorFill(panelList.get(i)); - currentPegLocation = i; - } + int size = foundNodes.size(); + for (int i = 0; i < size; i++) { + tileList.get(i).setInternalNode(foundNodes.get(i)); } } - private static void toColorFill(HexMazePanel panel) { - currentPegColor = pegFillSelector; - panel.fillPeg(currentPegColor); - } - - private static void deselectPreviousFill(HexMazePanel panel) { - panel.fillPeg(new Color(0.776, 0.766, 0.776, 1.0)); - } + private static void fillHexTiles(List tileList, List coordinatesList, int colorValue) { + Color color = RED; - /** - * Fills the HexGrid with the array and sends it to the HexComparator to find the section of the maze - * - * @throws IllegalArgumentException No sub-maze was found in the maze - */ - public static void compareToFullMaze() throws IllegalArgumentException { - grid.fillWithShapes(HEX_SHAPE_TRACKER); - grid.resetColorRing(); - MazeRunner.getPegInformation(currentPegColor, currentPegLocation, grid.sideLength()); - HexGrid result = HexHashLibrary.find(grid); - if (result != null) decipherResults(result); - else throw new IllegalArgumentException("No resulting maze was found"); - } + for (Map.Entry entry : COLOR_MAP.entrySet()) { + if (entry.getValue() == colorValue) + color = entry.getKey(); + } - /** - * Outputs the discovered location to the HexMazePanels to show the wall locations - * - * @param hexGrid The discovered location of the HexGrid - */ - private static void decipherResults(HexGrid hexGrid) { - clearPreviousLines(); - List exitOrder = MazeRunner.runMaze(hexGrid); - List stream = hexGrid.hexport().exportToList(); - for (int i = 0; i < stream.size(); i++) panelList.get(i).setup(stream.get(i)); - if (exitOrder != null) HexPanelFiller.fillPanels(exitOrder, panelList, currentPegColor, grid.sideLength()); - } + for (HexTile hexTile : tileList) + hexTile.setBackgroundFill(DEFAULT_BACKGROUND_COLOR); - private static void clearPreviousLines() { - for (HexMazePanel hexMazePanel : panelList) - hexMazePanel.makeWallsTransparent(); - } + BufferedQueue> tileQueues = HexagonalPlane.convertFromList(tileList); - public static void resetHexPanelList() { - for (HexMazePanel hexMazePanel : panelList) hexMazePanel.reset(); + Color finalColor = color; + coordinatesList.stream() + .map(c -> tileQueues.get(c.x()).get(c.y())) + .forEach(tile -> tile.setBackgroundFill(finalColor)); } } diff --git a/src/main/java/bomb/modules/dh/hexamaze/HexamazeController.java b/src/main/java/bomb/modules/dh/hexamaze/HexamazeController.java index 2a917a66..13a7bce8 100644 --- a/src/main/java/bomb/modules/dh/hexamaze/HexamazeController.java +++ b/src/main/java/bomb/modules/dh/hexamaze/HexamazeController.java @@ -1,170 +1,66 @@ package bomb.modules.dh.hexamaze; import bomb.abstractions.Resettable; -import bomb.components.hex.HexMazePanel; -import bomb.modules.dh.hexamaze.hexalgorithm.pathfinding.MazeRunner; +import bomb.components.hex.MazeComponent; import bomb.tools.pattern.facade.FacadeFX; import javafx.fxml.FXML; import javafx.scene.control.Alert; import javafx.scene.control.Label; import javafx.scene.control.RadioButton; import javafx.scene.control.ToggleGroup; -import javafx.scene.paint.Color; -import java.util.ArrayList; -import java.util.List; +import static bomb.tools.pattern.facade.FacadeFX.GET_TOGGLE_NAME; public class HexamazeController implements Resettable { @FXML - private ToggleGroup hexGroup, hexColorGroup; + private Label exitDirectionLabel; @FXML - private HexMazePanel oneOne, oneTwo, oneThree, oneFour, - twoOne, twoTwo, twoThree, twoFour, twoFive, - threeOne, threeTwo, threeThree, threeFour, threeFive, threeSix, - fourOne, fourTwo, fourThree, fourFour, fourFive, fourSix, fourSeven, - fiveOne, fiveTwo, fiveThree, fiveFour, fiveFive, fiveSix, - sixOne, sixTwo, sixThree, sixFour, sixFive, - sevenOne, sevenTwo, sevenThree, sevenFour; + private MazeComponent mazeComponent; @FXML private RadioButton redButton, yellowButton, greenButton, cyanButton, blueButton, pinkButton; @FXML - private Label exitDirectionLabel; - - public void initialize() { - Hexamaze.setupVariables(transportPanels()); - } + private ToggleGroup hexGroup, hexColorGroup; @FXML private void setShape() { - toggleColorControl(); - if (!FacadeFX.getToggleName(hexGroup).equals("Peg")) - Hexamaze.setShapeSelector(FacadeFX.getToggleName(hexGroup)); - } - - private void toggleColorControl() { - boolean toggle = !FacadeFX.getToggleName(hexGroup).equals("Peg"); - if (toggle) - FacadeFX.disableMultiple(redButton, yellowButton, greenButton, cyanButton, blueButton, pinkButton); - else - FacadeFX.enableMultiple(redButton, yellowButton, greenButton, cyanButton, blueButton, pinkButton); + String shape = GET_TOGGLE_NAME.apply(hexGroup.getSelectedToggle()); + mazeComponent.setShapeSelection(shape); + boolean disable = !shape.equals("Peg"); + redButton.setDisable(disable); + yellowButton.setDisable(disable); + greenButton.setDisable(disable); + cyanButton.setDisable(disable); + blueButton.setDisable(disable); + pinkButton.setDisable(disable); } @FXML private void setPegFill() { - Hexamaze.setPegFillSelector(colorPicker(FacadeFX.getToggleName(hexColorGroup))); - } - - private Color colorPicker(String strColor) { - return switch (strColor) { - case "Red" -> Color.RED; - case "Yellow" -> Color.YELLOW; - case "Green" -> Color.GREEN; - case "Cyan" -> Color.CYAN; - case "Blue" -> Color.BLUE; - case "Pink" -> Color.PINK; - default -> HexMazePanel.DEFAULT_PEG_COLOR; - }; + String color = GET_TOGGLE_NAME.apply(hexColorGroup.getSelectedToggle()); + mazeComponent.setColorSelection(color); } @FXML - private void plotShape() { - if (FacadeFX.getToggleName(hexGroup).equals("Peg") && FacadeFX.getToggleName(hexColorGroup) != null) - Hexamaze.setPegFillSelector(); - else - Hexamaze.setShapeFill(); - } - - @FXML - private void mazeCompare() { + private void solveMaze() { try { - Hexamaze.compareToFullMaze(); - String sideToExit = MazeRunner.getExitDirection(); - if (sideToExit != null) - exitDirectionLabel.setText("Exit out of the " + sideToExit + " side"); - else - FacadeFX.clearText(exitDirectionLabel); - } catch (IllegalArgumentException ex) { - FacadeFX.setAlert(Alert.AlertType.ERROR, ex.getMessage()); + String exitDirectionText = Hexamaze.solve(mazeComponent.createTileList()); + exitDirectionLabel.setText( + exitDirectionText.isEmpty() ? + exitDirectionText : + "Exit out of the " + exitDirectionText + " side" + ); + } catch (IllegalArgumentException illegal) { + FacadeFX.setAlert(Alert.AlertType.ERROR, illegal.getMessage()); } } - private List transportPanels() { - List output = new ArrayList<>(); - fillOne(output); - fillTwo(output); - fillThree(output); - fillFour(output); - fillFive(output); - fillSix(output); - fillSeven(output); - return output; - } - - private void fillOne(List out) { - out.add(oneOne); - out.add(oneTwo); - out.add(oneThree); - out.add(oneFour); - } - - private void fillTwo(List out) { - out.add(twoOne); - out.add(twoTwo); - out.add(twoThree); - out.add(twoFour); - out.add(twoFive); - } - - private void fillThree(List out) { - out.add(threeOne); - out.add(threeTwo); - out.add(threeThree); - out.add(threeFour); - out.add(threeFive); - out.add(threeSix); - } - - private void fillFour(List out) { - out.add(fourOne); - out.add(fourTwo); - out.add(fourThree); - out.add(fourFour); - out.add(fourFive); - out.add(fourSix); - out.add(fourSeven); - } - - private void fillFive(List out) { - out.add(fiveOne); - out.add(fiveTwo); - out.add(fiveThree); - out.add(fiveFour); - out.add(fiveFive); - out.add(fiveSix); - } - - private void fillSix(List out) { - out.add(sixOne); - out.add(sixTwo); - out.add(sixThree); - out.add(sixFour); - out.add(sixFive); - } - - private void fillSeven(List out) { - out.add(sevenOne); - out.add(sevenTwo); - out.add(sevenThree); - out.add(sevenFour); - } - @Override public void reset() { + mazeComponent.reset(); FacadeFX.clearText(exitDirectionLabel); - Hexamaze.resetHexPanelList(); FacadeFX.resetToggleGroups(hexGroup, hexColorGroup); FacadeFX.disableMultiple(redButton, yellowButton, greenButton, cyanButton, blueButton, pinkButton); } diff --git a/src/main/java/bomb/modules/dh/hexamaze_redesign/hexalgorithm/factory/MazeFactory.java b/src/main/java/bomb/modules/dh/hexamaze/hexalgorithm/factory/MazeFactory.java similarity index 55% rename from src/main/java/bomb/modules/dh/hexamaze_redesign/hexalgorithm/factory/MazeFactory.java rename to src/main/java/bomb/modules/dh/hexamaze/hexalgorithm/factory/MazeFactory.java index f525263d..4df9e19e 100644 --- a/src/main/java/bomb/modules/dh/hexamaze_redesign/hexalgorithm/factory/MazeFactory.java +++ b/src/main/java/bomb/modules/dh/hexamaze/hexalgorithm/factory/MazeFactory.java @@ -1,9 +1,8 @@ -package bomb.modules.dh.hexamaze_redesign.hexalgorithm.factory; +package bomb.modules.dh.hexamaze.hexalgorithm.factory; -import bomb.modules.dh.hexamaze.hexalgorithm.Maze; -import bomb.modules.dh.hexamaze_redesign.hexalgorithm.storage.HexNode; -import bomb.modules.dh.hexamaze_redesign.hexalgorithm.storage.HexNode.HexShape; -import bomb.modules.dh.hexamaze_redesign.hexalgorithm.storage.HexNode.HexWall; +import bomb.modules.dh.hexamaze.hexalgorithm.storage.HexNode; +import bomb.modules.dh.hexamaze.hexalgorithm.storage.HexNode.HexShape; +import bomb.modules.dh.hexamaze.hexalgorithm.storage.HexNode.HexWall; import com.opencsv.CSVReader; import com.opencsv.exceptions.CsvException; @@ -13,21 +12,21 @@ import java.util.Arrays; import java.util.EnumSet; import java.util.List; -import java.util.stream.Collectors; -import static bomb.modules.dh.hexamaze_redesign.hexalgorithm.storage.HexNode.HexShape.CIRCLE; -import static bomb.modules.dh.hexamaze_redesign.hexalgorithm.storage.HexNode.HexShape.DOWN_TRIANGLE; -import static bomb.modules.dh.hexamaze_redesign.hexalgorithm.storage.HexNode.HexShape.HEXAGON; -import static bomb.modules.dh.hexamaze_redesign.hexalgorithm.storage.HexNode.HexShape.LEFT_TRIANGLE; -import static bomb.modules.dh.hexamaze_redesign.hexalgorithm.storage.HexNode.HexShape.RIGHT_TRIANGLE; -import static bomb.modules.dh.hexamaze_redesign.hexalgorithm.storage.HexNode.HexShape.UP_TRIANGLE; +import static bomb.modules.dh.hexamaze.hexalgorithm.storage.HexNode.HexShape.CIRCLE; +import static bomb.modules.dh.hexamaze.hexalgorithm.storage.HexNode.HexShape.DOWN_TRIANGLE; +import static bomb.modules.dh.hexamaze.hexalgorithm.storage.HexNode.HexShape.HEXAGON; +import static bomb.modules.dh.hexamaze.hexalgorithm.storage.HexNode.HexShape.LEFT_TRIANGLE; +import static bomb.modules.dh.hexamaze.hexalgorithm.storage.HexNode.HexShape.RIGHT_TRIANGLE; +import static bomb.modules.dh.hexamaze.hexalgorithm.storage.HexNode.HexShape.UP_TRIANGLE; import static java.util.Arrays.stream; +import static java.util.stream.Collectors.toCollection; import static java.util.stream.Collectors.toList; @SuppressWarnings("ConstantConditions") public class MazeFactory { public static List createMaze() throws IOException, CsvException { - InputStream in = Maze.class.getResourceAsStream("maze.csv"); + InputStream in = MazeFactory.class.getResourceAsStream("maze.csv"); CSVReader csvReader = new CSVReader(new InputStreamReader(in)); return csvReader.readAll().stream() .flatMap(Arrays::stream) @@ -54,6 +53,6 @@ public static EnumSet decodeWalls(String code) { return stream(code.split("")) .mapToInt(Integer::parseInt) .mapToObj(num -> allWalls[num]) - .collect(Collectors.toCollection(() -> EnumSet.noneOf(HexWall.class))); + .collect(toCollection(() -> EnumSet.noneOf(HexNode.HexWall.class))); } } diff --git a/src/main/java/bomb/modules/dh/hexamaze_redesign/hexalgorithm/maze_finding/MazeSearch.java b/src/main/java/bomb/modules/dh/hexamaze/hexalgorithm/maze_finding/MazeSearch.java similarity index 90% rename from src/main/java/bomb/modules/dh/hexamaze_redesign/hexalgorithm/maze_finding/MazeSearch.java rename to src/main/java/bomb/modules/dh/hexamaze/hexalgorithm/maze_finding/MazeSearch.java index ba2d5aa2..c1e1a2f3 100644 --- a/src/main/java/bomb/modules/dh/hexamaze_redesign/hexalgorithm/maze_finding/MazeSearch.java +++ b/src/main/java/bomb/modules/dh/hexamaze/hexalgorithm/maze_finding/MazeSearch.java @@ -1,17 +1,17 @@ -package bomb.modules.dh.hexamaze_redesign.hexalgorithm.maze_finding; +package bomb.modules.dh.hexamaze.hexalgorithm.maze_finding; -import bomb.modules.dh.hexamaze_redesign.hexalgorithm.storage.Grid; -import bomb.modules.dh.hexamaze_redesign.hexalgorithm.storage.HexNode; -import bomb.modules.dh.hexamaze_redesign.hexalgorithm.storage.HexNode.HexShape; -import bomb.modules.dh.hexamaze_redesign.hexalgorithm.storage.HexagonalPlane; -import bomb.modules.dh.hexamaze_redesign.hexalgorithm.storage.Maze; +import bomb.modules.dh.hexamaze.hexalgorithm.storage.Grid; +import bomb.modules.dh.hexamaze.hexalgorithm.storage.HexNode; +import bomb.modules.dh.hexamaze.hexalgorithm.storage.HexNode.HexShape; +import bomb.modules.dh.hexamaze.hexalgorithm.storage.HexagonalPlane; +import bomb.modules.dh.hexamaze.hexalgorithm.storage.Maze; import bomb.tools.data.structures.queue.BufferedQueue; import org.jetbrains.annotations.NotNull; import java.util.Collection; import java.util.List; -import static bomb.modules.dh.hexamaze_redesign.hexalgorithm.storage.AbstractHexagon.calculateColumnLengthStream; +import static bomb.modules.dh.hexamaze.hexalgorithm.storage.AbstractHexagon.calculateColumnLengthStream; import static java.util.stream.Collectors.toList; public class MazeSearch { diff --git a/src/main/java/bomb/modules/dh/hexamaze_redesign/hexalgorithm/pathfinding/ExitChecker.java b/src/main/java/bomb/modules/dh/hexamaze/hexalgorithm/pathfinding/ExitChecker.java similarity index 80% rename from src/main/java/bomb/modules/dh/hexamaze_redesign/hexalgorithm/pathfinding/ExitChecker.java rename to src/main/java/bomb/modules/dh/hexamaze/hexalgorithm/pathfinding/ExitChecker.java index 10027ff1..b62a85ba 100644 --- a/src/main/java/bomb/modules/dh/hexamaze_redesign/hexalgorithm/pathfinding/ExitChecker.java +++ b/src/main/java/bomb/modules/dh/hexamaze/hexalgorithm/pathfinding/ExitChecker.java @@ -1,8 +1,8 @@ -package bomb.modules.dh.hexamaze_redesign.hexalgorithm.pathfinding; +package bomb.modules.dh.hexamaze.hexalgorithm.pathfinding; -import bomb.modules.dh.hexamaze_redesign.hexalgorithm.storage.Grid; -import bomb.modules.dh.hexamaze_redesign.hexalgorithm.storage.HexNode; -import bomb.modules.dh.hexamaze_redesign.hexalgorithm.storage.HexNode.HexWall; +import bomb.modules.dh.hexamaze.hexalgorithm.storage.Grid; +import bomb.modules.dh.hexamaze.hexalgorithm.storage.HexNode; +import bomb.modules.dh.hexamaze.hexalgorithm.storage.HexNode.HexWall; import bomb.tools.Coordinates; import bomb.tools.data.structures.queue.BufferedQueue; import javafx.scene.paint.Color; @@ -15,16 +15,16 @@ import java.util.Map; import java.util.stream.IntStream; -import static bomb.modules.dh.hexamaze.hexalgorithm.AbstractHexagon.calculateColumnLengths; -import static bomb.modules.dh.hexamaze_redesign.Hexamaze.COLOR_MAP; -import static bomb.modules.dh.hexamaze_redesign.hexalgorithm.storage.Grid.GRID_SIDE_LENGTH; -import static bomb.modules.dh.hexamaze_redesign.hexalgorithm.storage.HexNode.HexWall.BOTTOM; -import static bomb.modules.dh.hexamaze_redesign.hexalgorithm.storage.HexNode.HexWall.BOTTOM_LEFT; -import static bomb.modules.dh.hexamaze_redesign.hexalgorithm.storage.HexNode.HexWall.BOTTOM_RIGHT; -import static bomb.modules.dh.hexamaze_redesign.hexalgorithm.storage.HexNode.HexWall.TOP; -import static bomb.modules.dh.hexamaze_redesign.hexalgorithm.storage.HexNode.HexWall.TOP_LEFT; -import static bomb.modules.dh.hexamaze_redesign.hexalgorithm.storage.HexNode.HexWall.TOP_RIGHT; -import static bomb.modules.dh.hexamaze_redesign.hexalgorithm.storage.HexagonalPlane.CALCULATE_SPAN; +import static bomb.modules.dh.hexamaze.Hexamaze.COLOR_MAP; +import static bomb.modules.dh.hexamaze.hexalgorithm.storage.AbstractHexagon.calculateColumnLengthStream; +import static bomb.modules.dh.hexamaze.hexalgorithm.storage.Grid.GRID_SIDE_LENGTH; +import static bomb.modules.dh.hexamaze.hexalgorithm.storage.HexNode.HexWall.BOTTOM; +import static bomb.modules.dh.hexamaze.hexalgorithm.storage.HexNode.HexWall.BOTTOM_LEFT; +import static bomb.modules.dh.hexamaze.hexalgorithm.storage.HexNode.HexWall.BOTTOM_RIGHT; +import static bomb.modules.dh.hexamaze.hexalgorithm.storage.HexNode.HexWall.TOP; +import static bomb.modules.dh.hexamaze.hexalgorithm.storage.HexNode.HexWall.TOP_LEFT; +import static bomb.modules.dh.hexamaze.hexalgorithm.storage.HexNode.HexWall.TOP_RIGHT; +import static bomb.modules.dh.hexamaze.hexalgorithm.storage.HexagonalPlane.CALCULATE_SPAN; import static java.util.stream.Collectors.toList; public class ExitChecker { @@ -76,7 +76,7 @@ private static List getTopRightSideExits() { } private static List getRightSideExits() { - int[] columnCapacities = calculateColumnLengths(GRID_SIDE_LENGTH); + int[] columnCapacities = calculateColumnLengthStream(GRID_SIDE_LENGTH); int lastIndex = columnCapacities.length - 1; int finalColumnCapacity = columnCapacities[lastIndex]; @@ -88,7 +88,7 @@ private static List getRightSideExits() { private static List getBottomRightSideExits() { int gridSpan = CALCULATE_SPAN.applyAsInt(GRID_SIDE_LENGTH); List list = new ArrayList<>(); - int[] columnCapacities = calculateColumnLengths(GRID_SIDE_LENGTH); + int[] columnCapacities = calculateColumnLengthStream(GRID_SIDE_LENGTH); for (int i = GRID_SIDE_LENGTH - 1; i < gridSpan; i++) { list.add( new Coordinates(i, columnCapacities[i] - 1)); @@ -98,7 +98,7 @@ private static List getBottomRightSideExits() { private static List getBottomLeftSideExits() { List output = new ArrayList<>(); - int[] columnCapacities = calculateColumnLengths(GRID_SIDE_LENGTH); + int[] columnCapacities = calculateColumnLengthStream(GRID_SIDE_LENGTH); for (int i = 0; i < GRID_SIDE_LENGTH; i++) { output.add(new Coordinates(i, columnCapacities[i] - 1)); diff --git a/src/main/java/bomb/modules/dh/hexamaze/hexalgorithm/pathfinding/MazeRunner.java b/src/main/java/bomb/modules/dh/hexamaze/hexalgorithm/pathfinding/MazeRunner.java index 0d02b9c1..5aff0e9e 100644 --- a/src/main/java/bomb/modules/dh/hexamaze/hexalgorithm/pathfinding/MazeRunner.java +++ b/src/main/java/bomb/modules/dh/hexamaze/hexalgorithm/pathfinding/MazeRunner.java @@ -1,199 +1,94 @@ package bomb.modules.dh.hexamaze.hexalgorithm.pathfinding; -import bomb.modules.dh.hexamaze.hexalgorithm.AbstractHexagon; -import bomb.modules.dh.hexamaze.hexalgorithm.HexGrid; -import bomb.modules.dh.hexamaze.hexalgorithm.HexNodeProperties.HexWall; -import bomb.modules.dh.hexamaze.hexalgorithm.HexagonDataStructure.HexNode; +import bomb.modules.dh.hexamaze.hexalgorithm.storage.Grid; +import bomb.modules.dh.hexamaze.hexalgorithm.storage.HexNode; +import bomb.modules.dh.hexamaze.hexalgorithm.storage.HexNode.HexWall; import bomb.tools.Coordinates; import bomb.tools.data.structures.queue.BufferedQueue; -import javafx.scene.paint.Color; +import org.jetbrains.annotations.NotNull; import org.jgrapht.Graph; +import org.jgrapht.GraphPath; import org.jgrapht.alg.shortestpath.DijkstraShortestPath; import org.jgrapht.graph.DefaultEdge; import org.jgrapht.graph.SimpleGraph; -import java.util.ArrayList; import java.util.Comparator; import java.util.List; -import java.util.stream.Collectors; -import static bomb.modules.dh.hexamaze.hexalgorithm.HexNodeProperties.HexWall.Bottom; -import static bomb.modules.dh.hexamaze.hexalgorithm.HexNodeProperties.HexWall.BottomLeft; -import static bomb.modules.dh.hexamaze.hexalgorithm.HexNodeProperties.HexWall.BottomRight; -import static bomb.modules.dh.hexamaze.hexalgorithm.HexNodeProperties.HexWall.Top; -import static bomb.modules.dh.hexamaze.hexalgorithm.HexNodeProperties.HexWall.TopLeft; -import static bomb.modules.dh.hexamaze.hexalgorithm.HexNodeProperties.HexWall.TopRight; +import static bomb.modules.dh.hexamaze.hexalgorithm.storage.AbstractHexagon.calculateColumnLengthStream; +import static bomb.modules.dh.hexamaze.hexalgorithm.storage.Grid.GRID_SIDE_LENGTH; +import static bomb.modules.dh.hexamaze.hexalgorithm.storage.HexNode.HexWall.BOTTOM; +import static bomb.modules.dh.hexamaze.hexalgorithm.storage.HexNode.HexWall.BOTTOM_RIGHT; +import static bomb.modules.dh.hexamaze.hexalgorithm.storage.HexNode.HexWall.TOP_RIGHT; public class MazeRunner { - private static String exitDirection; - private static Color currentPegColor = null; - private static Coordinates currentLocation = null; - //Movement Vectors - private static final Coordinates MOVE_DOWN = new Coordinates(0, 1), MOVE_RIGHT = new Coordinates(1, 0), + private static final Coordinates + MOVE_DOWN = new Coordinates(0, 1), + MOVE_RIGHT = new Coordinates(1, 0), LEFT_SIDE_MOVE_DOWN_RIGHT = new Coordinates(1, 1), RIGHT_SIDE_MOVE_TOP_RIGHT = new Coordinates(1, -1); - /** - * Don't let anyone instantiate this class - */ - private MazeRunner() { - } + public static List runMaze(@NotNull Grid grid, @NotNull List possibleExits) + throws IllegalArgumentException { + Coordinates startingLocation = findStartingLocation(grid); + Graph mappedGraph = convertGridToGraph(grid); + DijkstraShortestPath dijkstraAlgorithm = + new DijkstraShortestPath<>(mappedGraph); - public static void getPegInformation(Color pegColor, int location, int gridSideLength) { - currentPegColor = pegColor; - startingPointCalculator(location, gridSideLength); + return possibleExits.stream() + .map(exit -> dijkstraAlgorithm.getPath(startingLocation, exit)) + .map(GraphPath::getVertexList) + .min(Comparator.comparingInt(List::size)) + .orElseThrow(IllegalArgumentException::new); } - private static void startingPointCalculator(int location, int gridSideLength) { - boolean found = false; - int[] columnLengths = AbstractHexagon.calculateColumnLengths(gridSideLength); - - for (int k = 0; !found && k < columnLengths.length; k++) { - if (location < columnLengths[k]) { - found = true; - currentLocation = new Coordinates(k, location); - } - location -= columnLengths[k]; - } - if (!found) throw new IllegalStateException("This should be impossible"); - } - - public static List runMaze(HexGrid grid) { - if (currentPegColor == null || currentLocation == null) return null; - - List possibleExits = getPossibleExits(grid, grid.getRing().findRelativeIndex(currentPegColor)); - - Graph mappedGraph = mapToGraph(grid); - List> options = new ArrayList<>(); - - for (Coordinates exit : possibleExits) { - DijkstraShortestPath shortest = - new DijkstraShortestPath<>(mappedGraph); - options.add(shortest.getPath(currentLocation, exit).getVertexList()); - } - options.sort(Comparator.comparingInt(List::size)); - - return options.get(0); - } - - private static List getPossibleExits(HexGrid grid, int sideToExit) { - List output = switch (sideToExit) { - case 0 -> getTopLeftSideExits(grid); - case 1 -> getTopRightSideExits(grid); - case 2 -> getRightSideExits(grid); - case 3 -> getBottomRightSideExits(grid); - case 4 -> getBottomLeftSideExits(grid); - default -> getLeftSideExits(grid); - }; - return filterBlockedExits(grid, output, sideToExit); - } - - private static List getTopLeftSideExits(HexGrid grid) { - exitDirection = "Top Left"; - List output = new ArrayList<>(); - for (int i = 0; i < grid.sideLength(); i++) { - output.add(new Coordinates(i, 0)); - } - return output; - } - - private static List getTopRightSideExits(HexGrid grid) { - exitDirection = "Top Right"; - List output = new ArrayList<>(); - for (int i = grid.sideLength() - 1; i < grid.getSpan(); i++) { - output.add(new Coordinates(i, 0)); - } - return output; - } - - private static List getRightSideExits(HexGrid grid) { - exitDirection = "Right"; - List output = new ArrayList<>(); - BufferedQueue> internals = grid.exportTo2DQueue(); - int lastIndex = internals.getCapacity() - 1; - for (int i = 0; i < internals.get(lastIndex).getCapacity(); i++) { - output.add(new Coordinates(lastIndex, i)); - } - return output; - } - - private static List getBottomRightSideExits(HexGrid grid) { - exitDirection = "Bottom Right"; - List output = new ArrayList<>(); - BufferedQueue> internals = grid.exportTo2DQueue(); - for (int i = grid.sideLength() - 1; i < grid.getSpan(); i++) { - output.add(new Coordinates(i, internals.get(i).getCapacity() - 1)); - } - return output; - } - - private static List getBottomLeftSideExits(HexGrid grid) { - exitDirection = "Bottom Left"; - List output = new ArrayList<>(); - BufferedQueue> internals = grid.exportTo2DQueue(); - for (int i = 0; i < grid.sideLength(); i++) { - output.add(new Coordinates(i, internals.get(i).getCapacity() - 1)); - } - return output; - } - - private static List getLeftSideExits(HexGrid grid) { - exitDirection = "Left"; - List output = new ArrayList<>(); - for (int i = 0; i < grid.sideLength(); i++) { - output.add(new Coordinates(0, i)); - } - return output; - } - - private static List filterBlockedExits(HexGrid grid, List list, int sideToExit) { - HexWall[] wallsToFind = switch (sideToExit) { - case 0 -> new HexWall[]{TopLeft, Top}; - case 1 -> new HexWall[]{TopRight, Top}; - case 2 -> new HexWall[]{TopRight, BottomRight}; - case 3 -> new HexWall[]{BottomRight, Bottom}; - case 4 -> new HexWall[]{Bottom, BottomLeft}; - default -> new HexWall[]{TopLeft, BottomLeft}; - }; - return list.stream().filter(coords -> grid.retrieveNode(coords).isPathClear(wallsToFind[0].ordinal()) || - grid.retrieveNode(coords).isPathClear(wallsToFind[1].ordinal())) - .collect(Collectors.toList()); - } - - private static Graph mapToGraph(HexGrid grid) { - BufferedQueue> internals = grid.exportTo2DQueue(); + private static Graph convertGridToGraph(Grid grid) { Graph graph = new SimpleGraph<>(DefaultEdge.class); - for (int x = 0; x < internals.getCapacity(); x++) { - for (int y = 0; y < internals.get(x).getCapacity(); y++) { + int[] columnLengths = calculateColumnLengthStream(GRID_SIDE_LENGTH); + int x = 0; + + for (int columnLength : columnLengths) { + for (int y = 0; y < columnLength; y++) { mapAdjacentNodes(grid, graph, new Coordinates(x, y)); } + x++; } return graph; } - private static void mapAdjacentNodes(HexGrid grid, Graph graph, Coordinates location) { - boolean notHalfWay = location.x() < grid.sideLength() - 1; - mapSingleNode(grid, graph, TopRight, location, location.add(notHalfWay ? - MOVE_RIGHT : RIGHT_SIDE_MOVE_TOP_RIGHT)); - mapSingleNode(grid, graph, BottomRight, location, location.add(notHalfWay ? + private static void mapAdjacentNodes(Grid grid, Graph graph, Coordinates location) { + boolean notHalfWay = location.x() < grid.getHexagon().getSideLength() - 1; + mapSingleNode(grid, graph, TOP_RIGHT, location, + location.add(notHalfWay ? MOVE_RIGHT : RIGHT_SIDE_MOVE_TOP_RIGHT)); + mapSingleNode(grid, graph, BOTTOM_RIGHT, location, location.add(notHalfWay ? LEFT_SIDE_MOVE_DOWN_RIGHT : MOVE_RIGHT)); - mapSingleNode(grid, graph, Bottom, location, location.add(MOVE_DOWN)); + mapSingleNode(grid, graph, BOTTOM, location, location.add(MOVE_DOWN)); } - private static void mapSingleNode(HexGrid grid, Graph graph, + private static void mapSingleNode(Grid grid, Graph graph, HexWall correspondingWall, Coordinates from, Coordinates to) { - HexNode currentNode = grid.retrieveNode(from); - HexNode checkExists = grid.retrieveNode(to); - - if (currentNode.isPathClear(correspondingWall.ordinal()) && checkExists != null) { - graph.addVertex(from); - graph.addVertex(to); - graph.addEdge(from, 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); + } + + private static Coordinates findStartingLocation(Grid grid) { + BufferedQueue> gridQueues = grid.getHexagon().getBufferedQueues(); + int size = gridQueues.size(); + for (int x = 0; x < size; x++) { + BufferedQueue 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); + } } - } - - public static String getExitDirection() { - return exitDirection; + throw new RuntimeException("Failed to find start position"); } } diff --git a/src/main/java/bomb/modules/dh/hexamaze_redesign/hexalgorithm/storage/AbstractHexagon.java b/src/main/java/bomb/modules/dh/hexamaze/hexalgorithm/storage/AbstractHexagon.java similarity index 95% rename from src/main/java/bomb/modules/dh/hexamaze_redesign/hexalgorithm/storage/AbstractHexagon.java rename to src/main/java/bomb/modules/dh/hexamaze/hexalgorithm/storage/AbstractHexagon.java index 55128eee..488c4fa9 100644 --- a/src/main/java/bomb/modules/dh/hexamaze_redesign/hexalgorithm/storage/AbstractHexagon.java +++ b/src/main/java/bomb/modules/dh/hexamaze/hexalgorithm/storage/AbstractHexagon.java @@ -1,4 +1,4 @@ -package bomb.modules.dh.hexamaze_redesign.hexalgorithm.storage; +package bomb.modules.dh.hexamaze.hexalgorithm.storage; import bomb.tools.Coordinates; diff --git a/src/main/java/bomb/modules/dh/hexamaze_redesign/hexalgorithm/storage/Grid.java b/src/main/java/bomb/modules/dh/hexamaze/hexalgorithm/storage/Grid.java similarity index 95% rename from src/main/java/bomb/modules/dh/hexamaze_redesign/hexalgorithm/storage/Grid.java rename to src/main/java/bomb/modules/dh/hexamaze/hexalgorithm/storage/Grid.java index d784782b..e2f089d6 100644 --- a/src/main/java/bomb/modules/dh/hexamaze_redesign/hexalgorithm/storage/Grid.java +++ b/src/main/java/bomb/modules/dh/hexamaze/hexalgorithm/storage/Grid.java @@ -1,4 +1,4 @@ -package bomb.modules.dh.hexamaze_redesign.hexalgorithm.storage; +package bomb.modules.dh.hexamaze.hexalgorithm.storage; import bomb.tools.data.structures.ring.ArrayRing; import javafx.scene.paint.Color; diff --git a/src/main/java/bomb/modules/dh/hexamaze_redesign/hexalgorithm/storage/HexNode.java b/src/main/java/bomb/modules/dh/hexamaze/hexalgorithm/storage/HexNode.java similarity index 97% rename from src/main/java/bomb/modules/dh/hexamaze_redesign/hexalgorithm/storage/HexNode.java rename to src/main/java/bomb/modules/dh/hexamaze/hexalgorithm/storage/HexNode.java index a9765783..0103d6d3 100644 --- a/src/main/java/bomb/modules/dh/hexamaze_redesign/hexalgorithm/storage/HexNode.java +++ b/src/main/java/bomb/modules/dh/hexamaze/hexalgorithm/storage/HexNode.java @@ -1,4 +1,4 @@ -package bomb.modules.dh.hexamaze_redesign.hexalgorithm.storage; +package bomb.modules.dh.hexamaze.hexalgorithm.storage; import java.util.EnumSet; import java.util.Objects; diff --git a/src/main/java/bomb/modules/dh/hexamaze_redesign/hexalgorithm/storage/HexagonalPlane.java b/src/main/java/bomb/modules/dh/hexamaze/hexalgorithm/storage/HexagonalPlane.java similarity index 82% rename from src/main/java/bomb/modules/dh/hexamaze_redesign/hexalgorithm/storage/HexagonalPlane.java rename to src/main/java/bomb/modules/dh/hexamaze/hexalgorithm/storage/HexagonalPlane.java index 460c119e..0d5fdcfa 100644 --- a/src/main/java/bomb/modules/dh/hexamaze_redesign/hexalgorithm/storage/HexagonalPlane.java +++ b/src/main/java/bomb/modules/dh/hexamaze/hexalgorithm/storage/HexagonalPlane.java @@ -1,7 +1,7 @@ -package bomb.modules.dh.hexamaze_redesign.hexalgorithm.storage; +package bomb.modules.dh.hexamaze.hexalgorithm.storage; -import bomb.modules.dh.hexamaze_redesign.hexalgorithm.storage.HexNode.HexShape; -import bomb.modules.dh.hexamaze_redesign.hexalgorithm.storage.HexNode.HexWall; +import bomb.modules.dh.hexamaze.hexalgorithm.storage.HexNode.HexShape; +import bomb.modules.dh.hexamaze.hexalgorithm.storage.HexNode.HexWall; import bomb.tools.Coordinates; import bomb.tools.data.structures.queue.BufferedQueue; @@ -11,19 +11,19 @@ import java.util.function.IntUnaryOperator; import java.util.stream.Collectors; -import static bomb.modules.dh.hexamaze_redesign.hexalgorithm.storage.AbstractHexagon.calculateColumnLengthStream; -import static bomb.modules.dh.hexamaze_redesign.hexalgorithm.storage.HexNode.HexShape.CIRCLE; -import static bomb.modules.dh.hexamaze_redesign.hexalgorithm.storage.HexNode.HexShape.DOWN_TRIANGLE; -import static bomb.modules.dh.hexamaze_redesign.hexalgorithm.storage.HexNode.HexShape.HEXAGON; -import static bomb.modules.dh.hexamaze_redesign.hexalgorithm.storage.HexNode.HexShape.LEFT_TRIANGLE; -import static bomb.modules.dh.hexamaze_redesign.hexalgorithm.storage.HexNode.HexShape.RIGHT_TRIANGLE; -import static bomb.modules.dh.hexamaze_redesign.hexalgorithm.storage.HexNode.HexShape.UP_TRIANGLE; -import static bomb.modules.dh.hexamaze_redesign.hexalgorithm.storage.HexNode.HexWall.BOTTOM; -import static bomb.modules.dh.hexamaze_redesign.hexalgorithm.storage.HexNode.HexWall.BOTTOM_LEFT; -import static bomb.modules.dh.hexamaze_redesign.hexalgorithm.storage.HexNode.HexWall.BOTTOM_RIGHT; -import static bomb.modules.dh.hexamaze_redesign.hexalgorithm.storage.HexNode.HexWall.TOP; -import static bomb.modules.dh.hexamaze_redesign.hexalgorithm.storage.HexNode.HexWall.TOP_LEFT; -import static bomb.modules.dh.hexamaze_redesign.hexalgorithm.storage.HexNode.HexWall.TOP_RIGHT; +import static bomb.modules.dh.hexamaze.hexalgorithm.storage.AbstractHexagon.calculateColumnLengthStream; +import static bomb.modules.dh.hexamaze.hexalgorithm.storage.HexNode.HexShape.CIRCLE; +import static bomb.modules.dh.hexamaze.hexalgorithm.storage.HexNode.HexShape.DOWN_TRIANGLE; +import static bomb.modules.dh.hexamaze.hexalgorithm.storage.HexNode.HexShape.HEXAGON; +import static bomb.modules.dh.hexamaze.hexalgorithm.storage.HexNode.HexShape.LEFT_TRIANGLE; +import static bomb.modules.dh.hexamaze.hexalgorithm.storage.HexNode.HexShape.RIGHT_TRIANGLE; +import static bomb.modules.dh.hexamaze.hexalgorithm.storage.HexNode.HexShape.UP_TRIANGLE; +import static bomb.modules.dh.hexamaze.hexalgorithm.storage.HexNode.HexWall.BOTTOM; +import static bomb.modules.dh.hexamaze.hexalgorithm.storage.HexNode.HexWall.BOTTOM_LEFT; +import static bomb.modules.dh.hexamaze.hexalgorithm.storage.HexNode.HexWall.BOTTOM_RIGHT; +import static bomb.modules.dh.hexamaze.hexalgorithm.storage.HexNode.HexWall.TOP; +import static bomb.modules.dh.hexamaze.hexalgorithm.storage.HexNode.HexWall.TOP_LEFT; +import static bomb.modules.dh.hexamaze.hexalgorithm.storage.HexNode.HexWall.TOP_RIGHT; import static bomb.tools.number.MathUtils.isAnInteger; import static java.util.Arrays.stream; import static java.util.stream.Collectors.toList; diff --git a/src/main/java/bomb/modules/dh/hexamaze_redesign/hexalgorithm/storage/Maze.java b/src/main/java/bomb/modules/dh/hexamaze/hexalgorithm/storage/Maze.java similarity index 77% rename from src/main/java/bomb/modules/dh/hexamaze_redesign/hexalgorithm/storage/Maze.java rename to src/main/java/bomb/modules/dh/hexamaze/hexalgorithm/storage/Maze.java index 26faf6d2..4475ec14 100644 --- a/src/main/java/bomb/modules/dh/hexamaze_redesign/hexalgorithm/storage/Maze.java +++ b/src/main/java/bomb/modules/dh/hexamaze/hexalgorithm/storage/Maze.java @@ -1,6 +1,6 @@ -package bomb.modules.dh.hexamaze_redesign.hexalgorithm.storage; +package bomb.modules.dh.hexamaze.hexalgorithm.storage; -import bomb.modules.dh.hexamaze_redesign.hexalgorithm.factory.MazeFactory; +import bomb.modules.dh.hexamaze.hexalgorithm.factory.MazeFactory; import com.opencsv.exceptions.CsvException; import java.io.IOException; diff --git a/src/main/java/bomb/modules/dh/hexamaze_redesign/Hexamaze.java b/src/main/java/bomb/modules/dh/hexamaze_redesign/Hexamaze.java deleted file mode 100644 index 2a12b782..00000000 --- a/src/main/java/bomb/modules/dh/hexamaze_redesign/Hexamaze.java +++ /dev/null @@ -1,91 +0,0 @@ -package bomb.modules.dh.hexamaze_redesign; - -import bomb.Widget; -import bomb.components.hex.HexTile; -import bomb.modules.dh.hexamaze_redesign.hexalgorithm.maze_finding.MazeSearch; -import bomb.modules.dh.hexamaze_redesign.hexalgorithm.pathfinding.ExitChecker; -import bomb.modules.dh.hexamaze_redesign.hexalgorithm.pathfinding.MazeRunner; -import bomb.modules.dh.hexamaze_redesign.hexalgorithm.storage.Grid; -import bomb.modules.dh.hexamaze_redesign.hexalgorithm.storage.HexNode; -import bomb.modules.dh.hexamaze_redesign.hexalgorithm.storage.HexagonalPlane; -import bomb.modules.dh.hexamaze_redesign.hexalgorithm.storage.Maze; -import bomb.tools.Coordinates; -import bomb.tools.data.structures.queue.BufferedQueue; -import javafx.scene.paint.Color; -import org.javatuples.Pair; -import org.jetbrains.annotations.NotNull; - -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import static bomb.components.hex.HexTile.DEFAULT_BACKGROUND_COLOR; -import static bomb.modules.dh.hexamaze_redesign.hexalgorithm.storage.HexagonalPlane.convertFromList; -import static java.util.stream.Collectors.toList; -import static javafx.scene.paint.Color.BLUE; -import static javafx.scene.paint.Color.CYAN; -import static javafx.scene.paint.Color.GREEN; -import static javafx.scene.paint.Color.MAGENTA; -import static javafx.scene.paint.Color.RED; -import static javafx.scene.paint.Color.YELLOW; - -public class Hexamaze extends Widget { - public static final Map COLOR_MAP = new HashMap<>(); - public static final Color PEG_COLOR = new Color(0.65, 0.65, 0.65, 1.0); - - static { - COLOR_MAP.put(PEG_COLOR, -1); - COLOR_MAP.put(RED, 0); - COLOR_MAP.put(YELLOW, 1); - COLOR_MAP.put(GREEN, 2); - COLOR_MAP.put(CYAN, 3); - COLOR_MAP.put(BLUE, 4); - COLOR_MAP.put(MAGENTA, 5); - } - - public static String solve(@NotNull List tileList) throws IllegalArgumentException { - Maze maze = new Maze(); - List nodeList = tileList.stream() - .map(HexTile::getInternalNode) - .collect(toList()); - Grid original = new Grid(new HexagonalPlane(nodeList)); - - Grid found = MazeSearch.search(maze, original); - if (found == null) - throw new IllegalArgumentException("Could not find maze from given shapes"); - - copyPegLocation(original, found); - Pair> exitInfo = ExitChecker.findPossibleExits(found); - if (exitInfo == null) - return ""; - - List resultingPath = MazeRunner.runMaze(found, exitInfo.getValue1()); - fillHexTiles(tileList, resultingPath); - return exitInfo.getValue0(); - } - - private static void copyPegLocation(Grid original, Grid found) { - List originalList = original.getHexagon().asList(); - List foundList = found.getHexagon().asList(); - int size = originalList.size(); - - for (int i = 0; i < size; i++) { - int currentNodeColorValue = originalList.get(i).getColor(); - if (currentNodeColorValue != -1) { - foundList.get(i).setColor(currentNodeColorValue); - return; - } - } - } - - private static void fillHexTiles(List tileList, List coordinatesList) { - for (HexTile hexTile : tileList) - hexTile.setBackgroundFill(DEFAULT_BACKGROUND_COLOR); - - BufferedQueue> tileQueues = convertFromList(tileList); - - coordinatesList.stream() - .map(c -> tileQueues.get(c.x()).get(c.y())) - .forEach(System.out::println); - } -} diff --git a/src/main/java/bomb/modules/dh/hexamaze_redesign/HexamazeController.java b/src/main/java/bomb/modules/dh/hexamaze_redesign/HexamazeController.java deleted file mode 100644 index d9ffe5b3..00000000 --- a/src/main/java/bomb/modules/dh/hexamaze_redesign/HexamazeController.java +++ /dev/null @@ -1,60 +0,0 @@ -package bomb.modules.dh.hexamaze_redesign; - -import bomb.abstractions.Resettable; -import bomb.components.hex.MazeComponent; -import bomb.tools.pattern.facade.FacadeFX; -import javafx.fxml.FXML; -import javafx.scene.control.Alert; -import javafx.scene.control.Label; -import javafx.scene.control.RadioButton; -import javafx.scene.control.ToggleGroup; - -import static bomb.tools.pattern.facade.FacadeFX.GET_TOGGLE_NAME; - -public class HexamazeController implements Resettable { - @FXML - private Label exitDirectionLabel; - - @FXML - private MazeComponent mazeComponent; - - @FXML - private RadioButton redButton, yellowButton, greenButton, cyanButton, blueButton, pinkButton; - - @FXML - private ToggleGroup hexGroup, hexColorGroup; - - @FXML - private void setShape() { - String shape = GET_TOGGLE_NAME.apply(hexGroup.getSelectedToggle()); - mazeComponent.setShapeSelection(shape); - } - - @FXML - private void setPegFill() { - String color = GET_TOGGLE_NAME.apply(hexColorGroup.getSelectedToggle()); - mazeComponent.setColorSelection(color); - } - - @FXML - private void solveMaze() { - try { - String exitDirectionText = Hexamaze.solve(mazeComponent.createTileList()); - exitDirectionLabel.setText( - exitDirectionText.isEmpty() ? - exitDirectionText : - "Exit out of the " + exitDirectionText + " side" - ); - } catch (IllegalArgumentException illegal) { - FacadeFX.setAlert(Alert.AlertType.ERROR, illegal.getMessage()); - } - } - - @Override - public void reset() { - mazeComponent.reset(); - FacadeFX.clearText(exitDirectionLabel); - FacadeFX.resetToggleGroups(hexGroup, hexColorGroup); - FacadeFX.disableMultiple(redButton, yellowButton, greenButton, cyanButton, blueButton, pinkButton); - } -} diff --git a/src/main/java/bomb/modules/dh/hexamaze_redesign/hexalgorithm/pathfinding/MazeRunner.java b/src/main/java/bomb/modules/dh/hexamaze_redesign/hexalgorithm/pathfinding/MazeRunner.java deleted file mode 100644 index 75821349..00000000 --- a/src/main/java/bomb/modules/dh/hexamaze_redesign/hexalgorithm/pathfinding/MazeRunner.java +++ /dev/null @@ -1,94 +0,0 @@ -package bomb.modules.dh.hexamaze_redesign.hexalgorithm.pathfinding; - -import bomb.modules.dh.hexamaze_redesign.hexalgorithm.storage.Grid; -import bomb.modules.dh.hexamaze_redesign.hexalgorithm.storage.HexNode; -import bomb.modules.dh.hexamaze_redesign.hexalgorithm.storage.HexNode.HexWall; -import bomb.tools.Coordinates; -import bomb.tools.data.structures.queue.BufferedQueue; -import org.jetbrains.annotations.NotNull; -import org.jgrapht.Graph; -import org.jgrapht.GraphPath; -import org.jgrapht.alg.shortestpath.DijkstraShortestPath; -import org.jgrapht.graph.DefaultEdge; -import org.jgrapht.graph.SimpleGraph; - -import java.util.Comparator; -import java.util.List; - -import static bomb.modules.dh.hexamaze.hexalgorithm.AbstractHexagon.calculateColumnLengths; -import static bomb.modules.dh.hexamaze_redesign.hexalgorithm.storage.Grid.GRID_SIDE_LENGTH; -import static bomb.modules.dh.hexamaze_redesign.hexalgorithm.storage.HexNode.HexWall.BOTTOM; -import static bomb.modules.dh.hexamaze_redesign.hexalgorithm.storage.HexNode.HexWall.BOTTOM_RIGHT; -import static bomb.modules.dh.hexamaze_redesign.hexalgorithm.storage.HexNode.HexWall.TOP_RIGHT; - -public class MazeRunner { - //Movement Vectors - private static final Coordinates - MOVE_DOWN = new Coordinates(0, 1), - MOVE_RIGHT = new Coordinates(1, 0), - LEFT_SIDE_MOVE_DOWN_RIGHT = new Coordinates(1, 1), - RIGHT_SIDE_MOVE_TOP_RIGHT = new Coordinates(1, -1); - - public static List runMaze(@NotNull Grid grid, @NotNull List possibleExits) - throws IllegalArgumentException { - Coordinates startingLocation = findStartingLocation(grid); - Graph mappedGraph = convertGridToGraph(grid); - DijkstraShortestPath dijkstraAlgorithm = - new DijkstraShortestPath<>(mappedGraph); - - return possibleExits.stream() - .map(exit -> dijkstraAlgorithm.getPath(startingLocation, exit)) - .map(GraphPath::getVertexList) - .min(Comparator.comparingInt(List::size)) - .orElseThrow(IllegalArgumentException::new); - } - - private static Graph convertGridToGraph(Grid grid) { - Graph graph = new SimpleGraph<>(DefaultEdge.class); - int[] columnLengths = calculateColumnLengths(GRID_SIDE_LENGTH); - int x = 0; - - for (int columnLength : columnLengths) { - for (int y = 0; y < columnLength; y++) { - mapAdjacentNodes(grid, graph, new Coordinates(x, y)); - } - x++; - } - return graph; - } - - private static void mapAdjacentNodes(Grid grid, Graph graph, Coordinates location) { - boolean notHalfWay = location.x() < grid.getHexagon().getSideLength() - 1; - mapSingleNode(grid, graph, TOP_RIGHT, location, - location.add(notHalfWay ? MOVE_RIGHT : RIGHT_SIDE_MOVE_TOP_RIGHT)); - mapSingleNode(grid, graph, BOTTOM_RIGHT, location, location.add(notHalfWay ? - LEFT_SIDE_MOVE_DOWN_RIGHT : MOVE_RIGHT)); - mapSingleNode(grid, graph, BOTTOM, location, location.add(MOVE_DOWN)); - } - - private static void mapSingleNode(Grid grid, Graph 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); - } - - private static Coordinates findStartingLocation(Grid grid) { - BufferedQueue> gridQueues = grid.getHexagon().getBufferedQueues(); - int size = gridQueues.size(); - for (int x = 0; x < size; x++) { - BufferedQueue 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"); - } -} diff --git a/src/main/java/module-info.java b/src/main/java/module-info.java index d2b4c4ed..55a22078 100644 --- a/src/main/java/module-info.java +++ b/src/main/java/module-info.java @@ -31,9 +31,7 @@ exports bomb.modules.dh.fast_math to javafx.fxml; exports bomb.modules.dh.forget_me to javafx.fxml; exports bomb.modules.dh.hexamaze to javafx.fxml; - exports bomb.modules.dh.hexamaze.hexalgorithm to javafx.fxml; - exports bomb.modules.dh.hexamaze_redesign to javafx.fxml; - exports bomb.modules.dh.hexamaze_redesign.hexalgorithm.storage to javafx.fxml; + exports bomb.modules.dh.hexamaze.hexalgorithm.storage to javafx.fxml; exports bomb.modules.il.ice_cream to javafx.fxml; exports bomb.modules.il.laundry to javafx.fxml; exports bomb.modules.il.led_encryption to javafx.fxml; diff --git a/src/main/resources/bomb/fxml/dh/hexamaze.fxml b/src/main/resources/bomb/fxml/dh/hexamaze.fxml index ba9a5005..609997be 100644 --- a/src/main/resources/bomb/fxml/dh/hexamaze.fxml +++ b/src/main/resources/bomb/fxml/dh/hexamaze.fxml @@ -1,14 +1,15 @@ - + - + + @@ -18,51 +19,15 @@ - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + @@ -91,7 +56,7 @@ onAction="#setShape" text="Peg" toggleGroup="$hexGroup"> + onAction="#solveMaze" text="Submit"> @@ -119,4 +84,4 @@ - + \ No newline at end of file diff --git a/src/main/resources/bomb/fxml/dh/new_hexamaze.fxml b/src/main/resources/bomb/fxml/dh/new_hexamaze.fxml deleted file mode 100644 index 57d0a645..00000000 --- a/src/main/resources/bomb/fxml/dh/new_hexamaze.fxml +++ /dev/null @@ -1,26 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/main/resources/bomb/modules/dh/hexamaze/hexalgorithm/maze.csv b/src/main/resources/bomb/modules/dh/hexamaze/hexalgorithm/factory/maze.csv similarity index 100% rename from src/main/resources/bomb/modules/dh/hexamaze/hexalgorithm/maze.csv rename to src/main/resources/bomb/modules/dh/hexamaze/hexalgorithm/factory/maze.csv diff --git a/src/main/resources/bomb/modules/dh/hexamaze_redesign/hexalgorithm/factory/maze.csv b/src/main/resources/bomb/modules/dh/hexamaze_redesign/hexalgorithm/factory/maze.csv deleted file mode 100644 index 223fac53..00000000 --- a/src/main/resources/bomb/modules/dh/hexamaze_redesign/hexalgorithm/factory/maze.csv +++ /dev/null @@ -1,23 +0,0 @@ -1345 n ,01345 n,01235 n,0345 n ,0145 n ,0135 n ,0235 n ,235 n ,035 n ,0235 n ,0245 n ,01345 n -0125 n ,025 n ,0235 n ,045 n ,0145 n ,015 n ,0235 n ,0345 n,0145 n,01345 n,01234 n,0124 n ,01345 n -01345 n,01234 n,01234 n,015 n ,025 n ,024 n ,01234 h,0124 n,0124 n,0145 n ,01234 n,123 n ,245 n ,01234 n -024 n ,01234 n,1234 n ,12 n ,0235 n ,0234 n ,123 n ,235 n ,234 n ,15 n ,035 lt ,235 n ,234 n ,0135 n ,23 n -0134 n ,1234 n ,1234 n ,1234 n ,1234 n ,0134 n ,1234 n ,1234 n,0134 n,145 n ,0145 n ,0135 n ,0345 n ,145 n ,01345 n,1234 n -0145 n ,1234 n ,1234 n ,135 n ,234 n ,145 n ,135 c ,235 n ,25 n ,45 c ,0145 n ,0145 n ,014 n ,015 n ,025 n ,02345 n,123 n -015 n ,0234 n ,1235 n ,45 n ,0135 n ,45 n ,01 n ,0235 n,0235 n,045 n ,015 n ,04 n ,014 n ,12 n ,0235 h ,0235 n ,0345 n ,1345 n -145 n ,0134 n ,1234 n ,0124 n ,0145 n ,0145 n ,014 n ,123 n ,023 n ,025 n ,045 n ,0145 n ,145 n ,135 n ,235 n ,0345 n ,015 n ,025 n ,02345 n -0145 n ,0145 n ,135 n ,235 n ,45 n ,012 dt ,024 n ,1234 n,1234 n,1234 ut,0145 n ,0145 n ,0145 n ,01 n ,0235 n ,045 n ,015 n ,02345 n,0135 n ,024 n -0125 n ,045 n ,0145 n ,0123 n ,02 n ,0235 n ,234 n ,1234 n,1234 n,1234 n ,124 n ,0145 n ,014 n ,0145 n ,134 n ,014 n ,015 n ,023 c ,0245 n ,01345 n,12345 n -0135 n ,045 n ,0145 n ,0135 n ,34 rt ,123 n ,0235 n ,235 n ,235 n ,3 n ,235 n ,25 n ,024 n ,124 n ,0145 n ,124 rt ,12 n ,02345 n,135 n ,025 n ,0235 n ,0234 n -1245 n ,0125 n ,024 n ,0124 n ,0145 n ,1234 n ,123 n ,0235 n,0235 n,045 n ,135 n ,235 h ,03 n ,235 n ,25 n ,0235 n ,234 n ,123 n ,025 n ,0235 n ,035 n ,02345 n,12345 n -01235 n,0235 n ,34 n ,145 n ,0135 n ,34 n ,123 n ,023 n ,024 n ,015 n ,023 n ,024 n ,123 n ,023 n ,0235 n ,0234 n ,3 n ,235 n ,02345 n,014 n ,01345 n,01345 n -0123 n ,0245 n ,125 n ,045 n ,014 ut ,1235 n ,234 n ,1234 n,12 n ,0235 n ,34 n ,134 n ,1234 n ,135 n ,035 n ,0245 c ,13 n ,0235 n ,0245 n ,12 n ,024 n -134 n ,01235 n,045 n ,0145 n ,135 n ,035 n ,34 n ,1234 n,123 n ,024 h ,124 n ,1234 n ,12 n ,02 n ,0235 n ,045 n ,123 n ,023 n ,02345 n,12345 n -1234 n ,0125 n ,045 n ,0124 n ,0124 n ,0125 n ,35 n ,35 n ,235 n ,34 n ,1234 n ,123 n ,23 n ,2345 n ,01 n ,023 n ,234 n ,123 n ,02345 n -1234 n ,014 n ,0135 n ,234 n ,1235 n ,045 n ,015 c ,035 n ,045 n ,13 n ,234 dt ,13 n ,2345 n ,0145 n ,1345 rt,12345 n,12345 n,135 n -1245 n ,145 n ,0135 n ,23 lt ,025 n ,0245 n ,0145 n ,0145 n,014 n ,1234 n ,1245 n ,1345 n ,0145 n ,015 n ,0235 n ,0234 n ,0145 n -0245 n ,0124 n ,0123 n ,235 n ,035 n ,045 n ,0145 n ,014 n ,1234 n,123 n ,025 n ,02 n ,02 n ,023 n ,02345 n,1245 n -01235 n,234 n ,1234 n ,01245 n,014 n ,01 n ,0245 n ,135 h ,34 n ,135 n ,035 n ,2345 n ,1234 n ,1235 n ,0345 n -0123 n ,234 n ,1234 n ,014 n ,1245 n ,1345 n ,0145 n ,014 n ,1245 n,01 n ,0235 n ,0235 n ,345 n ,0134 n -1234 n ,1234 n ,145 n ,134 n ,01245 n,0145 n ,0145 n ,1345 n,0145 n,135 n ,0345 n ,015 n ,0345 n -2345 n ,1245 n ,01245 n,135 n ,0245 n ,01245 n,01245 n,0145 n,0124 n,01245 n,01245 n,01245 n \ No newline at end of file diff --git a/src/test/java/bomb/modules/dh/hexamaze_redesign/hexalgorithm/maze_finding/MazeRunnerTest.java b/src/test/java/bomb/modules/dh/hexamaze/hexalgorithm/maze_finding/MazeRunnerTest.java similarity index 63% rename from src/test/java/bomb/modules/dh/hexamaze_redesign/hexalgorithm/maze_finding/MazeRunnerTest.java rename to src/test/java/bomb/modules/dh/hexamaze/hexalgorithm/maze_finding/MazeRunnerTest.java index 0ea16554..0ba38355 100644 --- a/src/test/java/bomb/modules/dh/hexamaze_redesign/hexalgorithm/maze_finding/MazeRunnerTest.java +++ b/src/test/java/bomb/modules/dh/hexamaze/hexalgorithm/maze_finding/MazeRunnerTest.java @@ -1,9 +1,9 @@ -package bomb.modules.dh.hexamaze_redesign.hexalgorithm.maze_finding; +package bomb.modules.dh.hexamaze.hexalgorithm.maze_finding; -import bomb.modules.dh.hexamaze_redesign.hexalgorithm.pathfinding.ExitChecker; -import bomb.modules.dh.hexamaze_redesign.hexalgorithm.pathfinding.MazeRunner; -import bomb.modules.dh.hexamaze_redesign.hexalgorithm.storage.Grid; -import bomb.modules.dh.hexamaze_redesign.hexalgorithm.storage.Maze; +import bomb.modules.dh.hexamaze.hexalgorithm.pathfinding.ExitChecker; +import bomb.modules.dh.hexamaze.hexalgorithm.pathfinding.MazeRunner; +import bomb.modules.dh.hexamaze.hexalgorithm.storage.Grid; +import bomb.modules.dh.hexamaze.hexalgorithm.storage.Maze; import bomb.tools.Coordinates; import org.javatuples.Pair; import org.testng.annotations.BeforeMethod; @@ -13,8 +13,8 @@ import java.util.List; import java.util.Set; -import static bomb.modules.dh.hexamaze_redesign.hexalgorithm.maze_finding.ExitCheckerTest.setPegLocations; -import static bomb.modules.dh.hexamaze_redesign.hexalgorithm.pathfinding.MazeSearchTest.hexagonFromLine; +import static bomb.modules.dh.hexamaze.hexalgorithm.pathfinding.ExitCheckerTest.setPegLocations; +import static bomb.modules.dh.hexamaze.hexalgorithm.pathfinding.MazeSearchTest.hexagonFromLine; import static org.testng.Assert.assertNotNull; @SuppressWarnings("ALL") diff --git a/src/test/java/bomb/modules/dh/hexamaze_redesign/hexalgorithm/maze_finding/ExitCheckerTest.java b/src/test/java/bomb/modules/dh/hexamaze/hexalgorithm/pathfinding/ExitCheckerTest.java similarity index 80% rename from src/test/java/bomb/modules/dh/hexamaze_redesign/hexalgorithm/maze_finding/ExitCheckerTest.java rename to src/test/java/bomb/modules/dh/hexamaze/hexalgorithm/pathfinding/ExitCheckerTest.java index d58a00d8..2b5a7298 100644 --- a/src/test/java/bomb/modules/dh/hexamaze_redesign/hexalgorithm/maze_finding/ExitCheckerTest.java +++ b/src/test/java/bomb/modules/dh/hexamaze/hexalgorithm/pathfinding/ExitCheckerTest.java @@ -1,9 +1,9 @@ -package bomb.modules.dh.hexamaze_redesign.hexalgorithm.maze_finding; +package bomb.modules.dh.hexamaze.hexalgorithm.pathfinding; -import bomb.modules.dh.hexamaze_redesign.hexalgorithm.pathfinding.ExitChecker; -import bomb.modules.dh.hexamaze_redesign.hexalgorithm.storage.Grid; -import bomb.modules.dh.hexamaze_redesign.hexalgorithm.storage.HexNode; -import bomb.modules.dh.hexamaze_redesign.hexalgorithm.storage.Maze; +import bomb.modules.dh.hexamaze.hexalgorithm.maze_finding.MazeSearch; +import bomb.modules.dh.hexamaze.hexalgorithm.storage.Grid; +import bomb.modules.dh.hexamaze.hexalgorithm.storage.HexNode; +import bomb.modules.dh.hexamaze.hexalgorithm.storage.Maze; import bomb.tools.Coordinates; import bomb.tools.data.structures.queue.BufferedQueue; import org.javatuples.Pair; @@ -14,7 +14,7 @@ import java.util.List; import java.util.Set; -import static bomb.modules.dh.hexamaze_redesign.hexalgorithm.pathfinding.MazeSearchTest.hexagonFromLine; +import static bomb.modules.dh.hexamaze.hexalgorithm.pathfinding.MazeSearchTest.hexagonFromLine; import static org.testng.Assert.assertEquals; import static org.testng.Assert.assertNotNull; import static org.testng.Assert.assertNull; @@ -67,7 +67,7 @@ public void validLocationTest() { assertEquals(results.getValue1().size(), 2); } - static void setPegLocations(Grid grid, Set locations) { + public static void setPegLocations(Grid grid, Set locations) { BufferedQueue> gridQueues = grid.getHexagon().getBufferedQueues(); int locationCounter = 0; diff --git a/src/test/java/bomb/modules/dh/hexamaze_redesign/hexalgorithm/pathfinding/MazeSearchTest.java b/src/test/java/bomb/modules/dh/hexamaze/hexalgorithm/pathfinding/MazeSearchTest.java similarity index 74% rename from src/test/java/bomb/modules/dh/hexamaze_redesign/hexalgorithm/pathfinding/MazeSearchTest.java rename to src/test/java/bomb/modules/dh/hexamaze/hexalgorithm/pathfinding/MazeSearchTest.java index 7578cd09..433f31f6 100644 --- a/src/test/java/bomb/modules/dh/hexamaze_redesign/hexalgorithm/pathfinding/MazeSearchTest.java +++ b/src/test/java/bomb/modules/dh/hexamaze/hexalgorithm/pathfinding/MazeSearchTest.java @@ -1,11 +1,11 @@ -package bomb.modules.dh.hexamaze_redesign.hexalgorithm.pathfinding; - -import bomb.modules.dh.hexamaze_redesign.hexalgorithm.factory.MazeFactory; -import bomb.modules.dh.hexamaze_redesign.hexalgorithm.maze_finding.MazeSearch; -import bomb.modules.dh.hexamaze_redesign.hexalgorithm.storage.Grid; -import bomb.modules.dh.hexamaze_redesign.hexalgorithm.storage.HexNode; -import bomb.modules.dh.hexamaze_redesign.hexalgorithm.storage.HexagonalPlane; -import bomb.modules.dh.hexamaze_redesign.hexalgorithm.storage.Maze; +package bomb.modules.dh.hexamaze.hexalgorithm.pathfinding; + +import bomb.modules.dh.hexamaze.hexalgorithm.factory.MazeFactory; +import bomb.modules.dh.hexamaze.hexalgorithm.maze_finding.MazeSearch; +import bomb.modules.dh.hexamaze.hexalgorithm.storage.Grid; +import bomb.modules.dh.hexamaze.hexalgorithm.storage.HexNode; +import bomb.modules.dh.hexamaze.hexalgorithm.storage.HexagonalPlane; +import bomb.modules.dh.hexamaze.hexalgorithm.storage.Maze; import org.testng.annotations.BeforeClass; import org.testng.annotations.DataProvider; import org.testng.annotations.Test; diff --git a/src/test/resources/suites/suiteOne.xml b/src/test/resources/suites/suiteOne.xml index dfa78b21..0ce82df3 100644 --- a/src/test/resources/suites/suiteOne.xml +++ b/src/test/resources/suites/suiteOne.xml @@ -29,9 +29,9 @@ - - - + + + From 829c3dff3357ce204d1123148610b37cdf17ef20 Mon Sep 17 00:00:00 2001 From: "Mr. J" <45538844+Ultraviolet-Ninja@users.noreply.github.com> Date: Sat, 22 Jan 2022 11:26:10 -0600 Subject: [PATCH 03/86] Create LICENSE (#43) - Created LICENSE --- .circleci/config.yml | 2 +- Dockerfile | 2 +- LICENSE | 21 ++++++++ build.gradle | 48 +++++++++++-------- src/main/java/bomb/ManualController.java | 4 +- src/main/java/bomb/Widget.java | 45 +++++++++-------- src/main/java/bomb/WidgetController.java | 7 ++- .../java/bomb/abstractions/ButtonType.java | 6 +++ .../components/simon/screams/CustomEdge.java | 22 ++++----- .../modules/ab/astrology/AstrologySymbol.java | 2 +- .../bomb/modules/ab/battleship/Ocean.java | 6 ++- .../java/bomb/modules/ab/battleship/Ship.java | 4 +- .../modules/ab/blind_alley/BlindAlley.java | 11 ++--- .../ab/blind_alley/BlindAlleyController.java | 15 +++--- .../ColoredSwitchGraphFactory.java | 11 ++--- .../c/colored_switches/ColoredSwitchNode.java | 7 +-- .../c/colored_switches/ColoredSwitches.java | 45 ++++++++--------- .../c/colored_switches/SwitchColor.java | 4 +- .../java/bomb/modules/dh/emoji/Emoji.java | 1 - .../hexalgorithm/storage/HexNode.java | 13 +++-- .../hexalgorithm/storage/HexagonalPlane.java | 6 +-- .../bomb/modules/il/ice_cream/Allergen.java | 4 +- .../bomb/modules/s/souvenir/Souvenir.java | 3 +- .../bomb/modules/s/square/SquareButton.java | 5 +- .../bomb/modules/t/translated/Button.java | 4 +- .../t/translated/solutions/button/Button.java | 4 +- src/main/java/bomb/tools/string/Base91.java | 33 ------------- .../java/bomb/tools/string/StringFormat.java | 11 ++--- src/test/java/bomb/WidgetTest.java | 14 ++++-- .../modules/ab/battleship/BattleshipTest.java | 2 +- .../modules/ab/battleship/OceanEqTest.java | 16 +++++++ .../ColoredSwitchNodeEqTest.java | 16 +++++++ .../hexalgorithm/storage/HexNodeEqTest.java | 18 +++++++ .../storage/HexagonalPlaneEqTest.java | 16 +++++++ .../java/bomb/tools/CoordinatesEqTest.java | 15 ++++++ .../structures/queue/BufferedQueueEqTest.java | 16 +++++++ src/test/resources/suites/suiteFive.xml | 19 ++++++++ src/test/resources/suites/suiteFour.xml | 23 +++++++++ src/test/resources/suites/suiteOne.xml | 20 +------- src/test/resources/suites/suiteThree.xml | 19 ++------ src/test/resources/suites/suiteTwo.xml | 33 ++++++------- 41 files changed, 350 insertions(+), 223 deletions(-) create mode 100644 LICENSE create mode 100644 src/main/java/bomb/abstractions/ButtonType.java delete mode 100644 src/main/java/bomb/tools/string/Base91.java create mode 100644 src/test/java/bomb/modules/ab/battleship/OceanEqTest.java create mode 100644 src/test/java/bomb/modules/c/colored_switches/ColoredSwitchNodeEqTest.java create mode 100644 src/test/java/bomb/modules/dh/hexamaze/hexalgorithm/storage/HexNodeEqTest.java create mode 100644 src/test/java/bomb/modules/dh/hexamaze/hexalgorithm/storage/HexagonalPlaneEqTest.java create mode 100644 src/test/java/bomb/tools/CoordinatesEqTest.java create mode 100644 src/test/java/bomb/tools/data/structures/queue/BufferedQueueEqTest.java create mode 100644 src/test/resources/suites/suiteFive.xml create mode 100644 src/test/resources/suites/suiteFour.xml diff --git a/.circleci/config.yml b/.circleci/config.yml index b710cdcf..8f2e8959 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -13,7 +13,7 @@ jobs: # CircleCI maintains a library of pre-built images # documented at https://circleci.com/docs/2.0/circleci-images/ # - image: circleci/postgres:9.4 - parallelism: 3 + parallelism: 5 resource_class: large working_directory: ~/repo diff --git a/Dockerfile b/Dockerfile index 526ecf8a..58384bda 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM openjdk:15-alpine +FROM openjdk:16-alpine ARG JAR_FILE COPY $JAR_FILE app.jar diff --git a/LICENSE b/LICENSE new file mode 100644 index 00000000..13014e9f --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2022 Malcolm Johnson + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/build.gradle b/build.gradle index d4479921..ef268a74 100644 --- a/build.gradle +++ b/build.gradle @@ -5,7 +5,7 @@ plugins { id 'org.beryx.jlink' version '2.24.4' id 'com.palantir.docker' version '0.28.0' id 'info.solidsoft.pitest' version '1.7.0' - id 'org.openjfx.javafxplugin' version '0.0.10' + id 'org.openjfx.javafxplugin' version '0.0.11' id 'org.javamodularity.moduleplugin' version '1.8.10' id 'com.github.breadmoirai.github-release' version '2.2.12' } @@ -57,7 +57,10 @@ dependencies { exclude group: "org.javafx" } - testImplementation 'org.testng:testng:7.4.0' + testImplementation 'org.testng:testng:7.5' + testImplementation 'org.slf4j:slf4j-api:1.7.32' + testImplementation 'org.slf4j:slf4j-simple:1.7.32' + testImplementation 'nl.jqno.equalsverifier:equalsverifier:3.8.2' } def firstInstance = project.hasProperty('thread0') @@ -67,7 +70,7 @@ def fourthInstance = project.hasProperty('thread3') def fifthInstance = project.hasProperty('thread4') def sixthInstance = project.hasProperty('thread5') -def includedDirectories = [ +def includedTestDirectories = [ 'bomb/tools/data/**', 'bomb/tools/*', 'bomb/tools/logic/*' ] @@ -75,21 +78,28 @@ test { useTestNG() { if(firstInstance) { suites "src/test/resources/suites/suiteOne.xml" - includedDirectories.addAll([ - 'bomb/modules/ab/**', 'bomb/modules/c/**', - 'bomb/modules/dh/**', 'bomb/modules/il/**', + includedTestDirectories.addAll([ + 'bomb/modules/ab/**', 'bomb/modules/c/**' ]) } else if (secondInstance) { suites "src/test/resources/suites/suiteTwo.xml" - includedDirectories.addAll([ - 'bomb/modules/m/**', 'bomb/modules/np/**', - 'bomb/modules/r/**', 'bomb/modules/s/**' + includedTestDirectories.addAll([ + 'bomb/modules/dh/**', 'bomb/modules/il/**', 'bomb/modules/m/**' ]) } else if (thirdInstance) { suites "src/test/resources/suites/suiteThree.xml" - includedDirectories.addAll([ - 'bomb', 'bomb/tools/filter/*', - 'bomb/modules/t/**', 'bomb/modules/wz/**' + includedTestDirectories.addAll([ + 'bomb/modules/np/**', 'bomb/modules/r/**' + ]) + } else if (fourthInstance) { + suites "src/test/resources/suites/suiteFour.xml" + includedTestDirectories.addAll([ + 'bomb/modules/s/**', 'bomb/modules/t/**' + ]) + } else if (fifthInstance) { + suites "src/test/resources/suites/suiteFive.xml" + includedTestDirectories.addAll([ + 'bomb', 'bomb/tools/filter/*', 'bomb/modules/wz/**' ]) } } @@ -99,10 +109,10 @@ test { jacocoTestReport { reports.xml.enabled(true) - if (includedDirectories.size() != 3) { + if (includedTestDirectories.size() != 3) { afterEvaluate { classDirectories.setFrom(files(classDirectories.files.collect { - fileTree(dir: it, include: includedDirectories, exclude: ['**/*Controller.*']) + fileTree(dir: it, include: includedTestDirectories, exclude: ['**/*Controller.*']) })) } } @@ -122,13 +132,13 @@ static List getTargetClasses(boolean firstInstance, boolean secondInstan else if (fifthInstance) return ['bomb.modules.r.**', 'bomb.modules.s.**'] else if (sixthInstance) - return ['bomb.modules.t.**', 'bomb.modules.wz.**','bomb.tools.filter.*'] + return ['bomb.modules.t.**', 'bomb.modules.wz.**', 'bomb.tools.filter.*'] return ['bomb.*'] } pitest { - targetClasses = getTargetClasses(firstInstance, secondInstance, thirdInstance, - fourthInstance, fifthInstance, sixthInstance) + targetClasses = getTargetClasses(firstInstance, secondInstance, thirdInstance, fourthInstance, + fifthInstance, sixthInstance) outputFormats = ['HTML'] testPlugin = 'testng' } @@ -179,7 +189,7 @@ distZip { include 'src/main/**/*' include 'gradle/wrapper/*' include 'markdown/*' - include 'build.gradle', 'gradlew', 'gradlew.bat', 'README.md', 'Progress.md' + include 'build.gradle', 'gradlew', 'gradlew.bat', 'README.md', 'Progress.md', 'Learned.md' } distTar { @@ -187,7 +197,7 @@ distTar { include 'src/main/**/*' include 'gradle/wrapper/*' include 'markdown/*' - include 'build.gradle', 'gradlew', 'gradlew.bat', 'README.md', 'Progress.md' + include 'build.gradle', 'gradlew', 'gradlew.bat', 'README.md', 'Progress.md', 'Learned.md' } githubRelease { diff --git a/src/main/java/bomb/ManualController.java b/src/main/java/bomb/ManualController.java index 7ea24729..da634cbd 100644 --- a/src/main/java/bomb/ManualController.java +++ b/src/main/java/bomb/ManualController.java @@ -30,7 +30,7 @@ import java.nio.file.Paths; import java.util.ArrayDeque; import java.util.ArrayList; -import java.util.IdentityHashMap; +import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.concurrent.CompletableFuture; @@ -186,7 +186,7 @@ private static List getFilesFromDirectory(final File topLevelDirectory) private static Map createRegionMap(Map radioButtonMap, Map filePathMap) { - Map regionMap = new IdentityHashMap<>(); + Map regionMap = new HashMap<>(); for (Map.Entry entry : radioButtonMap.entrySet()) regionMap.put( entry.getValue(), diff --git a/src/main/java/bomb/Widget.java b/src/main/java/bomb/Widget.java index accde266..62e32b85 100644 --- a/src/main/java/bomb/Widget.java +++ b/src/main/java/bomb/Widget.java @@ -3,7 +3,6 @@ import bomb.enumerations.Indicator; import bomb.enumerations.Port; import bomb.enumerations.TrinarySwitch; -import bomb.modules.ab.blind_alley.BlindAlley; import bomb.modules.dh.forget_me.ForgetMeNot; import org.jetbrains.annotations.NotNull; @@ -32,14 +31,14 @@ public class Widget { protected static boolean isSouvenirActive, isForgetMeNotActive; protected static int numDoubleAs, numDBatteries, numHolders, numModules, numPortPlates, numStartingMinutes; protected static String serialCode = "", twoFactor = ""; - protected static final Indicator[] indicatorArray = Indicator.values(); + + protected static final Indicator[] INDICATOR_ARRAY = Indicator.values(); private static int[] portArray = {0, 0, 0, 0, 0, 0}; public static void setNumHolders(int numHolders) { if (numHolders >= 0) { Widget.numHolders = numHolders; - BlindAlley.alleyUpdate(); } } @@ -54,27 +53,23 @@ public static void setSerialCode(String serialCode) { } private static void updatesModules() { - BlindAlley.alleyUpdate(); if (isForgetMeNotActive) ForgetMeNot.updateLargestValueInSerial(); } public static void setDoubleAs(int doubleAs) { if (doubleAs >= 0) { numDoubleAs = doubleAs; - BlindAlley.alleyUpdate(); } } public static void setDBatteries(int dBatteries) { if (dBatteries >= 0) { numDBatteries = dBatteries; - BlindAlley.alleyUpdate(); } } public static void setIndicator(@NotNull TrinarySwitch state, @NotNull Indicator which) { - indicatorArray[which.ordinal()].setState(state); - BlindAlley.alleyUpdate(); + INDICATOR_ARRAY[which.ordinal()].setState(state); } public static void setNumModules(int numModules) { @@ -104,7 +99,6 @@ public static void setIsForgetMeNotActive(boolean set) { public static void setPortValue(@NotNull Port which, int newValue) { portArray[which.ordinal()] = newValue; - BlindAlley.alleyUpdate(); } public static int getNumHolders() { @@ -201,7 +195,7 @@ protected static boolean hasIndicator(@NotNull Indicator ind) { * @return True if the lit Indicator is found */ protected static boolean hasLitIndicator(@NotNull Indicator ind) { - return indicatorArray[ind.ordinal()].getState() == ON; + return INDICATOR_ARRAY[ind.ordinal()].getState() == ON; } /** @@ -211,7 +205,7 @@ protected static boolean hasLitIndicator(@NotNull Indicator ind) { * @return True if the unlit Indicator is found */ protected static boolean hasUnlitIndicator(@NotNull Indicator ind) { - return indicatorArray[ind.ordinal()].getState() == OFF; + return INDICATOR_ARRAY[ind.ordinal()].getState() == OFF; } protected static boolean hasVowelInSerialCode() { @@ -288,21 +282,26 @@ public static void resetProperties() { twoFactor = ""; portArray = new int[]{0, 0, 0, 0, 0, 0}; - for (Indicator ind : indicatorArray) + for (Indicator ind : INDICATOR_ARRAY) ind.setState(UNKNOWN); } - public enum IndicatorFilter { - LIT(state -> state == ON), UNLIT(state -> state == OFF), ALL_PRESENT(state -> state != UNKNOWN); - - private final Predicate condition; - - IndicatorFilter(Predicate condition) { - this.condition = condition; - } - - public boolean test(TrinarySwitch state) { - return condition.test(state); + public enum IndicatorFilter implements Predicate { + LIT { + @Override + public boolean test(TrinarySwitch state) { + return state == ON; + } + }, UNLIT { + @Override + public boolean test(TrinarySwitch state) { + return state == OFF; + } + }, ALL_PRESENT { + @Override + public boolean test(TrinarySwitch state) { + return state != UNKNOWN; + } } } } diff --git a/src/main/java/bomb/WidgetController.java b/src/main/java/bomb/WidgetController.java index b716481d..d3b0dc7a 100644 --- a/src/main/java/bomb/WidgetController.java +++ b/src/main/java/bomb/WidgetController.java @@ -21,6 +21,7 @@ import java.util.function.Consumer; +import static bomb.Widget.INDICATOR_ARRAY; import static bomb.enumerations.Port.DVI; import static bomb.enumerations.Port.PARALLEL; import static bomb.enumerations.Port.PS2; @@ -107,11 +108,10 @@ private void injectTextFormatter() { } private void createIndicatorToggleButtonEvent() { - Indicator[] indicatorArray = Indicator.values(); ToggleGroup[] groupArray = {bobGroup, carGroup, clrGroup, frkGroup, frqGroup, indGroup, msaGroup, nsaGroup, sigGroup, sndGroup, trnGroup}; - for (int i = 0; i < indicatorArray.length; i++) { - Indicator currentIndicator = indicatorArray[i]; + for (int i = 0; i < INDICATOR_ARRAY.length; i++) { + Indicator currentIndicator = INDICATOR_ARRAY[i]; ToggleGroup currentGroup = groupArray[i]; groupArray[i].getToggles() .forEach(toggle -> ((ToggleButton) toggle).setOnAction( @@ -158,7 +158,6 @@ private void forgetMeToggle() { @FXML private void fullBombReset() { widgetPageReset(); - FacadeFX.enable(serialCodeField); forgetMeNot.setSelected(false); souvenir.setSelected(false); forgetMeToggle(); diff --git a/src/main/java/bomb/abstractions/ButtonType.java b/src/main/java/bomb/abstractions/ButtonType.java new file mode 100644 index 00000000..a34051fd --- /dev/null +++ b/src/main/java/bomb/abstractions/ButtonType.java @@ -0,0 +1,6 @@ +package bomb.abstractions; + +public interface ButtonType { + String HOLD = "Hold", + TAP = "Tap"; +} diff --git a/src/main/java/bomb/components/simon/screams/CustomEdge.java b/src/main/java/bomb/components/simon/screams/CustomEdge.java index 280cac32..5c7b6c1e 100644 --- a/src/main/java/bomb/components/simon/screams/CustomEdge.java +++ b/src/main/java/bomb/components/simon/screams/CustomEdge.java @@ -21,7 +21,7 @@ public class CustomEdge extends Polygon implements Resettable { private final ArrayRing colors; - public CustomEdge(){ + public CustomEdge() { super(); selectorMode = false; colors = new ArrayRing<>(6); @@ -32,18 +32,18 @@ public CustomEdge(){ FacadeFX.loadComponent(loader); } - private void fill(){ + private void fill() { for (ScreamColor scream : ScreamColor.values()) colors.add(scream); colors.rotateCounterClockwise(); } - public void setSelectorMode(boolean nextBool){ + public void setSelectorMode(boolean nextBool) { selectorMode = nextBool; } - public void clickAction(){ - if (selectorMode){ + public void clickAction() { + if (selectorMode) { colors.rotateClockwise(); setFill(Color.web(colors.getHeadData().getLabel(), 1.0)); } else { @@ -53,7 +53,7 @@ public void clickAction(){ } } - private void indicateButtonPress(){ + private void indicateButtonPress() { FacadeFX.parallelTransition( this, setupFade(), @@ -61,24 +61,24 @@ private void indicateButtonPress(){ ); } - public ScreamColor exportColor(){ + public ScreamColor exportColor() { if (getFill() == WHITE) return null; return colors.getHeadData(); } - public void getListReference(List list){ + public void getListReference(List list) { internalReference = list; } @Override - public void reset(){ + public void reset() { setFill(WHITE); while (colors.getHeadData() != ScreamColor.PURPLE) colors.rotateClockwise(); selectorMode = false; } - private static FadeTransition setupFade(){ + private static FadeTransition setupFade() { FadeTransition fade = new FadeTransition(Duration.millis(200)); fade.setFromValue(0.5); fade.setToValue(1); @@ -87,7 +87,7 @@ private static FadeTransition setupFade(){ return fade; } - private static ScaleTransition setupPressAnimation(){ + private static ScaleTransition setupPressAnimation() { ScaleTransition scale = new ScaleTransition(Duration.millis(50)); scale.setFromX(1.0); scale.setFromY(1.0); diff --git a/src/main/java/bomb/modules/ab/astrology/AstrologySymbol.java b/src/main/java/bomb/modules/ab/astrology/AstrologySymbol.java index 97da26b3..ab171037 100644 --- a/src/main/java/bomb/modules/ab/astrology/AstrologySymbol.java +++ b/src/main/java/bomb/modules/ab/astrology/AstrologySymbol.java @@ -28,7 +28,7 @@ public int getIndex() { } /** - * AstroSymbols constructor + * AstrologySymbols constructor * * @param index Its index number found in the bomb manual page for Astrology */ diff --git a/src/main/java/bomb/modules/ab/battleship/Ocean.java b/src/main/java/bomb/modules/ab/battleship/Ocean.java index 37e6050a..5392bb82 100644 --- a/src/main/java/bomb/modules/ab/battleship/Ocean.java +++ b/src/main/java/bomb/modules/ab/battleship/Ocean.java @@ -1,5 +1,7 @@ package bomb.modules.ab.battleship; +import org.jetbrains.annotations.NotNull; + import java.util.ArrayList; import java.util.Arrays; import java.util.List; @@ -19,7 +21,7 @@ public Ocean() { initializeBoard(); } - public Ocean(Tile[][] board) { + public Ocean(@NotNull Tile[][] board) { gameBoard = board; } @@ -83,7 +85,7 @@ public boolean hasUnknownTile() { } public int[] countByTile() { - int[] counters = new int[Tile.values().length]; + int[] counters = new int[UNKNOWN.ordinal() + 1]; for (Tile[] column : gameBoard) { for (Tile tile : column) { counters[tile.ordinal()]++; diff --git a/src/main/java/bomb/modules/ab/battleship/Ship.java b/src/main/java/bomb/modules/ab/battleship/Ship.java index 3f1bacf7..399982be 100644 --- a/src/main/java/bomb/modules/ab/battleship/Ship.java +++ b/src/main/java/bomb/modules/ab/battleship/Ship.java @@ -5,9 +5,11 @@ public enum Ship { BATTLESHIP(4), CRUISER(3), DESTROYER(2), SUBMARINE(1); + static final Ship[] SHIPS = values(); + /** Minimum number of ships on a given board */ private static final int MINIMUM_NUMBER_OF_SHIPS = 4; - private static final Ship[] SHIPS = values(); + private final byte shipSize; diff --git a/src/main/java/bomb/modules/ab/blind_alley/BlindAlley.java b/src/main/java/bomb/modules/ab/blind_alley/BlindAlley.java index b5adf7df..3a467ff0 100644 --- a/src/main/java/bomb/modules/ab/blind_alley/BlindAlley.java +++ b/src/main/java/bomb/modules/ab/blind_alley/BlindAlley.java @@ -30,10 +30,7 @@ public class BlindAlley extends Widget { private static int[][] alleyCat = new int[3][3]; - /** - * Updates all fields every time an appropriate change is made to the edgework - */ - public static void alleyUpdate() { + private static void alleyUpdate() { topLeft(); topMid(); left(); @@ -46,7 +43,7 @@ public static void alleyUpdate() { private static void topLeft() { alleyCat[0][0] = TO_INT.apply(hasUnlitIndicator(BOB)) + TO_INT.apply(hasLitIndicator(CAR)) + - TO_INT.apply(hasLitIndicator(IND)) + TO_INT.apply(getNumHolders() % 2 == 0); + TO_INT.apply(hasLitIndicator(IND)) + TO_INT.apply(numHolders % 2 == 0 && numHolders != 0); } private static void topMid() { @@ -60,8 +57,9 @@ private static void left() { } private static void middle() { + int batterySum = getAllBatteries(); alleyCat[1][1] = TO_INT.apply(hasUnlitIndicator(SIG)) + TO_INT.apply(hasUnlitIndicator(SND)) + - TO_INT.apply(hasLitIndicator(NSA)) + TO_INT.apply(getAllBatteries() % 2 == 0); + TO_INT.apply(hasLitIndicator(NSA)) + TO_INT.apply(batterySum % 2 == 0 && batterySum != 0); } private static void right() { @@ -90,6 +88,7 @@ private static void bottomRight() { * @return A 2D array with the information */ public static int[][] getAlleyCat() { + alleyUpdate(); return alleyCat; } diff --git a/src/main/java/bomb/modules/ab/blind_alley/BlindAlleyController.java b/src/main/java/bomb/modules/ab/blind_alley/BlindAlleyController.java index c7a4d8a8..5d0b744c 100644 --- a/src/main/java/bomb/modules/ab/blind_alley/BlindAlleyController.java +++ b/src/main/java/bomb/modules/ab/blind_alley/BlindAlleyController.java @@ -41,13 +41,14 @@ private void stylerSet(int[][] array) { } private static String style(int number) { - return switch (number) { - case 0 -> "-fx-text-fill: black"; - case 1 -> "-fx-text-fill: green"; - case 2 -> "-fx-text-fill: yellow"; - case 3 -> "-fx-text-fill: orange"; - default -> "-fx-text-fill: red"; - }; + return "-fx-text-fill: " + + switch (number) { + case 0 -> "black"; + case 1 -> "green"; + case 2 -> "yellow"; + case 3 -> "orange"; + default -> "red"; + }; } private void writeMaxNumber(int[][] array) { diff --git a/src/main/java/bomb/modules/c/colored_switches/ColoredSwitchGraphFactory.java b/src/main/java/bomb/modules/c/colored_switches/ColoredSwitchGraphFactory.java index b5ddd95f..a7dc8386 100644 --- a/src/main/java/bomb/modules/c/colored_switches/ColoredSwitchGraphFactory.java +++ b/src/main/java/bomb/modules/c/colored_switches/ColoredSwitchGraphFactory.java @@ -11,6 +11,7 @@ import java.io.InputStreamReader; import java.io.Reader; import java.util.ArrayList; +import java.util.Arrays; import java.util.List; public class ColoredSwitchGraphFactory { @@ -72,11 +73,9 @@ private static ColoredSwitchNode buildNode(String[] record, Regex connectionFind } private static SwitchColor[] createConditions(String ordinals) { - SwitchColor[] output = new SwitchColor[ordinals.length()]; - int i = 0; - for (String ordinal : ordinals.split("")) - output[i++] = SwitchColor.getByIndex(Integer.parseInt(ordinal)); - - return output; + return Arrays.stream(ordinals.split("")) + .mapToInt(Integer::parseInt) + .mapToObj(SwitchColor::getByIndex) + .toArray(SwitchColor[]::new); } } diff --git a/src/main/java/bomb/modules/c/colored_switches/ColoredSwitchNode.java b/src/main/java/bomb/modules/c/colored_switches/ColoredSwitchNode.java index 099e8175..b25b1e90 100644 --- a/src/main/java/bomb/modules/c/colored_switches/ColoredSwitchNode.java +++ b/src/main/java/bomb/modules/c/colored_switches/ColoredSwitchNode.java @@ -7,12 +7,14 @@ import java.util.Set; public class ColoredSwitchNode { + private static final int SIZE_LIMIT = 3; + private final byte state; private final Map> outgoingConnections; public ColoredSwitchNode(byte state) { this.state = state; - outgoingConnections = new LinkedHashMap<>(); + outgoingConnections = new LinkedHashMap<>(SIZE_LIMIT); } public byte getState() { @@ -33,14 +35,13 @@ public Pair getEdgeData(byte targetState) { @Override public int hashCode() { - return Byte.hashCode(state); + return state; } @Override public boolean equals(Object o) { if (o == this) return true; if (!(o instanceof ColoredSwitchNode node)) return false; - return this.state == node.state; } diff --git a/src/main/java/bomb/modules/c/colored_switches/ColoredSwitches.java b/src/main/java/bomb/modules/c/colored_switches/ColoredSwitches.java index bc513626..ee8ce814 100644 --- a/src/main/java/bomb/modules/c/colored_switches/ColoredSwitches.java +++ b/src/main/java/bomb/modules/c/colored_switches/ColoredSwitches.java @@ -11,12 +11,31 @@ import java.io.IOException; import java.util.ArrayList; import java.util.List; +import java.util.function.BiFunction; import static bomb.modules.c.colored_switches.SwitchColor.NEUTRAL; public class ColoredSwitches extends Switches { private static final double WRONG_PATH_VALUE = Double.MAX_VALUE; private static final Graph INTERNAL_GRAPH; + private static final BiFunction> + HEURISTIC_FUNCTION = (startingColors, desiredState) -> + ((sourceVertex, targetVertex) -> { + //Weight from source to target + double gX = Math.abs(sourceVertex.getState() - targetVertex.getState()); + //Weight from target to desired state + double hX = Math.abs(desiredState - targetVertex.getState()); + + Pair edgeData = sourceVertex.getEdgeData(targetVertex.getState()); + if (edgeData == null) + return WRONG_PATH_VALUE; + SwitchColor switchToFlip = startingColors[edgeData.getValue1()]; + + if (!canFollowPath(edgeData.getValue0(), switchToFlip)) + return WRONG_PATH_VALUE; + + return gX + hX; + }); private static byte secondaryStartLocation = -1; @@ -73,9 +92,10 @@ public static List produceFinalMoveList(@NotNull SwitchColor[] startingC if (!isFirstStepDone()) throw new IllegalStateException("Must flip 3 switches before producing the final list"); - AStarAdmissibleHeuristic heuristic = createFinalMoveHeuristic(startingColors, desiredState); - AStarShortestPath aStarShortestPath = - new AStarShortestPath<>(INTERNAL_GRAPH, heuristic); + AStarShortestPath aStarShortestPath = new AStarShortestPath<>( + INTERNAL_GRAPH, + HEURISTIC_FUNCTION.apply(startingColors, desiredState) + ); ColoredSwitchNode startNode = getNodeByState(secondaryStartLocation); ColoredSwitchNode destination = getNodeByState(desiredState); @@ -85,25 +105,6 @@ public static List produceFinalMoveList(@NotNull SwitchColor[] startingC return createSwitchToFlipList(nodeList); } - private static AStarAdmissibleHeuristic createFinalMoveHeuristic(SwitchColor[] startingColors, byte desiredState) { - return ((sourceVertex, targetVertex) -> { - //Weight from source to target - double gX = Math.abs(sourceVertex.getState() - targetVertex.getState()); - //Weight from target to desired state - double hX = Math.abs(desiredState - targetVertex.getState()); - - Pair edgeData = sourceVertex.getEdgeData(targetVertex.getState()); - if (edgeData == null) - return WRONG_PATH_VALUE; - SwitchColor switchToFlip = startingColors[edgeData.getValue1()]; - - if (!canFollowPath(edgeData.getValue0(), switchToFlip)) - return WRONG_PATH_VALUE; - - return gX + hX; - }); - } - private static List createSwitchToFlipList(List path) { List output = new ArrayList<>(); diff --git a/src/main/java/bomb/modules/c/colored_switches/SwitchColor.java b/src/main/java/bomb/modules/c/colored_switches/SwitchColor.java index deead782..0b492975 100644 --- a/src/main/java/bomb/modules/c/colored_switches/SwitchColor.java +++ b/src/main/java/bomb/modules/c/colored_switches/SwitchColor.java @@ -4,6 +4,8 @@ public enum SwitchColor { RED("red-switch"), ORANGE("orange-switch"), GREEN("green-switch"), CYAN("cyan-switch"), BLUE("blue-switch"), MAGENTA("magenta-switch"), NEUTRAL("reset-state"); + private static final SwitchColor[] COLORS = values(); + private final String cssId; SwitchColor(String cssId) { @@ -15,6 +17,6 @@ public String getCssId() { } public static SwitchColor getByIndex(int index) { - return values()[index]; + return COLORS[index]; } } diff --git a/src/main/java/bomb/modules/dh/emoji/Emoji.java b/src/main/java/bomb/modules/dh/emoji/Emoji.java index 95f879b2..d71a21e8 100644 --- a/src/main/java/bomb/modules/dh/emoji/Emoji.java +++ b/src/main/java/bomb/modules/dh/emoji/Emoji.java @@ -3,7 +3,6 @@ import bomb.abstractions.Labeled; import static java.util.Arrays.stream; -import static java.util.stream.Collectors.joining; public enum Emoji implements Labeled { COLON_CLOSE(":)"), EQUAL_OPEN("=("), OPEN_COLON("(:"), diff --git a/src/main/java/bomb/modules/dh/hexamaze/hexalgorithm/storage/HexNode.java b/src/main/java/bomb/modules/dh/hexamaze/hexalgorithm/storage/HexNode.java index 0103d6d3..fd89ce72 100644 --- a/src/main/java/bomb/modules/dh/hexamaze/hexalgorithm/storage/HexNode.java +++ b/src/main/java/bomb/modules/dh/hexamaze/hexalgorithm/storage/HexNode.java @@ -1,9 +1,12 @@ package bomb.modules.dh.hexamaze.hexalgorithm.storage; +import org.jetbrains.annotations.NotNull; + import java.util.EnumSet; import java.util.Objects; import static bomb.tools.number.MathUtils.HASHING_NUMBER; +import static java.util.Objects.requireNonNull; import static java.util.stream.Collectors.joining; public class HexNode { @@ -11,13 +14,14 @@ public class HexNode { private HexShape hexShape; private int color; - public HexNode(HexShape hexShape, EnumSet constructs) { + public HexNode(HexShape hexShape, @NotNull EnumSet constructs) { + requireNonNull(constructs); walls = constructs; this.hexShape = hexShape; color = -1; } - public HexNode(HexNode toCopy) { + public HexNode(@NotNull HexNode toCopy) { walls = EnumSet.copyOf(toCopy.walls); hexShape = toCopy.hexShape; color = -1; @@ -31,7 +35,8 @@ public EnumSet getWalls() { return walls; } - public void setWalls(EnumSet walls) { + public void setWalls(@NotNull EnumSet walls) { + requireNonNull(walls); this.walls = walls; } @@ -65,7 +70,7 @@ public boolean equals(Object obj) { @Override public int hashCode() { return HASHING_NUMBER * (hexShape != null ? hexShape.hashCode() : 1) + - ((walls != null) ? walls.hashCode() : 0); + walls.hashCode(); } @Override diff --git a/src/main/java/bomb/modules/dh/hexamaze/hexalgorithm/storage/HexagonalPlane.java b/src/main/java/bomb/modules/dh/hexamaze/hexalgorithm/storage/HexagonalPlane.java index 0d5fdcfa..bb532afd 100644 --- a/src/main/java/bomb/modules/dh/hexamaze/hexalgorithm/storage/HexagonalPlane.java +++ b/src/main/java/bomb/modules/dh/hexamaze/hexalgorithm/storage/HexagonalPlane.java @@ -9,7 +9,6 @@ import java.util.Iterator; import java.util.List; import java.util.function.IntUnaryOperator; -import java.util.stream.Collectors; import static bomb.modules.dh.hexamaze.hexalgorithm.storage.AbstractHexagon.calculateColumnLengthStream; import static bomb.modules.dh.hexamaze.hexalgorithm.storage.HexNode.HexShape.CIRCLE; @@ -26,6 +25,7 @@ import static bomb.modules.dh.hexamaze.hexalgorithm.storage.HexNode.HexWall.TOP_RIGHT; import static bomb.tools.number.MathUtils.isAnInteger; import static java.util.Arrays.stream; +import static java.util.stream.Collectors.toCollection; import static java.util.stream.Collectors.toList; public class HexagonalPlane implements Iterable> { @@ -143,7 +143,7 @@ public Iterator> iterator() { public boolean equals(Object o) { if (this == o) return true; if (!(o instanceof HexagonalPlane other)) return false; - return hexagon.equals(other.hexagon); + return sideLength == other.sideLength && hexagon.equals(other.hexagon); } @Override @@ -203,7 +203,7 @@ private static EnumSet rotateWalls(EnumSet walls) { return walls.stream() .map(HexagonalPlane::rotateSingleWall) - .collect(Collectors.toCollection(() -> EnumSet.noneOf(HexWall.class))); + .collect(toCollection(() -> EnumSet.noneOf(HexWall.class))); } private static HexWall rotateSingleWall(HexWall wall) { diff --git a/src/main/java/bomb/modules/il/ice_cream/Allergen.java b/src/main/java/bomb/modules/il/ice_cream/Allergen.java index 51f87388..6c653e1a 100644 --- a/src/main/java/bomb/modules/il/ice_cream/Allergen.java +++ b/src/main/java/bomb/modules/il/ice_cream/Allergen.java @@ -18,6 +18,8 @@ public boolean test(EnumSet allergens) { CHERRY, MARSHMALLOW; + private static final Allergen[] ALLERGENS = values(); + @Override public boolean test(EnumSet allergens) { return allergens.contains(this); @@ -26,6 +28,6 @@ public boolean test(EnumSet allergens) { public static Allergen getByIndex(int index) { return index < 0 || index > 9 ? null : - values()[index]; + ALLERGENS[index]; } } diff --git a/src/main/java/bomb/modules/s/souvenir/Souvenir.java b/src/main/java/bomb/modules/s/souvenir/Souvenir.java index 1fd37c03..fca446b8 100644 --- a/src/main/java/bomb/modules/s/souvenir/Souvenir.java +++ b/src/main/java/bomb/modules/s/souvenir/Souvenir.java @@ -1,5 +1,6 @@ package bomb.modules.s.souvenir; +import bomb.Widget; import org.javatuples.Pair; import java.util.LinkedHashMap; @@ -8,7 +9,7 @@ import static java.util.stream.Collectors.toList; -public class Souvenir { +public class Souvenir extends Widget { private static final Map MODULE_ARTIFACTS; static { diff --git a/src/main/java/bomb/modules/s/square/SquareButton.java b/src/main/java/bomb/modules/s/square/SquareButton.java index 1562f6df..65f2266a 100644 --- a/src/main/java/bomb/modules/s/square/SquareButton.java +++ b/src/main/java/bomb/modules/s/square/SquareButton.java @@ -1,6 +1,7 @@ package bomb.modules.s.square; import bomb.Widget; +import bomb.abstractions.ButtonType; import bomb.tools.number.MathUtils; import org.jetbrains.annotations.NotNull; @@ -14,15 +15,13 @@ import static bomb.Widget.IndicatorFilter.LIT; import static bomb.Widget.IndicatorFilter.UNLIT; -import static bomb.modules.t.translated.solutions.button.Button.HOLD; -import static bomb.modules.t.translated.solutions.button.Button.TAP; import static bomb.tools.filter.RegexFilter.NUMBER_PATTERN; import static bomb.tools.filter.RegexFilter.filter; import static bomb.tools.string.StringFormat.FIRST_LETTER_CAPITAL; import static java.util.Arrays.asList; import static java.util.stream.Collectors.joining; -public class SquareButton extends Widget { +public class SquareButton extends Widget implements ButtonType { //Button colors public static final int BLUE = 0, YELLOW = 1, DARK_GRAY = 2, WHITE = 3; //Held button light colors diff --git a/src/main/java/bomb/modules/t/translated/Button.java b/src/main/java/bomb/modules/t/translated/Button.java index d012a22b..00c527d2 100644 --- a/src/main/java/bomb/modules/t/translated/Button.java +++ b/src/main/java/bomb/modules/t/translated/Button.java @@ -6,14 +6,14 @@ package bomb.modules.t.translated; +import bomb.abstractions.ButtonType; import bomb.enumerations.Indicator; /** * Button class deals with a button module */ -public class Button extends TranslationCenter { +public class Button extends TranslationCenter implements ButtonType { private static final byte COLOR_INDEX = 0, LABEL_INDEX = 1; - private static final String HOLD = "Hold", TAP = "Tap"; /** * Sorts through the conditions of the current bomb and tells either to hold or tap the button diff --git a/src/main/java/bomb/modules/t/translated/solutions/button/Button.java b/src/main/java/bomb/modules/t/translated/solutions/button/Button.java index a891f33d..a5c00519 100644 --- a/src/main/java/bomb/modules/t/translated/solutions/button/Button.java +++ b/src/main/java/bomb/modules/t/translated/solutions/button/Button.java @@ -1,6 +1,7 @@ package bomb.modules.t.translated.solutions.button; import bomb.Widget; +import bomb.abstractions.ButtonType; import static bomb.enumerations.Indicator.CAR; import static bomb.enumerations.Indicator.FRK; @@ -13,9 +14,8 @@ /** * Button class deals with a button module */ -public class Button extends Widget { +public class Button extends Widget implements ButtonType { public static final byte COLOR_INDEX = 0, LABEL_INDEX = 1; - public static final String HOLD = "Hold", TAP = "Tap"; /** * Sorts through the conditions of the current bomb and tells either to hold or tap the button diff --git a/src/main/java/bomb/tools/string/Base91.java b/src/main/java/bomb/tools/string/Base91.java deleted file mode 100644 index 28ed0191..00000000 --- a/src/main/java/bomb/tools/string/Base91.java +++ /dev/null @@ -1,33 +0,0 @@ -package bomb.tools.string; - -public class Base91 { - private static final char[] CODEX_STRING = - "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!#$%&()*+,./;<=>?@[]^_`{|}~\":" - .toCharArray(); - - public static String encrypt(int val) { - if (val < CODEX_STRING.length) return String.valueOf(CODEX_STRING[val]); - - StringBuilder builder = new StringBuilder(); - while (val >= CODEX_STRING.length) { - int nextVal = val / CODEX_STRING.length; - int mod = val % CODEX_STRING.length; - builder.append(CODEX_STRING[mod]); - val = nextVal; - } - return builder.append(CODEX_STRING[val]).reverse().toString(); - } - - public static long decrypt(String val) throws IllegalArgumentException { - int degree = val.length() - 1; - long output = 0; - String searchString = String.valueOf(CODEX_STRING); - - for (char charInVal : val.toCharArray()) { - int tempNum = searchString.indexOf(charInVal); - if (tempNum == -1) throw new IllegalArgumentException("Letter was not in the codex"); - output += (long) Math.pow(CODEX_STRING.length, degree--) * tempNum; - } - return output; - } -} diff --git a/src/main/java/bomb/tools/string/StringFormat.java b/src/main/java/bomb/tools/string/StringFormat.java index 1b59a09e..6403a9ab 100644 --- a/src/main/java/bomb/tools/string/StringFormat.java +++ b/src/main/java/bomb/tools/string/StringFormat.java @@ -22,12 +22,11 @@ public class StringFormat { .collect(joining("_")); public static String createOrdinalNumber(int number) { - if (number % 10 == 1) - return number + "st"; - if (number % 10 == 2) - return number + "nd"; - if (number % 10 == 3) - return number + "rd"; + int mod = number % 100; + + if (mod == 1) return number + "st"; + if (mod == 2) return number + "nd"; + if (mod == 3) return number + "rd"; return number + "th"; } } diff --git a/src/test/java/bomb/WidgetTest.java b/src/test/java/bomb/WidgetTest.java index 2000fc71..68f798ab 100644 --- a/src/test/java/bomb/WidgetTest.java +++ b/src/test/java/bomb/WidgetTest.java @@ -1,13 +1,17 @@ package bomb; import bomb.enumerations.Indicator; -import bomb.enumerations.TrinarySwitch; import org.testng.annotations.AfterClass; import org.testng.annotations.BeforeMethod; import org.testng.annotations.DataProvider; import org.testng.annotations.Test; import static bomb.ConditionSetter.EMPTY_SETTER; +import static bomb.enumerations.Indicator.BOB; +import static bomb.enumerations.Indicator.MSA; +import static bomb.enumerations.Indicator.NSA; +import static bomb.enumerations.TrinarySwitch.OFF; +import static bomb.enumerations.TrinarySwitch.ON; import static org.testng.Assert.assertEquals; public class WidgetTest { @@ -111,13 +115,13 @@ public void serialCodeLengthTest(String input, int expectedLetterLength, int exp @DataProvider public Object[][] indicatorProvider() { ConditionSetter trueSetter = () -> { - Widget.setIndicator(TrinarySwitch.ON, Indicator.MSA); - Widget.setIndicator(TrinarySwitch.OFF, Indicator.NSA); + Widget.setIndicator(ON, MSA); + Widget.setIndicator(OFF, NSA); }; return new Object[][]{ - {EMPTY_SETTER, Indicator.BOB, false}, {trueSetter, Indicator.MSA, true}, - {trueSetter, Indicator.NSA, true} + {EMPTY_SETTER, BOB, false}, {trueSetter, MSA, true}, + {trueSetter, NSA, true} }; } diff --git a/src/test/java/bomb/modules/ab/battleship/BattleshipTest.java b/src/test/java/bomb/modules/ab/battleship/BattleshipTest.java index 7bb88877..21bd4f66 100644 --- a/src/test/java/bomb/modules/ab/battleship/BattleshipTest.java +++ b/src/test/java/bomb/modules/ab/battleship/BattleshipTest.java @@ -206,7 +206,7 @@ private static void setVideoEdgework() { } private static void setShipQuantities(int[] shipQuantities) { - Ship[] ships = Ship.values(); + Ship[] ships = Ship.SHIPS; for (int i = 0; i < shipQuantities.length; i++) { ships[i].setCurrentQuantity((byte) shipQuantities[i]); } diff --git a/src/test/java/bomb/modules/ab/battleship/OceanEqTest.java b/src/test/java/bomb/modules/ab/battleship/OceanEqTest.java new file mode 100644 index 00000000..268c72ed --- /dev/null +++ b/src/test/java/bomb/modules/ab/battleship/OceanEqTest.java @@ -0,0 +1,16 @@ +package bomb.modules.ab.battleship; + +import nl.jqno.equalsverifier.EqualsVerifier; +import org.testng.annotations.Test; + +import static nl.jqno.equalsverifier.Warning.STRICT_INHERITANCE; + +public class OceanEqTest { + @Test + public void equalsContract() { + EqualsVerifier.forClass(Ocean.class) + .withNonnullFields("gameBoard") + .suppress(STRICT_INHERITANCE) + .verify(); + } +} diff --git a/src/test/java/bomb/modules/c/colored_switches/ColoredSwitchNodeEqTest.java b/src/test/java/bomb/modules/c/colored_switches/ColoredSwitchNodeEqTest.java new file mode 100644 index 00000000..6eb28fde --- /dev/null +++ b/src/test/java/bomb/modules/c/colored_switches/ColoredSwitchNodeEqTest.java @@ -0,0 +1,16 @@ +package bomb.modules.c.colored_switches; + +import nl.jqno.equalsverifier.EqualsVerifier; +import org.testng.annotations.Test; + +import static nl.jqno.equalsverifier.Warning.STRICT_INHERITANCE; + +public class ColoredSwitchNodeEqTest { + @Test + public void equalsContract() { + EqualsVerifier.forClass(ColoredSwitchNode.class) + .withIgnoredFields("outgoingConnections") + .suppress(STRICT_INHERITANCE) + .verify(); + } +} diff --git a/src/test/java/bomb/modules/dh/hexamaze/hexalgorithm/storage/HexNodeEqTest.java b/src/test/java/bomb/modules/dh/hexamaze/hexalgorithm/storage/HexNodeEqTest.java new file mode 100644 index 00000000..e0f293f1 --- /dev/null +++ b/src/test/java/bomb/modules/dh/hexamaze/hexalgorithm/storage/HexNodeEqTest.java @@ -0,0 +1,18 @@ +package bomb.modules.dh.hexamaze.hexalgorithm.storage; + +import nl.jqno.equalsverifier.EqualsVerifier; +import org.testng.annotations.Test; + +import static nl.jqno.equalsverifier.Warning.NONFINAL_FIELDS; +import static nl.jqno.equalsverifier.Warning.STRICT_INHERITANCE; + +public class HexNodeEqTest { + @Test + public void equalsContract() { + EqualsVerifier.forClass(HexNode.class) + .withNonnullFields("walls", "hexShape") + .withIgnoredFields("color") + .suppress(STRICT_INHERITANCE, NONFINAL_FIELDS) + .verify(); + } +} diff --git a/src/test/java/bomb/modules/dh/hexamaze/hexalgorithm/storage/HexagonalPlaneEqTest.java b/src/test/java/bomb/modules/dh/hexamaze/hexalgorithm/storage/HexagonalPlaneEqTest.java new file mode 100644 index 00000000..e8eec86e --- /dev/null +++ b/src/test/java/bomb/modules/dh/hexamaze/hexalgorithm/storage/HexagonalPlaneEqTest.java @@ -0,0 +1,16 @@ +package bomb.modules.dh.hexamaze.hexalgorithm.storage; + +import nl.jqno.equalsverifier.EqualsVerifier; +import org.testng.annotations.Test; + +import static nl.jqno.equalsverifier.Warning.STRICT_INHERITANCE; + +public class HexagonalPlaneEqTest { + @Test(enabled = false) + public void equalsContract() { + EqualsVerifier.forClass(HexagonalPlane.class) + .withNonnullFields("hexagon") + .suppress(STRICT_INHERITANCE) + .verify(); + } +} diff --git a/src/test/java/bomb/tools/CoordinatesEqTest.java b/src/test/java/bomb/tools/CoordinatesEqTest.java new file mode 100644 index 00000000..9a17a992 --- /dev/null +++ b/src/test/java/bomb/tools/CoordinatesEqTest.java @@ -0,0 +1,15 @@ +package bomb.tools; + +import nl.jqno.equalsverifier.EqualsVerifier; +import org.testng.annotations.Test; + +import static nl.jqno.equalsverifier.Warning.STRICT_INHERITANCE; + +public class CoordinatesEqTest { + @Test + public void equalsContract() { + EqualsVerifier.forClass(Coordinates.class) + .suppress(STRICT_INHERITANCE) + .verify(); + } +} diff --git a/src/test/java/bomb/tools/data/structures/queue/BufferedQueueEqTest.java b/src/test/java/bomb/tools/data/structures/queue/BufferedQueueEqTest.java new file mode 100644 index 00000000..e9f11cf7 --- /dev/null +++ b/src/test/java/bomb/tools/data/structures/queue/BufferedQueueEqTest.java @@ -0,0 +1,16 @@ +package bomb.tools.data.structures.queue; + +import nl.jqno.equalsverifier.EqualsVerifier; +import org.testng.annotations.Test; + +import static nl.jqno.equalsverifier.Warning.STRICT_INHERITANCE; + +public class BufferedQueueEqTest { + @Test(enabled = false) + public void equalsContract() { + EqualsVerifier.forClass(BufferedQueue.class) + .withIgnoredFields("capacity", "dataCache") + .suppress(STRICT_INHERITANCE) + .verify(); + } +} diff --git a/src/test/resources/suites/suiteFive.xml b/src/test/resources/suites/suiteFive.xml new file mode 100644 index 00000000..0336c57f --- /dev/null +++ b/src/test/resources/suites/suiteFive.xml @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/test/resources/suites/suiteFour.xml b/src/test/resources/suites/suiteFour.xml new file mode 100644 index 00000000..e1107f09 --- /dev/null +++ b/src/test/resources/suites/suiteFour.xml @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/test/resources/suites/suiteOne.xml b/src/test/resources/suites/suiteOne.xml index 0ce82df3..0e65f22c 100644 --- a/src/test/resources/suites/suiteOne.xml +++ b/src/test/resources/suites/suiteOne.xml @@ -7,6 +7,7 @@ + @@ -21,24 +22,7 @@ - - - - - - - - - - - - - - - - - - + \ No newline at end of file diff --git a/src/test/resources/suites/suiteThree.xml b/src/test/resources/suites/suiteThree.xml index 207a87c9..a8b28809 100644 --- a/src/test/resources/suites/suiteThree.xml +++ b/src/test/resources/suites/suiteThree.xml @@ -2,26 +2,15 @@ - + - - - - + - + - - - - - - - - - + \ No newline at end of file diff --git a/src/test/resources/suites/suiteTwo.xml b/src/test/resources/suites/suiteTwo.xml index 1b9c1790..e066bb20 100644 --- a/src/test/resources/suites/suiteTwo.xml +++ b/src/test/resources/suites/suiteTwo.xml @@ -2,33 +2,30 @@ - - - - - - - - - + - + + + + + + + - + - + + - + - - - - - + + + \ No newline at end of file From 35dbe450bcd8187e5a7605b381fb61e3a563e46a Mon Sep 17 00:00:00 2001 From: "Mr. J" <45538844+Ultraviolet-Ninja@users.noreply.github.com> Date: Sat, 22 Jan 2022 11:45:42 -0600 Subject: [PATCH 04/86] Update build.gradle --- build.gradle | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/build.gradle b/build.gradle index ef268a74..5640a197 100644 --- a/build.gradle +++ b/build.gradle @@ -58,8 +58,8 @@ dependencies { } testImplementation 'org.testng:testng:7.5' - testImplementation 'org.slf4j:slf4j-api:1.7.32' - testImplementation 'org.slf4j:slf4j-simple:1.7.32' + testImplementation 'org.slf4j:slf4j-api:1.7.33' + testImplementation 'org.slf4j:slf4j-simple:1.7.33' testImplementation 'nl.jqno.equalsverifier:equalsverifier:3.8.2' } @@ -214,4 +214,4 @@ task releaseToGitHub() { githubRelease.token = "${authToken}" } finalizedBy(tasks.getByName('githubRelease')) -} \ No newline at end of file +} From d23efe855db3feed83aa21fcb167a227b4b6b61a Mon Sep 17 00:00:00 2001 From: "Mr. J" <45538844+Ultraviolet-Ninja@users.noreply.github.com> Date: Sun, 23 Jan 2022 20:50:48 -0600 Subject: [PATCH 05/86] Minor changes --- src/main/java/bomb/ManualController.java | 3 +-- src/main/resources/bomb/components/hex/maze_component.fxml | 1 + src/main/resources/bomb/components/simon/screams/star.fxml | 1 - 3 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/main/java/bomb/ManualController.java b/src/main/java/bomb/ManualController.java index da634cbd..c70439b2 100644 --- a/src/main/java/bomb/ManualController.java +++ b/src/main/java/bomb/ManualController.java @@ -114,9 +114,8 @@ private static CompletableFuture> createRadioButtonNameFutur private static CompletableFuture>> createFilePathFuture() { URI uri = toURI(ManualController.class.getResource(FXML_DIRECTORY)); - File file = new File(uri); - return supplyAsync(() -> getFilesFromDirectory(file)) + return supplyAsync(() -> getFilesFromDirectory(new File(uri))) .thenApply(ManualController::convertFilesToRegions); } diff --git a/src/main/resources/bomb/components/hex/maze_component.fxml b/src/main/resources/bomb/components/hex/maze_component.fxml index 0aa644b8..e4ca1fd2 100644 --- a/src/main/resources/bomb/components/hex/maze_component.fxml +++ b/src/main/resources/bomb/components/hex/maze_component.fxml @@ -2,6 +2,7 @@ + diff --git a/src/main/resources/bomb/components/simon/screams/star.fxml b/src/main/resources/bomb/components/simon/screams/star.fxml index e489e5fc..7eaa2160 100644 --- a/src/main/resources/bomb/components/simon/screams/star.fxml +++ b/src/main/resources/bomb/components/simon/screams/star.fxml @@ -1,7 +1,6 @@ - From 6f45bfdf5bf3436be2caec5368386de6250edf8e Mon Sep 17 00:00:00 2001 From: "Mr. J" <45538844+Ultraviolet-Ninja@users.noreply.github.com> Date: Sun, 23 Jan 2022 21:34:30 -0600 Subject: [PATCH 06/86] Update README.md --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index ab1d9236..01e5e637 100644 --- a/README.md +++ b/README.md @@ -20,9 +20,9 @@ This is a huge project for one man to tackle, but I've [learned a lot](Learned.m - Palantir Docker - Breadmoirai GitHub Release ### Dependencies -- MaterialFX ver 11.12.0 -- JFoenix ver 9.0.4 -- JavaTuple ver 1.2 +- MaterialFX ver. 11.12.0 +- JFoenix ver. 9.0.4 +- JavaTuple ver. 1.2 - JGraphT ver. 1.5.1 - OpenCSV ver. 5.5.2 ### Other Technologies From b915d18109a8d731bc64d21c687c1f74f88716b7 Mon Sep 17 00:00:00 2001 From: "Mr. J" <45538844+Ultraviolet-Ninja@users.noreply.github.com> Date: Mon, 24 Jan 2022 13:00:17 -0600 Subject: [PATCH 07/86] Created some keyboard events to switch between panes --- src/main/java/bomb/Main.java | 72 +++++++- src/main/java/bomb/ManualController.java | 50 +++++- src/main/resources/bomb/manual.fxml | 204 +++++++++++------------ 3 files changed, 218 insertions(+), 108 deletions(-) diff --git a/src/main/java/bomb/Main.java b/src/main/java/bomb/Main.java index 52228ff5..9317cfca 100644 --- a/src/main/java/bomb/Main.java +++ b/src/main/java/bomb/Main.java @@ -5,19 +5,85 @@ import javafx.scene.Parent; import javafx.scene.Scene; import javafx.scene.image.Image; +import javafx.scene.input.KeyCodeCombination; +import javafx.scene.input.KeyEvent; import javafx.stage.Stage; -@SuppressWarnings("ConstantConditions") +import java.util.List; +import java.util.stream.Stream; + +import static javafx.scene.input.KeyCode.DIGIT0; +import static javafx.scene.input.KeyCode.DIGIT1; +import static javafx.scene.input.KeyCode.DIGIT2; +import static javafx.scene.input.KeyCode.DIGIT3; +import static javafx.scene.input.KeyCode.DIGIT4; +import static javafx.scene.input.KeyCode.DIGIT5; +import static javafx.scene.input.KeyCode.DIGIT6; +import static javafx.scene.input.KeyCode.DIGIT7; +import static javafx.scene.input.KeyCode.DIGIT8; +import static javafx.scene.input.KeyCode.DIGIT9; +import static javafx.scene.input.KeyCode.DOWN; +import static javafx.scene.input.KeyCode.UP; +import static javafx.scene.input.KeyCombination.CONTROL_DOWN; + public class Main extends Application { @Override public void start(Stage primaryStage) throws Exception { - Parent root = FXMLLoader.load(Main.class.getResource("manual.fxml")); + FXMLLoader loader = new FXMLLoader(Main.class.getResource("manual.fxml")); + Parent root = loader.load(); + Scene scene = new Scene(root); + ManualController controller = loader.getController(); + + setSceneKeyboardEvents(scene, controller); + setSceneArrowEvents(scene, controller); + primaryStage.setTitle("Centurion Bomb Manual"); - primaryStage.setScene(new Scene(root)); + primaryStage.setScene(scene); primaryStage.getIcons().add(new Image(String.valueOf(Main.class.getResource("KTANE logo.png")))); primaryStage.show(); } + private static void setSceneKeyboardEvents(Scene scene, ManualController controller) { + List digitList = Stream.of(DIGIT1, DIGIT2, DIGIT3, DIGIT4, DIGIT5, + DIGIT6, DIGIT7, DIGIT8, DIGIT9, DIGIT0) + .map(code -> new KeyCodeCombination(code, CONTROL_DOWN)) + .toList(); + + int count = 0; + for (KeyCodeCombination combo : digitList) { + int index = count++; + scene.addEventFilter( + KeyEvent.KEY_PRESSED, + event -> { + if (combo.match(event)) + controller.switchPaneByIndex(index); + } + ); + } + + } + + private static void setSceneArrowEvents(Scene scene, ManualController controller) { + KeyCodeCombination upArrow = new KeyCodeCombination(UP); + KeyCodeCombination downArrow = new KeyCodeCombination(DOWN); + + scene.addEventFilter( + KeyEvent.KEY_PRESSED, + event -> { + if (downArrow.match(event)) + controller.switchPaneByDownArrow(); + } + ); + + scene.addEventFilter( + KeyEvent.KEY_PRESSED, + event -> { + if (upArrow.match(event)) + controller.switchPaneByUpArrow(); + } + ); + } + public static void main(String[] args) { launch(args); } diff --git a/src/main/java/bomb/ManualController.java b/src/main/java/bomb/ManualController.java index c70439b2..480c8bec 100644 --- a/src/main/java/bomb/ManualController.java +++ b/src/main/java/bomb/ManualController.java @@ -16,6 +16,7 @@ import javafx.scene.control.RadioButton; import javafx.scene.control.TextField; import javafx.scene.control.Toggle; + import javafx.scene.control.ToggleGroup; import javafx.scene.layout.GridPane; import javafx.scene.layout.Region; @@ -30,7 +31,7 @@ import java.nio.file.Paths; import java.util.ArrayDeque; import java.util.ArrayList; -import java.util.HashMap; +import java.util.LinkedHashMap; import java.util.List; import java.util.Map; import java.util.concurrent.CompletableFuture; @@ -185,7 +186,7 @@ private static List getFilesFromDirectory(final File topLevelDirectory) private static Map createRegionMap(Map radioButtonMap, Map filePathMap) { - Map regionMap = new HashMap<>(); + Map regionMap = new LinkedHashMap<>(); for (Map.Entry entry : radioButtonMap.entrySet()) regionMap.put( entry.getValue(), @@ -203,7 +204,7 @@ private static URI toURI(URL url) throws IllegalArgumentException { } @FXML - public void buttonPress() { + public void switchPaneByButtonPress() { Toggle selected = options.getSelectedToggle(); String selectedName = GET_TOGGLE_NAME.apply(selected); if (selectedName.equals("Blind Alley")) ObserverHub.updateAtIndex(BLIND_ALLEY_PANE); @@ -234,4 +235,47 @@ public void search() { ).toList() ); } + + public void switchPaneByIndex(final int index) { + int counter = 0; + for (RadioButton radioButton : allRadioButtons) { + if (counter++ == index && !radioButton.isDisabled()) { + radioButton.fire(); + return; + } + } + } + + public void switchPaneByUpArrow() { + RadioButton selected = (RadioButton) options.getSelectedToggle(); + if (selected == null) return; + int index = allRadioButtons.indexOf(selected) - 1; + int size = allRadioButtons.size(); + if (index < 0) index += size; + + RadioButton nextButton = allRadioButtons.get(index); + while (nextButton.isDisabled()) { + index--; + if (index < 0) index += size; + nextButton = allRadioButtons.get(index); + } + + nextButton.fire(); + } + + public void switchPaneByDownArrow() { + RadioButton selected = (RadioButton) options.getSelectedToggle(); + if (selected == null) return; + int index = allRadioButtons.indexOf(selected); + int mod = allRadioButtons.size(); + index = (index + 1) % mod; + RadioButton nextButton = allRadioButtons.get(index); + while (nextButton.isDisabled()) { + index++; + index %= mod; + nextButton = allRadioButtons.get(index); + } + + nextButton.fire(); + } } diff --git a/src/main/resources/bomb/manual.fxml b/src/main/resources/bomb/manual.fxml index 73dd3a1e..3ecbc228 100644 --- a/src/main/resources/bomb/manual.fxml +++ b/src/main/resources/bomb/manual.fxml @@ -37,7 +37,7 @@ - @@ -47,612 +47,612 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - From 382487d316afd416714b84cef9efea445651c7bc Mon Sep 17 00:00:00 2001 From: "Mr. J" <45538844+Ultraviolet-Ninja@users.noreply.github.com> Date: Sat, 29 Jan 2022 12:50:54 -0600 Subject: [PATCH 08/86] Using the String.matches() method to check the serial code --- src/main/java/bomb/WidgetController.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/main/java/bomb/WidgetController.java b/src/main/java/bomb/WidgetController.java index d3b0dc7a..abcf3f5b 100644 --- a/src/main/java/bomb/WidgetController.java +++ b/src/main/java/bomb/WidgetController.java @@ -133,8 +133,7 @@ private static TrinarySwitch determineState(Toggle selected) { @FXML private void detectSerialCodeAreaChange() { String serialCode = serialCodeField.getText(); - SERIAL_CODE_PATTERN.loadText(serialCode); - if (SERIAL_CODE_PATTERN.matchesRegex()) { + if (serialCode.matches(SERIAL_CODE_PATTERN.getOriginalPattern())) { Widget.setSerialCode(serialCode); } else if (serialCode.length() == 6) { FacadeFX.setAlert(Alert.AlertType.INFORMATION, """ From eabf3d458c2f84fb880720ae812f63a0efb25cb2 Mon Sep 17 00:00:00 2001 From: "Mr. J" <45538844+Ultraviolet-Ninja@users.noreply.github.com> Date: Fri, 4 Feb 2022 18:18:25 -0600 Subject: [PATCH 09/86] Started a rework for ColorFlash --- .../modules/c/color_flash/ColorFlash.java | 160 +++++++++--------- .../c/color_flash/ColorFlashColor.java | 5 + .../c/color_flash/ColorFlashProperties.java | 11 -- .../java/bomb/tools/string/StringFormat.java | 3 +- 4 files changed, 86 insertions(+), 93 deletions(-) create mode 100644 src/main/java/bomb/modules/c/color_flash/ColorFlashColor.java delete mode 100644 src/main/java/bomb/modules/c/color_flash/ColorFlashProperties.java diff --git a/src/main/java/bomb/modules/c/color_flash/ColorFlash.java b/src/main/java/bomb/modules/c/color_flash/ColorFlash.java index 74800c6b..9ccc477c 100644 --- a/src/main/java/bomb/modules/c/color_flash/ColorFlash.java +++ b/src/main/java/bomb/modules/c/color_flash/ColorFlash.java @@ -1,102 +1,100 @@ package bomb.modules.c.color_flash; import bomb.Widget; +import org.javatuples.Pair; +import org.jetbrains.annotations.NotNull; -//TODO - Complete, then make Javadocs +import java.util.ArrayList; +import java.util.List; + +import static bomb.modules.c.color_flash.ColorFlashColor.BLUE; +import static bomb.modules.c.color_flash.ColorFlashColor.GREEN; +import static bomb.modules.c.color_flash.ColorFlashColor.RED; +import static bomb.modules.c.color_flash.ColorFlashColor.WHITE; +import static bomb.tools.string.StringFormat.NO; +import static bomb.tools.string.StringFormat.YES; public class ColorFlash extends Widget { - static class Combo { - private final ColorFlashProperties.Word word; - private final ColorFlashProperties.Color color; + private static final int COMBO_LIMIT = 8; - Combo(ColorFlashProperties.Word word, ColorFlashProperties.Color color) { - this.color = color; - this.word = word; - } + private static final String RESULT_IS_COLOR_OR_WORD = "is either the word or color"; - public ColorFlashProperties.Word getWord() { - return word; - } + public static String decipher(@NotNull ColorFlashColor[] words, @NotNull ColorFlashColor[] colors) { + validateInput(words, colors); + var comboList = forgeCombos(words, colors); + ColorFlashColor lastColor = comboList.get(comboList.size() - 1).getValue1(); - public ColorFlashProperties.Color getColor() { - return color; - } + return switch (lastColor) { + case RED -> handleLastColorRed(comboList); + case YELLOW -> handleLastColorYellow(comboList); + case GREEN -> handleLastColorGreen(comboList); + case BLUE -> handleLastColorBlue(comboList); + case MAGENTA -> handleLastColorMagenta(comboList); + default -> handleLastColorWhite(comboList); + }; + } + + private static String handleLastColorRed(List> comboList) { + if (countParticularWord(comboList, GREEN) >= 3) + return YES + " on the third time Green " + RESULT_IS_COLOR_OR_WORD; + if (countParticularColor(comboList, BLUE) == 1) + return NO + " when the word Magenta is shown"; + return YES + " the last time White " + RESULT_IS_COLOR_OR_WORD; } -// public static String decypher(CFlash.Word[] words, CFlash.Color[] colors) { -// Combo[] combos = forgeCombos(words, colors); -// String output; -// -// switch (words[words.length - 1]) { -// case RED -> { -// if (iterateWord(combos, CFlash.Word.GREEN) >= 3) -// return "Press Yes on the 3rd time Green is used as either the word or color"; -// else if (iterateColor(combos, CFlash.Color.BLUE) == 1) -// return "Press No when the word is Magenta"; -// return "Press Yes on the last time White is a word or color"; -// } -// case YELLOW -> { -// if (matches(combos, CFlash.Color.GREEN, CFlash.Word.BLUE)) -// return "Press Yes on the first Green Color"; -// else if (matches(combos, CFlash.Color.WHITE, CFlash.Word.WHITE) || -// matches(combos, CFlash.Color.RED, CFlash.Word.WHITE)) -// return ""; -// return ""; -// } -// case GREEN -> { -// if () -// return ""; -// else if (iterateWord(combos, CFlash.Word.MAGENTA) >= 3) -// return ""; -// return ""; -// } -// case BLUE -> { -// -// } -// case MAGENTA -> { -// -// } -// default -> { -// -// } -// } -// return output; -// } - - private static Combo[] forgeCombos(ColorFlashProperties.Word[] words, ColorFlashProperties.Color[] colors) { - Combo[] combos = new Combo[8]; - for (int i = 0; i < 8; i++) { - combos[i] = new Combo(words[i], colors[i]); + private static String handleLastColorYellow(List> comboList) { + if (doesMatchExists(comboList, GREEN, BLUE)) + return ""; + if (doesMatchExists(comboList, WHITE, WHITE) || doesMatchExists(comboList, RED, WHITE)) + return ""; + return ""; + } + + private static String handleLastColorGreen(List> comboList) { + return ""; + } + + private static String handleLastColorBlue(List> comboList) { + return ""; + } + + private static String handleLastColorMagenta(List> comboList) { + return ""; + } + + private static String handleLastColorWhite(List> comboList) { + return ""; + } + + private static List> forgeCombos(ColorFlashColor[] words, + ColorFlashColor[] colors) { + List> combos = new ArrayList<>(COMBO_LIMIT); + for (int i = 0; i < COMBO_LIMIT; i++) { + combos.add(new Pair<>(words[i], colors[i])); } return combos; } - private static int iterateWord(Combo[] combos, ColorFlashProperties.Word word) { - int found = 0; - for (Combo combo : combos) { - if (combo.getWord() == word) { - found++; - } - } - return found; + private static int countParticularWord(List> combos, ColorFlashColor word) { + return (int) combos.stream() + .filter(pair -> pair.getValue0() == word) + .count(); } - private static int iterateColor(Combo[] combos, ColorFlashProperties.Color color) { - int found = 0; - for (Combo combo : combos) { - if (combo.getColor() == color) { - found++; - } - } - return found; + private static int countParticularColor(List> combos, ColorFlashColor color) { + return (int) combos.stream() + .filter(pair -> pair.getValue1() == color) + .count(); } - private static boolean matches(Combo[] combos, ColorFlashProperties.Color color, ColorFlashProperties.Word word) { - for (Combo combo : combos) { - if (combo.getWord() == word && combo.getColor() == color) { - return true; - } - } - return false; + private static boolean doesMatchExists(List> combos, + ColorFlashColor color, ColorFlashColor word) { + return combos.stream() + .anyMatch(pair -> pair.getValue0() == word && pair.getValue1() == color); + } + + private static void validateInput(ColorFlashColor[] words, ColorFlashColor[] colors) { + if (words.length != colors.length && words.length != COMBO_LIMIT) + throw new IllegalArgumentException("Input is not of the specified length: 8"); } } \ No newline at end of file diff --git a/src/main/java/bomb/modules/c/color_flash/ColorFlashColor.java b/src/main/java/bomb/modules/c/color_flash/ColorFlashColor.java new file mode 100644 index 00000000..687d308c --- /dev/null +++ b/src/main/java/bomb/modules/c/color_flash/ColorFlashColor.java @@ -0,0 +1,5 @@ +package bomb.modules.c.color_flash; + +public enum ColorFlashColor { + RED, YELLOW, GREEN, BLUE, MAGENTA, WHITE +} diff --git a/src/main/java/bomb/modules/c/color_flash/ColorFlashProperties.java b/src/main/java/bomb/modules/c/color_flash/ColorFlashProperties.java deleted file mode 100644 index b7a0cffc..00000000 --- a/src/main/java/bomb/modules/c/color_flash/ColorFlashProperties.java +++ /dev/null @@ -1,11 +0,0 @@ -package bomb.modules.c.color_flash; - -public class ColorFlashProperties { - public enum Word { - RED, YELLOW, GREEN, BLUE, MAGENTA, WHITE - } - - public enum Color { - RED, YELLOW, GREEN, BLUE, MAGENTA, WHITE - } -} diff --git a/src/main/java/bomb/tools/string/StringFormat.java b/src/main/java/bomb/tools/string/StringFormat.java index 6403a9ab..e21ad94e 100644 --- a/src/main/java/bomb/tools/string/StringFormat.java +++ b/src/main/java/bomb/tools/string/StringFormat.java @@ -6,7 +6,8 @@ import static java.util.stream.Collectors.joining; public class StringFormat { - public static final String BULLET_POINT = "\\u2022 ", ARROW = " -> "; + public static final String BULLET_POINT = "\\u2022 ", ARROW = " -> ", + YES = "Yes", NO = "No"; public static final UnaryOperator FIRST_LETTER_CAPITAL = sample -> sample.length() > 1 ? sample.substring(0, 1).toUpperCase() + sample.substring(1).toLowerCase() : sample.toUpperCase(); From c7554a4e758e25ec4054aaecd099c79047873b21 Mon Sep 17 00:00:00 2001 From: "Mr. J" <45538844+Ultraviolet-Ninja@users.noreply.github.com> Date: Fri, 4 Feb 2022 18:37:05 -0600 Subject: [PATCH 10/86] Dependency upgrades --- Progress.md | 6 +++--- build.gradle | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Progress.md b/Progress.md index 7e5cfb6f..93af5fe5 100644 --- a/Progress.md +++ b/Progress.md @@ -28,6 +28,7 @@ - Battleship - Caesar Cipher - Cheap Checkout +- Color Flash - Ice Cream - Morsematics - Murder @@ -37,7 +38,7 @@ - Square Button - Word Search -11/100 +12/100 ### Untouched Modules - 3D Maze @@ -47,7 +48,6 @@ - Binary LEDs - BitMaps - Broken Button -- Color Flash - Color Math - Color Squares - Combination Lock @@ -109,4 +109,4 @@ - Yahtzee - Zoo -68/100 +67/100 diff --git a/build.gradle b/build.gradle index 5640a197..d8556a2d 100644 --- a/build.gradle +++ b/build.gradle @@ -58,9 +58,9 @@ dependencies { } testImplementation 'org.testng:testng:7.5' - testImplementation 'org.slf4j:slf4j-api:1.7.33' - testImplementation 'org.slf4j:slf4j-simple:1.7.33' - testImplementation 'nl.jqno.equalsverifier:equalsverifier:3.8.2' + testImplementation 'org.slf4j:slf4j-api:1.7.35' + testImplementation 'org.slf4j:slf4j-simple:1.7.35' + testImplementation 'nl.jqno.equalsverifier:equalsverifier:3.9' } def firstInstance = project.hasProperty('thread0') From 204f1a9dcc294f93a8d136dfff6a2cf177f85bc4 Mon Sep 17 00:00:00 2001 From: "Mr. J" <45538844+Ultraviolet-Ninja@users.noreply.github.com> Date: Sat, 5 Feb 2022 17:59:41 -0600 Subject: [PATCH 11/86] Fixed the HexNode enums to simplify rotation --- build.gradle | 2 +- .../hexalgorithm/storage/HexNode.java | 64 +++++++++++++++++-- .../hexalgorithm/storage/HexagonalPlane.java | 37 ++--------- 3 files changed, 65 insertions(+), 38 deletions(-) diff --git a/build.gradle b/build.gradle index d8556a2d..07d8a11f 100644 --- a/build.gradle +++ b/build.gradle @@ -144,7 +144,7 @@ pitest { } javafx { - version = '16' + version = '17.0.1' modules = ['javafx.controls', 'javafx.fxml'] } diff --git a/src/main/java/bomb/modules/dh/hexamaze/hexalgorithm/storage/HexNode.java b/src/main/java/bomb/modules/dh/hexamaze/hexalgorithm/storage/HexNode.java index fd89ce72..c566ad45 100644 --- a/src/main/java/bomb/modules/dh/hexamaze/hexalgorithm/storage/HexNode.java +++ b/src/main/java/bomb/modules/dh/hexamaze/hexalgorithm/storage/HexNode.java @@ -1,5 +1,6 @@ package bomb.modules.dh.hexamaze.hexalgorithm.storage; +import bomb.abstractions.State; import org.jetbrains.annotations.NotNull; import java.util.EnumSet; @@ -88,11 +89,66 @@ public String toString() { return sb.toString(); } - public enum HexShape { - CIRCLE, HEXAGON, LEFT_TRIANGLE, RIGHT_TRIANGLE, UP_TRIANGLE, DOWN_TRIANGLE + public enum HexShape implements State { + CIRCLE, HEXAGON, LEFT_TRIANGLE { + @Override + public HexShape nextState() { + return RIGHT_TRIANGLE; + } + }, RIGHT_TRIANGLE { + @Override + public HexShape nextState() { + return LEFT_TRIANGLE; + } + }, UP_TRIANGLE { + @Override + public HexShape nextState() { + return DOWN_TRIANGLE; + } + }, DOWN_TRIANGLE { + @Override + public HexShape nextState() { + return UP_TRIANGLE; + } + }; + + @Override + public HexShape nextState() { + return this; + } } - public enum HexWall { - TOP_LEFT, TOP, TOP_RIGHT, BOTTOM_LEFT, BOTTOM, BOTTOM_RIGHT + public enum HexWall implements State { + TOP_LEFT { + @Override + public HexWall nextState() { + return TOP; + } + }, TOP { + @Override + public HexWall nextState() { + return TOP_RIGHT; + } + }, TOP_RIGHT { + @Override + public HexWall nextState() { + return BOTTOM_RIGHT; + } + }, BOTTOM_LEFT { + @Override + public HexWall nextState() { + return TOP_LEFT; + } + }, BOTTOM { + @Override + public HexWall nextState() { + return BOTTOM_LEFT; + } + }, BOTTOM_RIGHT { + @Override + public HexWall nextState() { + return BOTTOM; + } + } } } diff --git a/src/main/java/bomb/modules/dh/hexamaze/hexalgorithm/storage/HexagonalPlane.java b/src/main/java/bomb/modules/dh/hexamaze/hexalgorithm/storage/HexagonalPlane.java index bb532afd..fdef87ac 100644 --- a/src/main/java/bomb/modules/dh/hexamaze/hexalgorithm/storage/HexagonalPlane.java +++ b/src/main/java/bomb/modules/dh/hexamaze/hexalgorithm/storage/HexagonalPlane.java @@ -11,18 +11,6 @@ import java.util.function.IntUnaryOperator; import static bomb.modules.dh.hexamaze.hexalgorithm.storage.AbstractHexagon.calculateColumnLengthStream; -import static bomb.modules.dh.hexamaze.hexalgorithm.storage.HexNode.HexShape.CIRCLE; -import static bomb.modules.dh.hexamaze.hexalgorithm.storage.HexNode.HexShape.DOWN_TRIANGLE; -import static bomb.modules.dh.hexamaze.hexalgorithm.storage.HexNode.HexShape.HEXAGON; -import static bomb.modules.dh.hexamaze.hexalgorithm.storage.HexNode.HexShape.LEFT_TRIANGLE; -import static bomb.modules.dh.hexamaze.hexalgorithm.storage.HexNode.HexShape.RIGHT_TRIANGLE; -import static bomb.modules.dh.hexamaze.hexalgorithm.storage.HexNode.HexShape.UP_TRIANGLE; -import static bomb.modules.dh.hexamaze.hexalgorithm.storage.HexNode.HexWall.BOTTOM; -import static bomb.modules.dh.hexamaze.hexalgorithm.storage.HexNode.HexWall.BOTTOM_LEFT; -import static bomb.modules.dh.hexamaze.hexalgorithm.storage.HexNode.HexWall.BOTTOM_RIGHT; -import static bomb.modules.dh.hexamaze.hexalgorithm.storage.HexNode.HexWall.TOP; -import static bomb.modules.dh.hexamaze.hexalgorithm.storage.HexNode.HexWall.TOP_LEFT; -import static bomb.modules.dh.hexamaze.hexalgorithm.storage.HexNode.HexWall.TOP_RIGHT; import static bomb.tools.number.MathUtils.isAnInteger; import static java.util.Arrays.stream; import static java.util.stream.Collectors.toCollection; @@ -187,33 +175,16 @@ private static BufferedQueue> createHexagon(int sideLength) } private static HexShape rotateShape(HexShape currentShape) { - if (currentShape == null || currentShape == CIRCLE || currentShape == HEXAGON) - return currentShape; - - return switch (currentShape) { - case UP_TRIANGLE -> DOWN_TRIANGLE; - case DOWN_TRIANGLE -> UP_TRIANGLE; - case LEFT_TRIANGLE -> RIGHT_TRIANGLE; - default -> LEFT_TRIANGLE; - }; + return currentShape == null ? + null : + currentShape.nextState(); } private static EnumSet rotateWalls(EnumSet walls) { if (walls.isEmpty()) return walls; return walls.stream() - .map(HexagonalPlane::rotateSingleWall) + .map(HexWall::nextState) .collect(toCollection(() -> EnumSet.noneOf(HexWall.class))); } - - private static HexWall rotateSingleWall(HexWall wall) { - return switch (wall) { - case TOP_LEFT -> TOP; - case TOP -> TOP_RIGHT; - case TOP_RIGHT -> BOTTOM_RIGHT; - case BOTTOM_RIGHT -> BOTTOM; - case BOTTOM -> BOTTOM_LEFT; - default -> TOP_LEFT; - }; - } } From ec97c6aa8edd034f8c0b48431adb5b7a8d9da446 Mon Sep 17 00:00:00 2001 From: "Mr. J" <45538844+Ultraviolet-Ninja@users.noreply.github.com> Date: Mon, 7 Feb 2022 23:39:37 -0600 Subject: [PATCH 12/86] Rewrote what parameters Hexamaze takes in and output to remove the front end component dependency --- .../bomb/modules/dh/hexamaze/Hexamaze.java | 54 ++++----------- .../dh/hexamaze/HexamazeController.java | 66 +++++++++++++++++-- 2 files changed, 72 insertions(+), 48 deletions(-) diff --git a/src/main/java/bomb/modules/dh/hexamaze/Hexamaze.java b/src/main/java/bomb/modules/dh/hexamaze/Hexamaze.java index ef71d806..e2ea2b27 100644 --- a/src/main/java/bomb/modules/dh/hexamaze/Hexamaze.java +++ b/src/main/java/bomb/modules/dh/hexamaze/Hexamaze.java @@ -1,7 +1,6 @@ package bomb.modules.dh.hexamaze; import bomb.Widget; -import bomb.components.hex.HexTile; import bomb.modules.dh.hexamaze.hexalgorithm.maze_finding.MazeSearch; import bomb.modules.dh.hexamaze.hexalgorithm.pathfinding.ExitChecker; import bomb.modules.dh.hexamaze.hexalgorithm.pathfinding.MazeRunner; @@ -10,17 +9,16 @@ import bomb.modules.dh.hexamaze.hexalgorithm.storage.HexagonalPlane; import bomb.modules.dh.hexamaze.hexalgorithm.storage.Maze; import bomb.tools.Coordinates; -import bomb.tools.data.structures.queue.BufferedQueue; import javafx.scene.paint.Color; import org.javatuples.Pair; +import org.javatuples.Quartet; import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; import java.util.HashMap; import java.util.List; import java.util.Map; -import static bomb.components.hex.HexTile.DEFAULT_BACKGROUND_COLOR; -import static java.util.stream.Collectors.toList; import static javafx.scene.paint.Color.BLUE; import static javafx.scene.paint.Color.CYAN; import static javafx.scene.paint.Color.GREEN; @@ -42,11 +40,9 @@ public class Hexamaze extends Widget { COLOR_MAP.put(PINK, 5); } - public static String solve(@NotNull List tileList) throws IllegalArgumentException { + public static Quartet<@NotNull Grid, @Nullable String, @Nullable Integer, @Nullable List> solve( + @NotNull List nodeList) { Maze maze = new Maze(); - List nodeList = tileList.stream() - .map(HexTile::getInternalNode) - .collect(toList()); Grid original = new Grid(new HexagonalPlane(nodeList)); Grid found = MazeSearch.search(maze, original); @@ -54,14 +50,16 @@ public static String solve(@NotNull List tileList) throws IllegalArgume throw new IllegalArgumentException("Could not find maze from given shapes"); int colorValue = copyPegLocation(original, found); - setHexTileWalls(tileList, found); Pair> exitInfo = ExitChecker.findPossibleExits(found); if (exitInfo == null) - return ""; - - List resultingPath = MazeRunner.runMaze(found, exitInfo.getValue1()); - fillHexTiles(tileList, resultingPath, colorValue); - return exitInfo.getValue0(); + return new Quartet<>(found, null, null, null); + + return new Quartet<>( + found, + exitInfo.getValue0(), + colorValue, + MazeRunner.runMaze(found, exitInfo.getValue1()) + ); } private static int copyPegLocation(Grid original, Grid found) { @@ -78,32 +76,4 @@ private static int copyPegLocation(Grid original, Grid found) { } return -1; } - - private static void setHexTileWalls(List tileList, Grid found) { - List foundNodes = found.getHexagon().asList(); - - int size = foundNodes.size(); - for (int i = 0; i < size; i++) { - tileList.get(i).setInternalNode(foundNodes.get(i)); - } - } - - private static void fillHexTiles(List tileList, List coordinatesList, int colorValue) { - Color color = RED; - - for (Map.Entry entry : COLOR_MAP.entrySet()) { - if (entry.getValue() == colorValue) - color = entry.getKey(); - } - - for (HexTile hexTile : tileList) - hexTile.setBackgroundFill(DEFAULT_BACKGROUND_COLOR); - - BufferedQueue> tileQueues = HexagonalPlane.convertFromList(tileList); - - Color finalColor = color; - coordinatesList.stream() - .map(c -> tileQueues.get(c.x()).get(c.y())) - .forEach(tile -> tile.setBackgroundFill(finalColor)); - } } diff --git a/src/main/java/bomb/modules/dh/hexamaze/HexamazeController.java b/src/main/java/bomb/modules/dh/hexamaze/HexamazeController.java index 13a7bce8..cbd69d3f 100644 --- a/src/main/java/bomb/modules/dh/hexamaze/HexamazeController.java +++ b/src/main/java/bomb/modules/dh/hexamaze/HexamazeController.java @@ -1,15 +1,29 @@ package bomb.modules.dh.hexamaze; import bomb.abstractions.Resettable; +import bomb.components.hex.HexTile; import bomb.components.hex.MazeComponent; +import bomb.modules.dh.hexamaze.hexalgorithm.storage.Grid; +import bomb.modules.dh.hexamaze.hexalgorithm.storage.HexNode; +import bomb.modules.dh.hexamaze.hexalgorithm.storage.HexagonalPlane; +import bomb.tools.Coordinates; +import bomb.tools.data.structures.queue.BufferedQueue; import bomb.tools.pattern.facade.FacadeFX; import javafx.fxml.FXML; import javafx.scene.control.Alert; import javafx.scene.control.Label; import javafx.scene.control.RadioButton; import javafx.scene.control.ToggleGroup; +import javafx.scene.paint.Color; +import org.javatuples.Quartet; +import java.util.List; +import java.util.Map; + +import static bomb.components.hex.HexTile.DEFAULT_BACKGROUND_COLOR; +import static bomb.modules.dh.hexamaze.Hexamaze.COLOR_MAP; import static bomb.tools.pattern.facade.FacadeFX.GET_TOGGLE_NAME; +import static javafx.scene.paint.Color.RED; public class HexamazeController implements Resettable { @FXML @@ -46,17 +60,57 @@ private void setPegFill() { @FXML private void solveMaze() { try { - String exitDirectionText = Hexamaze.solve(mazeComponent.createTileList()); - exitDirectionLabel.setText( - exitDirectionText.isEmpty() ? - exitDirectionText : - "Exit out of the " + exitDirectionText + " side" - ); + List hexTileList = mazeComponent.createTileList(); + List nodeList = hexTileList.stream() + .map(HexTile::getInternalNode) + .toList(); + + Quartet> exitInfo = Hexamaze.solve(nodeList); + setHexTileWalls(hexTileList, exitInfo.getValue0()); + String exitDirectionText = exitInfo.getValue1(); + if (exitDirectionText != null) { + exitDirectionLabel.setText( + exitDirectionText.isEmpty() ? + exitDirectionText : + "Exit out of the " + exitDirectionText + " side" + ); + + fillHexTiles(hexTileList, exitInfo.getValue3(), exitInfo.getValue2()); + } + } catch (IllegalArgumentException illegal) { FacadeFX.setAlert(Alert.AlertType.ERROR, illegal.getMessage()); } } + private static void setHexTileWalls(List tileList, Grid found) { + List foundNodes = found.getHexagon().asList(); + + int size = foundNodes.size(); + for (int i = 0; i < size; i++) { + tileList.get(i).setInternalNode(foundNodes.get(i)); + } + } + + private static void fillHexTiles(List tileList, List coordinatesList, int colorValue) { + Color color = RED; + + for (Map.Entry entry : COLOR_MAP.entrySet()) { + if (entry.getValue() == colorValue) + color = entry.getKey(); + } + + for (HexTile hexTile : tileList) + hexTile.setBackgroundFill(DEFAULT_BACKGROUND_COLOR); + + BufferedQueue> tileQueues = HexagonalPlane.convertFromList(tileList); + + Color finalColor = color; + coordinatesList.stream() + .map(c -> tileQueues.get(c.x()).get(c.y())) + .forEach(tile -> tile.setBackgroundFill(finalColor)); + } + @Override public void reset() { mazeComponent.reset(); From cb45c5de770887e5a0ed05988c77e47b8467f069 Mon Sep 17 00:00:00 2001 From: "Mr. J" <45538844+Ultraviolet-Ninja@users.noreply.github.com> Date: Tue, 8 Feb 2022 09:15:48 -0600 Subject: [PATCH 13/86] Minor changes --- src/main/java/bomb/Widget.java | 5 +++-- .../bomb/modules/c/color_flash/ColorFlash.java | 17 ++++++++++++++--- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/src/main/java/bomb/Widget.java b/src/main/java/bomb/Widget.java index 62e32b85..01481252 100644 --- a/src/main/java/bomb/Widget.java +++ b/src/main/java/bomb/Widget.java @@ -139,9 +139,10 @@ public static String getTwoFactor() { return twoFactor; } - public static void checkSerialCode() { + public static void checkSerialCode() throws IllegalArgumentException { SERIAL_CODE_PATTERN.loadText(serialCode); - if (!SERIAL_CODE_PATTERN.matchesRegex()) throw new IllegalArgumentException(""" + if (!SERIAL_CODE_PATTERN.matchesRegex()) + throw new IllegalArgumentException(""" Serial Code is required Please check formatting on Widget page"""); } diff --git a/src/main/java/bomb/modules/c/color_flash/ColorFlash.java b/src/main/java/bomb/modules/c/color_flash/ColorFlash.java index 9ccc477c..9e366874 100644 --- a/src/main/java/bomb/modules/c/color_flash/ColorFlash.java +++ b/src/main/java/bomb/modules/c/color_flash/ColorFlash.java @@ -19,7 +19,8 @@ public class ColorFlash extends Widget { private static final String RESULT_IS_COLOR_OR_WORD = "is either the word or color"; - public static String decipher(@NotNull ColorFlashColor[] words, @NotNull ColorFlashColor[] colors) { + public static String decipher(@NotNull ColorFlashColor[] words, @NotNull ColorFlashColor[] colors) + throws IllegalArgumentException { validateInput(words, colors); var comboList = forgeCombos(words, colors); ColorFlashColor lastColor = comboList.get(comboList.size() - 1).getValue1(); @@ -93,8 +94,18 @@ private static boolean doesMatchExists(List pair.getValue0() == word && pair.getValue1() == color); } - private static void validateInput(ColorFlashColor[] words, ColorFlashColor[] colors) { + private static void validateInput(ColorFlashColor[] words, ColorFlashColor[] colors) + throws IllegalArgumentException { if (words.length != colors.length && words.length != COMBO_LIMIT) - throw new IllegalArgumentException("Input is not of the specified length: 8"); + throw new IllegalArgumentException("One of the inputs is not of the specified length: 8"); + for (var word : words) { + if (word == null) + throw new IllegalArgumentException("Null element found in words"); + } + + for (var color : colors) { + if (color == null) + throw new IllegalArgumentException("Null element found in colors"); + } } } \ No newline at end of file From 24e07e7b3e034a931d0cd635b9d4a95e2309b0c1 Mon Sep 17 00:00:00 2001 From: "Mr. J" <45538844+Ultraviolet-Ninja@users.noreply.github.com> Date: Tue, 8 Feb 2022 11:29:07 -0600 Subject: [PATCH 14/86] Finished notating for the hexamaze directory classes --- .../bomb/modules/dh/hexamaze/Hexamaze.java | 7 ++- .../dh/hexamaze/HexamazeController.java | 1 - .../hexalgorithm/factory/MazeFactory.java | 3 +- .../hexalgorithm/maze_finding/MazeSearch.java | 7 ++- .../hexalgorithm/pathfinding/ExitChecker.java | 15 +++--- .../hexalgorithm/pathfinding/MazeRunner.java | 4 +- .../hexalgorithm/storage/AbstractHexagon.java | 2 +- .../hexamaze/hexalgorithm/storage/Grid.java | 3 +- .../hexalgorithm/storage/HexNode.java | 19 +++++--- .../hexalgorithm/storage/HexagonalPlane.java | 46 ++++++------------- .../hexalgorithm/storage/Rotatable.java | 5 ++ src/main/java/bomb/tools/Coordinates.java | 4 +- .../pathfinding/ExitCheckerTest.java | 3 +- 13 files changed, 58 insertions(+), 61 deletions(-) create mode 100644 src/main/java/bomb/modules/dh/hexamaze/hexalgorithm/storage/Rotatable.java diff --git a/src/main/java/bomb/modules/dh/hexamaze/Hexamaze.java b/src/main/java/bomb/modules/dh/hexamaze/Hexamaze.java index e2ea2b27..6477a521 100644 --- a/src/main/java/bomb/modules/dh/hexamaze/Hexamaze.java +++ b/src/main/java/bomb/modules/dh/hexamaze/Hexamaze.java @@ -40,8 +40,11 @@ public class Hexamaze extends Widget { COLOR_MAP.put(PINK, 5); } - public static Quartet<@NotNull Grid, @Nullable String, @Nullable Integer, @Nullable List> solve( - @NotNull List nodeList) { + public static @NotNull Quartet< + @NotNull Grid, + @Nullable String, + @Nullable Integer, + @Nullable List>solve(@NotNull List nodeList) throws IllegalArgumentException { Maze maze = new Maze(); Grid original = new Grid(new HexagonalPlane(nodeList)); diff --git a/src/main/java/bomb/modules/dh/hexamaze/HexamazeController.java b/src/main/java/bomb/modules/dh/hexamaze/HexamazeController.java index cbd69d3f..aa559d3f 100644 --- a/src/main/java/bomb/modules/dh/hexamaze/HexamazeController.java +++ b/src/main/java/bomb/modules/dh/hexamaze/HexamazeController.java @@ -77,7 +77,6 @@ private void solveMaze() { fillHexTiles(hexTileList, exitInfo.getValue3(), exitInfo.getValue2()); } - } catch (IllegalArgumentException illegal) { FacadeFX.setAlert(Alert.AlertType.ERROR, illegal.getMessage()); } diff --git a/src/main/java/bomb/modules/dh/hexamaze/hexalgorithm/factory/MazeFactory.java b/src/main/java/bomb/modules/dh/hexamaze/hexalgorithm/factory/MazeFactory.java index 4df9e19e..0c28d0c1 100644 --- a/src/main/java/bomb/modules/dh/hexamaze/hexalgorithm/factory/MazeFactory.java +++ b/src/main/java/bomb/modules/dh/hexamaze/hexalgorithm/factory/MazeFactory.java @@ -21,7 +21,6 @@ import static bomb.modules.dh.hexamaze.hexalgorithm.storage.HexNode.HexShape.UP_TRIANGLE; import static java.util.Arrays.stream; import static java.util.stream.Collectors.toCollection; -import static java.util.stream.Collectors.toList; @SuppressWarnings("ConstantConditions") public class MazeFactory { @@ -32,7 +31,7 @@ public static List createMaze() throws IOException, CsvException { .flatMap(Arrays::stream) .map(line -> line.split(" ")) .map(data -> new HexNode(decodeShape(data[1]), decodeWalls(data[0]))) - .collect(toList()); + .toList(); } public static HexShape decodeShape(String code) { diff --git a/src/main/java/bomb/modules/dh/hexamaze/hexalgorithm/maze_finding/MazeSearch.java b/src/main/java/bomb/modules/dh/hexamaze/hexalgorithm/maze_finding/MazeSearch.java index c1e1a2f3..9e64217c 100644 --- a/src/main/java/bomb/modules/dh/hexamaze/hexalgorithm/maze_finding/MazeSearch.java +++ b/src/main/java/bomb/modules/dh/hexamaze/hexalgorithm/maze_finding/MazeSearch.java @@ -11,8 +11,7 @@ import java.util.Collection; import java.util.List; -import static bomb.modules.dh.hexamaze.hexalgorithm.storage.AbstractHexagon.calculateColumnLengthStream; -import static java.util.stream.Collectors.toList; +import static bomb.modules.dh.hexamaze.hexalgorithm.storage.AbstractHexagon.calculateColumnLengthArray; public class MazeSearch { public static final int ROTATION_COUNT = 6; @@ -107,7 +106,7 @@ private static void trimPillar(BufferedQueue> pillar) { private static BufferedQueue> createInitialCopy( BufferedQueue> pillar, int gridSideLength) { - int[] columnLengths = calculateColumnLengthStream(gridSideLength); + int[] columnLengths = calculateColumnLengthArray(gridSideLength); BufferedQueue> copiedGrid = new BufferedQueue<>(columnLengths.length); int index = 0; @@ -136,7 +135,7 @@ private static List convertToHexShapes(HexagonalPlane structure) { .stream() .flatMap(Collection::stream) .map(HexNode::getHexShape) - .collect(toList()); + .toList(); } private static void moveToNextSegment(BufferedQueue> pillar, diff --git a/src/main/java/bomb/modules/dh/hexamaze/hexalgorithm/pathfinding/ExitChecker.java b/src/main/java/bomb/modules/dh/hexamaze/hexalgorithm/pathfinding/ExitChecker.java index b62a85ba..e1f791fe 100644 --- a/src/main/java/bomb/modules/dh/hexamaze/hexalgorithm/pathfinding/ExitChecker.java +++ b/src/main/java/bomb/modules/dh/hexamaze/hexalgorithm/pathfinding/ExitChecker.java @@ -8,6 +8,7 @@ import javafx.scene.paint.Color; import org.javatuples.Pair; import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; import java.util.ArrayList; import java.util.EnumSet; @@ -16,7 +17,7 @@ import java.util.stream.IntStream; import static bomb.modules.dh.hexamaze.Hexamaze.COLOR_MAP; -import static bomb.modules.dh.hexamaze.hexalgorithm.storage.AbstractHexagon.calculateColumnLengthStream; +import static bomb.modules.dh.hexamaze.hexalgorithm.storage.AbstractHexagon.calculateColumnLengthArray; import static bomb.modules.dh.hexamaze.hexalgorithm.storage.Grid.GRID_SIDE_LENGTH; import static bomb.modules.dh.hexamaze.hexalgorithm.storage.HexNode.HexWall.BOTTOM; import static bomb.modules.dh.hexamaze.hexalgorithm.storage.HexNode.HexWall.BOTTOM_LEFT; @@ -28,7 +29,7 @@ import static java.util.stream.Collectors.toList; public class ExitChecker { - public static Pair> findPossibleExits(@NotNull Grid grid) + public static @Nullable Pair> findPossibleExits(@NotNull Grid grid) throws IllegalArgumentException { int pegCount = countPegsOnGrid(grid.getHexagon().getBufferedQueues()); if (pegCount == 0) @@ -76,7 +77,7 @@ private static List getTopRightSideExits() { } private static List getRightSideExits() { - int[] columnCapacities = calculateColumnLengthStream(GRID_SIDE_LENGTH); + int[] columnCapacities = calculateColumnLengthArray(GRID_SIDE_LENGTH); int lastIndex = columnCapacities.length - 1; int finalColumnCapacity = columnCapacities[lastIndex]; @@ -88,7 +89,7 @@ private static List getRightSideExits() { private static List getBottomRightSideExits() { int gridSpan = CALCULATE_SPAN.applyAsInt(GRID_SIDE_LENGTH); List list = new ArrayList<>(); - int[] columnCapacities = calculateColumnLengthStream(GRID_SIDE_LENGTH); + int[] columnCapacities = calculateColumnLengthArray(GRID_SIDE_LENGTH); for (int i = GRID_SIDE_LENGTH - 1; i < gridSpan; i++) { list.add( new Coordinates(i, columnCapacities[i] - 1)); @@ -98,7 +99,7 @@ private static List getBottomRightSideExits() { private static List getBottomLeftSideExits() { List output = new ArrayList<>(); - int[] columnCapacities = calculateColumnLengthStream(GRID_SIDE_LENGTH); + int[] columnCapacities = calculateColumnLengthArray(GRID_SIDE_LENGTH); for (int i = 0; i < GRID_SIDE_LENGTH; i++) { output.add(new Coordinates(i, columnCapacities[i] - 1)); @@ -127,12 +128,12 @@ private static List filterBlockedExits(Grid grid, List return list.stream() .filter(coordinates -> { HexNode node = grid.getAtCoordinates(coordinates); - return isOneWallClear(node, wallsToFind); + return isAtLeastOneWallClear(node, wallsToFind); }) .collect(toList()); } - private static boolean isOneWallClear(HexNode node, EnumSet wallsToFind) { + private static boolean isAtLeastOneWallClear(HexNode node, EnumSet wallsToFind) { for (HexWall wall : wallsToFind) { if (!node.isPathBlocked(wall)) return true; diff --git a/src/main/java/bomb/modules/dh/hexamaze/hexalgorithm/pathfinding/MazeRunner.java b/src/main/java/bomb/modules/dh/hexamaze/hexalgorithm/pathfinding/MazeRunner.java index 5aff0e9e..721edf17 100644 --- a/src/main/java/bomb/modules/dh/hexamaze/hexalgorithm/pathfinding/MazeRunner.java +++ b/src/main/java/bomb/modules/dh/hexamaze/hexalgorithm/pathfinding/MazeRunner.java @@ -15,7 +15,7 @@ import java.util.Comparator; import java.util.List; -import static bomb.modules.dh.hexamaze.hexalgorithm.storage.AbstractHexagon.calculateColumnLengthStream; +import static bomb.modules.dh.hexamaze.hexalgorithm.storage.AbstractHexagon.calculateColumnLengthArray; import static bomb.modules.dh.hexamaze.hexalgorithm.storage.Grid.GRID_SIDE_LENGTH; import static bomb.modules.dh.hexamaze.hexalgorithm.storage.HexNode.HexWall.BOTTOM; import static bomb.modules.dh.hexamaze.hexalgorithm.storage.HexNode.HexWall.BOTTOM_RIGHT; @@ -45,7 +45,7 @@ public static List runMaze(@NotNull Grid grid, @NotNull List convertGridToGraph(Grid grid) { Graph graph = new SimpleGraph<>(DefaultEdge.class); - int[] columnLengths = calculateColumnLengthStream(GRID_SIDE_LENGTH); + int[] columnLengths = calculateColumnLengthArray(GRID_SIDE_LENGTH); int x = 0; for (int columnLength : columnLengths) { diff --git a/src/main/java/bomb/modules/dh/hexamaze/hexalgorithm/storage/AbstractHexagon.java b/src/main/java/bomb/modules/dh/hexamaze/hexalgorithm/storage/AbstractHexagon.java index 488c4fa9..47dee4b1 100644 --- a/src/main/java/bomb/modules/dh/hexamaze/hexalgorithm/storage/AbstractHexagon.java +++ b/src/main/java/bomb/modules/dh/hexamaze/hexalgorithm/storage/AbstractHexagon.java @@ -25,7 +25,7 @@ public HexNode getAtCoordinates(Coordinates coordinates) { return hexagon.findAtCoordinate(coordinates); } - public static int[] calculateColumnLengthStream(int sideLength) { + public static int[] calculateColumnLengthArray(int sideLength) { int span = HexagonalPlane.CALCULATE_SPAN.applyAsInt(sideLength); int[] firstHalf = IntStream.rangeClosed(sideLength, span).toArray(); int[] secondHalf = reverseOrder(IntStream.rangeClosed(sideLength, span - 1).toArray()); diff --git a/src/main/java/bomb/modules/dh/hexamaze/hexalgorithm/storage/Grid.java b/src/main/java/bomb/modules/dh/hexamaze/hexalgorithm/storage/Grid.java index e2f089d6..7fd7f481 100644 --- a/src/main/java/bomb/modules/dh/hexamaze/hexalgorithm/storage/Grid.java +++ b/src/main/java/bomb/modules/dh/hexamaze/hexalgorithm/storage/Grid.java @@ -10,7 +10,7 @@ import static javafx.scene.paint.Color.RED; import static javafx.scene.paint.Color.YELLOW; -public class Grid extends AbstractHexagon { +public class Grid extends AbstractHexagon implements Rotatable { public static final int GRID_SIDE_LENGTH = 4; private final ArrayRing colorRing; @@ -33,6 +33,7 @@ public Grid(HexagonalPlane grid) { this(grid, 0); } + @Override public void rotate() { hexagon.rotate(); colorRing.rotateCounterClockwise(); diff --git a/src/main/java/bomb/modules/dh/hexamaze/hexalgorithm/storage/HexNode.java b/src/main/java/bomb/modules/dh/hexamaze/hexalgorithm/storage/HexNode.java index c566ad45..dc1caf59 100644 --- a/src/main/java/bomb/modules/dh/hexamaze/hexalgorithm/storage/HexNode.java +++ b/src/main/java/bomb/modules/dh/hexamaze/hexalgorithm/storage/HexNode.java @@ -9,8 +9,9 @@ import static bomb.tools.number.MathUtils.HASHING_NUMBER; import static java.util.Objects.requireNonNull; import static java.util.stream.Collectors.joining; +import static java.util.stream.Collectors.toCollection; -public class HexNode { +public class HexNode implements Rotatable { private EnumSet walls; private HexShape hexShape; private int color; @@ -36,11 +37,6 @@ public EnumSet getWalls() { return walls; } - public void setWalls(@NotNull EnumSet walls) { - requireNonNull(walls); - this.walls = walls; - } - public HexShape getHexShape() { return hexShape; } @@ -89,6 +85,17 @@ public String toString() { return sb.toString(); } + @Override + public void rotate() { + if (!walls.isEmpty()) { + walls = walls.stream() + .map(State::nextState) + .collect(toCollection(() -> EnumSet.noneOf(HexWall.class))); + } + + if (hexShape != null) hexShape = hexShape.nextState(); + } + public enum HexShape implements State { CIRCLE, HEXAGON, LEFT_TRIANGLE { @Override diff --git a/src/main/java/bomb/modules/dh/hexamaze/hexalgorithm/storage/HexagonalPlane.java b/src/main/java/bomb/modules/dh/hexamaze/hexalgorithm/storage/HexagonalPlane.java index fdef87ac..cf2c6a28 100644 --- a/src/main/java/bomb/modules/dh/hexamaze/hexalgorithm/storage/HexagonalPlane.java +++ b/src/main/java/bomb/modules/dh/hexamaze/hexalgorithm/storage/HexagonalPlane.java @@ -1,22 +1,19 @@ package bomb.modules.dh.hexamaze.hexalgorithm.storage; -import bomb.modules.dh.hexamaze.hexalgorithm.storage.HexNode.HexShape; -import bomb.modules.dh.hexamaze.hexalgorithm.storage.HexNode.HexWall; import bomb.tools.Coordinates; import bomb.tools.data.structures.queue.BufferedQueue; +import org.jetbrains.annotations.NotNull; -import java.util.EnumSet; import java.util.Iterator; import java.util.List; import java.util.function.IntUnaryOperator; -import static bomb.modules.dh.hexamaze.hexalgorithm.storage.AbstractHexagon.calculateColumnLengthStream; +import static bomb.modules.dh.hexamaze.hexalgorithm.storage.AbstractHexagon.calculateColumnLengthArray; import static bomb.tools.number.MathUtils.isAnInteger; import static java.util.Arrays.stream; -import static java.util.stream.Collectors.toCollection; import static java.util.stream.Collectors.toList; -public class HexagonalPlane implements Iterable> { +public class HexagonalPlane implements Iterable>, Rotatable { public static final IntUnaryOperator CALCULATE_SPAN = length -> 2 * length - 1, NODAL_SIDE_LENGTH = area -> { double result = (3 + Math.sqrt(12 * area - 3)) / 6; @@ -37,13 +34,14 @@ public HexagonalPlane(BufferedQueue> hexagon, int sideLen this.hexagon = hexagon; } - public HexagonalPlane(List nodeList) throws IllegalArgumentException { + public HexagonalPlane(@NotNull List nodeList) throws IllegalArgumentException { sideLength = NODAL_SIDE_LENGTH.applyAsInt(nodeList.size()); if (sideLength == -1) throw new IllegalArgumentException("Given List would not create a complete Hexagon"); hexagon = convertFromList(nodeList); } + @Override public void rotate() { int span = CALCULATE_SPAN.applyAsInt(sideLength); BufferedQueue> output = createHexagon(sideLength); @@ -57,12 +55,7 @@ public void rotate() { output.stream() .flatMap(BufferedQueue::stream) - .forEach(node -> { - HexShape newShape = rotateShape(node.getHexShape()); - EnumSet newWalls = rotateWalls(node.getWalls()); - node.setHexShape(newShape); - node.setWalls(newWalls); - }); + .forEach(Rotatable::rotate); hexagon = output; } @@ -97,7 +90,7 @@ public List asList() { .collect(toList()); } - public HexNode findAtCoordinate(Coordinates coordinates) { + public HexNode findAtCoordinate(@NotNull Coordinates coordinates) { int x = coordinates.x(); if (x < 0 || x >= getSpan()) return null; @@ -139,7 +132,7 @@ public int hashCode() { return hexagon.hashCode(); } - public static BufferedQueue> convertFromList(List list) { + public static BufferedQueue> convertFromList(@NotNull List list) { int sideLength = NODAL_SIDE_LENGTH.applyAsInt(list.size()); BufferedQueue> output = createHexagon(sideLength); @@ -163,28 +156,15 @@ private static boolean add(BufferedQueue> toFill, T toAdd) } private static BufferedQueue> createHexagon(int sideLength) { - if (sideLength <= 2) - throw new IllegalArgumentException("Size is too small"); + if (sideLength <= 2) throw new IllegalArgumentException("Size is too small"); + int span = CALCULATE_SPAN.applyAsInt(sideLength); BufferedQueue> output = new BufferedQueue<>(span); - int[] columnLengths = calculateColumnLengthStream(sideLength); - stream(columnLengths) + + stream(calculateColumnLengthArray(sideLength)) .mapToObj(size -> new BufferedQueue(size)) .forEach(output::add); - return output; - } - private static HexShape rotateShape(HexShape currentShape) { - return currentShape == null ? - null : - currentShape.nextState(); - } - - private static EnumSet rotateWalls(EnumSet walls) { - if (walls.isEmpty()) return walls; - - return walls.stream() - .map(HexWall::nextState) - .collect(toCollection(() -> EnumSet.noneOf(HexWall.class))); + return output; } } diff --git a/src/main/java/bomb/modules/dh/hexamaze/hexalgorithm/storage/Rotatable.java b/src/main/java/bomb/modules/dh/hexamaze/hexalgorithm/storage/Rotatable.java new file mode 100644 index 00000000..0373c522 --- /dev/null +++ b/src/main/java/bomb/modules/dh/hexamaze/hexalgorithm/storage/Rotatable.java @@ -0,0 +1,5 @@ +package bomb.modules.dh.hexamaze.hexalgorithm.storage; + +public interface Rotatable { + void rotate(); +} diff --git a/src/main/java/bomb/tools/Coordinates.java b/src/main/java/bomb/tools/Coordinates.java index 8b304cd3..40f097b3 100644 --- a/src/main/java/bomb/tools/Coordinates.java +++ b/src/main/java/bomb/tools/Coordinates.java @@ -1,9 +1,11 @@ package bomb.tools; +import org.jetbrains.annotations.NotNull; + import static bomb.tools.number.MathUtils.HASHING_NUMBER; public record Coordinates(int x, int y) implements Comparable { - public Coordinates add(Coordinates vector) { + public Coordinates add(@NotNull Coordinates vector) { return new Coordinates(this.x + vector.x, this.y + vector.y); } diff --git a/src/test/java/bomb/modules/dh/hexamaze/hexalgorithm/pathfinding/ExitCheckerTest.java b/src/test/java/bomb/modules/dh/hexamaze/hexalgorithm/pathfinding/ExitCheckerTest.java index 2b5a7298..e1ec906e 100644 --- a/src/test/java/bomb/modules/dh/hexamaze/hexalgorithm/pathfinding/ExitCheckerTest.java +++ b/src/test/java/bomb/modules/dh/hexamaze/hexalgorithm/pathfinding/ExitCheckerTest.java @@ -7,6 +7,7 @@ import bomb.tools.Coordinates; import bomb.tools.data.structures.queue.BufferedQueue; import org.javatuples.Pair; +import org.jetbrains.annotations.NotNull; import org.testng.annotations.BeforeMethod; import org.testng.annotations.Test; @@ -67,7 +68,7 @@ public void validLocationTest() { assertEquals(results.getValue1().size(), 2); } - public static void setPegLocations(Grid grid, Set locations) { + public static void setPegLocations(@NotNull Grid grid, Set locations) { BufferedQueue> gridQueues = grid.getHexagon().getBufferedQueues(); int locationCounter = 0; From 929aef3f96341e744f0664f86d2a40e302568647 Mon Sep 17 00:00:00 2001 From: "Mr. J" <45538844+Ultraviolet-Ninja@users.noreply.github.com> Date: Tue, 8 Feb 2022 22:25:11 -0600 Subject: [PATCH 15/86] Reformatting fixes --- src/main/java/bomb/ManualController.java | 3 +- src/main/java/bomb/Widget.java | 3 +- .../java/bomb/modules/c/caesar/Caesar.java | 2 +- .../java/bomb/modules/dh/emoji/Emoji.java | 21 ++++--- .../modules/dh/emoji/EmojiController.java | 3 +- .../java/bomb/modules/dh/emoji/EmojiMath.java | 60 +++++++------------ .../bomb/modules/dh/fast_math/FastMath.java | 25 ++++---- .../modules/dh/forget_me/ForgetMeNot.java | 3 +- .../dh/hexamaze/HexamazeController.java | 1 + .../hexalgorithm/factory/MazeFactory.java | 3 +- .../hexalgorithm/maze_finding/MazeSearch.java | 3 +- .../hexalgorithm/pathfinding/ExitChecker.java | 9 ++- .../hexalgorithm/pathfinding/MazeRunner.java | 2 +- .../hexalgorithm/storage/HexagonalPlane.java | 3 +- .../modules/m/morsematics/Morsematics.java | 5 +- .../modules/m/murder/LocationMapFactory.java | 6 +- .../java/bomb/modules/m/murder/Murder.java | 2 +- .../np/neutralization/Neutralization.java | 4 +- .../bomb/modules/s/souvenir/Souvenir.java | 4 +- src/main/java/bomb/tools/filter/Regex.java | 5 +- .../modules/dh/fast_math/FastMathTest.java | 9 +-- 21 files changed, 79 insertions(+), 97 deletions(-) diff --git a/src/main/java/bomb/ManualController.java b/src/main/java/bomb/ManualController.java index 480c8bec..e7ae99b9 100644 --- a/src/main/java/bomb/ManualController.java +++ b/src/main/java/bomb/ManualController.java @@ -48,7 +48,6 @@ import static java.util.Arrays.asList; import static java.util.concurrent.CompletableFuture.supplyAsync; import static java.util.function.UnaryOperator.identity; -import static java.util.stream.Collectors.toList; import static java.util.stream.Collectors.toMap; @SuppressWarnings("ConstantConditions") @@ -129,7 +128,7 @@ private static CompletableFuture> convertFilesToRegions(List .thenApply(stream -> stream.map(Paths::get) .map(Path::toUri) .map(uri -> createSingleRegion(uri, resetObserver)) - .collect(toList()) + .toList() ); CompletableFuture> fileToRegionMapFuture = diff --git a/src/main/java/bomb/Widget.java b/src/main/java/bomb/Widget.java index 01481252..c119e564 100644 --- a/src/main/java/bomb/Widget.java +++ b/src/main/java/bomb/Widget.java @@ -20,7 +20,6 @@ import static bomb.tools.filter.RegexFilter.VOWEL_FILTER; import static bomb.tools.filter.RegexFilter.filter; import static java.util.Arrays.stream; -import static java.util.stream.Collectors.toList; /** * Widget class carries all the important widgets of the current bomb. @@ -251,7 +250,7 @@ protected static EnumSet getFilteredSetOfIndicators(IndicatorFilter f List tempList = allIndicators.stream() .filter(indicator -> filter.test(indicator.getState())) - .collect(toList()); + .toList(); return tempList.isEmpty() ? EnumSet.noneOf(Indicator.class) : diff --git a/src/main/java/bomb/modules/c/caesar/Caesar.java b/src/main/java/bomb/modules/c/caesar/Caesar.java index 1f2a5699..ee3713f0 100644 --- a/src/main/java/bomb/modules/c/caesar/Caesar.java +++ b/src/main/java/bomb/modules/c/caesar/Caesar.java @@ -12,7 +12,7 @@ public class Caesar extends Widget { private static final int MAX_LETTER_COUNT = 26; - public static String reshuffle(@NotNull String input) throws IllegalArgumentException { + public static @NotNull String reshuffle(@NotNull String input) throws IllegalArgumentException { checkSerialCode(); return shift(input, createOffset()); } diff --git a/src/main/java/bomb/modules/dh/emoji/Emoji.java b/src/main/java/bomb/modules/dh/emoji/Emoji.java index d71a21e8..b328b6cb 100644 --- a/src/main/java/bomb/modules/dh/emoji/Emoji.java +++ b/src/main/java/bomb/modules/dh/emoji/Emoji.java @@ -2,7 +2,11 @@ import bomb.abstractions.Labeled; +import java.util.Map; + import static java.util.Arrays.stream; +import static java.util.function.UnaryOperator.identity; +import static java.util.stream.Collectors.toUnmodifiableMap; public enum Emoji implements Labeled { COLON_CLOSE(":)"), EQUAL_OPEN("=("), OPEN_COLON("(:"), @@ -10,7 +14,15 @@ public enum Emoji implements Labeled { EQUAL_CLOSED("=)"), OPEN_EQUAL("(="), COLON_BAR(":|"), BAR_COLON("|:"); - static final Emoji[] EMOJI_ARRAY = values(); + public static final Map EMOJI_MAP; + + static { + EMOJI_MAP = stream(values()) + .collect(toUnmodifiableMap( + emoji -> emoji.label, + identity() + )); + } private final String label; @@ -19,13 +31,6 @@ public String getLabel() { return label; } - public static Emoji getEmojiFromText(String incoming) { - return stream(EMOJI_ARRAY) - .filter(emoji -> emoji.label.equals(incoming)) - .findFirst() - .orElse(null); - } - Emoji(String label) { this.label = label; } diff --git a/src/main/java/bomb/modules/dh/emoji/EmojiController.java b/src/main/java/bomb/modules/dh/emoji/EmojiController.java index 18eb14ed..f1c39a1c 100644 --- a/src/main/java/bomb/modules/dh/emoji/EmojiController.java +++ b/src/main/java/bomb/modules/dh/emoji/EmojiController.java @@ -11,6 +11,7 @@ import java.util.Objects; import java.util.function.Consumer; +import static bomb.modules.dh.emoji.Emoji.EMOJI_MAP; import static bomb.modules.dh.emoji.EmojiControllerState.END; import static bomb.modules.dh.emoji.EmojiControllerState.FIRST_EMOJI_PRESS; import static bomb.modules.dh.emoji.EmojiControllerState.MATH_SYMBOL_PRESS; @@ -46,7 +47,7 @@ public void initialize() { private Consumer createEmojiButtonAction() { return event -> { String emojiText = BUTTON_NAME_FROM_EVENT.apply(event); - Emoji current = Emoji.getEmojiFromText(emojiText); + Emoji current = EMOJI_MAP.get(emojiText); internalEquation.append(Objects.requireNonNull(current).getLabel()); exportToUI(); handleState(); diff --git a/src/main/java/bomb/modules/dh/emoji/EmojiMath.java b/src/main/java/bomb/modules/dh/emoji/EmojiMath.java index 7584a19e..1fd880aa 100644 --- a/src/main/java/bomb/modules/dh/emoji/EmojiMath.java +++ b/src/main/java/bomb/modules/dh/emoji/EmojiMath.java @@ -5,7 +5,7 @@ import org.intellij.lang.annotations.Language; import org.jetbrains.annotations.NotNull; -import static bomb.modules.dh.emoji.Emoji.EMOJI_ARRAY; +import static bomb.modules.dh.emoji.Emoji.EMOJI_MAP; /** * This class deals with the Emoji Math module. @@ -13,10 +13,11 @@ */ public class EmojiMath extends Widget { @Language("regexp") - private static final String EMOJI_PATTERN = "(?:[=:][|()]|[|()][=:]){1,2}"; + private static final String EMOJI_PATTERN; private static final Regex VALIDATION; static { + EMOJI_PATTERN = "(?:[=:][|()]|[|()][=:]){1,2}"; VALIDATION = new Regex("^" + EMOJI_PATTERN + "([+\\-])" + EMOJI_PATTERN + "$"); } @@ -26,51 +27,32 @@ public class EmojiMath extends Widget { * @param input The equation from the TextField * @return The values gathered from the emoji equation */ - public static int calculate(@NotNull String input) { + public static int calculate(@NotNull String input) throws IllegalArgumentException { VALIDATION.loadText(input); if (!VALIDATION.matchesRegex()) throw new IllegalArgumentException(input + " does not match pattern"); boolean toAdd = VALIDATION.captureGroup(1).equals("+"); - String translatedEq = toAdd ? - translateEmojis(input.split("\\+"), true) : - translateEmojis(input.split("-"), false); + int[] results = convertEmojis(input.split(toAdd ? "\\+" : "-")); - return calculateRealNumbers(translatedEq, toAdd); + return toAdd ? + results[0] + results[1] : + results[0] - results[1]; } - private static String translateEmojis(String[] samples, boolean add) { - StringBuilder result = new StringBuilder(); - boolean flag = true; - for (String half : samples) { - if (half.length() == 4) { - result.append(findEmoji(half.substring(0, half.length() / 2))); - result.append(findEmoji(half.substring(half.length() / 2))); - } else result.append(findEmoji(half)); - - if (flag) { - flag = false; - result.append(add ? "+" : "-"); - } + private static int[] convertEmojis(String[] operands) { + final int[] output = new int[operands.length]; + final StringBuilder tempResult = new StringBuilder(); + int counter = 0; + + for (String operand : operands) { + if (operand.length() == 4) { + tempResult.append(EMOJI_MAP.get(operand.substring(0, 2)).ordinal()); + tempResult.append(EMOJI_MAP.get(operand.substring(2)).ordinal()); + } else tempResult.append(EMOJI_MAP.get(operand).ordinal()); + output[counter++] = Integer.parseInt(tempResult.toString()); + tempResult.setLength(0); } - return result.toString(); - } - - private static String findEmoji(String emoji) { - for (Emoji emo : EMOJI_ARRAY) { - if (emo.getLabel().equals(emoji)) { - return String.valueOf(emo.ordinal()); - } - } - return null; - } - private static int calculateRealNumbers(String equation, boolean add) throws NumberFormatException { - String[] toNum = equation.split(add ? "\\+" : "-"); - int[] nums = new int[toNum.length]; - nums[0] = Integer.parseInt(toNum[0]); - nums[1] = Integer.parseInt(toNum[1]); - return add ? - nums[0] + nums[1] : - nums[0] - nums[1]; + return output; } } \ No newline at end of file diff --git a/src/main/java/bomb/modules/dh/fast_math/FastMath.java b/src/main/java/bomb/modules/dh/fast_math/FastMath.java index 4e70cfdb..62b90e93 100644 --- a/src/main/java/bomb/modules/dh/fast_math/FastMath.java +++ b/src/main/java/bomb/modules/dh/fast_math/FastMath.java @@ -20,11 +20,12 @@ public class FastMath extends Widget { {13, 23, 26, 85, 92, 12, 73, 56, 81, 7, 75, 47, 99} }; - public static String solve(@NotNull String letters) throws IllegalArgumentException { - if (letters.length() != 2) - throw new IllegalArgumentException("Input 2 letters, please"); + public static @NotNull String solve(@NotNull String letters) throws IllegalArgumentException { checkSerialCode(); - int preconditions = edgework(); + letters = letters.toUpperCase(); + if (!letters.matches("[ABCDEGKNPSTXZ]{2}")) + throw new IllegalArgumentException("Input 2 of the following letters: [A B C D E G K N P S T X Z]"); + int preconditions = evaluateEdgework(); int leftNum = translateLetter(letters.substring(0, 1)); int rightNum = translateLetter(letters.substring(1)); @@ -33,7 +34,7 @@ public static String solve(@NotNull String letters) throws IllegalArgumentExcept } private static int translateLetter(String letter) throws IllegalArgumentException { - return switch (letter.toUpperCase()) { + return switch (letter) { case "A" -> 0; case "B" -> 1; case "C" -> 2; @@ -46,18 +47,16 @@ private static int translateLetter(String letter) throws IllegalArgumentExceptio case "S" -> 9; case "T" -> 10; case "X" -> 11; - case "Z" -> 12; - default -> throw new IllegalArgumentException("Illegal letter given"); + default -> 12; }; } - private static int edgework() { - int output = hasLitIndicator(MSA) ? 20 : 0; //If the bomb has a lit MSA indicator - output += doesPortExists(SERIAL) ? 14 : 0; //If the bomb has a Serial Port - //If the serial number has the letters F A S T + private static int evaluateEdgework() { + int output = hasLitIndicator(MSA) ? 20 : 0; + output += doesPortExists(SERIAL) ? 14 : 0; output -= !EMPTY_FILTER_RESULTS.test(serialCode, new Regex("[fast]")) ? 5 : 0; - output += doesPortExists(RJ45) ? 27 : 0; //If the bomb has an RJ-45 Port - output -= getAllBatteries() > 3 ? 15 : 0; //If the bomb has more than 3 batteries + output += doesPortExists(RJ45) ? 27 : 0; + output -= getAllBatteries() > 3 ? 15 : 0; return output; } diff --git a/src/main/java/bomb/modules/dh/forget_me/ForgetMeNot.java b/src/main/java/bomb/modules/dh/forget_me/ForgetMeNot.java index 9265e027..df498bc0 100644 --- a/src/main/java/bomb/modules/dh/forget_me/ForgetMeNot.java +++ b/src/main/java/bomb/modules/dh/forget_me/ForgetMeNot.java @@ -3,6 +3,7 @@ import bomb.Widget; import bomb.tools.filter.Regex; import bomb.tools.filter.RegexFilter; +import org.jetbrains.annotations.NotNull; import java.util.ArrayList; import java.util.List; @@ -120,7 +121,7 @@ public static void undoLastStage() { FINAL_CODE.remove(size - 1); } - public static String stringifyFinalCode() { + public static @NotNull String stringifyFinalCode() { StringBuilder sb = new StringBuilder(); for (int i = 0; i < FINAL_CODE.size(); i++) { diff --git a/src/main/java/bomb/modules/dh/hexamaze/HexamazeController.java b/src/main/java/bomb/modules/dh/hexamaze/HexamazeController.java index aa559d3f..0602b1cf 100644 --- a/src/main/java/bomb/modules/dh/hexamaze/HexamazeController.java +++ b/src/main/java/bomb/modules/dh/hexamaze/HexamazeController.java @@ -68,6 +68,7 @@ private void solveMaze() { Quartet> exitInfo = Hexamaze.solve(nodeList); setHexTileWalls(hexTileList, exitInfo.getValue0()); String exitDirectionText = exitInfo.getValue1(); + if (exitDirectionText != null) { exitDirectionLabel.setText( exitDirectionText.isEmpty() ? diff --git a/src/main/java/bomb/modules/dh/hexamaze/hexalgorithm/factory/MazeFactory.java b/src/main/java/bomb/modules/dh/hexamaze/hexalgorithm/factory/MazeFactory.java index 0c28d0c1..9dd769fb 100644 --- a/src/main/java/bomb/modules/dh/hexamaze/hexalgorithm/factory/MazeFactory.java +++ b/src/main/java/bomb/modules/dh/hexamaze/hexalgorithm/factory/MazeFactory.java @@ -5,6 +5,7 @@ import bomb.modules.dh.hexamaze.hexalgorithm.storage.HexNode.HexWall; import com.opencsv.CSVReader; import com.opencsv.exceptions.CsvException; +import org.jetbrains.annotations.NotNull; import java.io.IOException; import java.io.InputStream; @@ -24,7 +25,7 @@ @SuppressWarnings("ConstantConditions") public class MazeFactory { - public static List createMaze() throws IOException, CsvException { + public static @NotNull List createMaze() throws IOException, CsvException { InputStream in = MazeFactory.class.getResourceAsStream("maze.csv"); CSVReader csvReader = new CSVReader(new InputStreamReader(in)); return csvReader.readAll().stream() diff --git a/src/main/java/bomb/modules/dh/hexamaze/hexalgorithm/maze_finding/MazeSearch.java b/src/main/java/bomb/modules/dh/hexamaze/hexalgorithm/maze_finding/MazeSearch.java index 9e64217c..5e52882c 100644 --- a/src/main/java/bomb/modules/dh/hexamaze/hexalgorithm/maze_finding/MazeSearch.java +++ b/src/main/java/bomb/modules/dh/hexamaze/hexalgorithm/maze_finding/MazeSearch.java @@ -7,6 +7,7 @@ import bomb.modules.dh.hexamaze.hexalgorithm.storage.Maze; import bomb.tools.data.structures.queue.BufferedQueue; import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; import java.util.Collection; import java.util.List; @@ -16,7 +17,7 @@ public class MazeSearch { public static final int ROTATION_COUNT = 6; - public static Grid search(@NotNull Maze maze, @NotNull Grid grid) { + public static @Nullable Grid search(@NotNull Maze maze, @NotNull Grid grid) { int gridSpan = grid.getHexagon().getSpan(); int lastIndex = maze.getHexagon().getSpan() - gridSpan; BufferedQueue> pillar; diff --git a/src/main/java/bomb/modules/dh/hexamaze/hexalgorithm/pathfinding/ExitChecker.java b/src/main/java/bomb/modules/dh/hexamaze/hexalgorithm/pathfinding/ExitChecker.java index e1f791fe..7c4704cd 100644 --- a/src/main/java/bomb/modules/dh/hexamaze/hexalgorithm/pathfinding/ExitChecker.java +++ b/src/main/java/bomb/modules/dh/hexamaze/hexalgorithm/pathfinding/ExitChecker.java @@ -26,7 +26,6 @@ import static bomb.modules.dh.hexamaze.hexalgorithm.storage.HexNode.HexWall.TOP_LEFT; import static bomb.modules.dh.hexamaze.hexalgorithm.storage.HexNode.HexWall.TOP_RIGHT; import static bomb.modules.dh.hexamaze.hexalgorithm.storage.HexagonalPlane.CALCULATE_SPAN; -import static java.util.stream.Collectors.toList; public class ExitChecker { public static @Nullable Pair> findPossibleExits(@NotNull Grid grid) @@ -65,7 +64,7 @@ private static Pair> getPossibleExits(Grid grid, int s private static List getTopLeftSideExits() { return IntStream.range(0, GRID_SIDE_LENGTH) .mapToObj(i -> new Coordinates(i, 0)) - .collect(toList()); + .toList(); } private static List getTopRightSideExits() { @@ -73,7 +72,7 @@ private static List getTopRightSideExits() { return IntStream.range(GRID_SIDE_LENGTH - 1, gripSpan) .mapToObj(index -> new Coordinates(index, 0)) - .collect(toList()); + .toList(); } private static List getRightSideExits() { @@ -83,7 +82,7 @@ private static List getRightSideExits() { return IntStream.range(0, finalColumnCapacity) .mapToObj(i -> new Coordinates(lastIndex, i)) - .collect(toList()); + .toList(); } private static List getBottomRightSideExits() { @@ -130,7 +129,7 @@ private static List filterBlockedExits(Grid grid, List HexNode node = grid.getAtCoordinates(coordinates); return isAtLeastOneWallClear(node, wallsToFind); }) - .collect(toList()); + .toList(); } private static boolean isAtLeastOneWallClear(HexNode node, EnumSet wallsToFind) { diff --git a/src/main/java/bomb/modules/dh/hexamaze/hexalgorithm/pathfinding/MazeRunner.java b/src/main/java/bomb/modules/dh/hexamaze/hexalgorithm/pathfinding/MazeRunner.java index 721edf17..cadc9a2f 100644 --- a/src/main/java/bomb/modules/dh/hexamaze/hexalgorithm/pathfinding/MazeRunner.java +++ b/src/main/java/bomb/modules/dh/hexamaze/hexalgorithm/pathfinding/MazeRunner.java @@ -29,7 +29,7 @@ public class MazeRunner { LEFT_SIDE_MOVE_DOWN_RIGHT = new Coordinates(1, 1), RIGHT_SIDE_MOVE_TOP_RIGHT = new Coordinates(1, -1); - public static List runMaze(@NotNull Grid grid, @NotNull List possibleExits) + public static @NotNull List runMaze(@NotNull Grid grid, @NotNull List possibleExits) throws IllegalArgumentException { Coordinates startingLocation = findStartingLocation(grid); Graph mappedGraph = convertGridToGraph(grid); diff --git a/src/main/java/bomb/modules/dh/hexamaze/hexalgorithm/storage/HexagonalPlane.java b/src/main/java/bomb/modules/dh/hexamaze/hexalgorithm/storage/HexagonalPlane.java index cf2c6a28..c79ef38e 100644 --- a/src/main/java/bomb/modules/dh/hexamaze/hexalgorithm/storage/HexagonalPlane.java +++ b/src/main/java/bomb/modules/dh/hexamaze/hexalgorithm/storage/HexagonalPlane.java @@ -11,7 +11,6 @@ import static bomb.modules.dh.hexamaze.hexalgorithm.storage.AbstractHexagon.calculateColumnLengthArray; import static bomb.tools.number.MathUtils.isAnInteger; import static java.util.Arrays.stream; -import static java.util.stream.Collectors.toList; public class HexagonalPlane implements Iterable>, Rotatable { public static final IntUnaryOperator CALCULATE_SPAN = length -> 2 * length - 1, @@ -87,7 +86,7 @@ private void addRightHalf(BufferedQueue> output, int colu public List asList() { return hexagon.stream() .flatMap(BufferedQueue::stream) - .collect(toList()); + .toList(); } public HexNode findAtCoordinate(@NotNull Coordinates coordinates) { diff --git a/src/main/java/bomb/modules/m/morsematics/Morsematics.java b/src/main/java/bomb/modules/m/morsematics/Morsematics.java index ad60027f..b895d1db 100644 --- a/src/main/java/bomb/modules/m/morsematics/Morsematics.java +++ b/src/main/java/bomb/modules/m/morsematics/Morsematics.java @@ -18,7 +18,6 @@ import static bomb.Widget.IndicatorFilter.LIT; import static bomb.Widget.IndicatorFilter.UNLIT; import static bomb.tools.number.MathUtils.isPerfectSquare; -import static java.util.stream.Collectors.toList; public class Morsematics extends Widget { public static String solve(LinkedHashSet inputSet) throws IllegalArgumentException { @@ -27,7 +26,7 @@ public static String solve(LinkedHashSet inputSet) throws IllegalArgumen List inputLetter = validate(inputSet, morseGraph); List letterList = IntStream.rangeClosed('A', 'Z') .mapToObj(number -> String.valueOf((char) number)) - .collect(toList()); + .toList(); Pair, ArrayRing> rotatingLetters = createStartingLetters(letterList); findFinalLetter(rotatingLetters, inputLetter); @@ -56,7 +55,7 @@ private static List validate(Set inputSet, ListGraph gra input.toUpperCase() ) .distinct() - .collect(toList()); + .toList(); if (inputLetters.size() != 3) throw new IllegalArgumentException( "Repeated value detected in both morse code and the letter form" diff --git a/src/main/java/bomb/modules/m/murder/LocationMapFactory.java b/src/main/java/bomb/modules/m/murder/LocationMapFactory.java index ac46cd8d..f720bbb9 100644 --- a/src/main/java/bomb/modules/m/murder/LocationMapFactory.java +++ b/src/main/java/bomb/modules/m/murder/LocationMapFactory.java @@ -11,8 +11,6 @@ import java.util.EnumMap; import java.util.List; -import static java.util.stream.Collectors.toList; - @SuppressWarnings("ConstantConditions") public class LocationMapFactory { private static final String FILENAME = "location_list.csv"; @@ -46,8 +44,8 @@ private static List> createLocationLists() throws IOException, Cs .map(Arrays::stream) .map(stream -> stream .map(Location::valueOf) - .collect(toList()) + .toList() ) - .collect(toList()); + .toList(); } } diff --git a/src/main/java/bomb/modules/m/murder/Murder.java b/src/main/java/bomb/modules/m/murder/Murder.java index f83e3a4f..0352221f 100644 --- a/src/main/java/bomb/modules/m/murder/Murder.java +++ b/src/main/java/bomb/modules/m/murder/Murder.java @@ -29,7 +29,7 @@ import static java.util.stream.Collectors.toMap; public class Murder extends Widget { - public static String solve(Location bodyFoundRoom, @NotNull EnumSet possibleWeapons, + public static String solve(@NotNull Location bodyFoundRoom, @NotNull EnumSet possibleWeapons, @NotNull EnumSet possibleSuspects) throws IllegalArgumentException { validateInput(possibleWeapons, possibleSuspects, bodyFoundRoom); diff --git a/src/main/java/bomb/modules/np/neutralization/Neutralization.java b/src/main/java/bomb/modules/np/neutralization/Neutralization.java index 06d6bdc9..b500a1eb 100644 --- a/src/main/java/bomb/modules/np/neutralization/Neutralization.java +++ b/src/main/java/bomb/modules/np/neutralization/Neutralization.java @@ -10,7 +10,6 @@ import java.util.Arrays; import java.util.Set; -import java.util.stream.Collectors; import static bomb.Widget.IndicatorFilter.ALL_PRESENT; import static bomb.enumerations.Indicator.CAR; @@ -27,6 +26,7 @@ import static bomb.modules.np.neutralization.Chemical.Base.SODIUM_HYDROXIDE; import static bomb.tools.filter.RegexFilter.EMPTY_FILTER_RESULTS; import static bomb.tools.filter.RegexFilter.VOWEL_FILTER; +import static java.util.stream.Collectors.toSet; import static javafx.scene.paint.Color.BLUE; import static javafx.scene.paint.Color.GREEN; import static javafx.scene.paint.Color.RED; @@ -104,7 +104,7 @@ private static boolean doesIndicatorLetterMatch() { .map(String::toLowerCase) .map(name -> name.split("")) .flatMap(Arrays::stream) - .collect(Collectors.toSet()); + .collect(toSet()); @Language("regexp") String regex = uniqueCharacterSet.toString().replaceAll(", ", ""); diff --git a/src/main/java/bomb/modules/s/souvenir/Souvenir.java b/src/main/java/bomb/modules/s/souvenir/Souvenir.java index fca446b8..58a3daa1 100644 --- a/src/main/java/bomb/modules/s/souvenir/Souvenir.java +++ b/src/main/java/bomb/modules/s/souvenir/Souvenir.java @@ -7,8 +7,6 @@ import java.util.List; import java.util.Map; -import static java.util.stream.Collectors.toList; - public class Souvenir extends Widget { private static final Map MODULE_ARTIFACTS; @@ -24,7 +22,7 @@ public static List> getPuzzleArtifacts() { return MODULE_ARTIFACTS.entrySet() .stream() .map(entry -> new Pair<>(entry.getKey(), entry.getValue())) - .collect(toList()); + .toList(); } public static void reset() { diff --git a/src/main/java/bomb/tools/filter/Regex.java b/src/main/java/bomb/tools/filter/Regex.java index 71a49bd0..d44f244a 100644 --- a/src/main/java/bomb/tools/filter/Regex.java +++ b/src/main/java/bomb/tools/filter/Regex.java @@ -14,7 +14,6 @@ import static java.util.regex.Pattern.CASE_INSENSITIVE; import static java.util.stream.Collectors.joining; -import static java.util.stream.Collectors.toList; @SuppressWarnings("MagicConstant") public class Regex implements Iterable { @@ -77,7 +76,7 @@ public List filterCollection(@NotNull Collection textCollections .map(textMatcher::reset) .map(RESULT_STREAM) .map(stream -> stream.collect(joining())) - .collect(toList()); + .toList(); } public boolean hasMatch() { @@ -102,7 +101,7 @@ public int groupCount() { public List findAllMatches() { return RESULT_STREAM.apply(textMatcher) - .collect(toList()); + .toList(); } public String getOriginalPattern() { diff --git a/src/test/java/bomb/modules/dh/fast_math/FastMathTest.java b/src/test/java/bomb/modules/dh/fast_math/FastMathTest.java index d753a8e2..0fc724ef 100644 --- a/src/test/java/bomb/modules/dh/fast_math/FastMathTest.java +++ b/src/test/java/bomb/modules/dh/fast_math/FastMathTest.java @@ -2,17 +2,17 @@ import bomb.ConditionSetter; import bomb.Widget; -import bomb.enumerations.Indicator; -import bomb.enumerations.TrinarySwitch; import org.testng.annotations.AfterClass; import org.testng.annotations.BeforeMethod; import org.testng.annotations.DataProvider; import org.testng.annotations.Test; import static bomb.ConditionSetter.EMPTY_SETTER; +import static bomb.enumerations.Indicator.MSA; import static bomb.enumerations.Port.PARALLEL; import static bomb.enumerations.Port.RJ45; import static bomb.enumerations.Port.SERIAL; +import static bomb.enumerations.TrinarySwitch.ON; import static org.testng.Assert.assertEquals; public class FastMathTest { @@ -29,7 +29,8 @@ public Object[][] exceptionTestProvider() { }; } - @Test(dataProvider = "exceptionTestProvider", expectedExceptions = IllegalArgumentException.class) + @Test(dataProvider = "exceptionTestProvider", + expectedExceptions = IllegalArgumentException.class) public void exceptionTest(ConditionSetter setter, String input) { setter.setCondition(); FastMath.solve(input); @@ -46,7 +47,7 @@ public Object[][] allPreconditionTestProvider() { public void allPreconditionTest(String expected, String input) { Widget.setPortValue(SERIAL, 1); Widget.setPortValue(RJ45, 1); - Widget.setIndicator(TrinarySwitch.ON, Indicator.MSA); + Widget.setIndicator(ON, MSA); Widget.setDBatteries(4); Widget.setSerialCode("fr4op2"); //In total, adds 41 to the count From bf918a197f9d405676fdb231d81c6f61fa0dabf1 Mon Sep 17 00:00:00 2001 From: "Mr. J" <45538844+Ultraviolet-Ninja@users.noreply.github.com> Date: Wed, 9 Feb 2022 08:49:06 -0600 Subject: [PATCH 16/86] Made static blocks in modules --- .../java/bomb/enumerations/TrinarySwitch.java | 13 +----- .../bomb/modules/ab/alphabet/Alphabet.java | 9 ++-- .../bomb/modules/ab/astrology/Astrology.java | 38 +++++++++-------- .../bomb/modules/ab/battleship/Ocean.java | 3 +- .../modules/ab/boolean_venn/BooleanVenn.java | 34 +++++++++------ .../c/cheap_checkout/CheapCheckout.java | 23 +++++++--- src/main/java/bomb/modules/c/chess/Chess.java | 12 ++++-- .../bomb/modules/c/chess/ChessController.java | 4 +- .../modules/c/chess/CoverageCalculator.java | 3 +- .../bomb/modules/c/chords/ChordQualities.java | 3 +- .../modules/c/color_flash/ColorFlash.java | 9 +++- .../c/colored_switches/ColoredSwitches.java | 42 ++++++++++--------- .../java/bomb/modules/dh/emoji/EmojiMath.java | 11 +++-- .../bomb/modules/dh/fast_math/FastMath.java | 28 +++++++++---- .../modules/dh/forget_me/ForgetMeNot.java | 16 ++++--- .../bomb/modules/dh/hexamaze/Hexamaze.java | 7 +++- .../bomb/modules/il/ice_cream/Allergen.java | 6 ++- .../bomb/modules/il/ice_cream/Person.java | 6 ++- .../java/bomb/modules/il/laundry/Laundry.java | 4 +- .../modules/il/laundry/LaundryController.java | 5 +-- .../np/neutralization/Neutralization.java | 14 +++++-- .../bomb/modules/r/round_keypads/Keypad.java | 6 ++- .../modules/r/round_keypads/RoundKeypads.java | 10 +++-- .../bomb/modules/s/shape_shift/ShapeEnd.java | 6 ++- .../modules/s/shape_shift/ShapeShift.java | 12 +++--- .../s/shape_shift/ShapeShiftController.java | 6 +-- .../s/simon/screams/ScreamsController.java | 5 +-- .../modules/s/simon/screams/SimonScreams.java | 38 ++++++++++------- .../modules/s/simon/states/SimonStates.java | 15 ++++--- .../bomb/modules/s/square/SquareButton.java | 15 +++++-- .../bomb/modules/s/switches/Switches.java | 9 ++-- .../java/bomb/modules/t/bulb/TheBulb.java | 10 ++++- .../t/translated/LanguageCSVReader.java | 3 +- .../java/bomb/modules/t/two_bit/TwoBit.java | 33 +++++++++------ .../modules/wz/word_search/WordSearch.java | 13 ++++-- 35 files changed, 288 insertions(+), 183 deletions(-) diff --git a/src/main/java/bomb/enumerations/TrinarySwitch.java b/src/main/java/bomb/enumerations/TrinarySwitch.java index cff6698e..8f0d9f88 100644 --- a/src/main/java/bomb/enumerations/TrinarySwitch.java +++ b/src/main/java/bomb/enumerations/TrinarySwitch.java @@ -6,16 +6,5 @@ * that are lit and unlit. */ public enum TrinarySwitch { - /** - * The off state - */ - OFF, - /** - * The on state - */ - ON, - /** - * The unknown state - */ - UNKNOWN + OFF, ON, UNKNOWN } diff --git a/src/main/java/bomb/modules/ab/alphabet/Alphabet.java b/src/main/java/bomb/modules/ab/alphabet/Alphabet.java index 28d3c67f..09a201b3 100644 --- a/src/main/java/bomb/modules/ab/alphabet/Alphabet.java +++ b/src/main/java/bomb/modules/ab/alphabet/Alphabet.java @@ -18,9 +18,12 @@ * But if no set matches the 4 tiles, the tiles are to be pressed in alphabetical order. */ public class Alphabet extends Widget { - private static final String[] WORD_BANK = {"JQXZ", "QEW", "AC", "ZNY", "TJL", - "OKBV", "DFW", "YKQ", "LXE", "GS", "VSI", "PQJS", "VCN", "JR", "IRNM", - "OP", "QYDX", "HDU", "PKD", "ARGF"}; + private static final String[] WORD_BANK; + + static { + WORD_BANK = new String[]{"JQXZ", "QEW", "AC", "ZNY", "TJL", "OKBV", "DFW", "YKQ", "LXE", "GS", + "VSI", "PQJS", "VCN", "JR", "IRNM", "OP", "QYDX", "HDU", "PKD", "ARGF"}; + } /** * Arranges the given letters into the order they need to be pressed diff --git a/src/main/java/bomb/modules/ab/astrology/Astrology.java b/src/main/java/bomb/modules/ab/astrology/Astrology.java index 268b503d..2d49e520 100644 --- a/src/main/java/bomb/modules/ab/astrology/Astrology.java +++ b/src/main/java/bomb/modules/ab/astrology/Astrology.java @@ -26,23 +26,7 @@ public class Astrology extends Widget { public static final byte ELEMENT_INDEX = 0, CELESTIAL_INDEX = 1, ZODIAC_INDEX = 2, EXPECTED_SIZE = 3; public static final String GOOD_OMEN = "Good Omen at ", POOR_OMEN = "Poor Omen at ", NO_OMEN = "No Omen"; - private static final byte[][] ELEMENT_CELESTIAL_GRID = { - {0, 0, 1, -1, 0, 1, -2, 2, 0, -1}, {-2, 0, -1, 0, 2, 0, -2, 2, 0, 1}, - {-1, -1, 0, -1, 1, 2, 0, 2, 1, -2}, {-1, 2, -1, 0, -2, -1, 0, 2, -2, 2} - }, - - ELEMENT_ZODIAC_GRID = { - {1, 0, -1, 0, 0, 2, 2, 0, 1, 0, 1, 0}, {2, 2, -1, 2, -1, -1, -2, 1, 2, 0, 0, 2}, - {-2, -1, 0, 0, 1, 0, 1, 2, -1, -2, 1, 1}, {1, 1, -2, -2, 2, 0, -1, 1, 0, 0, -1, -1} - }, - - CELESTIAL_ZODIAC_GRID = { - {-1, -1, 2, 0, -1, 0, -1, 1, 0, 0, -2, -2}, {-2, 0, 1, 0, 2, 0, -1, 1, 2, 0, 1, 0}, - {-2, -2, -1, -1, 1, -1, 0, -2, 0, 0, -1, 1}, {-2, 2, -2, 0, 0, 1, -1, 0, 2, -2, -1, 1}, - {-2, 0, -1, -2, -2, -2, -1, 1, 1, 1, 0, -1}, {-1, -2, 1, -1, 0, 0, 0, 1, 0, -1, 2, 0}, - {-1, -1, 0, 0, 1, 1, 0, 0, 0, 0, -1, -1}, {-1, 2, 0, 0, 1, -2, 1, 0, 2, -1, 1, 0}, - {1, 0, 2, 1, -1, 1, 1, 1, 0, -2, 2, 0}, {-1, 0, 0, -1, -2, 1, 2, 1, 1, 0, 0, -1} - }; + private static final byte[][] ELEMENT_CELESTIAL_GRID, ELEMENT_ZODIAC_GRID, CELESTIAL_ZODIAC_GRID; /** * Calculates the phrase composed of the Omen to press and when to press it @@ -115,4 +99,24 @@ else if (celestialSet.contains(symbol)) if (zodiacCount != celestialCount && zodiacCount != elementalCount) throw new IllegalArgumentException("There are too many of one type of Astrology Symbol"); } + + static { + ELEMENT_CELESTIAL_GRID = new byte[][]{ + {0, 0, 1, -1, 0, 1, -2, 2, 0, -1}, {-2, 0, -1, 0, 2, 0, -2, 2, 0, 1}, + {-1, -1, 0, -1, 1, 2, 0, 2, 1, -2}, {-1, 2, -1, 0, -2, -1, 0, 2, -2, 2} + }; + + ELEMENT_ZODIAC_GRID = new byte[][]{ + {1, 0, -1, 0, 0, 2, 2, 0, 1, 0, 1, 0}, {2, 2, -1, 2, -1, -1, -2, 1, 2, 0, 0, 2}, + {-2, -1, 0, 0, 1, 0, 1, 2, -1, -2, 1, 1}, {1, 1, -2, -2, 2, 0, -1, 1, 0, 0, -1, -1} + }; + + CELESTIAL_ZODIAC_GRID = new byte[][]{ + {-1, -1, 2, 0, -1, 0, -1, 1, 0, 0, -2, -2}, {-2, 0, 1, 0, 2, 0, -1, 1, 2, 0, 1, 0}, + {-2, -2, -1, -1, 1, -1, 0, -2, 0, 0, -1, 1}, {-2, 2, -2, 0, 0, 1, -1, 0, 2, -2, -1, 1}, + {-2, 0, -1, -2, -2, -2, -1, 1, 1, 1, 0, -1}, {-1, -2, 1, -1, 0, 0, 0, 1, 0, -1, 2, 0}, + {-1, -1, 0, 0, 1, 1, 0, 0, 0, 0, -1, -1}, {-1, 2, 0, 0, 1, -2, 1, 0, 2, -1, 1, 0}, + {1, 0, 2, 1, -1, 1, 1, 1, 0, -2, 2, 0}, {-1, 0, 0, -1, -2, 1, 2, 1, 1, 0, 0, -1} + }; + } } diff --git a/src/main/java/bomb/modules/ab/battleship/Ocean.java b/src/main/java/bomb/modules/ab/battleship/Ocean.java index 5392bb82..e5e7454e 100644 --- a/src/main/java/bomb/modules/ab/battleship/Ocean.java +++ b/src/main/java/bomb/modules/ab/battleship/Ocean.java @@ -5,7 +5,6 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.List; -import java.util.stream.Collectors; import static bomb.modules.ab.battleship.Tile.UNKNOWN; import static java.util.Arrays.stream; @@ -110,7 +109,7 @@ public boolean equals(Object o) { private List createBoardList(Tile[][] board) { return stream(board) .flatMap(Arrays::stream) - .collect(Collectors.toList()); + .toList(); } @Override diff --git a/src/main/java/bomb/modules/ab/boolean_venn/BooleanVenn.java b/src/main/java/bomb/modules/ab/boolean_venn/BooleanVenn.java index 6c84b50a..a4c70ff7 100644 --- a/src/main/java/bomb/modules/ab/boolean_venn/BooleanVenn.java +++ b/src/main/java/bomb/modules/ab/boolean_venn/BooleanVenn.java @@ -3,6 +3,7 @@ import bomb.Widget; import bomb.tools.filter.Regex; import bomb.tools.logic.LogicOperator; +import org.intellij.lang.annotations.Language; import org.jetbrains.annotations.NotNull; import static bomb.tools.filter.RegexFilter.LOGIC_REGEX; @@ -23,19 +24,26 @@ * to determine the state of each section of the triple venn diagram, green being true and red for false. */ public class BooleanVenn extends Widget { - private static final boolean[][] TEST_CASES = { - {false, false, false}, - {false, false, true}, - {false, true, false}, - {true, false, false}, - {false, true, true}, - {true, false, true}, - {true, true, false}, - {true, true, true}}; + private static final boolean[][] TEST_CASES; private static final byte A = 0, B = 1, C = 2; - private static final Regex AB_PRIORITY = new Regex("\\(A" + LOGIC_REGEX + "B\\)" + LOGIC_REGEX + "C"), - BC_PRIORITY = new Regex("A" + LOGIC_REGEX + "\\(B" + LOGIC_REGEX + "C\\)"); + @Language("regexp") + private static final String AB_PRIORITY_PATTERN, BC_PRIORITY_PATTERN; + + static { + AB_PRIORITY_PATTERN = "\\(A" + LOGIC_REGEX + "B\\)" + LOGIC_REGEX + "C"; + BC_PRIORITY_PATTERN = "A" + LOGIC_REGEX + "\\(B" + LOGIC_REGEX + "C\\)"; + + TEST_CASES = new boolean[][]{ + {false, false, false}, + {false, false, true}, + {false, true, false}, + {true, false, false}, + {false, true, true}, + {true, false, true}, + {true, true, false}, + {true, true, true}}; + } /** * Turns the String operation into a String code for the Venn Diagram to decode by choosing @@ -63,8 +71,8 @@ public static String resultCode(@NotNull String operation) throws IllegalArgumen * @throws IllegalArgumentException Format mismatch for the input equation */ private static boolean checkFormat(String equation) throws IllegalArgumentException { - String abPriority = filter(equation, AB_PRIORITY); - String bcPriority = filter(equation, BC_PRIORITY); + String abPriority = filter(equation, new Regex(AB_PRIORITY_PATTERN)); + String bcPriority = filter(equation, new Regex(BC_PRIORITY_PATTERN)); if (XNOR.test(abPriority.isEmpty(), bcPriority.isEmpty())) throw new IllegalArgumentException("Format mismatch!!"); diff --git a/src/main/java/bomb/modules/c/cheap_checkout/CheapCheckout.java b/src/main/java/bomb/modules/c/cheap_checkout/CheapCheckout.java index 8b2ad234..152a0d42 100644 --- a/src/main/java/bomb/modules/c/cheap_checkout/CheapCheckout.java +++ b/src/main/java/bomb/modules/c/cheap_checkout/CheapCheckout.java @@ -13,12 +13,23 @@ import static bomb.tools.number.MathUtils.roundToNPlaces; public class CheapCheckout extends Widget { - private static final double SUNDAY_ADDITION = 2.15, THURSDAY_SALE = 0.5, - FRIDAY_MARK_UP = 1.25, SATURDAY_SALE = 0.65; - private static final int REQUIRED_ITEM_COUNT = 6, REQUIRED_WEIGHT_COUNT = 2; - private static final ToDoubleFunction> TO_SUM = items -> items.stream() - .mapToDouble(CheckoutItem::getCurrentPiece) - .sum(); + private static final double SUNDAY_ADDITION, THURSDAY_SALE, FRIDAY_MARK_UP, SATURDAY_SALE; + private static final int REQUIRED_ITEM_COUNT, REQUIRED_WEIGHT_COUNT; + private static final ToDoubleFunction> TO_SUM; + + static { + SUNDAY_ADDITION = 2.15; + THURSDAY_SALE = 0.5; + FRIDAY_MARK_UP = 1.25; + SATURDAY_SALE = 0.65; + + REQUIRED_ITEM_COUNT = 6; + REQUIRED_WEIGHT_COUNT = 2; + + TO_SUM = items -> items.stream() + .mapToDouble(CheckoutItem::getCurrentPiece) + .sum(); + } public static String calculateTotalPrice(@NotNull List items, @NotNull DayOfWeek dayOfWeek, double[] perPoundWeights, double givenCash) throws IllegalArgumentException { diff --git a/src/main/java/bomb/modules/c/chess/Chess.java b/src/main/java/bomb/modules/c/chess/Chess.java index 6549a605..ac184a48 100644 --- a/src/main/java/bomb/modules/c/chess/Chess.java +++ b/src/main/java/bomb/modules/c/chess/Chess.java @@ -8,7 +8,6 @@ import java.util.ArrayList; import java.util.List; import java.util.Set; -import java.util.stream.Collectors; import static bomb.modules.c.chess.ChessBoard.BOARD_LENGTH; import static bomb.modules.c.chess.ChessPiece.BISHOP; @@ -18,12 +17,17 @@ import static bomb.modules.c.chess.ChessPiece.ROOK; import static bomb.modules.c.chess.Tile.TileColor.WHITE; import static java.util.Arrays.asList; +import static java.util.stream.Collectors.toUnmodifiableSet; public class Chess extends Widget { - public static final String VALIDITY_REGEX = "[A-Fa-f]-?[1-6]"; + public static final String VALIDITY_PATTERN; private static final char INT_CONVERSION_LETTER = 'A'; + static { + VALIDITY_PATTERN = "[A-Fa-f]-?[1-6]"; + } + public static String solve(@NotNull List inputCoordinateList) throws IllegalArgumentException, IllegalStateException { checkSerialCode(); @@ -127,7 +131,7 @@ private static void validateList(List inputCoordinateList) throws Illega throw new IllegalArgumentException("Every space must be filled with a move"); for (String chessCoordinate : inputCoordinateList) { - if (!chessCoordinate.matches(VALIDITY_REGEX)) + if (!chessCoordinate.matches(VALIDITY_PATTERN)) throw new IllegalArgumentException("Coordinate doesn't match the specified format"); } } @@ -135,7 +139,7 @@ private static void validateList(List inputCoordinateList) throws Illega private static void checkUniqueness(List inputCoordinateList) { Set uniqueCoordinateChecker = inputCoordinateList.stream() .map(chessCoordinate -> chessCoordinate.toUpperCase().replace("-", "")) - .collect(Collectors.toSet()); + .collect(toUnmodifiableSet()); if (uniqueCoordinateChecker.size() != BOARD_LENGTH) throw new IllegalArgumentException("Not all positions were unique. Please remove duplicates"); } diff --git a/src/main/java/bomb/modules/c/chess/ChessController.java b/src/main/java/bomb/modules/c/chess/ChessController.java index ebffafa4..7cefb904 100644 --- a/src/main/java/bomb/modules/c/chess/ChessController.java +++ b/src/main/java/bomb/modules/c/chess/ChessController.java @@ -60,7 +60,7 @@ private EventHandler createButtonAction() { private EventHandler createTextFieldEvent() { return event -> { String positionInput = positionTextField.getText(); - String inputToSet = positionInput.matches(Chess.VALIDITY_REGEX) ? positionInput : ""; + String inputToSet = positionInput.matches(Chess.VALIDITY_PATTERN) ? positionInput : ""; positionList.set(previousPosition, inputToSet); submitButton.setDisable(areAnyPositionsInvalid()); @@ -69,7 +69,7 @@ private EventHandler createTextFieldEvent() { private boolean areAnyPositionsInvalid() { return positionList.stream() - .anyMatch(position -> position == null || !position.matches(Chess.VALIDITY_REGEX)); + .anyMatch(position -> position == null || !position.matches(Chess.VALIDITY_PATTERN)); } @FXML diff --git a/src/main/java/bomb/modules/c/chess/CoverageCalculator.java b/src/main/java/bomb/modules/c/chess/CoverageCalculator.java index e7e0371b..8f492062 100644 --- a/src/main/java/bomb/modules/c/chess/CoverageCalculator.java +++ b/src/main/java/bomb/modules/c/chess/CoverageCalculator.java @@ -9,7 +9,6 @@ import java.util.NavigableSet; import java.util.Set; import java.util.TreeSet; -import java.util.stream.Collectors; import static bomb.modules.c.chess.ChessBoard.BOARD_LENGTH; import static bomb.modules.c.chess.ChessPiece.BISHOP; @@ -165,7 +164,7 @@ private static List filterOutOfBoundsMoves(Collection return moveList.stream() .filter(coordinates -> coordinates.x() >= 0 && coordinates.x() < BOARD_LENGTH) .filter(coordinates -> coordinates.y() >= 0 && coordinates.y() < BOARD_LENGTH) - .collect(Collectors.toList()); + .toList(); } private static Collection removeBlockedMoves(ChessBoard board, Collection coordinatesList, boolean isAscending) { diff --git a/src/main/java/bomb/modules/c/chords/ChordQualities.java b/src/main/java/bomb/modules/c/chords/ChordQualities.java index ed9f93da..9830db5e 100644 --- a/src/main/java/bomb/modules/c/chords/ChordQualities.java +++ b/src/main/java/bomb/modules/c/chords/ChordQualities.java @@ -9,11 +9,12 @@ import java.util.TreeSet; public class ChordQualities extends Widget { - public static final String NEW_CHORD = "New Chord: "; + public static final String NEW_CHORD; private static final ArrayRing ALL_NOTES; static { + NEW_CHORD = "New Chord: "; ALL_NOTES = new ArrayRing<>("A", "A#", "B", "C", "C#", "D", "D#", "E", "F", "F#", "G", "G#"); } diff --git a/src/main/java/bomb/modules/c/color_flash/ColorFlash.java b/src/main/java/bomb/modules/c/color_flash/ColorFlash.java index 9e366874..443e6b77 100644 --- a/src/main/java/bomb/modules/c/color_flash/ColorFlash.java +++ b/src/main/java/bomb/modules/c/color_flash/ColorFlash.java @@ -15,9 +15,14 @@ import static bomb.tools.string.StringFormat.YES; public class ColorFlash extends Widget { - private static final int COMBO_LIMIT = 8; + private static final int COMBO_LIMIT; - private static final String RESULT_IS_COLOR_OR_WORD = "is either the word or color"; + private static final String RESULT_IS_COLOR_OR_WORD; + + static { + COMBO_LIMIT = 8; + RESULT_IS_COLOR_OR_WORD = "is either the word or color"; + } public static String decipher(@NotNull ColorFlashColor[] words, @NotNull ColorFlashColor[] colors) throws IllegalArgumentException { diff --git a/src/main/java/bomb/modules/c/colored_switches/ColoredSwitches.java b/src/main/java/bomb/modules/c/colored_switches/ColoredSwitches.java index ee8ce814..5200ddad 100644 --- a/src/main/java/bomb/modules/c/colored_switches/ColoredSwitches.java +++ b/src/main/java/bomb/modules/c/colored_switches/ColoredSwitches.java @@ -16,30 +16,14 @@ import static bomb.modules.c.colored_switches.SwitchColor.NEUTRAL; public class ColoredSwitches extends Switches { - private static final double WRONG_PATH_VALUE = Double.MAX_VALUE; + private static final double WRONG_PATH_VALUE; private static final Graph INTERNAL_GRAPH; - private static final BiFunction> - HEURISTIC_FUNCTION = (startingColors, desiredState) -> - ((sourceVertex, targetVertex) -> { - //Weight from source to target - double gX = Math.abs(sourceVertex.getState() - targetVertex.getState()); - //Weight from target to desired state - double hX = Math.abs(desiredState - targetVertex.getState()); - - Pair edgeData = sourceVertex.getEdgeData(targetVertex.getState()); - if (edgeData == null) - return WRONG_PATH_VALUE; - SwitchColor switchToFlip = startingColors[edgeData.getValue1()]; - - if (!canFollowPath(edgeData.getValue0(), switchToFlip)) - return WRONG_PATH_VALUE; - - return gX + hX; - }); + private static final BiFunction> HEURISTIC_FUNCTION; private static byte secondaryStartLocation = -1; static { + WRONG_PATH_VALUE = Double.MAX_VALUE; try { INTERNAL_GRAPH = ColoredSwitchGraphFactory.makeGraph(); } catch (IOException e) { @@ -149,4 +133,24 @@ public static boolean isFirstStepDone() { public static void reset() { secondaryStartLocation = -1; } + + static { + HEURISTIC_FUNCTION = (startingColors, desiredState) -> + ((sourceVertex, targetVertex) -> { + //Weight from source to target + double gX = Math.abs(sourceVertex.getState() - targetVertex.getState()); + //Weight from target to desired state + double hX = Math.abs(desiredState - targetVertex.getState()); + + Pair edgeData = sourceVertex.getEdgeData(targetVertex.getState()); + if (edgeData == null) + return WRONG_PATH_VALUE; + SwitchColor switchToFlip = startingColors[edgeData.getValue1()]; + + if (!canFollowPath(edgeData.getValue0(), switchToFlip)) + return WRONG_PATH_VALUE; + + return gX + hX; + }); + } } diff --git a/src/main/java/bomb/modules/dh/emoji/EmojiMath.java b/src/main/java/bomb/modules/dh/emoji/EmojiMath.java index 1fd880aa..ce817439 100644 --- a/src/main/java/bomb/modules/dh/emoji/EmojiMath.java +++ b/src/main/java/bomb/modules/dh/emoji/EmojiMath.java @@ -13,12 +13,11 @@ */ public class EmojiMath extends Widget { @Language("regexp") - private static final String EMOJI_PATTERN; - private static final Regex VALIDATION; + private static final String EMOJI_PATTERN, VALIDATION_PATTERN; static { EMOJI_PATTERN = "(?:[=:][|()]|[|()][=:]){1,2}"; - VALIDATION = new Regex("^" + EMOJI_PATTERN + "([+\\-])" + EMOJI_PATTERN + "$"); + VALIDATION_PATTERN = "^" + EMOJI_PATTERN + "([+\\-])" + EMOJI_PATTERN + "$"; } /** @@ -28,10 +27,10 @@ public class EmojiMath extends Widget { * @return The values gathered from the emoji equation */ public static int calculate(@NotNull String input) throws IllegalArgumentException { - VALIDATION.loadText(input); - if (!VALIDATION.matchesRegex()) throw new IllegalArgumentException(input + " does not match pattern"); + Regex validationRegex = new Regex(VALIDATION_PATTERN, input); + if (!validationRegex.matchesRegex()) throw new IllegalArgumentException(input + " does not match pattern"); - boolean toAdd = VALIDATION.captureGroup(1).equals("+"); + boolean toAdd = validationRegex.captureGroup(1).equals("+"); int[] results = convertEmojis(input.split(toAdd ? "\\+" : "-")); return toAdd ? diff --git a/src/main/java/bomb/modules/dh/fast_math/FastMath.java b/src/main/java/bomb/modules/dh/fast_math/FastMath.java index 62b90e93..c917b579 100644 --- a/src/main/java/bomb/modules/dh/fast_math/FastMath.java +++ b/src/main/java/bomb/modules/dh/fast_math/FastMath.java @@ -10,15 +10,7 @@ import static bomb.tools.filter.RegexFilter.EMPTY_FILTER_RESULTS; public class FastMath extends Widget { - private static final int[][] INTERNAL_GRID = new int[][]{ - {25, 11, 53, 97, 2, 42, 51, 97, 12, 86, 55, 73, 33}, {54, 7, 32, 19, 84, 33, 27, 78, 26, 46, 9, 13, 58}, - {86, 37, 44, 1, 5, 26, 93, 49, 18, 69, 23, 40, 22}, {54, 28, 77, 93, 11, 0, 35, 61, 27, 48, 13, 72, 80}, - {99, 36, 23, 95, 67, 5, 26, 17, 44, 60, 26, 41, 67}, {74, 95, 3, 4, 56, 23, 54, 29, 52, 38, 10, 76, 98}, - {88, 46, 37, 96, 2, 52, 81, 37, 12, 70, 14, 36, 78}, {54, 43, 12, 65, 94, 3, 47, 23, 16, 62, 73, 46, 21}, - {7, 33, 26, 1, 67, 26, 27, 77, 83, 14, 27, 93, 9}, {63, 64, 94, 27, 48, 84, 33, 10, 16, 74, 43, 99, 4}, - {35, 39, 3, 25, 47, 62, 38, 45, 88, 48, 34, 31, 27}, {67, 30, 27, 71, 9, 11, 44, 37, 18, 40, 32, 15, 78}, - {13, 23, 26, 85, 92, 12, 73, 56, 81, 7, 75, 47, 99} - }; + private static final int[][] INTERNAL_GRID; public static @NotNull String solve(@NotNull String letters) throws IllegalArgumentException { checkSerialCode(); @@ -65,4 +57,22 @@ private static int postConditions(int num) { if (num < 0) return num + 50; return num; } + + static { + INTERNAL_GRID = new int[][]{ + {25, 11, 53, 97, 2, 42, 51, 97, 12, 86, 55, 73, 33}, + {54, 7, 32, 19, 84, 33, 27, 78, 26, 46, 9, 13, 58}, + {86, 37, 44, 1, 5, 26, 93, 49, 18, 69, 23, 40, 22}, + {54, 28, 77, 93, 11, 0, 35, 61, 27, 48, 13, 72, 80}, + {99, 36, 23, 95, 67, 5, 26, 17, 44, 60, 26, 41, 67}, + {74, 95, 3, 4, 56, 23, 54, 29, 52, 38, 10, 76, 98}, + {88, 46, 37, 96, 2, 52, 81, 37, 12, 70, 14, 36, 78}, + {54, 43, 12, 65, 94, 3, 47, 23, 16, 62, 73, 46, 21}, + {7, 33, 26, 1, 67, 26, 27, 77, 83, 14, 27, 93, 9}, + {63, 64, 94, 27, 48, 84, 33, 10, 16, 74, 43, 99, 4}, + {35, 39, 3, 25, 47, 62, 38, 45, 88, 48, 34, 31, 27}, + {67, 30, 27, 71, 9, 11, 44, 37, 18, 40, 32, 15, 78}, + {13, 23, 26, 85, 92, 12, 73, 56, 81, 7, 75, 47, 99} + }; + } } diff --git a/src/main/java/bomb/modules/dh/forget_me/ForgetMeNot.java b/src/main/java/bomb/modules/dh/forget_me/ForgetMeNot.java index df498bc0..1633ae47 100644 --- a/src/main/java/bomb/modules/dh/forget_me/ForgetMeNot.java +++ b/src/main/java/bomb/modules/dh/forget_me/ForgetMeNot.java @@ -15,12 +15,18 @@ import static bomb.enumerations.Port.SERIAL; public class ForgetMeNot extends Widget { - private static final IntUnaryOperator LEAST_SIG_DIGIT = num -> num % 10; - private static final IntUnaryOperator MOST_SIG_DIGIT = - num -> (int) (num / Math.pow(10, Math.floor(Math.log10(num)))); - private static final List FINAL_CODE = new ArrayList<>(100); + private static final IntUnaryOperator LEAST_SIG_DIGIT, MOST_SIG_DIGIT; + private static final List FINAL_CODE; - private static byte largestSerialCodeNumber = -1; + private static byte largestSerialCodeNumber; + + static { + LEAST_SIG_DIGIT = num -> num % 10; + MOST_SIG_DIGIT = num -> (int) (num / Math.pow(10, Math.floor(Math.log10(num)))); + FINAL_CODE = new ArrayList<>(100); + + largestSerialCodeNumber = -1; + } public static void add(int stageNumber) throws IllegalStateException { if (!isForgetMeNotActive) diff --git a/src/main/java/bomb/modules/dh/hexamaze/Hexamaze.java b/src/main/java/bomb/modules/dh/hexamaze/Hexamaze.java index 6477a521..2a31ef5c 100644 --- a/src/main/java/bomb/modules/dh/hexamaze/Hexamaze.java +++ b/src/main/java/bomb/modules/dh/hexamaze/Hexamaze.java @@ -27,10 +27,13 @@ import static javafx.scene.paint.Color.YELLOW; public class Hexamaze extends Widget { - public static final Map COLOR_MAP = new HashMap<>(); - public static final Color PEG_COLOR = new Color(0.65, 0.65, 0.65, 1.0); + public static final Map COLOR_MAP; + public static final Color PEG_COLOR; static { + PEG_COLOR = new Color(0.65, 0.65, 0.65, 1.0); + + COLOR_MAP = new HashMap<>(); COLOR_MAP.put(PEG_COLOR, -1); COLOR_MAP.put(RED, 0); COLOR_MAP.put(YELLOW, 1); diff --git a/src/main/java/bomb/modules/il/ice_cream/Allergen.java b/src/main/java/bomb/modules/il/ice_cream/Allergen.java index 6c653e1a..e84888ff 100644 --- a/src/main/java/bomb/modules/il/ice_cream/Allergen.java +++ b/src/main/java/bomb/modules/il/ice_cream/Allergen.java @@ -18,7 +18,11 @@ public boolean test(EnumSet allergens) { CHERRY, MARSHMALLOW; - private static final Allergen[] ALLERGENS = values(); + private static final Allergen[] ALLERGENS; + + static { + ALLERGENS = values(); + } @Override public boolean test(EnumSet allergens) { diff --git a/src/main/java/bomb/modules/il/ice_cream/Person.java b/src/main/java/bomb/modules/il/ice_cream/Person.java index ba6ae67d..20fbdf60 100644 --- a/src/main/java/bomb/modules/il/ice_cream/Person.java +++ b/src/main/java/bomb/modules/il/ice_cream/Person.java @@ -16,7 +16,11 @@ public enum Person { MIKE, TIM, TOM, DAVE, ADAM, CHERYL, SEAN, ASHLEY, JESSICA, TAYLOR, SIMON, SALLY, JADE, SAM, GARY, VICTOR, GEORGE, JACOB, PAT, BOB; - private static final String FILENAME = "allergyTable.csv"; + private static final String FILENAME; + + static { + FILENAME = "allergyTable.csv"; + } public static EnumMap> getPersonAllergens(int index) throws IllegalStateException { InputStream in = Person.class.getResourceAsStream(FILENAME); diff --git a/src/main/java/bomb/modules/il/laundry/Laundry.java b/src/main/java/bomb/modules/il/laundry/Laundry.java index 36ba6f1e..04a8874c 100644 --- a/src/main/java/bomb/modules/il/laundry/Laundry.java +++ b/src/main/java/bomb/modules/il/laundry/Laundry.java @@ -29,7 +29,7 @@ import static bomb.tools.filter.RegexFilter.CHAR_FILTER; import static bomb.tools.filter.RegexFilter.filter; import static java.util.Arrays.stream; -import static java.util.stream.Collectors.toSet; +import static java.util.stream.Collectors.toUnmodifiableSet; /** * This class deals with the Laundry module. The module requires a plethora of conditions that involve the @@ -235,7 +235,7 @@ private static boolean thanksBob() { private static boolean letterMatch() { Set clothingArticleLetters = stream(ARTICLE.getMaterial().name().split("")) .map(String::toLowerCase) - .collect(toSet()); + .collect(toUnmodifiableSet()); return Stream.of(filter(serialCode, CHAR_FILTER).split("")) .anyMatch(clothingArticleLetters::contains); diff --git a/src/main/java/bomb/modules/il/laundry/LaundryController.java b/src/main/java/bomb/modules/il/laundry/LaundryController.java index 21526b32..cce9aea0 100644 --- a/src/main/java/bomb/modules/il/laundry/LaundryController.java +++ b/src/main/java/bomb/modules/il/laundry/LaundryController.java @@ -11,10 +11,9 @@ import javafx.scene.image.Image; import javafx.scene.image.ImageView; -import java.util.stream.Collectors; - import static bomb.tools.string.StringFormat.FIRST_LETTER_CAPITAL; import static java.util.Arrays.stream; +import static java.util.stream.Collectors.joining; public class LaundryController implements Resettable { private static final String WASH_INSTRUCTIONS = "Wash Instructions: ", DRY_INSTRUCTIONS = "Dry Instructions: ", @@ -68,7 +67,7 @@ private static String reformatClothingOutput(String in) { final String delimiter = " - "; return stream(in.split(delimiter)) .map(FIRST_LETTER_CAPITAL) - .collect(Collectors.joining(delimiter)); + .collect(joining(delimiter)); } @Override diff --git a/src/main/java/bomb/modules/np/neutralization/Neutralization.java b/src/main/java/bomb/modules/np/neutralization/Neutralization.java index b500a1eb..b34bc7dc 100644 --- a/src/main/java/bomb/modules/np/neutralization/Neutralization.java +++ b/src/main/java/bomb/modules/np/neutralization/Neutralization.java @@ -26,7 +26,7 @@ import static bomb.modules.np.neutralization.Chemical.Base.SODIUM_HYDROXIDE; import static bomb.tools.filter.RegexFilter.EMPTY_FILTER_RESULTS; import static bomb.tools.filter.RegexFilter.VOWEL_FILTER; -import static java.util.stream.Collectors.toSet; +import static java.util.stream.Collectors.toUnmodifiableSet; import static javafx.scene.paint.Color.BLUE; import static javafx.scene.paint.Color.GREEN; import static javafx.scene.paint.Color.RED; @@ -38,13 +38,19 @@ * drop count and determine if the titration needs a filter or not. */ public class Neutralization extends Widget { - public static final String NO_FILTER_TEXT = "No Filter", FILTER_TEXT = "Filter"; + public static final String NO_FILTER_TEXT, FILTER_TEXT; - static final String OUTPUT_SEPARATOR = "-"; + static final String OUTPUT_SEPARATOR; private static Acid currentAcid; private static Base currentBase; + static { + OUTPUT_SEPARATOR = "-"; + NO_FILTER_TEXT = "No Filter"; + FILTER_TEXT = "Filter"; + } + /** * @param acidVol The volume of the acid. * There are no bound limitations, but the game only uses 5 <= x <= 20 @@ -104,7 +110,7 @@ private static boolean doesIndicatorLetterMatch() { .map(String::toLowerCase) .map(name -> name.split("")) .flatMap(Arrays::stream) - .collect(toSet()); + .collect(toUnmodifiableSet()); @Language("regexp") String regex = uniqueCharacterSet.toString().replaceAll(", ", ""); diff --git a/src/main/java/bomb/modules/r/round_keypads/Keypad.java b/src/main/java/bomb/modules/r/round_keypads/Keypad.java index 010b8b7c..480a2bf2 100644 --- a/src/main/java/bomb/modules/r/round_keypads/Keypad.java +++ b/src/main/java/bomb/modules/r/round_keypads/Keypad.java @@ -32,7 +32,11 @@ public enum Keypad implements Flaggable { PUZZLE, AE, PSI2, RUSSIAN_NH, OMEGA; - static final Keypad[] KEYPAD_ARRAY = values(); + static final Keypad[] KEYPAD_ARRAY; + + static { + KEYPAD_ARRAY = values(); + } private boolean flag; private Image memory = null; diff --git a/src/main/java/bomb/modules/r/round_keypads/RoundKeypads.java b/src/main/java/bomb/modules/r/round_keypads/RoundKeypads.java index 498be1bf..fc159365 100644 --- a/src/main/java/bomb/modules/r/round_keypads/RoundKeypads.java +++ b/src/main/java/bomb/modules/r/round_keypads/RoundKeypads.java @@ -16,9 +16,13 @@ import static java.util.stream.Collectors.groupingBy; public class RoundKeypads extends Widget { - private static final byte IMAGES_PER_COLUMN = 7; - private static final UnaryOperator HIGHLIGHT_COMMAND = previousColor -> - new Color(0, previousColor.getGreen(), previousColor.getBlue(), 1); + private static final int IMAGES_PER_COLUMN = 7; + private static final UnaryOperator HIGHLIGHT_COMMAND; + + static { + HIGHLIGHT_COMMAND = previousColor -> + new Color(0, previousColor.getGreen(), previousColor.getBlue(), 1); + } public static int determineBadColumn() { Map frequencyCounter = stream(KEYPAD_ARRAY) diff --git a/src/main/java/bomb/modules/s/shape_shift/ShapeEnd.java b/src/main/java/bomb/modules/s/shape_shift/ShapeEnd.java index 58534758..d794df5f 100644 --- a/src/main/java/bomb/modules/s/shape_shift/ShapeEnd.java +++ b/src/main/java/bomb/modules/s/shape_shift/ShapeEnd.java @@ -3,5 +3,9 @@ public enum ShapeEnd { ROUND, POINT, FLAT, TICKET; - static final ShapeEnd[] END_ARRAY = values(); + static final ShapeEnd[] SHAPE_END_ARRAY; + + static { + SHAPE_END_ARRAY = values(); + } } diff --git a/src/main/java/bomb/modules/s/shape_shift/ShapeShift.java b/src/main/java/bomb/modules/s/shape_shift/ShapeShift.java index 98904cb3..f22326c1 100644 --- a/src/main/java/bomb/modules/s/shape_shift/ShapeShift.java +++ b/src/main/java/bomb/modules/s/shape_shift/ShapeShift.java @@ -19,7 +19,7 @@ import static bomb.enumerations.Port.PS2; import static bomb.enumerations.Port.RCA; import static bomb.enumerations.Port.RJ45; -import static bomb.modules.s.shape_shift.ShapeEnd.END_ARRAY; +import static bomb.modules.s.shape_shift.ShapeEnd.SHAPE_END_ARRAY; import static bomb.tools.logic.BitConverter.TO_INT; public class ShapeShift extends Widget { @@ -29,15 +29,15 @@ public class ShapeShift extends Widget { // static { - int size = END_ARRAY.length; + int size = SHAPE_END_ARRAY.length; COUNT_TRACKER = new int[size][size]; zeroOutArray(); initializeGraph(); } private static void zeroOutArray() { - for (ShapeEnd leftSide : END_ARRAY) { - for (ShapeEnd rightSide : END_ARRAY) + for (ShapeEnd leftSide : SHAPE_END_ARRAY) { + for (ShapeEnd rightSide : SHAPE_END_ARRAY) COUNT_TRACKER[leftSide.ordinal()][rightSide.ordinal()] = 0; } } @@ -49,8 +49,8 @@ private static void initializeGraph() { private static List> createList() { List> list = new ArrayList<>(); - for (ShapeEnd left : END_ARRAY) { - for (ShapeEnd right : END_ARRAY) + for (ShapeEnd left : SHAPE_END_ARRAY) { + for (ShapeEnd right : SHAPE_END_ARRAY) list.add(new Pair<>(left, right)); } return list; diff --git a/src/main/java/bomb/modules/s/shape_shift/ShapeShiftController.java b/src/main/java/bomb/modules/s/shape_shift/ShapeShiftController.java index 53166867..d372538d 100644 --- a/src/main/java/bomb/modules/s/shape_shift/ShapeShiftController.java +++ b/src/main/java/bomb/modules/s/shape_shift/ShapeShiftController.java @@ -4,14 +4,14 @@ import bomb.tools.data.structures.ring.ArrayRing; import javafx.fxml.FXML; -import static bomb.modules.s.shape_shift.ShapeEnd.END_ARRAY; +import static bomb.modules.s.shape_shift.ShapeEnd.SHAPE_END_ARRAY; public class ShapeShiftController implements Resettable { private final ArrayRing leftSide, rightSide; public ShapeShiftController() { - leftSide = new ArrayRing<>(END_ARRAY); - rightSide = new ArrayRing<>(END_ARRAY); + leftSide = new ArrayRing<>(SHAPE_END_ARRAY); + rightSide = new ArrayRing<>(SHAPE_END_ARRAY); } public void initialize() { diff --git a/src/main/java/bomb/modules/s/simon/screams/ScreamsController.java b/src/main/java/bomb/modules/s/simon/screams/ScreamsController.java index 1ed4590b..f273135d 100644 --- a/src/main/java/bomb/modules/s/simon/screams/ScreamsController.java +++ b/src/main/java/bomb/modules/s/simon/screams/ScreamsController.java @@ -10,10 +10,9 @@ import javafx.scene.control.TextArea; import javafx.scene.control.ToggleButton; -import java.util.stream.Collectors; - import static bomb.tools.string.StringFormat.BULLET_POINT; import static java.util.Arrays.stream; +import static java.util.stream.Collectors.joining; public class ScreamsController implements Resettable { @FXML @@ -58,7 +57,7 @@ private void collectClicks() { String outputText = stream(output.split(",")) .map(sample -> BULLET_POINT + sample) - .collect(Collectors.joining("\n")); + .collect(joining("\n")); resultArea.setText(outputText); star.resetClicks(); diff --git a/src/main/java/bomb/modules/s/simon/screams/SimonScreams.java b/src/main/java/bomb/modules/s/simon/screams/SimonScreams.java index d8b67850..45004b0d 100644 --- a/src/main/java/bomb/modules/s/simon/screams/SimonScreams.java +++ b/src/main/java/bomb/modules/s/simon/screams/SimonScreams.java @@ -6,24 +6,13 @@ import java.util.ArrayList; import java.util.List; -import java.util.stream.Collectors; + +import static java.util.stream.Collectors.joining; public class SimonScreams extends Widget { - private static final int MAX_OUTPUT_RULES = 6; + private static final int MAX_OUTPUT_RULES; private static final List CURRENT_OUTPUT_NUMBERS; - private static final String[][] - // The output colors that depend on the edgework conditions and enum Letter - RESULTING_COLORS = {{"Yellow", "Orange", "Green", "Red", "Blue", "Purple"}, - {"Purple", "Yellow", "Red", "Blue", "Orange", "Green"}, - {"Orange", "Green", "Blue", "Purple", "Red", "Yellow"}, - {"Green", "Blue", "Orange", "Yellow", "Purple", "Red"}, - {"Red", "Purple", "Yellow", "Orange", "Green", "Blue"}, - {"Blue", "Red", "Purple", "Green", "Yellow", "Orange"}}, - - // The letter sets that determine the column of colors to use in resultingColors 2D array - CATEGORIES = {{"FFC", "CEH", "HAF", "ECD", "DDE", "AHA"}, {"AHF", "DFC", "ECH", "CDE", "FEA", "HAD"}, - {"DED", "ECF", "FHE", "HAA", "AFH", "CDC"}, {"HCE", "ADA", "CFD", "DHH", "EAC", "FEF"}, - {"CAH", "FHD", "DDA", "AEC", "HCF", "EFE"}, {"EDA", "HAE", "AEC", "FFF", "CHD", "DCH"}}; + private static final String[][] RESULTING_COLORS, CATEGORIES; private static boolean initialized; private static int stage; @@ -32,6 +21,7 @@ public class SimonScreams extends Widget { static { initialized = false; stage = 0; + MAX_OUTPUT_RULES = 6; CURRENT_OUTPUT_NUMBERS = new ArrayList<>(MAX_OUTPUT_RULES); } @@ -100,7 +90,7 @@ private static char extractCategory(ScreamColor stageColor, int correctRule) { private static String findColors(Letters current) { return CURRENT_OUTPUT_NUMBERS.stream() .map(index -> RESULTING_COLORS[index][current.ordinal()]) - .collect(Collectors.joining(",")); + .collect(joining(",")); } /** @@ -133,4 +123,20 @@ public static void reset() { private enum Letters { A, C, D, E, F, H } + + static { + // The output colors that depend on the edgework conditions and enum Letter + RESULTING_COLORS = new String[][]{{"Yellow", "Orange", "Green", "Red", "Blue", "Purple"}, + {"Purple", "Yellow", "Red", "Blue", "Orange", "Green"}, + {"Orange", "Green", "Blue", "Purple", "Red", "Yellow"}, + {"Green", "Blue", "Orange", "Yellow", "Purple", "Red"}, + {"Red", "Purple", "Yellow", "Orange", "Green", "Blue"}, + {"Blue", "Red", "Purple", "Green", "Yellow", "Orange"}}; + + // The letter sets that determine the column of colors to use in resultingColors 2D array + CATEGORIES = new String[][]{{"FFC", "CEH", "HAF", "ECD", "DDE", "AHA"}, + {"AHF", "DFC", "ECH", "CDE", "FEA", "HAD"}, {"DED", "ECF", "FHE", "HAA", "AFH", "CDC"}, + {"HCE", "ADA", "CFD", "DHH", "EAC", "FEF"}, {"CAH", "FHD", "DDA", "AEC", "HCF", "EFE"}, + {"EDA", "HAE", "AEC", "FFF", "CHD", "DCH"}}; + } } \ No newline at end of file diff --git a/src/main/java/bomb/modules/s/simon/states/SimonStates.java b/src/main/java/bomb/modules/s/simon/states/SimonStates.java index 4a0f0b38..80d384c8 100644 --- a/src/main/java/bomb/modules/s/simon/states/SimonStates.java +++ b/src/main/java/bomb/modules/s/simon/states/SimonStates.java @@ -28,12 +28,7 @@ public class SimonStates extends Widget { private static final String ERROR_MESSAGE = "The element does not exist"; private static final BiPredicate, StateColor> FLASHED, DID_NOT_FLASH; - private static final StateColor[][] PRIORITY_ORDERS = new StateColor[][]{ - {RED, BLUE, GREEN, YELLOW}, //Highest to Lowest - {BLUE, YELLOW, RED, GREEN}, - {GREEN, RED, YELLOW, BLUE}, - {YELLOW, GREEN, BLUE, RED} - }; + private static final StateColor[][] PRIORITY_ORDERS; private static int dominantColorIndex; private static StageState currentStage; @@ -45,6 +40,14 @@ public class SimonStates extends Widget { PRESSED_COLOR_HISTORY = new ArrayList<>(); FLASHED = AbstractCollection::contains; DID_NOT_FLASH = FLASHED.negate(); + + //The Highest to lowest priorities + PRIORITY_ORDERS = new StateColor[][]{ + {RED, BLUE, GREEN, YELLOW}, + {BLUE, YELLOW, RED, GREEN}, + {GREEN, RED, YELLOW, BLUE}, + {YELLOW, GREEN, BLUE, RED} + }; } public static void setDominantColor(@NotNull StateColor dominantColor) { diff --git a/src/main/java/bomb/modules/s/square/SquareButton.java b/src/main/java/bomb/modules/s/square/SquareButton.java index 65f2266a..7008b868 100644 --- a/src/main/java/bomb/modules/s/square/SquareButton.java +++ b/src/main/java/bomb/modules/s/square/SquareButton.java @@ -23,11 +23,20 @@ public class SquareButton extends Widget implements ButtonType { //Button colors - public static final int BLUE = 0, YELLOW = 1, DARK_GRAY = 2, WHITE = 3; + public static final int BLUE, YELLOW, DARK_GRAY, WHITE; //Held button light colors - public static final int ORANGE = 0, GREEN = 1, CYAN = 2; + public static final int ORANGE, GREEN, CYAN; - private static final Set COLOR_WORDS = new TreeSet<>(asList("Purple", "Indigo", "Maroon", "Jade")); + private static final Set COLOR_WORDS; + + static { + BLUE = ORANGE = 0; + YELLOW = GREEN = 1; + DARK_GRAY = CYAN = 2; + WHITE = 3; + + COLOR_WORDS = new TreeSet<>(asList("Purple", "Indigo", "Maroon", "Jade")); + } public static String solve(int buttonColor, @NotNull String buttonText) throws IllegalArgumentException { checkSerialCode(); diff --git a/src/main/java/bomb/modules/s/switches/Switches.java b/src/main/java/bomb/modules/s/switches/Switches.java index 0ad6a50f..3fce7ef3 100644 --- a/src/main/java/bomb/modules/s/switches/Switches.java +++ b/src/main/java/bomb/modules/s/switches/Switches.java @@ -3,7 +3,6 @@ import bomb.Widget; import java.util.ArrayList; -import java.util.Arrays; import java.util.Collections; import java.util.HashMap; import java.util.HashSet; @@ -11,6 +10,8 @@ import java.util.Map; import java.util.Set; +import static java.util.Arrays.asList; + public class Switches extends Widget { protected static final byte BIT_LENGTH = 5; private static final Set FORBIDDEN_MOVES; @@ -18,7 +19,7 @@ public class Switches extends Widget { static { Byte[] forbiddenMoveSource = {4, 11, 15, 18, 19, 23, 24, 26, 28, 30}; - FORBIDDEN_MOVES = new HashSet<>(Arrays.asList(forbiddenMoveSource)); + FORBIDDEN_MOVES = new HashSet<>(asList(forbiddenMoveSource)); SPECIAL_CONDITIONS = new HashMap<>(); setUpSpecialConditions(); } @@ -66,7 +67,7 @@ private static boolean isSpecialCondition(byte currentState) { private static void setToZero(List moveList, byte startingState) { if (isSpecialCondition(startingState)) { - moveList.addAll(Arrays.asList(SPECIAL_CONDITIONS.get(startingState))); + moveList.addAll(asList(SPECIAL_CONDITIONS.get(startingState))); return; } @@ -80,7 +81,7 @@ private static void setToZero(List moveList, byte startingState) { private static void setNeededSwitchesOn(List moveList, byte desiredState) { if (isSpecialCondition(desiredState)) { - List tempList = Arrays.asList(SPECIAL_CONDITIONS.get(desiredState).clone()); + List tempList = asList(SPECIAL_CONDITIONS.get(desiredState).clone()); Collections.reverse(tempList); moveList.addAll(tempList); return; diff --git a/src/main/java/bomb/modules/t/bulb/TheBulb.java b/src/main/java/bomb/modules/t/bulb/TheBulb.java index e4a331df..4eed5c4d 100644 --- a/src/main/java/bomb/modules/t/bulb/TheBulb.java +++ b/src/main/java/bomb/modules/t/bulb/TheBulb.java @@ -34,8 +34,14 @@ import static bomb.modules.t.bulb.Bulb.Position.UNSCREWED; public class TheBulb extends Widget { - public static final String PRESS_I = "Press I", PRESS_O = "Press O", - UNSCREW = "Unscrew it", SCREW = "Screw it back in"; + public static final String PRESS_I, PRESS_O, SCREW, UNSCREW; + + static { + PRESS_I = "Press I"; + PRESS_O = "Press O"; + UNSCREW = "Unscrew it"; + SCREW = "Screw it back in"; + } private static boolean isLightOffAtStepOne; private static Indicator rememberedIndicator = null; diff --git a/src/main/java/bomb/modules/t/translated/LanguageCSVReader.java b/src/main/java/bomb/modules/t/translated/LanguageCSVReader.java index ce0134c3..5c04e6af 100644 --- a/src/main/java/bomb/modules/t/translated/LanguageCSVReader.java +++ b/src/main/java/bomb/modules/t/translated/LanguageCSVReader.java @@ -8,7 +8,6 @@ import java.io.InputStreamReader; import java.nio.charset.StandardCharsets; import java.util.List; -import java.util.stream.Collectors; @SuppressWarnings("ConstantConditions") public class LanguageCSVReader { @@ -22,7 +21,7 @@ public static List getLanguageContent(LanguageColumn languageColumn) List dictionaryContent = csvReader.readAll() .stream() .map(array -> array[columnIndex]) - .collect(Collectors.toList()); + .toList(); csvReader.close(); return dictionaryContent; diff --git a/src/main/java/bomb/modules/t/two_bit/TwoBit.java b/src/main/java/bomb/modules/t/two_bit/TwoBit.java index e88d777f..bae10262 100644 --- a/src/main/java/bomb/modules/t/two_bit/TwoBit.java +++ b/src/main/java/bomb/modules/t/two_bit/TwoBit.java @@ -17,21 +17,10 @@ * */ public class TwoBit extends Widget { - public static final String QUERY_TEXT = "Query: ", SUBMIT_TEXT = "Submit: "; + public static final String QUERY_TEXT, SUBMIT_TEXT; private static final char LETTER_TO_NUMBER_CONVERTER = '`'; - private static final String[][] CODE_GRID = { - {"kb", "dk", "gv", "tk", "pv", "kp", "bv", "vt", "pz", "dt"}, - {"ee", "zk", "ke", "ck", "zp", "pp", "tp", "tg", "pd", "pt"}, - {"tz", "eb", "ec", "cc", "cz", "zv", "cv", "gc", "bt", "gt"}, - {"bz", "pk", "kz", "kg", "vd", "ce", "vb", "kd", "gg", "dg"}, - {"pb", "vv", "ge", "kv", "dz", "pe", "db", "cd", "td", "cb"}, - {"gb", "tv", "kk", "bg", "bp", "vp", "ep", "tt", "ed", "zg"}, - {"de", "dd", "ev", "te", "zd", "bb", "pc", "bd", "kc", "zb"}, - {"eg", "bc", "tc", "ze", "zc", "gp", "et", "vc", "tb", "vz"}, - {"ez", "ek", "dv", "cg", "ve", "dp", "bk", "pg", "gk", "gz"}, - {"kt", "ct", "zz", "vg", "gd", "cp", "be", "zt", "vk", "dc"} - }; + private static final String[][] CODE_GRID; private static TwoBitState currentState = SECOND_QUERY; @@ -115,4 +104,22 @@ private static int[] translateToBitCoordinates(String code) { public static void resetStage() { currentState = SECOND_QUERY; } + + static { + CODE_GRID = new String[][]{ + {"kb", "dk", "gv", "tk", "pv", "kp", "bv", "vt", "pz", "dt"}, + {"ee", "zk", "ke", "ck", "zp", "pp", "tp", "tg", "pd", "pt"}, + {"tz", "eb", "ec", "cc", "cz", "zv", "cv", "gc", "bt", "gt"}, + {"bz", "pk", "kz", "kg", "vd", "ce", "vb", "kd", "gg", "dg"}, + {"pb", "vv", "ge", "kv", "dz", "pe", "db", "cd", "td", "cb"}, + {"gb", "tv", "kk", "bg", "bp", "vp", "ep", "tt", "ed", "zg"}, + {"de", "dd", "ev", "te", "zd", "bb", "pc", "bd", "kc", "zb"}, + {"eg", "bc", "tc", "ze", "zc", "gp", "et", "vc", "tb", "vz"}, + {"ez", "ek", "dv", "cg", "ve", "dp", "bk", "pg", "gk", "gz"}, + {"kt", "ct", "zz", "vg", "gd", "cp", "be", "zt", "vk", "dc"} + }; + + QUERY_TEXT = "Query: "; + SUBMIT_TEXT = "Submit: "; + } } \ No newline at end of file diff --git a/src/main/java/bomb/modules/wz/word_search/WordSearch.java b/src/main/java/bomb/modules/wz/word_search/WordSearch.java index 5c3ccb50..0c387ee5 100644 --- a/src/main/java/bomb/modules/wz/word_search/WordSearch.java +++ b/src/main/java/bomb/modules/wz/word_search/WordSearch.java @@ -10,12 +10,17 @@ import java.util.Set; import java.util.TreeSet; -import static java.util.stream.Collectors.toMap; +import static java.util.stream.Collectors.toUnmodifiableMap; @SuppressWarnings("ConstantConditions") public class WordSearch extends Widget { - private static final int ARRAY_SIZE = 4; - private static final String FILENAME = "words.txt"; + private static final int ARRAY_SIZE; + private static final String FILENAME; + + static { + ARRAY_SIZE = 4; + FILENAME = "words.txt"; + } public static Set findPossibleWords(char[] letters) throws IllegalArgumentException { checkSerialCode(); @@ -63,7 +68,7 @@ private static Map> createWordMap() { InputStream in = WordSearch.class.getResourceAsStream(FILENAME); return new BufferedReader(new InputStreamReader(in)) .lines() - .collect(toMap( + .collect(toUnmodifiableMap( line -> line.charAt(0), line -> List.of(line.substring(2).split(" ")) )); From c6f35a003e1ad83428f433ab69c323f2e50fab22 Mon Sep 17 00:00:00 2001 From: "Mr. J" <45538844+Ultraviolet-Ninja@users.noreply.github.com> Date: Fri, 11 Feb 2022 17:05:38 -0600 Subject: [PATCH 17/86] Minor regex pattern changes --- src/main/java/bomb/Main.java | 5 ++--- src/main/java/bomb/ManualController.java | 4 +++- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/main/java/bomb/Main.java b/src/main/java/bomb/Main.java index 9317cfca..eb4bc4a7 100644 --- a/src/main/java/bomb/Main.java +++ b/src/main/java/bomb/Main.java @@ -44,8 +44,8 @@ public void start(Stage primaryStage) throws Exception { } private static void setSceneKeyboardEvents(Scene scene, ManualController controller) { - List digitList = Stream.of(DIGIT1, DIGIT2, DIGIT3, DIGIT4, DIGIT5, - DIGIT6, DIGIT7, DIGIT8, DIGIT9, DIGIT0) + List digitList = Stream.of(DIGIT1, DIGIT2, DIGIT3, DIGIT4, DIGIT5, DIGIT6, DIGIT7, + DIGIT8, DIGIT9, DIGIT0) .map(code -> new KeyCodeCombination(code, CONTROL_DOWN)) .toList(); @@ -60,7 +60,6 @@ private static void setSceneKeyboardEvents(Scene scene, ManualController control } ); } - } private static void setSceneArrowEvents(Scene scene, ManualController controller) { diff --git a/src/main/java/bomb/ManualController.java b/src/main/java/bomb/ManualController.java index e7ae99b9..32b82a8d 100644 --- a/src/main/java/bomb/ManualController.java +++ b/src/main/java/bomb/ManualController.java @@ -218,7 +218,9 @@ private void paneSwitch(final Region pane) { @FXML public void search() { - String searchTerm = searchBar.getText().toLowerCase(); + String searchTerm = searchBar.getText() + .toLowerCase() + .replaceAll("[^a-z0-9]", ""); radioButtonHouse.getChildren().clear(); if (searchTerm.isEmpty()) { radioButtonHouse.getChildren().addAll(allRadioButtons); From 797461842550edbf816646dc1ccfd27403d6bd66 Mon Sep 17 00:00:00 2001 From: "Mr. J" <45538844+Ultraviolet-Ninja@users.noreply.github.com> Date: Sat, 12 Feb 2022 09:09:58 -0600 Subject: [PATCH 18/86] Restricted the up and down selectors to the full button list --- src/main/java/bomb/ManualController.java | 56 ++++++++---------------- 1 file changed, 18 insertions(+), 38 deletions(-) diff --git a/src/main/java/bomb/ManualController.java b/src/main/java/bomb/ManualController.java index 32b82a8d..5212b2ab 100644 --- a/src/main/java/bomb/ManualController.java +++ b/src/main/java/bomb/ManualController.java @@ -13,6 +13,7 @@ import com.jfoenix.controls.JFXRadioButton; import javafx.fxml.FXML; import javafx.fxml.FXMLLoader; +import javafx.scene.Node; import javafx.scene.control.RadioButton; import javafx.scene.control.TextField; import javafx.scene.control.Toggle; @@ -55,6 +56,7 @@ public class ManualController { private static final String FXML_DIRECTORY = "fxml"; private Map regionMap; + private List observableRadioList; private final List allRadioButtons; @FXML @@ -78,8 +80,9 @@ public ManualController() { public void initialize() throws ExecutionException, InterruptedException { searchBar.setTextFormatter(createSearchBarFormatter()); + observableRadioList = radioButtonHouse.getChildren(); allRadioButtons.addAll( - radioButtonHouse.getChildren().stream() + observableRadioList.stream() .map(node -> (RadioButton) node) .toList() ); @@ -218,16 +221,14 @@ private void paneSwitch(final Region pane) { @FXML public void search() { - String searchTerm = searchBar.getText() - .toLowerCase() - .replaceAll("[^a-z0-9]", ""); + String searchTerm = searchBar.getText().toLowerCase(); radioButtonHouse.getChildren().clear(); if (searchTerm.isEmpty()) { radioButtonHouse.getChildren().addAll(allRadioButtons); return; } - String pattern = "[\\w ]*" + searchTerm + "[\\w ]*"; + String pattern = "[a-z3 ]*" + searchTerm + "[a-z3 ]*"; radioButtonHouse.getChildren().addAll( allRadioButtons.stream() .filter(radioButton -> GET_TOGGLE_NAME.apply(radioButton) @@ -237,46 +238,25 @@ public void search() { ); } - public void switchPaneByIndex(final int index) { - int counter = 0; - for (RadioButton radioButton : allRadioButtons) { - if (counter++ == index && !radioButton.isDisabled()) { - radioButton.fire(); - return; - } - } + void switchPaneByIndex(final int index) { + ((RadioButton)observableRadioList.get(index)).fire(); } - public void switchPaneByUpArrow() { + void switchPaneByUpArrow() { RadioButton selected = (RadioButton) options.getSelectedToggle(); - if (selected == null) return; - int index = allRadioButtons.indexOf(selected) - 1; int size = allRadioButtons.size(); + if (selected == null || allRadioButtons.size() != observableRadioList.size()) return; + int index = allRadioButtons.indexOf(selected) - 1; if (index < 0) index += size; - - RadioButton nextButton = allRadioButtons.get(index); - while (nextButton.isDisabled()) { - index--; - if (index < 0) index += size; - nextButton = allRadioButtons.get(index); - } - - nextButton.fire(); + switchPaneByIndex(index); } - public void switchPaneByDownArrow() { + void switchPaneByDownArrow() { RadioButton selected = (RadioButton) options.getSelectedToggle(); - if (selected == null) return; - int index = allRadioButtons.indexOf(selected); - int mod = allRadioButtons.size(); - index = (index + 1) % mod; - RadioButton nextButton = allRadioButtons.get(index); - while (nextButton.isDisabled()) { - index++; - index %= mod; - nextButton = allRadioButtons.get(index); - } - - nextButton.fire(); + int size = allRadioButtons.size(); + if (selected == null || size != observableRadioList.size()) return; + int index = allRadioButtons.indexOf(selected) + 1; + index %= size; + switchPaneByIndex(index); } } From 8ae3342a6359830b16bc5ff135a0780269d6115d Mon Sep 17 00:00:00 2001 From: "Mr. J" <45538844+Ultraviolet-Ninja@users.noreply.github.com> Date: Sat, 12 Feb 2022 09:27:26 -0600 Subject: [PATCH 19/86] Restricted the up and down selectors to the full button list part 2 --- src/main/java/bomb/ManualController.java | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/main/java/bomb/ManualController.java b/src/main/java/bomb/ManualController.java index 5212b2ab..3319135d 100644 --- a/src/main/java/bomb/ManualController.java +++ b/src/main/java/bomb/ManualController.java @@ -243,18 +243,24 @@ void switchPaneByIndex(final int index) { } void switchPaneByUpArrow() { - RadioButton selected = (RadioButton) options.getSelectedToggle(); int size = allRadioButtons.size(); - if (selected == null || allRadioButtons.size() != observableRadioList.size()) return; + if (size != observableRadioList.size()) return; + + RadioButton selected = (RadioButton) options.getSelectedToggle(); + if (selected == null) return; + int index = allRadioButtons.indexOf(selected) - 1; if (index < 0) index += size; switchPaneByIndex(index); } void switchPaneByDownArrow() { - RadioButton selected = (RadioButton) options.getSelectedToggle(); int size = allRadioButtons.size(); - if (selected == null || size != observableRadioList.size()) return; + if (size != observableRadioList.size()) return; + + RadioButton selected = (RadioButton) options.getSelectedToggle(); + if (selected == null) return; + int index = allRadioButtons.indexOf(selected) + 1; index %= size; switchPaneByIndex(index); From 714334edbdecf114cd513930dbf3cf91e3cfbca1 Mon Sep 17 00:00:00 2001 From: "Mr. J" <45538844+Ultraviolet-Ninja@users.noreply.github.com> Date: Sun, 13 Feb 2022 21:50:17 -0600 Subject: [PATCH 20/86] Added NotNull annotations and changed Nullable annotations to return Optional --- .../bomb/modules/ab/alphabet/Alphabet.java | 2 +- .../bomb/modules/ab/astrology/Astrology.java | 3 +- .../java/bomb/modules/ab/bitwise/Bitwise.java | 2 +- .../modules/ab/boolean_venn/BooleanVenn.java | 2 +- .../c/cheap_checkout/CheapCheckout.java | 4 +- src/main/java/bomb/modules/c/chess/Chess.java | 2 +- .../bomb/modules/c/chords/ChordQualities.java | 2 +- .../c/colored_switches/ColoredSwitches.java | 4 +- .../bomb/modules/dh/hexamaze/Hexamaze.java | 13 ++-- .../hexalgorithm/maze_finding/MazeSearch.java | 8 +-- .../hexalgorithm/pathfinding/ExitChecker.java | 8 +-- .../bomb/modules/il/ice_cream/IceCream.java | 4 +- .../java/bomb/modules/il/laundry/Laundry.java | 61 +++++++++++-------- .../m/microcontroller/MicroController.java | 3 +- .../modules/m/morsematics/Morsematics.java | 3 +- .../java/bomb/modules/m/murder/Murder.java | 4 +- .../np/neutralization/Neutralization.java | 3 +- .../modules/r/round_keypads/RoundKeypads.java | 3 +- .../modules/s/shape_shift/ShapeShift.java | 3 +- .../modules/s/simon/screams/SimonScreams.java | 2 +- .../modules/s/simon/states/SimonStates.java | 2 +- .../bomb/modules/s/souvenir/Souvenir.java | 3 +- .../bomb/modules/s/square/SquareButton.java | 2 +- .../bomb/modules/s/switches/Switches.java | 3 +- .../java/bomb/modules/t/bulb/TheBulb.java | 2 +- .../java/bomb/modules/t/two_bit/TwoBit.java | 4 +- .../modules/wz/word_search/WordFinder.java | 8 +-- .../modules/wz/word_search/WordSearch.java | 3 +- .../maze_finding/MazeRunnerTest.java | 14 ++++- .../pathfinding/ExitCheckerTest.java | 20 +++--- .../pathfinding/MazeSearchTest.java | 6 +- .../bomb/modules/t/two_bit/TwoBitTest.java | 10 +-- .../wz/word_search/WordFinderTest.java | 11 +++- 33 files changed, 133 insertions(+), 91 deletions(-) diff --git a/src/main/java/bomb/modules/ab/alphabet/Alphabet.java b/src/main/java/bomb/modules/ab/alphabet/Alphabet.java index 09a201b3..00d1ee1d 100644 --- a/src/main/java/bomb/modules/ab/alphabet/Alphabet.java +++ b/src/main/java/bomb/modules/ab/alphabet/Alphabet.java @@ -31,7 +31,7 @@ public class Alphabet extends Widget { * @param input The given letter order of tiles * @return The letters in the way they should be pressed */ - public static String order(@NotNull String input) throws IllegalArgumentException { + public static @NotNull String order(@NotNull String input) throws IllegalArgumentException { validateInput(input); input = input.toUpperCase(); StringBuilder output = new StringBuilder(); diff --git a/src/main/java/bomb/modules/ab/astrology/Astrology.java b/src/main/java/bomb/modules/ab/astrology/Astrology.java index 2d49e520..ce95c779 100644 --- a/src/main/java/bomb/modules/ab/astrology/Astrology.java +++ b/src/main/java/bomb/modules/ab/astrology/Astrology.java @@ -2,6 +2,7 @@ import bomb.Widget; import bomb.tools.filter.Regex; +import org.jetbrains.annotations.NotNull; import java.util.Arrays; import java.util.EnumSet; @@ -35,7 +36,7 @@ public class Astrology extends Widget { * @return The String command * @throws IllegalArgumentException Serial code is empty or there's an issue with the amount or type of symbols */ - public static String calculate(AstrologySymbol... symbols) throws IllegalArgumentException { + public static @NotNull String calculate(AstrologySymbol... symbols) throws IllegalArgumentException { checkSerialCode(); checkInputHasAllThreeTypes(symbols); Arrays.sort(symbols); diff --git a/src/main/java/bomb/modules/ab/bitwise/Bitwise.java b/src/main/java/bomb/modules/ab/bitwise/Bitwise.java index 5bf9fecc..33c27374 100644 --- a/src/main/java/bomb/modules/ab/bitwise/Bitwise.java +++ b/src/main/java/bomb/modules/ab/bitwise/Bitwise.java @@ -26,7 +26,7 @@ public class Bitwise extends Widget { * @throws IllegalArgumentException - The serial code, number of timer minutes and modules * are needed for this module to work */ - public static String getByte(@NotNull LogicOperator logicOps) throws IllegalArgumentException { + public static @NotNull String getByte(@NotNull LogicOperator logicOps) throws IllegalArgumentException { StringBuilder builder = new StringBuilder(); for (int i = 0; i < 8; i++) builder.append(solve(i, logicOps)); diff --git a/src/main/java/bomb/modules/ab/boolean_venn/BooleanVenn.java b/src/main/java/bomb/modules/ab/boolean_venn/BooleanVenn.java index a4c70ff7..3a3c5abe 100644 --- a/src/main/java/bomb/modules/ab/boolean_venn/BooleanVenn.java +++ b/src/main/java/bomb/modules/ab/boolean_venn/BooleanVenn.java @@ -55,7 +55,7 @@ public class BooleanVenn extends Widget { * The output order is not, c, b, a, bc, ac, ab, all * @throws IllegalArgumentException Format mismatch for the input equation */ - public static String resultCode(@NotNull String operation) throws IllegalArgumentException { + public static @NotNull String resultCode(@NotNull String operation) throws IllegalArgumentException { if (operation.isEmpty()) throw new IllegalArgumentException("Cannot have empty String"); return checkFormat(operation) ? interpretAB(operation) : diff --git a/src/main/java/bomb/modules/c/cheap_checkout/CheapCheckout.java b/src/main/java/bomb/modules/c/cheap_checkout/CheapCheckout.java index 152a0d42..6e284099 100644 --- a/src/main/java/bomb/modules/c/cheap_checkout/CheapCheckout.java +++ b/src/main/java/bomb/modules/c/cheap_checkout/CheapCheckout.java @@ -31,8 +31,8 @@ public class CheapCheckout extends Widget { .sum(); } - public static String calculateTotalPrice(@NotNull List items, @NotNull DayOfWeek dayOfWeek, - double[] perPoundWeights, double givenCash) throws IllegalArgumentException { + public static @NotNull String calculateTotalPrice(@NotNull List items, @NotNull DayOfWeek dayOfWeek, + double[] perPoundWeights, double givenCash) throws IllegalArgumentException { validateInput(items, perPoundWeights); items.get(4).applyMultiplicand(perPoundWeights[0]); items.get(5).applyMultiplicand(perPoundWeights[1]); diff --git a/src/main/java/bomb/modules/c/chess/Chess.java b/src/main/java/bomb/modules/c/chess/Chess.java index ac184a48..26bf576e 100644 --- a/src/main/java/bomb/modules/c/chess/Chess.java +++ b/src/main/java/bomb/modules/c/chess/Chess.java @@ -28,7 +28,7 @@ public class Chess extends Widget { VALIDITY_PATTERN = "[A-Fa-f]-?[1-6]"; } - public static String solve(@NotNull List inputCoordinateList) + public static @NotNull String solve(@NotNull List inputCoordinateList) throws IllegalArgumentException, IllegalStateException { checkSerialCode(); validateList(inputCoordinateList); diff --git a/src/main/java/bomb/modules/c/chords/ChordQualities.java b/src/main/java/bomb/modules/c/chords/ChordQualities.java index 9830db5e..1f2f389c 100644 --- a/src/main/java/bomb/modules/c/chords/ChordQualities.java +++ b/src/main/java/bomb/modules/c/chords/ChordQualities.java @@ -18,7 +18,7 @@ public class ChordQualities extends Widget { ALL_NOTES = new ArrayRing<>("A", "A#", "B", "C", "C#", "D", "D#", "E", "F", "F#", "G", "G#"); } - public static String solve(@NotNull String input) throws IllegalArgumentException { + public static @NotNull String solve(@NotNull String input) throws IllegalArgumentException { Set sortedSet = validateInput(input); if (isSouvenirActive) Souvenir.addRelic("Chord Quality Original Notes", input); diff --git a/src/main/java/bomb/modules/c/colored_switches/ColoredSwitches.java b/src/main/java/bomb/modules/c/colored_switches/ColoredSwitches.java index 5200ddad..5b4b3cd3 100644 --- a/src/main/java/bomb/modules/c/colored_switches/ColoredSwitches.java +++ b/src/main/java/bomb/modules/c/colored_switches/ColoredSwitches.java @@ -31,7 +31,7 @@ public class ColoredSwitches extends Switches { } } - public static List producePreemptiveMoveList(byte startingState) throws IllegalArgumentException { + public static @NotNull List producePreemptiveMoveList(byte startingState) throws IllegalArgumentException { validateByte(startingState); List outputList = new ArrayList<>(); @@ -66,7 +66,7 @@ private static ColoredSwitchNode getNodeByState(byte startingState) throws Illeg throw new IllegalStateException(); } - public static List produceFinalMoveList(@NotNull SwitchColor[] startingColors, byte desiredState) + public static @NotNull List produceFinalMoveList(@NotNull SwitchColor[] startingColors, byte desiredState) throws IllegalStateException, IllegalArgumentException { validateByte(desiredState); validateSwitchColors(startingColors); diff --git a/src/main/java/bomb/modules/dh/hexamaze/Hexamaze.java b/src/main/java/bomb/modules/dh/hexamaze/Hexamaze.java index 2a31ef5c..7f7591f6 100644 --- a/src/main/java/bomb/modules/dh/hexamaze/Hexamaze.java +++ b/src/main/java/bomb/modules/dh/hexamaze/Hexamaze.java @@ -18,6 +18,7 @@ import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.Optional; import static javafx.scene.paint.Color.BLUE; import static javafx.scene.paint.Color.CYAN; @@ -51,15 +52,17 @@ public class Hexamaze extends Widget { Maze maze = new Maze(); Grid original = new Grid(new HexagonalPlane(nodeList)); - Grid found = MazeSearch.search(maze, original); - if (found == null) - throw new IllegalArgumentException("Could not find maze from given shapes"); + Grid found = MazeSearch.search(maze, original) + .orElseThrow(() -> { + throw new IllegalArgumentException("Could not find maze from given shapes"); + }); int colorValue = copyPegLocation(original, found); - Pair> exitInfo = ExitChecker.findPossibleExits(found); - if (exitInfo == null) + Optional>> exitInfoOptional = ExitChecker.findPossibleExits(found); + if (exitInfoOptional.isEmpty()) return new Quartet<>(found, null, null, null); + Pair> exitInfo = exitInfoOptional.get(); return new Quartet<>( found, exitInfo.getValue0(), diff --git a/src/main/java/bomb/modules/dh/hexamaze/hexalgorithm/maze_finding/MazeSearch.java b/src/main/java/bomb/modules/dh/hexamaze/hexalgorithm/maze_finding/MazeSearch.java index 5e52882c..7836a5dc 100644 --- a/src/main/java/bomb/modules/dh/hexamaze/hexalgorithm/maze_finding/MazeSearch.java +++ b/src/main/java/bomb/modules/dh/hexamaze/hexalgorithm/maze_finding/MazeSearch.java @@ -7,17 +7,17 @@ import bomb.modules.dh.hexamaze.hexalgorithm.storage.Maze; import bomb.tools.data.structures.queue.BufferedQueue; import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; import java.util.Collection; import java.util.List; +import java.util.Optional; import static bomb.modules.dh.hexamaze.hexalgorithm.storage.AbstractHexagon.calculateColumnLengthArray; public class MazeSearch { public static final int ROTATION_COUNT = 6; - public static @Nullable Grid search(@NotNull Maze maze, @NotNull Grid grid) { + public static Optional search(@NotNull Maze maze, @NotNull Grid grid) { int gridSpan = grid.getHexagon().getSpan(); int lastIndex = maze.getHexagon().getSpan() - gridSpan; BufferedQueue> pillar; @@ -27,9 +27,9 @@ public class MazeSearch { pillar = generatePillar(maze, gridSpan, offset); output = searchPillar(pillar, grid); if (output != null) - return output; + return Optional.of(output); } - return null; + return Optional.empty(); } private static BufferedQueue> generatePillar(Maze maze, int gridSpan, int offset) { diff --git a/src/main/java/bomb/modules/dh/hexamaze/hexalgorithm/pathfinding/ExitChecker.java b/src/main/java/bomb/modules/dh/hexamaze/hexalgorithm/pathfinding/ExitChecker.java index 7c4704cd..f2f17a3c 100644 --- a/src/main/java/bomb/modules/dh/hexamaze/hexalgorithm/pathfinding/ExitChecker.java +++ b/src/main/java/bomb/modules/dh/hexamaze/hexalgorithm/pathfinding/ExitChecker.java @@ -8,12 +8,12 @@ import javafx.scene.paint.Color; import org.javatuples.Pair; import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; import java.util.ArrayList; import java.util.EnumSet; import java.util.List; import java.util.Map; +import java.util.Optional; import java.util.stream.IntStream; import static bomb.modules.dh.hexamaze.Hexamaze.COLOR_MAP; @@ -28,16 +28,16 @@ import static bomb.modules.dh.hexamaze.hexalgorithm.storage.HexagonalPlane.CALCULATE_SPAN; public class ExitChecker { - public static @Nullable Pair> findPossibleExits(@NotNull Grid grid) + public static Optional>> findPossibleExits(@NotNull Grid grid) throws IllegalArgumentException { int pegCount = countPegsOnGrid(grid.getHexagon().getBufferedQueues()); if (pegCount == 0) - return null; + return Optional.empty(); if (pegCount > 1) throw new IllegalArgumentException("Cannot have more than one peg on the board"); int sideToExit = getSideToExit(grid); - return getPossibleExits(grid, sideToExit); + return Optional.of(getPossibleExits(grid, sideToExit)); } private static Pair> getPossibleExits(Grid grid, int sideToExit) { diff --git a/src/main/java/bomb/modules/il/ice_cream/IceCream.java b/src/main/java/bomb/modules/il/ice_cream/IceCream.java index 41db4b10..54c5842f 100644 --- a/src/main/java/bomb/modules/il/ice_cream/IceCream.java +++ b/src/main/java/bomb/modules/il/ice_cream/IceCream.java @@ -21,8 +21,8 @@ import static bomb.modules.il.ice_cream.Flavor.VANILLA; public class IceCream extends Widget { - public static Flavor findFlavor(@NotNull Person person, @NotNull EnumSet possibleFlavors, - boolean hasEmptyPortPlate) + public static @NotNull Flavor findFlavor(@NotNull Person person, @NotNull EnumSet possibleFlavors, + boolean hasEmptyPortPlate) throws IllegalArgumentException, IllegalStateException { validateInput(possibleFlavors); diff --git a/src/main/java/bomb/modules/il/laundry/Laundry.java b/src/main/java/bomb/modules/il/laundry/Laundry.java index 04a8874c..9add7211 100644 --- a/src/main/java/bomb/modules/il/laundry/Laundry.java +++ b/src/main/java/bomb/modules/il/laundry/Laundry.java @@ -50,7 +50,8 @@ public class Laundry extends Widget { * @return The array of Strings containing the solve conditions * @throws IllegalArgumentException Whether serial code, needy or solved fields are empty */ - public static String[] clean(@NotNull String solved, @NotNull String needy) throws IllegalArgumentException { + public static @NotNull String[] clean(@NotNull String solved, @NotNull String needy) + throws IllegalArgumentException { validateInput(solved, needy); Laundry.needy = Integer.parseInt(needy); setClothing(Integer.parseInt(solved)); @@ -94,14 +95,16 @@ private static void setClothing(int solved) throws IllegalArgumentException { * @param solved The number of solved modules */ private static void setMaterial(int solved) { - switch (balance(solved + calculateTotalPorts() - numHolders)) { - case 0 -> ARTICLE.setMaterial(POLYESTER); - case 1 -> ARTICLE.setMaterial(COTTON); - case 2 -> ARTICLE.setMaterial(WOOL); - case 3 -> ARTICLE.setMaterial(NYLON); - case 4 -> ARTICLE.setMaterial(CORDUROY); - default -> ARTICLE.setMaterial(LEATHER); - } + Clothing.Material foundMaterial = switch (balance(solved + calculateTotalPorts() - numHolders)) { + case 0 -> POLYESTER; + case 1 -> COTTON; + case 2 -> WOOL; + case 3 -> NYLON; + case 4 -> CORDUROY; + default -> LEATHER; + }; + + ARTICLE.setMaterial(foundMaterial); } /** @@ -109,14 +112,16 @@ private static void setMaterial(int solved) { * Last Digit of the Serial Code + the No. of All Batteries */ private static void setColor() { - switch (balance(getSerialCodeLastDigit() + getAllBatteries())) { - case 0 -> ARTICLE.setColor(RUBY); - case 1 -> ARTICLE.setColor(STAR); - case 2 -> ARTICLE.setColor(SAPPHIRE); - case 3 -> ARTICLE.setColor(JADE); - case 4 -> ARTICLE.setColor(PEARL); - default -> ARTICLE.setColor(MALINITE); - } + Clothing.Color foundColor = switch (balance(getSerialCodeLastDigit() + getAllBatteries())) { + case 0 -> RUBY; + case 1 -> STAR; + case 2 -> SAPPHIRE; + case 3 -> JADE; + case 4 -> PEARL; + default -> MALINITE; + }; + + ARTICLE.setColor(foundColor); } /** @@ -126,14 +131,16 @@ private static void setColor() { * @param unsolved The number of unsolved modules */ private static void setItem(int unsolved) { - switch (balance(unsolved + countIndicators(IndicatorFilter.ALL_PRESENT))) { - case 0 -> ARTICLE.setItem(CORSET); - case 1 -> ARTICLE.setItem(SHIRT); - case 2 -> ARTICLE.setItem(SKIRT); - case 3 -> ARTICLE.setItem(SKORT); - case 4 -> ARTICLE.setItem(SHORTS); - default -> ARTICLE.setItem(SCARF); - } + Clothing.Item foundItem = switch (balance(unsolved + countIndicators(IndicatorFilter.ALL_PRESENT))) { + case 0 -> CORSET; + case 1 -> SHIRT; + case 2 -> SKIRT; + case 3 -> SKORT; + case 4 -> SHORTS; + default -> SCARF; + }; + + ARTICLE.setItem(foundItem); } /** @@ -142,7 +149,7 @@ private static void setItem(int unsolved) { * @return The array of Strings for the solve conditions */ private static String[] conditions() { - if (thanksBob()) return returnBob(); + if (checkBobConditions()) return returnBob(); String[] attributes = new String[5]; fillThird(attributes); @@ -222,7 +229,7 @@ private static int balance(int in) { * * @return True if the edgework matches the BOB conditions */ - private static boolean thanksBob() { + private static boolean checkBobConditions() { return getAllBatteries() == 4 && numHolders == 2 && hasLitIndicator(BOB); } diff --git a/src/main/java/bomb/modules/m/microcontroller/MicroController.java b/src/main/java/bomb/modules/m/microcontroller/MicroController.java index 5b91bfda..0e865e8f 100644 --- a/src/main/java/bomb/modules/m/microcontroller/MicroController.java +++ b/src/main/java/bomb/modules/m/microcontroller/MicroController.java @@ -13,7 +13,8 @@ import static bomb.tools.filter.RegexFilter.filter; public class MicroController extends Widget { - public static List getPinColors(@NotNull String moduleSerialNumbers, AbstractController controller) + public static @NotNull List getPinColors(@NotNull String moduleSerialNumbers, + @NotNull AbstractController controller) throws IllegalArgumentException { validateInput(moduleSerialNumbers, controller); if (containsRequiredNumbers(moduleSerialNumbers)) diff --git a/src/main/java/bomb/modules/m/morsematics/Morsematics.java b/src/main/java/bomb/modules/m/morsematics/Morsematics.java index b895d1db..6e361e6e 100644 --- a/src/main/java/bomb/modules/m/morsematics/Morsematics.java +++ b/src/main/java/bomb/modules/m/morsematics/Morsematics.java @@ -7,6 +7,7 @@ import bomb.tools.number.MathUtils; import bomb.tools.pattern.factory.MorseCodeGraphFactory; import org.javatuples.Pair; +import org.jetbrains.annotations.NotNull; import java.util.EnumSet; import java.util.LinkedHashSet; @@ -20,7 +21,7 @@ import static bomb.tools.number.MathUtils.isPerfectSquare; public class Morsematics extends Widget { - public static String solve(LinkedHashSet inputSet) throws IllegalArgumentException { + public static @NotNull String solve(@NotNull LinkedHashSet inputSet) throws IllegalArgumentException { checkSerialCode(); ListGraph morseGraph = MorseCodeGraphFactory.createGraph(); List inputLetter = validate(inputSet, morseGraph); diff --git a/src/main/java/bomb/modules/m/murder/Murder.java b/src/main/java/bomb/modules/m/murder/Murder.java index 0352221f..7ae87b28 100644 --- a/src/main/java/bomb/modules/m/murder/Murder.java +++ b/src/main/java/bomb/modules/m/murder/Murder.java @@ -29,8 +29,8 @@ import static java.util.stream.Collectors.toMap; public class Murder extends Widget { - public static String solve(@NotNull Location bodyFoundRoom, @NotNull EnumSet possibleWeapons, - @NotNull EnumSet possibleSuspects) throws IllegalArgumentException { + public static @NotNull String solve(@NotNull Location bodyFoundRoom, @NotNull EnumSet possibleWeapons, + @NotNull EnumSet possibleSuspects) throws IllegalArgumentException { validateInput(possibleWeapons, possibleSuspects, bodyFoundRoom); Pair>, EnumMap>> mapPair; diff --git a/src/main/java/bomb/modules/np/neutralization/Neutralization.java b/src/main/java/bomb/modules/np/neutralization/Neutralization.java index b34bc7dc..e27fc504 100644 --- a/src/main/java/bomb/modules/np/neutralization/Neutralization.java +++ b/src/main/java/bomb/modules/np/neutralization/Neutralization.java @@ -7,6 +7,7 @@ import bomb.tools.filter.Regex; import javafx.scene.paint.Color; import org.intellij.lang.annotations.Language; +import org.jetbrains.annotations.NotNull; import java.util.Arrays; import java.util.Set; @@ -57,7 +58,7 @@ public class Neutralization extends Widget { * @param acidColor The color of acid * @return The name and formula of the base, the drop count and whether the titration needs a filter */ - public static String titrate(int acidVol, Color acidColor) throws IllegalArgumentException { + public static @NotNull String titrate(int acidVol, @NotNull Color acidColor) throws IllegalArgumentException { checkSerialCode(); if (isSouvenirActive) diff --git a/src/main/java/bomb/modules/r/round_keypads/RoundKeypads.java b/src/main/java/bomb/modules/r/round_keypads/RoundKeypads.java index fc159365..45cc7f3e 100644 --- a/src/main/java/bomb/modules/r/round_keypads/RoundKeypads.java +++ b/src/main/java/bomb/modules/r/round_keypads/RoundKeypads.java @@ -5,6 +5,7 @@ import javafx.scene.image.Image; import javafx.scene.image.WritableImage; import javafx.scene.paint.Color; +import org.jetbrains.annotations.NotNull; import java.util.Map; import java.util.function.UnaryOperator; @@ -42,7 +43,7 @@ public static int determineBadColumn() { .orElse(-1); } - public static Image toggleImageColor(Keypad toEdit, Image original) { + public static Image toggleImageColor(@NotNull Keypad toEdit, @NotNull Image original) { if (toEdit.getFlag()) { toEdit.setFlag(false); return toEdit.getMemory(); diff --git a/src/main/java/bomb/modules/s/shape_shift/ShapeShift.java b/src/main/java/bomb/modules/s/shape_shift/ShapeShift.java index f22326c1..caf990c6 100644 --- a/src/main/java/bomb/modules/s/shape_shift/ShapeShift.java +++ b/src/main/java/bomb/modules/s/shape_shift/ShapeShift.java @@ -3,6 +3,7 @@ import bomb.Widget; import bomb.tools.data.structures.graph.list.ListGraph; import org.javatuples.Pair; +import org.jetbrains.annotations.NotNull; import java.util.ArrayList; import java.util.List; @@ -84,7 +85,7 @@ private static void initializePairs(Pair firstPair, } // - public static ShapeEnd[] solve(ShapeEnd left, ShapeEnd right) { + public static ShapeEnd[] solve(@NotNull ShapeEnd left, @NotNull ShapeEnd right) { checkSerialCode(); increment(left, right); if (checkIfVisitedTwice(left, right)) { diff --git a/src/main/java/bomb/modules/s/simon/screams/SimonScreams.java b/src/main/java/bomb/modules/s/simon/screams/SimonScreams.java index 45004b0d..2b63f973 100644 --- a/src/main/java/bomb/modules/s/simon/screams/SimonScreams.java +++ b/src/main/java/bomb/modules/s/simon/screams/SimonScreams.java @@ -46,7 +46,7 @@ public static void initialize(@NotNull ScreamColor[] order) throws IllegalArgume * @return - The resulting colors to pressed * @throws IllegalArgumentException - The init() method wasn't called first */ - public static String nextSolve(@NotNull ScreamColor[] flashingOrder) throws IllegalArgumentException { + public static String nextSolve(@NotNull ScreamColor @NotNull [] flashingOrder) throws IllegalArgumentException { if (flashingOrder.length == 0) throw new IllegalArgumentException("No colors were selected"); if (!initialized) throw new IllegalArgumentException("Initialization wasn't started"); diff --git a/src/main/java/bomb/modules/s/simon/states/SimonStates.java b/src/main/java/bomb/modules/s/simon/states/SimonStates.java index 80d384c8..346c978f 100644 --- a/src/main/java/bomb/modules/s/simon/states/SimonStates.java +++ b/src/main/java/bomb/modules/s/simon/states/SimonStates.java @@ -54,7 +54,7 @@ public static void setDominantColor(@NotNull StateColor dominantColor) { dominantColorIndex = dominantColor.ordinal(); } - public static List calculateNextColorPress(@NotNull EnumSet colorsFlashed) + public static @NotNull List calculateNextColorPress(@NotNull EnumSet colorsFlashed) throws IllegalArgumentException { validate(colorsFlashed); if (isSouvenirActive) diff --git a/src/main/java/bomb/modules/s/souvenir/Souvenir.java b/src/main/java/bomb/modules/s/souvenir/Souvenir.java index 58a3daa1..5592f178 100644 --- a/src/main/java/bomb/modules/s/souvenir/Souvenir.java +++ b/src/main/java/bomb/modules/s/souvenir/Souvenir.java @@ -2,6 +2,7 @@ import bomb.Widget; import org.javatuples.Pair; +import org.jetbrains.annotations.NotNull; import java.util.LinkedHashMap; import java.util.List; @@ -18,7 +19,7 @@ public static void addRelic(String key, String answer) { MODULE_ARTIFACTS.put(key, answer); } - public static List> getPuzzleArtifacts() { + public static @NotNull List> getPuzzleArtifacts() { return MODULE_ARTIFACTS.entrySet() .stream() .map(entry -> new Pair<>(entry.getKey(), entry.getValue())) diff --git a/src/main/java/bomb/modules/s/square/SquareButton.java b/src/main/java/bomb/modules/s/square/SquareButton.java index 7008b868..00d633c7 100644 --- a/src/main/java/bomb/modules/s/square/SquareButton.java +++ b/src/main/java/bomb/modules/s/square/SquareButton.java @@ -38,7 +38,7 @@ public class SquareButton extends Widget implements ButtonType { COLOR_WORDS = new TreeSet<>(asList("Purple", "Indigo", "Maroon", "Jade")); } - public static String solve(int buttonColor, @NotNull String buttonText) throws IllegalArgumentException { + public static @NotNull String solve(int buttonColor, @NotNull String buttonText) throws IllegalArgumentException { checkSerialCode(); validateButtonColor(buttonColor); buttonText = FIRST_LETTER_CAPITAL.apply(buttonText); diff --git a/src/main/java/bomb/modules/s/switches/Switches.java b/src/main/java/bomb/modules/s/switches/Switches.java index 3fce7ef3..a08d542a 100644 --- a/src/main/java/bomb/modules/s/switches/Switches.java +++ b/src/main/java/bomb/modules/s/switches/Switches.java @@ -1,6 +1,7 @@ package bomb.modules.s.switches; import bomb.Widget; +import org.jetbrains.annotations.NotNull; import java.util.ArrayList; import java.util.Collections; @@ -31,7 +32,7 @@ private static void setUpSpecialConditions() { SPECIAL_CONDITIONS.put(specialConditionsSource[i], specialConditionsOutputs[i]); } - public static List produceMoveList(byte startingState, byte desiredState) + public static @NotNull List produceMoveList(byte startingState, byte desiredState) throws IllegalArgumentException { validateInput(startingState, desiredState); List outputList = new ArrayList<>(); diff --git a/src/main/java/bomb/modules/t/bulb/TheBulb.java b/src/main/java/bomb/modules/t/bulb/TheBulb.java index 4eed5c4d..7fa7f8de 100644 --- a/src/main/java/bomb/modules/t/bulb/TheBulb.java +++ b/src/main/java/bomb/modules/t/bulb/TheBulb.java @@ -46,7 +46,7 @@ public class TheBulb extends Widget { private static boolean isLightOffAtStepOne; private static Indicator rememberedIndicator = null; - public static List solve(@NotNull Bulb bulb) { + public static @NotNull List solve(@NotNull Bulb bulb) { validateBulb(bulb); List outputList = new ArrayList<>(); stepOne(bulb, outputList); diff --git a/src/main/java/bomb/modules/t/two_bit/TwoBit.java b/src/main/java/bomb/modules/t/two_bit/TwoBit.java index bae10262..a122a8bf 100644 --- a/src/main/java/bomb/modules/t/two_bit/TwoBit.java +++ b/src/main/java/bomb/modules/t/two_bit/TwoBit.java @@ -30,7 +30,7 @@ public class TwoBit extends Widget { * @return The value in the {@link TwoBit#CODE_GRID} * @throws IllegalArgumentException The serial code was not set */ - public static String initialCode() throws IllegalArgumentException { + public static @NotNull String initialCode() throws IllegalArgumentException { checkSerialCode(); String numbersInSerialCode = filter(serialCode, NUMBER_PATTERN); String first = filter(serialCode, CHAR_FILTER).toLowerCase(); @@ -60,7 +60,7 @@ public static String initialCode() throws IllegalArgumentException { * @return The next letter code along with a Query or Submit phrase * @throws IllegalArgumentException The given input was not 2 numbers */ - public static String nextCode(@NotNull String code) throws IllegalArgumentException { + public static @NotNull String nextCode(@NotNull String code) throws IllegalArgumentException { String newCode = filter(code, NUMBER_PATTERN); validateNextCode(code, newCode); int[] coords = translateToBitCoordinates(newCode); diff --git a/src/main/java/bomb/modules/wz/word_search/WordFinder.java b/src/main/java/bomb/modules/wz/word_search/WordFinder.java index f6b611f1..022e3120 100644 --- a/src/main/java/bomb/modules/wz/word_search/WordFinder.java +++ b/src/main/java/bomb/modules/wz/word_search/WordFinder.java @@ -4,15 +4,15 @@ import bomb.tools.data.structures.trie.Trie; import org.javatuples.Pair; import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; +import java.util.Optional; import java.util.Set; @SuppressWarnings("SuspiciousNameCombination") public class WordFinder { private static int currentGridLength, longestWordLength; - public static @Nullable Pair findWordCoordinates(char[][] grid, + public static Optional> findWordCoordinates(char[][] grid, @NotNull Set possibleWords) { validate(grid); @@ -31,11 +31,11 @@ public class WordFinder { endPosition = searchLocation(grid, i, j, trie); if (endPosition != null) - return new Pair<>(startPosition, endPosition); + return Optional.of(new Pair<>(startPosition, endPosition)); } } - return null; + return Optional.empty(); } private static void validate(char[][] grid) throws IllegalArgumentException { diff --git a/src/main/java/bomb/modules/wz/word_search/WordSearch.java b/src/main/java/bomb/modules/wz/word_search/WordSearch.java index 0c387ee5..7321343e 100644 --- a/src/main/java/bomb/modules/wz/word_search/WordSearch.java +++ b/src/main/java/bomb/modules/wz/word_search/WordSearch.java @@ -1,6 +1,7 @@ package bomb.modules.wz.word_search; import bomb.Widget; +import org.jetbrains.annotations.NotNull; import java.io.BufferedReader; import java.io.InputStream; @@ -22,7 +23,7 @@ public class WordSearch extends Widget { FILENAME = "words.txt"; } - public static Set findPossibleWords(char[] letters) throws IllegalArgumentException { + public static @NotNull Set findPossibleWords(char[] letters) throws IllegalArgumentException { checkSerialCode(); validate(letters); diff --git a/src/test/java/bomb/modules/dh/hexamaze/hexalgorithm/maze_finding/MazeRunnerTest.java b/src/test/java/bomb/modules/dh/hexamaze/hexalgorithm/maze_finding/MazeRunnerTest.java index 0ba38355..0bcd8093 100644 --- a/src/test/java/bomb/modules/dh/hexamaze/hexalgorithm/maze_finding/MazeRunnerTest.java +++ b/src/test/java/bomb/modules/dh/hexamaze/hexalgorithm/maze_finding/MazeRunnerTest.java @@ -11,13 +11,14 @@ import java.util.HashSet; import java.util.List; +import java.util.Optional; import java.util.Set; import static bomb.modules.dh.hexamaze.hexalgorithm.pathfinding.ExitCheckerTest.setPegLocations; import static bomb.modules.dh.hexamaze.hexalgorithm.pathfinding.MazeSearchTest.hexagonFromLine; import static org.testng.Assert.assertNotNull; +import static org.testng.Assert.assertTrue; -@SuppressWarnings("ALL") public class MazeRunnerTest { private Maze maze; private Grid grid; @@ -37,11 +38,18 @@ public void validPathTest() { setPegLocations(grid, locations); - grid = MazeSearch.search(maze, grid); + Optional optional = MazeSearch.search(maze, grid); + + assertTrue(optional.isPresent()); + + grid = optional.get(); setPegLocations(grid, locations); - Pair> pair = ExitChecker.findPossibleExits(grid); + Optional>> pairOptional = ExitChecker.findPossibleExits(grid); + assertTrue(pairOptional.isPresent()); + + Pair> pair = pairOptional.get(); assertNotNull(MazeRunner.runMaze(grid, pair.getValue1())); } } diff --git a/src/test/java/bomb/modules/dh/hexamaze/hexalgorithm/pathfinding/ExitCheckerTest.java b/src/test/java/bomb/modules/dh/hexamaze/hexalgorithm/pathfinding/ExitCheckerTest.java index e1ec906e..9ec41141 100644 --- a/src/test/java/bomb/modules/dh/hexamaze/hexalgorithm/pathfinding/ExitCheckerTest.java +++ b/src/test/java/bomb/modules/dh/hexamaze/hexalgorithm/pathfinding/ExitCheckerTest.java @@ -13,12 +13,12 @@ import java.util.HashSet; import java.util.List; +import java.util.Optional; import java.util.Set; import static bomb.modules.dh.hexamaze.hexalgorithm.pathfinding.MazeSearchTest.hexagonFromLine; import static org.testng.Assert.assertEquals; -import static org.testng.Assert.assertNotNull; -import static org.testng.Assert.assertNull; +import static org.testng.Assert.assertTrue; public class ExitCheckerTest { private static final int RED_PEG_VALUE = 0; @@ -46,10 +46,10 @@ public void exceptionTest() { @Test public void nullTest() { - assertNull(ExitChecker.findPossibleExits(grid)); + Optional>> emptyOptional = ExitChecker.findPossibleExits(grid); + assertTrue(emptyOptional.isEmpty()); } - @SuppressWarnings("ConstantConditions") @Test public void validLocationTest() { Maze maze = new Maze(); @@ -58,12 +58,18 @@ public void validLocationTest() { setPegLocations(grid, locations); - grid = MazeSearch.search(maze, grid); + Optional optional = MazeSearch.search(maze, grid); + + assertTrue(optional.isPresent()); + + grid = optional.get(); setPegLocations(grid, locations); - Pair> results = ExitChecker.findPossibleExits(grid); - assertNotNull(results); + Optional>> resultsOptional = ExitChecker.findPossibleExits(grid); + assertTrue(resultsOptional.isPresent()); + + Pair> results = resultsOptional.get(); assertEquals(results.getValue0(), "Top Left"); assertEquals(results.getValue1().size(), 2); } diff --git a/src/test/java/bomb/modules/dh/hexamaze/hexalgorithm/pathfinding/MazeSearchTest.java b/src/test/java/bomb/modules/dh/hexamaze/hexalgorithm/pathfinding/MazeSearchTest.java index 433f31f6..ce96cd75 100644 --- a/src/test/java/bomb/modules/dh/hexamaze/hexalgorithm/pathfinding/MazeSearchTest.java +++ b/src/test/java/bomb/modules/dh/hexamaze/hexalgorithm/pathfinding/MazeSearchTest.java @@ -13,9 +13,10 @@ import java.util.ArrayList; import java.util.EnumSet; import java.util.List; +import java.util.Optional; import static org.testng.Assert.assertNotNull; -import static org.testng.Assert.assertNull; +import static org.testng.Assert.assertTrue; public class MazeSearchTest { private Maze maze; @@ -30,7 +31,8 @@ public void nullTest() { Grid nullState = hexagonFromLine( "n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n" ); - assertNull(MazeSearch.search(maze, nullState)); + Optional emptyOptional = MazeSearch.search(maze, nullState); + assertTrue(emptyOptional.isEmpty()); } @DataProvider diff --git a/src/test/java/bomb/modules/t/two_bit/TwoBitTest.java b/src/test/java/bomb/modules/t/two_bit/TwoBitTest.java index 75ec605d..34a3c764 100644 --- a/src/test/java/bomb/modules/t/two_bit/TwoBitTest.java +++ b/src/test/java/bomb/modules/t/two_bit/TwoBitTest.java @@ -1,12 +1,14 @@ package bomb.modules.t.two_bit; import bomb.Widget; -import bomb.enumerations.Port; import org.testng.annotations.AfterClass; import org.testng.annotations.BeforeMethod; import org.testng.annotations.DataProvider; import org.testng.annotations.Test; +import static bomb.enumerations.Port.PS2; +import static bomb.enumerations.Port.RCA; +import static bomb.enumerations.Port.RJ45; import static bomb.modules.t.two_bit.TwoBit.QUERY_TEXT; import static bomb.modules.t.two_bit.TwoBit.SUBMIT_TEXT; import static org.testng.Assert.assertEquals; @@ -65,9 +67,9 @@ public void trainingVideoQuerySubmitTest(String[] expectedArr, String[] inputArr private void widgetSetupOne() { Widget.setNumberOfPlates(2); - Widget.setPortValue(Port.RJ45, 1); - Widget.setPortValue(Port.PS2, 2); - Widget.setPortValue(Port.RCA, 1); + Widget.setPortValue(RJ45, 1); + Widget.setPortValue(PS2, 2); + Widget.setPortValue(RCA, 1); Widget.setSerialCode("AI3ZC1"); } diff --git a/src/test/java/bomb/modules/wz/word_search/WordFinderTest.java b/src/test/java/bomb/modules/wz/word_search/WordFinderTest.java index 207028c6..bab7cc34 100644 --- a/src/test/java/bomb/modules/wz/word_search/WordFinderTest.java +++ b/src/test/java/bomb/modules/wz/word_search/WordFinderTest.java @@ -5,10 +5,11 @@ import org.testng.annotations.DataProvider; import org.testng.annotations.Test; +import java.util.Optional; import java.util.Set; import static org.testng.Assert.assertEquals; -import static org.testng.Assert.assertNotNull; +import static org.testng.Assert.assertTrue; public class WordFinderTest { @Test(expectedExceptions = IllegalArgumentException.class, @@ -49,9 +50,13 @@ public Object[][] nonNullTestProvider() { @Test(dataProvider = "nonNullTestProvider") public void nonNullTest(Set possibleWords, Coordinates start, Coordinates end, char[][] grid) { - Pair resultPair = WordFinder.findWordCoordinates(grid, possibleWords); + Optional> resultingOptional = + WordFinder.findWordCoordinates(grid, possibleWords); + + assertTrue(resultingOptional.isPresent()); + + Pair resultPair = resultingOptional.get(); - assertNotNull(resultPair); assertEquals(resultPair.getValue0(), start); assertEquals(resultPair.getValue1(), end); } From e001c165eeaae468790f3ef93c802e4cdb68b2cc Mon Sep 17 00:00:00 2001 From: "Mr. J" <45538844+Ultraviolet-Ninja@users.noreply.github.com> Date: Tue, 15 Feb 2022 19:03:51 -0600 Subject: [PATCH 21/86] No more ButtonType, only ButtonResults --- .../java/bomb/abstractions/ButtonType.java | 6 ----- .../java/bomb/enumerations/ButtonResult.java | 12 ++++++++++ .../modules/ab/astrology/AstrologySymbol.java | 5 ----- src/main/java/bomb/modules/c/chess/Chess.java | 9 ++++---- .../java/bomb/modules/c/chess/ChessBoard.java | 7 +++--- .../hexalgorithm/pathfinding/MazeRunner.java | 14 +++++++----- .../hexamaze/hexalgorithm/storage/Grid.java | 3 ++- .../hexalgorithm/storage/HexagonalPlane.java | 16 +++++++++----- .../bomb/modules/il/ice_cream/Allergen.java | 17 +++++++------- .../m/microcontroller/MicroController.java | 6 ++--- .../modules/s/shape_shift/ShapeShift.java | 2 +- .../bomb/modules/s/simon/screams/Star.java | 4 ++-- .../bomb/modules/s/square/SquareButton.java | 18 ++++++++------- .../bomb/modules/t/translated/Button.java | 8 ++++--- .../t/translated/solutions/button/Button.java | 7 +++--- .../solutions/button/ButtonComponent.java | 18 ++++++++------- .../java/bomb/modules/t/two_bit/TwoBit.java | 4 ++-- .../modules/wz/word_search/WordFinder.java | 19 ++++++++-------- .../java/bomb/tools/string/StringFormat.java | 8 ++++++- .../modules/s/square/SquareButtonTest.java | 22 +++++++++---------- .../solutions/button/ButtonTest.java | 9 ++++---- 21 files changed, 121 insertions(+), 93 deletions(-) delete mode 100644 src/main/java/bomb/abstractions/ButtonType.java create mode 100644 src/main/java/bomb/enumerations/ButtonResult.java diff --git a/src/main/java/bomb/abstractions/ButtonType.java b/src/main/java/bomb/abstractions/ButtonType.java deleted file mode 100644 index a34051fd..00000000 --- a/src/main/java/bomb/abstractions/ButtonType.java +++ /dev/null @@ -1,6 +0,0 @@ -package bomb.abstractions; - -public interface ButtonType { - String HOLD = "Hold", - TAP = "Tap"; -} diff --git a/src/main/java/bomb/enumerations/ButtonResult.java b/src/main/java/bomb/enumerations/ButtonResult.java new file mode 100644 index 00000000..2d5610c4 --- /dev/null +++ b/src/main/java/bomb/enumerations/ButtonResult.java @@ -0,0 +1,12 @@ +package bomb.enumerations; + +import static bomb.tools.string.StringFormat.FIRST_LETTER_CAPITAL; + +public enum ButtonResult { + TAP, HOLD; + + @Override + public String toString() { + return FIRST_LETTER_CAPITAL.apply(name()); + } +} diff --git a/src/main/java/bomb/modules/ab/astrology/AstrologySymbol.java b/src/main/java/bomb/modules/ab/astrology/AstrologySymbol.java index ab171037..f0a6ea44 100644 --- a/src/main/java/bomb/modules/ab/astrology/AstrologySymbol.java +++ b/src/main/java/bomb/modules/ab/astrology/AstrologySymbol.java @@ -27,11 +27,6 @@ public int getIndex() { return index; } - /** - * AstrologySymbols constructor - * - * @param index Its index number found in the bomb manual page for Astrology - */ AstrologySymbol(int index) { this.index = (byte) index; } diff --git a/src/main/java/bomb/modules/c/chess/Chess.java b/src/main/java/bomb/modules/c/chess/Chess.java index 26bf576e..92672387 100644 --- a/src/main/java/bomb/modules/c/chess/Chess.java +++ b/src/main/java/bomb/modules/c/chess/Chess.java @@ -3,6 +3,7 @@ import bomb.Widget; import bomb.modules.s.souvenir.Souvenir; import bomb.tools.Coordinates; +import org.intellij.lang.annotations.Language; import org.jetbrains.annotations.NotNull; import java.util.ArrayList; @@ -16,14 +17,14 @@ import static bomb.modules.c.chess.ChessPiece.QUEEN; import static bomb.modules.c.chess.ChessPiece.ROOK; import static bomb.modules.c.chess.Tile.TileColor.WHITE; +import static bomb.tools.string.StringFormat.INDEX_ZERO_LETTER_CONVERSION; import static java.util.Arrays.asList; import static java.util.stream.Collectors.toUnmodifiableSet; public class Chess extends Widget { + @Language("regexp") public static final String VALIDITY_PATTERN; - private static final char INT_CONVERSION_LETTER = 'A'; - static { VALIDITY_PATTERN = "[A-Fa-f]-?[1-6]"; } @@ -49,7 +50,7 @@ private static List convertNotation(List inputCoordinateLis char xCoordinate = chessCoordinate.toUpperCase().charAt(0); char yCoordinate = chessCoordinate.charAt(chessCoordinate.length() - 1); - int x = xCoordinate - INT_CONVERSION_LETTER; + int x = xCoordinate - INDEX_ZERO_LETTER_CONVERSION; int y = BOARD_LENGTH - Character.getNumericValue(yCoordinate); output.add(new Coordinates(x, y)); } @@ -145,7 +146,7 @@ private static void checkUniqueness(List inputCoordinateList) { } private static String convertToChessNotation(Coordinates uncoveredLocation) { - char horizontal = (char) (INT_CONVERSION_LETTER + uncoveredLocation.x()); + char horizontal = (char) (INDEX_ZERO_LETTER_CONVERSION + uncoveredLocation.x()); String vertical = String.valueOf(BOARD_LENGTH - uncoveredLocation.y()); return horizontal + "-" + vertical; } diff --git a/src/main/java/bomb/modules/c/chess/ChessBoard.java b/src/main/java/bomb/modules/c/chess/ChessBoard.java index 6abb6d2f..028e683b 100644 --- a/src/main/java/bomb/modules/c/chess/ChessBoard.java +++ b/src/main/java/bomb/modules/c/chess/ChessBoard.java @@ -1,6 +1,7 @@ package bomb.modules.c.chess; import bomb.tools.Coordinates; +import org.jetbrains.annotations.NotNull; import static bomb.modules.c.chess.Tile.TileColor.BLACK; import static bomb.modules.c.chess.Tile.TileColor.WHITE; @@ -23,15 +24,15 @@ private void setUpBoard() { } } - public void setTileCovered(Coordinates location) { + public void setTileCovered(@NotNull Coordinates location) { board[location.x()][location.y()].coverTile(); } - public void setPieceAtLocation(ChessPiece piece, Coordinates location) { + public void setPieceAtLocation(ChessPiece piece, @NotNull Coordinates location) { board[location.x()][location.y()].setCurrentPiece(piece); } - public Tile getTile(Coordinates location) { + public Tile getTile(@NotNull Coordinates location) { return board[location.x()][location.y()]; } diff --git a/src/main/java/bomb/modules/dh/hexamaze/hexalgorithm/pathfinding/MazeRunner.java b/src/main/java/bomb/modules/dh/hexamaze/hexalgorithm/pathfinding/MazeRunner.java index cadc9a2f..d6448872 100644 --- a/src/main/java/bomb/modules/dh/hexamaze/hexalgorithm/pathfinding/MazeRunner.java +++ b/src/main/java/bomb/modules/dh/hexamaze/hexalgorithm/pathfinding/MazeRunner.java @@ -23,11 +23,8 @@ public class MazeRunner { //Movement Vectors - private static final Coordinates - MOVE_DOWN = new Coordinates(0, 1), - MOVE_RIGHT = new Coordinates(1, 0), - LEFT_SIDE_MOVE_DOWN_RIGHT = new Coordinates(1, 1), - RIGHT_SIDE_MOVE_TOP_RIGHT = new Coordinates(1, -1); + private static final Coordinates MOVE_DOWN, MOVE_RIGHT, + LEFT_SIDE_MOVE_DOWN_RIGHT, RIGHT_SIDE_MOVE_TOP_RIGHT; public static @NotNull List runMaze(@NotNull Grid grid, @NotNull List possibleExits) throws IllegalArgumentException { @@ -91,4 +88,11 @@ private static Coordinates findStartingLocation(Grid grid) { } throw new RuntimeException("Failed to find start position"); } + + static { + MOVE_DOWN = new Coordinates(0, 1); + MOVE_RIGHT = new Coordinates(1, 0); + LEFT_SIDE_MOVE_DOWN_RIGHT = new Coordinates(1, 1); + RIGHT_SIDE_MOVE_TOP_RIGHT = new Coordinates(1, -1); + } } diff --git a/src/main/java/bomb/modules/dh/hexamaze/hexalgorithm/storage/Grid.java b/src/main/java/bomb/modules/dh/hexamaze/hexalgorithm/storage/Grid.java index 7fd7f481..70b41fad 100644 --- a/src/main/java/bomb/modules/dh/hexamaze/hexalgorithm/storage/Grid.java +++ b/src/main/java/bomb/modules/dh/hexamaze/hexalgorithm/storage/Grid.java @@ -2,6 +2,7 @@ import bomb.tools.data.structures.ring.ArrayRing; import javafx.scene.paint.Color; +import org.jetbrains.annotations.NotNull; import static javafx.scene.paint.Color.BLUE; import static javafx.scene.paint.Color.CYAN; @@ -20,7 +21,7 @@ public Grid() { colorRing = new ArrayRing<>(RED, YELLOW, GREEN, CYAN, BLUE, PINK); } - public Grid(HexagonalPlane internalGrid, int neededRotations) { + public Grid(@NotNull HexagonalPlane internalGrid, int neededRotations) { if (internalGrid.getSideLength() != GRID_SIDE_LENGTH) throw new IllegalArgumentException("Grid doesn't have required side length"); diff --git a/src/main/java/bomb/modules/dh/hexamaze/hexalgorithm/storage/HexagonalPlane.java b/src/main/java/bomb/modules/dh/hexamaze/hexalgorithm/storage/HexagonalPlane.java index c79ef38e..6e93bc68 100644 --- a/src/main/java/bomb/modules/dh/hexamaze/hexalgorithm/storage/HexagonalPlane.java +++ b/src/main/java/bomb/modules/dh/hexamaze/hexalgorithm/storage/HexagonalPlane.java @@ -13,11 +13,7 @@ import static java.util.Arrays.stream; public class HexagonalPlane implements Iterable>, Rotatable { - public static final IntUnaryOperator CALCULATE_SPAN = length -> 2 * length - 1, - NODAL_SIDE_LENGTH = area -> { - double result = (3 + Math.sqrt(12 * area - 3)) / 6; - return isAnInteger(result) ? (int) result : -1; - }; + public static final IntUnaryOperator CALCULATE_SPAN, NODAL_SIDE_LENGTH; private final int sideLength; @@ -131,7 +127,7 @@ public int hashCode() { return hexagon.hashCode(); } - public static BufferedQueue> convertFromList(@NotNull List list) { + public static @NotNull BufferedQueue> convertFromList(@NotNull List list) { int sideLength = NODAL_SIDE_LENGTH.applyAsInt(list.size()); BufferedQueue> output = createHexagon(sideLength); @@ -166,4 +162,12 @@ private static BufferedQueue> createHexagon(int sideLength) return output; } + + static { + CALCULATE_SPAN = length -> 2 * length - 1; + NODAL_SIDE_LENGTH = area -> { + double result = (3 + Math.sqrt(12 * area - 3)) / 6; + return isAnInteger(result) ? (int) result : -1; + }; + } } diff --git a/src/main/java/bomb/modules/il/ice_cream/Allergen.java b/src/main/java/bomb/modules/il/ice_cream/Allergen.java index e84888ff..149fb8cd 100644 --- a/src/main/java/bomb/modules/il/ice_cream/Allergen.java +++ b/src/main/java/bomb/modules/il/ice_cream/Allergen.java @@ -1,5 +1,9 @@ package bomb.modules.il.ice_cream; +import org.jetbrains.annotations.Contract; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + import java.util.EnumSet; import java.util.function.Predicate; @@ -8,7 +12,7 @@ public enum Allergen implements Predicate> { FRUIT { @Override - public boolean test(EnumSet allergens) { + public boolean test(@NotNull EnumSet allergens) { return allergens.stream().anyMatch(allergen -> allergen == this || allergen == RASPBERRY || allergen == CHERRY || allergen == STRAWBERRY @@ -18,18 +22,15 @@ public boolean test(EnumSet allergens) { CHERRY, MARSHMALLOW; - private static final Allergen[] ALLERGENS; - - static { - ALLERGENS = values(); - } + private static final Allergen[] ALLERGENS = values(); @Override - public boolean test(EnumSet allergens) { + public boolean test(@NotNull EnumSet allergens) { return allergens.contains(this); } - public static Allergen getByIndex(int index) { + @Contract(pure = true) + public static @Nullable Allergen getByIndex(int index) { return index < 0 || index > 9 ? null : ALLERGENS[index]; diff --git a/src/main/java/bomb/modules/m/microcontroller/MicroController.java b/src/main/java/bomb/modules/m/microcontroller/MicroController.java index 0e865e8f..436b2535 100644 --- a/src/main/java/bomb/modules/m/microcontroller/MicroController.java +++ b/src/main/java/bomb/modules/m/microcontroller/MicroController.java @@ -1,8 +1,6 @@ package bomb.modules.m.microcontroller; import bomb.Widget; -import bomb.enumerations.Indicator; -import bomb.enumerations.Port; import bomb.modules.m.microcontroller.chip.AbstractController; import bomb.tools.filter.Regex; import javafx.scene.paint.Color; @@ -10,6 +8,8 @@ import java.util.List; +import static bomb.enumerations.Indicator.SIG; +import static bomb.enumerations.Port.RJ45; import static bomb.tools.filter.RegexFilter.filter; public class MicroController extends Widget { @@ -19,7 +19,7 @@ public class MicroController extends Widget { validateInput(moduleSerialNumbers, controller); if (containsRequiredNumbers(moduleSerialNumbers)) return controller.traversePins(0); - else if (hasLitIndicator(Indicator.SIG) || doesPortExists(Port.RJ45)) + else if (hasLitIndicator(SIG) || doesPortExists(RJ45)) return controller.traversePins(1); else if (filter(serialCode, new Regex("[clrx18]")).length() > 0) return controller.traversePins(2); diff --git a/src/main/java/bomb/modules/s/shape_shift/ShapeShift.java b/src/main/java/bomb/modules/s/shape_shift/ShapeShift.java index caf990c6..72befacb 100644 --- a/src/main/java/bomb/modules/s/shape_shift/ShapeShift.java +++ b/src/main/java/bomb/modules/s/shape_shift/ShapeShift.java @@ -85,7 +85,7 @@ private static void initializePairs(Pair firstPair, } // - public static ShapeEnd[] solve(@NotNull ShapeEnd left, @NotNull ShapeEnd right) { + public static ShapeEnd @NotNull [] solve(@NotNull ShapeEnd left, @NotNull ShapeEnd right) { checkSerialCode(); increment(left, right); if (checkIfVisitedTwice(left, right)) { diff --git a/src/main/java/bomb/modules/s/simon/screams/Star.java b/src/main/java/bomb/modules/s/simon/screams/Star.java index ac4e5d3c..fb4f5ab6 100644 --- a/src/main/java/bomb/modules/s/simon/screams/Star.java +++ b/src/main/java/bomb/modules/s/simon/screams/Star.java @@ -26,7 +26,7 @@ private static void checkUniqueColors(ScreamColor[] order) { if (set.size() != LIMIT) throw new IllegalArgumentException("Size doesn't equal 6"); } - public boolean threeAdjacencyRule(ScreamColor[] flashOrder) { + public boolean threeAdjacencyRule(ScreamColor @NotNull [] flashOrder) { for (int i = 0; i < flashOrder.length - 2; i++) if (threeAdjacencyRule(flashOrder[i], flashOrder[i + 1], flashOrder[i + 2])) return true; @@ -83,7 +83,7 @@ public boolean complementRule(ScreamColor[] flashOrder) { return counter == 0; } - public boolean twoAdjacencyRule(ScreamColor[] flashOrder) { + public boolean twoAdjacencyRule(ScreamColor @NotNull [] flashOrder) { for (int i = 0; i < flashOrder.length - 1; i++) { if (twoAdjacencyRule(flashOrder[i], flashOrder[i + 1])) return true; } diff --git a/src/main/java/bomb/modules/s/square/SquareButton.java b/src/main/java/bomb/modules/s/square/SquareButton.java index 00d633c7..f2d3a2f1 100644 --- a/src/main/java/bomb/modules/s/square/SquareButton.java +++ b/src/main/java/bomb/modules/s/square/SquareButton.java @@ -1,7 +1,6 @@ package bomb.modules.s.square; import bomb.Widget; -import bomb.abstractions.ButtonType; import bomb.tools.number.MathUtils; import org.jetbrains.annotations.NotNull; @@ -15,13 +14,15 @@ import static bomb.Widget.IndicatorFilter.LIT; import static bomb.Widget.IndicatorFilter.UNLIT; +import static bomb.enumerations.ButtonResult.HOLD; +import static bomb.enumerations.ButtonResult.TAP; import static bomb.tools.filter.RegexFilter.NUMBER_PATTERN; import static bomb.tools.filter.RegexFilter.filter; import static bomb.tools.string.StringFormat.FIRST_LETTER_CAPITAL; import static java.util.Arrays.asList; import static java.util.stream.Collectors.joining; -public class SquareButton extends Widget implements ButtonType { +public class SquareButton extends Widget { //Button colors public static final int BLUE, YELLOW, DARK_GRAY, WHITE; //Held button light colors @@ -43,17 +44,17 @@ public class SquareButton extends Widget implements ButtonType { validateButtonColor(buttonColor); buttonText = FIRST_LETTER_CAPITAL.apply(buttonText); - if (buttonColor == BLUE && numDoubleAs > numDBatteries) return HOLD; + if (buttonColor == BLUE && numDoubleAs > numDBatteries) return HOLD.toString(); if ((buttonColor == BLUE || buttonColor == YELLOW) && matchesGreatestSerialCodeNumber(buttonText)) - return TAP; - if ((buttonColor == BLUE || buttonColor == YELLOW) && COLOR_WORDS.contains(buttonText)) return HOLD; + return TAP.toString(); + if ((buttonColor == BLUE || buttonColor == YELLOW) && COLOR_WORDS.contains(buttonText)) return HOLD.toString(); if (buttonText.isEmpty()) return TAP + " when the the two seconds digits on the timer match"; if ( (buttonColor != DARK_GRAY && buttonText.length() > countIndicators(LIT)) || (countIndicators(UNLIT) >= 2 && hasVowelInSerialCode()) - ) return TAP; + ) return TAP.toString(); - return HOLD; + return HOLD.toString(); } private static void validateButtonColor(int buttonColor) throws IllegalArgumentException { @@ -68,7 +69,8 @@ private static boolean matchesGreatestSerialCodeNumber(String buttonText) { .orElse(0) == buttonText.length(); } - public static String solveForHeldButton(boolean isFlashing, int lightColor) throws IllegalArgumentException { + public static @NotNull String solveForHeldButton(boolean isFlashing, int lightColor) + throws IllegalArgumentException { if (lightColor < ORANGE || lightColor > CYAN) throw new IllegalArgumentException("Invalid light color"); diff --git a/src/main/java/bomb/modules/t/translated/Button.java b/src/main/java/bomb/modules/t/translated/Button.java index 00c527d2..3006c20b 100644 --- a/src/main/java/bomb/modules/t/translated/Button.java +++ b/src/main/java/bomb/modules/t/translated/Button.java @@ -6,13 +6,15 @@ package bomb.modules.t.translated; -import bomb.abstractions.ButtonType; import bomb.enumerations.Indicator; +import static bomb.enumerations.ButtonResult.HOLD; +import static bomb.enumerations.ButtonResult.TAP; + /** * Button class deals with a button module */ -public class Button extends TranslationCenter implements ButtonType { +public class Button extends TranslationCenter { private static final byte COLOR_INDEX = 0, LABEL_INDEX = 1; /** @@ -37,6 +39,6 @@ else if (properties[COLOR_INDEX] == ButtonProperties.YELLOW) else which = properties[COLOR_INDEX] == ButtonProperties.RED && properties[LABEL_INDEX] == ButtonProperties.HOLD; - return which ? TAP : HOLD; + return "" + (which ? TAP : HOLD); } } diff --git a/src/main/java/bomb/modules/t/translated/solutions/button/Button.java b/src/main/java/bomb/modules/t/translated/solutions/button/Button.java index a5c00519..55ebba88 100644 --- a/src/main/java/bomb/modules/t/translated/solutions/button/Button.java +++ b/src/main/java/bomb/modules/t/translated/solutions/button/Button.java @@ -1,8 +1,9 @@ package bomb.modules.t.translated.solutions.button; import bomb.Widget; -import bomb.abstractions.ButtonType; +import static bomb.enumerations.ButtonResult.HOLD; +import static bomb.enumerations.ButtonResult.TAP; import static bomb.enumerations.Indicator.CAR; import static bomb.enumerations.Indicator.FRK; import static bomb.modules.t.translated.solutions.button.ButtonProperty.ABORT; @@ -14,7 +15,7 @@ /** * Button class deals with a button module */ -public class Button extends Widget implements ButtonType { +public class Button extends Widget { public static final byte COLOR_INDEX = 0, LABEL_INDEX = 1; /** @@ -37,7 +38,7 @@ else if ((properties[COLOR_INDEX] == BLUE && properties[LABEL_INDEX] == ABORT) | else shouldTapButton = getAllBatteries() > 2 && hasLitIndicator(FRK); - return shouldTapButton ? TAP : HOLD; + return "" + (shouldTapButton ? TAP : HOLD); } private static void validateAllInput(ButtonProperty[] properties) throws IllegalArgumentException { diff --git a/src/main/java/bomb/modules/t/translated/solutions/button/ButtonComponent.java b/src/main/java/bomb/modules/t/translated/solutions/button/ButtonComponent.java index 64b85032..5d859acb 100644 --- a/src/main/java/bomb/modules/t/translated/solutions/button/ButtonComponent.java +++ b/src/main/java/bomb/modules/t/translated/solutions/button/ButtonComponent.java @@ -16,6 +16,8 @@ import java.util.List; import static bomb.modules.t.translated.LanguageCSVReader.LanguageRow.BUTTON_LABEL_ROW; +import static bomb.modules.t.translated.solutions.button.Button.COLOR_INDEX; +import static bomb.modules.t.translated.solutions.button.Button.LABEL_INDEX; public class ButtonComponent extends Pane implements Resettable, TranslationComponent { private final ButtonProperty[] properties; @@ -44,14 +46,14 @@ public ButtonComponent() { } public void initialize() { - redButton.setOnAction(createButtonAction(ButtonProperty.RED, Button.COLOR_INDEX)); - yellowButton.setOnAction(createButtonAction(ButtonProperty.YELLOW, Button.COLOR_INDEX)); - blueButton.setOnAction(createButtonAction(ButtonProperty.BLUE, Button.COLOR_INDEX)); - whiteButton.setOnAction(createButtonAction(ButtonProperty.WHITE, Button.COLOR_INDEX)); - detonateButton.setOnAction(createButtonAction(ButtonProperty.DETONATE, Button.LABEL_INDEX)); - abortButton.setOnAction(createButtonAction(ButtonProperty.ABORT, Button.LABEL_INDEX)); - pressButton.setOnAction(createButtonAction(ButtonProperty.PRESS, Button.LABEL_INDEX)); - holdButton.setOnAction(createButtonAction(ButtonProperty.HOLD, Button.LABEL_INDEX)); + redButton.setOnAction(createButtonAction(ButtonProperty.RED, COLOR_INDEX)); + yellowButton.setOnAction(createButtonAction(ButtonProperty.YELLOW, COLOR_INDEX)); + blueButton.setOnAction(createButtonAction(ButtonProperty.BLUE, COLOR_INDEX)); + whiteButton.setOnAction(createButtonAction(ButtonProperty.WHITE, COLOR_INDEX)); + detonateButton.setOnAction(createButtonAction(ButtonProperty.DETONATE, LABEL_INDEX)); + abortButton.setOnAction(createButtonAction(ButtonProperty.ABORT, LABEL_INDEX)); + pressButton.setOnAction(createButtonAction(ButtonProperty.PRESS, LABEL_INDEX)); + holdButton.setOnAction(createButtonAction(ButtonProperty.HOLD, LABEL_INDEX)); } private EventHandler createButtonAction(ButtonProperty property, int index) { diff --git a/src/main/java/bomb/modules/t/two_bit/TwoBit.java b/src/main/java/bomb/modules/t/two_bit/TwoBit.java index a122a8bf..9ee94698 100644 --- a/src/main/java/bomb/modules/t/two_bit/TwoBit.java +++ b/src/main/java/bomb/modules/t/two_bit/TwoBit.java @@ -11,6 +11,7 @@ import static bomb.tools.filter.RegexFilter.CHAR_FILTER; import static bomb.tools.filter.RegexFilter.NUMBER_PATTERN; import static bomb.tools.filter.RegexFilter.filter; +import static bomb.tools.string.StringFormat.INDEX_ONE_LETTER_CONVERSION; import static bomb.tools.string.StringFormat.createOrdinalNumber; /** @@ -19,7 +20,6 @@ public class TwoBit extends Widget { public static final String QUERY_TEXT, SUBMIT_TEXT; - private static final char LETTER_TO_NUMBER_CONVERTER = '`'; private static final String[][] CODE_GRID; private static TwoBitState currentState = SECOND_QUERY; @@ -35,7 +35,7 @@ public class TwoBit extends Widget { String numbersInSerialCode = filter(serialCode, NUMBER_PATTERN); String first = filter(serialCode, CHAR_FILTER).toLowerCase(); int alphabetBaseValue = !first.isEmpty() ? - first.charAt(0) - LETTER_TO_NUMBER_CONVERTER : + first.charAt(0) - INDEX_ONE_LETTER_CONVERSION : 0; alphabetBaseValue += getAllBatteries() * Integer.parseInt( diff --git a/src/main/java/bomb/modules/wz/word_search/WordFinder.java b/src/main/java/bomb/modules/wz/word_search/WordFinder.java index 022e3120..66f1172d 100644 --- a/src/main/java/bomb/modules/wz/word_search/WordFinder.java +++ b/src/main/java/bomb/modules/wz/word_search/WordFinder.java @@ -10,16 +10,17 @@ @SuppressWarnings("SuspiciousNameCombination") public class WordFinder { - private static int currentGridLength, longestWordLength; + private static int currentGridLength; - public static Optional> findWordCoordinates(char[][] grid, - @NotNull Set possibleWords) { + public static Optional> findWordCoordinates( + char[] @NotNull [] grid, @NotNull Set possibleWords) { validate(grid); Coordinates startPosition, endPosition; Trie trie = new Trie(possibleWords); currentGridLength = grid.length; - longestWordLength = possibleWords.stream() + + int longestWordLength = possibleWords.stream() .mapToInt(String::length) .max() .orElse(currentGridLength); @@ -28,7 +29,7 @@ public static Optional> findWordCoordinates(char[ for (int i = 0; i < currentGridLength; i++) { for (int j = 0; j < currentGridLength; j++) { startPosition = new Coordinates(j, i); - endPosition = searchLocation(grid, i, j, trie); + endPosition = searchLocation(grid, i, j, trie, longestWordLength); if (endPosition != null) return Optional.of(new Pair<>(startPosition, endPosition)); @@ -47,7 +48,7 @@ private static void validate(char[][] grid) throws IllegalArgumentException { } } - private static Coordinates searchLocation(char[][] grid, int x, int y, Trie trie) { + private static Coordinates searchLocation(char[][] grid, int x, int y, Trie trie, int longestWordLength) { StringBuilder constructedWord = new StringBuilder().append(grid[x][y]); if (trie.containsWord(constructedWord.toString())) @@ -58,7 +59,7 @@ private static Coordinates searchLocation(char[][] grid, int x, int y, Trie trie for (int dY = -1; dY <= 1; dY++) { if (dX == 0 && dY == 0) continue; - result = searchWithVector(grid, x, y, dX, dY, constructedWord, trie); + result = searchWithVector(grid, x, y, dX, dY, constructedWord, trie, longestWordLength); if (result != null) return result; else constructedWord.setLength(1); } @@ -68,7 +69,7 @@ private static Coordinates searchLocation(char[][] grid, int x, int y, Trie trie } private static Coordinates searchWithVector(char[][] grid, int x, int y, int dX, int dY, - StringBuilder constructedWord, Trie trie) { + StringBuilder constructedWord, Trie trie, int longestWordLength) { x += dX; y += dY; @@ -80,7 +81,7 @@ private static Coordinates searchWithVector(char[][] grid, int x, int y, int dX if (trie.containsWord(constructedWord.toString())) return new Coordinates(y, x); - return searchWithVector(grid, x, y, dX, dY, constructedWord, trie); + return searchWithVector(grid, x, y, dX, dY, constructedWord, trie, longestWordLength); } private static boolean isOutOfRange(int x, int y) { diff --git a/src/main/java/bomb/tools/string/StringFormat.java b/src/main/java/bomb/tools/string/StringFormat.java index e21ad94e..ade07546 100644 --- a/src/main/java/bomb/tools/string/StringFormat.java +++ b/src/main/java/bomb/tools/string/StringFormat.java @@ -1,11 +1,15 @@ package bomb.tools.string; +import org.jetbrains.annotations.NotNull; + import java.util.function.UnaryOperator; import static java.util.Arrays.stream; import static java.util.stream.Collectors.joining; public class StringFormat { + public static final char INDEX_ZERO_LETTER_CONVERSION = 'A', + INDEX_ONE_LETTER_CONVERSION = '`'; public static final String BULLET_POINT = "\\u2022 ", ARROW = " -> ", YES = "Yes", NO = "No"; public static final UnaryOperator FIRST_LETTER_CAPITAL = sample -> sample.length() > 1 ? @@ -22,7 +26,9 @@ public class StringFormat { .map(String::toUpperCase) .collect(joining("_")); - public static String createOrdinalNumber(int number) { + public static @NotNull String createOrdinalNumber(int number) { + if (number < 0) + throw new IllegalArgumentException("Number cannot be negative"); int mod = number % 100; if (mod == 1) return number + "st"; diff --git a/src/test/java/bomb/modules/s/square/SquareButtonTest.java b/src/test/java/bomb/modules/s/square/SquareButtonTest.java index 3ef5160f..4cf5d230 100644 --- a/src/test/java/bomb/modules/s/square/SquareButtonTest.java +++ b/src/test/java/bomb/modules/s/square/SquareButtonTest.java @@ -9,6 +9,8 @@ import org.testng.annotations.Test; import static bomb.ConditionSetter.EMPTY_SETTER; +import static bomb.enumerations.ButtonResult.HOLD; +import static bomb.enumerations.ButtonResult.TAP; import static bomb.enumerations.Indicator.MSA; import static bomb.enumerations.Indicator.NSA; import static bomb.enumerations.TrinarySwitch.OFF; @@ -19,8 +21,6 @@ import static bomb.modules.s.square.SquareButton.ORANGE; import static bomb.modules.s.square.SquareButton.WHITE; import static bomb.modules.s.square.SquareButton.YELLOW; -import static bomb.modules.t.translated.solutions.button.Button.HOLD; -import static bomb.modules.t.translated.solutions.button.Button.TAP; import static org.testng.Assert.assertEquals; import static org.testng.Assert.assertTrue; @@ -64,23 +64,23 @@ public void firstBranchSolveTest() { Widget.setSerialCode(VALID_SERIAL_CODE); Widget.setDoubleAs(2); - assertEquals(SquareButton.solve(BLUE, ""), HOLD); + assertEquals(SquareButton.solve(BLUE, ""), HOLD.toString()); } @Test public void secondBranchSolveTest() { Widget.setSerialCode(VALID_SERIAL_CODE); - assertEquals(SquareButton.solve(BLUE, "Elevate"), TAP); - assertEquals(SquareButton.solve(YELLOW, "Elevate"), TAP); + assertEquals(SquareButton.solve(BLUE, "Elevate"), TAP.toString()); + assertEquals(SquareButton.solve(YELLOW, "Elevate"), TAP.toString()); } @Test public void thirdBranchSolveTest() { Widget.setSerialCode(VALID_SERIAL_CODE); - assertEquals(SquareButton.solve(BLUE, "jade"), HOLD); - assertEquals(SquareButton.solve(YELLOW, "JADE"), HOLD); + assertEquals(SquareButton.solve(BLUE, "jade"), HOLD.toString()); + assertEquals(SquareButton.solve(YELLOW, "JADE"), HOLD.toString()); } @Test @@ -95,7 +95,7 @@ public void fourthBranchSolveTest() { public void fifthBranchSolveTest() { Widget.setSerialCode(VALID_SERIAL_CODE); - assertEquals(SquareButton.solve(WHITE, "Maroon"), TAP); + assertEquals(SquareButton.solve(WHITE, "Maroon"), TAP.toString()); } @Test @@ -104,15 +104,15 @@ public void sixthBranchSolveTest() { Widget.setIndicator(OFF, NSA); Widget.setIndicator(OFF, MSA); - assertEquals(SquareButton.solve(DARK_GRAY, "Maroon"), TAP); - assertEquals(SquareButton.solve(WHITE, "Maroon"), TAP); + assertEquals(SquareButton.solve(DARK_GRAY, "Maroon"), TAP.toString()); + assertEquals(SquareButton.solve(WHITE, "Maroon"), TAP.toString()); } @Test public void seventhBranchSolveTest() { Widget.setSerialCode(VALID_SERIAL_CODE); - assertEquals(SquareButton.solve(DARK_GRAY, "Maroon"), HOLD); + assertEquals(SquareButton.solve(DARK_GRAY, "Maroon"), HOLD.toString()); } @DataProvider diff --git a/src/test/java/bomb/modules/t/translated/solutions/button/ButtonTest.java b/src/test/java/bomb/modules/t/translated/solutions/button/ButtonTest.java index fcc00592..2e686bc3 100644 --- a/src/test/java/bomb/modules/t/translated/solutions/button/ButtonTest.java +++ b/src/test/java/bomb/modules/t/translated/solutions/button/ButtonTest.java @@ -2,17 +2,18 @@ import bomb.ConditionSetter; import bomb.Widget; +import bomb.enumerations.ButtonResult; import org.testng.annotations.AfterClass; import org.testng.annotations.BeforeMethod; import org.testng.annotations.DataProvider; import org.testng.annotations.Test; import static bomb.ConditionSetter.EMPTY_SETTER; +import static bomb.enumerations.ButtonResult.HOLD; +import static bomb.enumerations.ButtonResult.TAP; import static bomb.enumerations.Indicator.CAR; import static bomb.enumerations.Indicator.FRK; import static bomb.enumerations.TrinarySwitch.ON; -import static bomb.modules.t.translated.solutions.button.Button.HOLD; -import static bomb.modules.t.translated.solutions.button.Button.TAP; import static org.testng.Assert.assertEquals; public class ButtonTest { @@ -57,10 +58,10 @@ public Object[][] validInputTestProvider() { } @Test(dataProvider = "validInputTestProvider") - public void validInputTest(ConditionSetter setter, ButtonProperty[] properties, String expected) { + public void validInputTest(ConditionSetter setter, ButtonProperty[] properties, ButtonResult expected) { setter.setCondition(); - assertEquals(Button.evaluate(properties), expected); + assertEquals(Button.evaluate(properties), expected.toString()); } @AfterClass From 996ed34333ec91f982c08700331117bf9e854e6f Mon Sep 17 00:00:00 2001 From: "Mr. J" <45538844+Ultraviolet-Ninja@users.noreply.github.com> Date: Tue, 15 Feb 2022 23:19:36 -0600 Subject: [PATCH 22/86] More minor changes --- .../modules/ab/battleship/Battleship.java | 26 +++++++++---------- src/main/java/bomb/modules/c/chess/Chess.java | 6 ++--- .../bomb/modules/s/square/SquareButton.java | 2 +- .../java/bomb/modules/t/two_bit/TwoBit.java | 4 +-- .../java/bomb/tools/number/MathUtils.java | 5 ++++ .../java/bomb/tools/string/StringFormat.java | 8 ++++-- .../modules/s/square/SquareButtonTest.java | 2 +- 7 files changed, 31 insertions(+), 22 deletions(-) diff --git a/src/main/java/bomb/modules/ab/battleship/Battleship.java b/src/main/java/bomb/modules/ab/battleship/Battleship.java index 555727f1..87a65d57 100644 --- a/src/main/java/bomb/modules/ab/battleship/Battleship.java +++ b/src/main/java/bomb/modules/ab/battleship/Battleship.java @@ -1,12 +1,14 @@ package bomb.modules.ab.battleship; import bomb.Widget; +import org.jetbrains.annotations.NotNull; import java.util.ArrayList; import java.util.List; import java.util.Set; import java.util.TreeSet; +import static bomb.Widget.IndicatorFilter.ALL_PRESENT; import static bomb.modules.ab.battleship.Tile.RADAR; import static bomb.modules.ab.battleship.Tile.UNKNOWN; @@ -14,11 +16,12 @@ import static bomb.tools.filter.RegexFilter.CHAR_FILTER; import static bomb.tools.filter.RegexFilter.NUMBER_PATTERN; import static bomb.tools.filter.RegexFilter.filter; +import static bomb.tools.number.MathUtils.negativeSafeModulo; +import static bomb.tools.string.StringFormat.CONVERT_CHAR_NUMBER_AT_ONE; +import static bomb.tools.string.StringFormat.INDEX_ZERO_LOWERCASE_LETTER; import static java.util.Arrays.stream; public class Battleship extends Widget { - private static final char CHAR_LETTER_TO_INT = 'a', CHAR_NUMBER_TO_INT = '1'; - private static Ocean ocean; private static int[] rowCounters, columnCounters; private static int numberOfRadarSpots; @@ -27,7 +30,7 @@ public class Battleship extends Widget { reset(); } - public static Set calculateRadarPositions() throws IllegalArgumentException { + public static @NotNull Set calculateRadarPositions() throws IllegalArgumentException { checkSerialCode(); Set output = new TreeSet<>(calculateSerialCodeCoordinates()); output.add(calculateEdgeworkCoordinates()); @@ -53,25 +56,22 @@ private static List calculateSerialCodeCoordinates() { } private static String calculateSingleSerialCodeCoordinates(char letter, char number) { - int startingRow = (letter - CHAR_LETTER_TO_INT) % Ocean.BOARD_LENGTH; - int startingColumn = (number - CHAR_NUMBER_TO_INT) % Ocean.BOARD_LENGTH; - - if (startingColumn < 0) - startingColumn += Ocean.BOARD_LENGTH; + int startingRow = (letter - INDEX_ZERO_LOWERCASE_LETTER) % Ocean.BOARD_LENGTH; + int startingColumn = negativeSafeModulo((number - CONVERT_CHAR_NUMBER_AT_ONE), Ocean.BOARD_LENGTH); setTileAsRadar(startingColumn, startingRow); - return offsetChar(CHAR_LETTER_TO_INT, startingRow) + - offsetChar(CHAR_NUMBER_TO_INT, startingColumn); + return offsetChar(INDEX_ZERO_LOWERCASE_LETTER, startingRow) + + offsetChar(CONVERT_CHAR_NUMBER_AT_ONE, startingColumn); } private static String calculateEdgeworkCoordinates() { int startingRow = calculateTotalPorts() % Ocean.BOARD_LENGTH - 1; int startingColumn = - (countIndicators(IndicatorFilter.ALL_PRESENT) + getAllBatteries() - 1) % Ocean.BOARD_LENGTH; + (countIndicators(ALL_PRESENT) + getAllBatteries() - 1) % Ocean.BOARD_LENGTH; setTileAsRadar(startingColumn, startingRow); - return offsetChar(CHAR_LETTER_TO_INT, startingRow) + - offsetChar(CHAR_NUMBER_TO_INT, startingColumn); + return offsetChar(INDEX_ZERO_LOWERCASE_LETTER, startingRow) + + offsetChar(CONVERT_CHAR_NUMBER_AT_ONE, startingColumn); } private static void setTileAsRadar(int x, int y) { diff --git a/src/main/java/bomb/modules/c/chess/Chess.java b/src/main/java/bomb/modules/c/chess/Chess.java index 92672387..52b9bb78 100644 --- a/src/main/java/bomb/modules/c/chess/Chess.java +++ b/src/main/java/bomb/modules/c/chess/Chess.java @@ -17,7 +17,7 @@ import static bomb.modules.c.chess.ChessPiece.QUEEN; import static bomb.modules.c.chess.ChessPiece.ROOK; import static bomb.modules.c.chess.Tile.TileColor.WHITE; -import static bomb.tools.string.StringFormat.INDEX_ZERO_LETTER_CONVERSION; +import static bomb.tools.string.StringFormat.INDEX_ZERO_UPPERCASE_LETTER; import static java.util.Arrays.asList; import static java.util.stream.Collectors.toUnmodifiableSet; @@ -50,7 +50,7 @@ private static List convertNotation(List inputCoordinateLis char xCoordinate = chessCoordinate.toUpperCase().charAt(0); char yCoordinate = chessCoordinate.charAt(chessCoordinate.length() - 1); - int x = xCoordinate - INDEX_ZERO_LETTER_CONVERSION; + int x = xCoordinate - INDEX_ZERO_UPPERCASE_LETTER; int y = BOARD_LENGTH - Character.getNumericValue(yCoordinate); output.add(new Coordinates(x, y)); } @@ -146,7 +146,7 @@ private static void checkUniqueness(List inputCoordinateList) { } private static String convertToChessNotation(Coordinates uncoveredLocation) { - char horizontal = (char) (INDEX_ZERO_LETTER_CONVERSION + uncoveredLocation.x()); + char horizontal = (char) (INDEX_ZERO_UPPERCASE_LETTER + uncoveredLocation.x()); String vertical = String.valueOf(BOARD_LENGTH - uncoveredLocation.y()); return horizontal + "-" + vertical; } diff --git a/src/main/java/bomb/modules/s/square/SquareButton.java b/src/main/java/bomb/modules/s/square/SquareButton.java index f2d3a2f1..879b4f3d 100644 --- a/src/main/java/bomb/modules/s/square/SquareButton.java +++ b/src/main/java/bomb/modules/s/square/SquareButton.java @@ -48,7 +48,7 @@ public class SquareButton extends Widget { if ((buttonColor == BLUE || buttonColor == YELLOW) && matchesGreatestSerialCodeNumber(buttonText)) return TAP.toString(); if ((buttonColor == BLUE || buttonColor == YELLOW) && COLOR_WORDS.contains(buttonText)) return HOLD.toString(); - if (buttonText.isEmpty()) return TAP + " when the the two seconds digits on the timer match"; + if (buttonText.isEmpty()) return TAP + " when the two seconds digits on the timer match"; if ( (buttonColor != DARK_GRAY && buttonText.length() > countIndicators(LIT)) || (countIndicators(UNLIT) >= 2 && hasVowelInSerialCode()) diff --git a/src/main/java/bomb/modules/t/two_bit/TwoBit.java b/src/main/java/bomb/modules/t/two_bit/TwoBit.java index 9ee94698..3f2d72a4 100644 --- a/src/main/java/bomb/modules/t/two_bit/TwoBit.java +++ b/src/main/java/bomb/modules/t/two_bit/TwoBit.java @@ -11,7 +11,7 @@ import static bomb.tools.filter.RegexFilter.CHAR_FILTER; import static bomb.tools.filter.RegexFilter.NUMBER_PATTERN; import static bomb.tools.filter.RegexFilter.filter; -import static bomb.tools.string.StringFormat.INDEX_ONE_LETTER_CONVERSION; +import static bomb.tools.string.StringFormat.INDEX_ONE_LOWERCASE_LETTER; import static bomb.tools.string.StringFormat.createOrdinalNumber; /** @@ -35,7 +35,7 @@ public class TwoBit extends Widget { String numbersInSerialCode = filter(serialCode, NUMBER_PATTERN); String first = filter(serialCode, CHAR_FILTER).toLowerCase(); int alphabetBaseValue = !first.isEmpty() ? - first.charAt(0) - INDEX_ONE_LETTER_CONVERSION : + first.charAt(0) - INDEX_ONE_LOWERCASE_LETTER : 0; alphabetBaseValue += getAllBatteries() * Integer.parseInt( diff --git a/src/main/java/bomb/tools/number/MathUtils.java b/src/main/java/bomb/tools/number/MathUtils.java index 3410ef5e..388d2bbc 100644 --- a/src/main/java/bomb/tools/number/MathUtils.java +++ b/src/main/java/bomb/tools/number/MathUtils.java @@ -50,4 +50,9 @@ public static double roundToNPlaces(double number, int places) { double factor = pow(10.0, places); return round(number * factor) / factor; } + + public static int negativeSafeModulo(int number, final int modulus) { + while(number < 0) number += modulus; + return number % modulus; + } } diff --git a/src/main/java/bomb/tools/string/StringFormat.java b/src/main/java/bomb/tools/string/StringFormat.java index ade07546..5ef1ee21 100644 --- a/src/main/java/bomb/tools/string/StringFormat.java +++ b/src/main/java/bomb/tools/string/StringFormat.java @@ -8,10 +8,14 @@ import static java.util.stream.Collectors.joining; public class StringFormat { - public static final char INDEX_ZERO_LETTER_CONVERSION = 'A', - INDEX_ONE_LETTER_CONVERSION = '`'; + public static final char INDEX_ZERO_UPPERCASE_LETTER = 'A', + INDEX_ZERO_LOWERCASE_LETTER = 'a', + INDEX_ONE_LOWERCASE_LETTER = '`', + CONVERT_CHAR_NUMBER_AT_ONE = '1'; + public static final String BULLET_POINT = "\\u2022 ", ARROW = " -> ", YES = "Yes", NO = "No"; + public static final UnaryOperator FIRST_LETTER_CAPITAL = sample -> sample.length() > 1 ? sample.substring(0, 1).toUpperCase() + sample.substring(1).toLowerCase() : sample.toUpperCase(); diff --git a/src/test/java/bomb/modules/s/square/SquareButtonTest.java b/src/test/java/bomb/modules/s/square/SquareButtonTest.java index 4cf5d230..3fef5ed5 100644 --- a/src/test/java/bomb/modules/s/square/SquareButtonTest.java +++ b/src/test/java/bomb/modules/s/square/SquareButtonTest.java @@ -88,7 +88,7 @@ public void fourthBranchSolveTest() { Widget.setSerialCode(VALID_SERIAL_CODE); assertEquals(SquareButton.solve(DARK_GRAY, ""), - TAP + " when the the two seconds digits on the timer match"); + TAP + " when the two seconds digits on the timer match"); } @Test From f9bc3b514f1b30c9dff3f148a4c3f131310fd373 Mon Sep 17 00:00:00 2001 From: "Mr. J" <45538844+Ultraviolet-Ninja@users.noreply.github.com> Date: Wed, 16 Feb 2022 09:01:31 -0600 Subject: [PATCH 23/86] Added a negative safe modulus operation --- src/main/java/bomb/ManualController.java | 4 +-- .../java/bomb/modules/il/laundry/Laundry.java | 25 ++++++++----------- 2 files changed, 12 insertions(+), 17 deletions(-) diff --git a/src/main/java/bomb/ManualController.java b/src/main/java/bomb/ManualController.java index 3319135d..6717e592 100644 --- a/src/main/java/bomb/ManualController.java +++ b/src/main/java/bomb/ManualController.java @@ -39,6 +39,7 @@ import java.util.concurrent.ExecutionException; import java.util.stream.IntStream; +import static bomb.tools.number.MathUtils.negativeSafeModulo; import static bomb.tools.pattern.facade.FacadeFX.GET_TOGGLE_NAME; import static bomb.tools.pattern.factory.TextFormatterFactory.createSearchBarFormatter; import static bomb.tools.pattern.observer.ObserverHub.ObserverIndex.BLIND_ALLEY_PANE; @@ -249,8 +250,7 @@ void switchPaneByUpArrow() { RadioButton selected = (RadioButton) options.getSelectedToggle(); if (selected == null) return; - int index = allRadioButtons.indexOf(selected) - 1; - if (index < 0) index += size; + int index = negativeSafeModulo(allRadioButtons.indexOf(selected) - 1, size); switchPaneByIndex(index); } diff --git a/src/main/java/bomb/modules/il/laundry/Laundry.java b/src/main/java/bomb/modules/il/laundry/Laundry.java index 9add7211..f87704c1 100644 --- a/src/main/java/bomb/modules/il/laundry/Laundry.java +++ b/src/main/java/bomb/modules/il/laundry/Laundry.java @@ -28,6 +28,7 @@ import static bomb.modules.il.laundry.Clothing.Material.WOOL; import static bomb.tools.filter.RegexFilter.CHAR_FILTER; import static bomb.tools.filter.RegexFilter.filter; +import static bomb.tools.number.MathUtils.negativeSafeModulo; import static java.util.Arrays.stream; import static java.util.stream.Collectors.toUnmodifiableSet; @@ -40,6 +41,8 @@ public class Laundry extends Widget { public static final String THANKS_BOB = "Thanks, Bob! :)"; + private static final int NUMBER_OF_OPTIONS = 6; + private static int needy; /** @@ -95,7 +98,9 @@ private static void setClothing(int solved) throws IllegalArgumentException { * @param solved The number of solved modules */ private static void setMaterial(int solved) { - Clothing.Material foundMaterial = switch (balance(solved + calculateTotalPorts() - numHolders)) { + int number = solved + calculateTotalPorts() - numHolders; + int selector = negativeSafeModulo(number, NUMBER_OF_OPTIONS); + Clothing.Material foundMaterial = switch (selector) { case 0 -> POLYESTER; case 1 -> COTTON; case 2 -> WOOL; @@ -112,7 +117,8 @@ private static void setMaterial(int solved) { * Last Digit of the Serial Code + the No. of All Batteries */ private static void setColor() { - Clothing.Color foundColor = switch (balance(getSerialCodeLastDigit() + getAllBatteries())) { + int selector = (getSerialCodeLastDigit() + getAllBatteries()) % NUMBER_OF_OPTIONS; + Clothing.Color foundColor = switch (selector) { case 0 -> RUBY; case 1 -> STAR; case 2 -> SAPPHIRE; @@ -131,7 +137,8 @@ private static void setColor() { * @param unsolved The number of unsolved modules */ private static void setItem(int unsolved) { - Clothing.Item foundItem = switch (balance(unsolved + countIndicators(IndicatorFilter.ALL_PRESENT))) { + int selector = (unsolved + countIndicators(IndicatorFilter.ALL_PRESENT)) % NUMBER_OF_OPTIONS; + Clothing.Item foundItem = switch (selector) { case 0 -> CORSET; case 1 -> SHIRT; case 2 -> SKIRT; @@ -212,18 +219,6 @@ private static String[] fillRest(String[] att) { return att; } - /** - * Keeps the balance factor between 0 and 6 for determining clothing properties - * - * @param in The number - * @return The balanced number - */ - private static int balance(int in) { - if (in > 5) in %= 6; - else if (in < 0) in += 6; - return in; - } - /** * Determines if Bob did all the work for us * From 3bbe60f88372b446d7d9e227ffb41883bd7662d3 Mon Sep 17 00:00:00 2001 From: "Mr. J" <45538844+Ultraviolet-Ninja@users.noreply.github.com> Date: Wed, 16 Feb 2022 11:39:43 -0600 Subject: [PATCH 24/86] Changed how the TrieNodes store data --- .../java/bomb/tools/data/structures/trie/Trie.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/main/java/bomb/tools/data/structures/trie/Trie.java b/src/main/java/bomb/tools/data/structures/trie/Trie.java index 2a9f980e..8442fb5c 100644 --- a/src/main/java/bomb/tools/data/structures/trie/Trie.java +++ b/src/main/java/bomb/tools/data/structures/trie/Trie.java @@ -4,11 +4,12 @@ import java.util.ArrayList; import java.util.Collection; -import java.util.HashMap; +import java.util.Collections; import java.util.LinkedHashSet; import java.util.List; import java.util.Map; import java.util.Set; +import java.util.TreeMap; public class Trie { private final TrieNode root; @@ -17,7 +18,7 @@ public Trie() { root = new TrieNode(); } - public Trie(Collection startWords) { + public Trie(@NotNull Collection startWords) { this(); addWords(startWords); } @@ -67,11 +68,10 @@ public Set getWordsStartingWith(@NotNull String prefix) { } private static List getWordsStartingWith(TrieNode currentNode, StringBuilder builder) { - List words = new ArrayList<>(); - if (currentNode.hasNoChild()) - return words; + return Collections.emptyList(); + List words = new ArrayList<>(); if (currentNode.getChildCount() == 1) { Character nextChar = currentNode.firstChild(); currentNode = currentNode.getNextNode(nextChar); @@ -122,7 +122,7 @@ private static class TrieNode { private boolean isEndOfWord; public TrieNode() { - children = new HashMap<>(5); + children = new TreeMap<>(); isEndOfWord = false; } From a3ba59b2b4d6f8596f7e0e5de289a2f162839fbe Mon Sep 17 00:00:00 2001 From: "Mr. J" <45538844+Ultraviolet-Ninja@users.noreply.github.com> Date: Fri, 18 Feb 2022 11:13:00 -0600 Subject: [PATCH 25/86] Upgrade to Gradle 7.4 --- README.md | 4 +--- build.gradle | 2 +- gradle/wrapper/gradle-wrapper.properties | 2 +- 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 01e5e637..72e8e472 100644 --- a/README.md +++ b/README.md @@ -12,11 +12,9 @@ This is a huge project for one man to tackle, but I've [learned a lot](Learned.m ## Technologies - Java 16 -- Gradle 7.3.3 +- Gradle 7.4 ### Plugins -- Jacoco - JavaFX -- Pitest - Palantir Docker - Breadmoirai GitHub Release ### Dependencies diff --git a/build.gradle b/build.gradle index 07d8a11f..871ca309 100644 --- a/build.gradle +++ b/build.gradle @@ -59,7 +59,7 @@ dependencies { testImplementation 'org.testng:testng:7.5' testImplementation 'org.slf4j:slf4j-api:1.7.35' - testImplementation 'org.slf4j:slf4j-simple:1.7.35' + testImplementation 'org.slf4j:slf4j-simple:1.7.36' testImplementation 'nl.jqno.equalsverifier:equalsverifier:3.9' } diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 2e6e5897..41dfb879 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists From 0701a6d7741a5dd7d982779f83131e26571d0917 Mon Sep 17 00:00:00 2001 From: "Mr. J" <45538844+Ultraviolet-Ninja@users.noreply.github.com> Date: Sat, 19 Feb 2022 16:02:01 -0600 Subject: [PATCH 26/86] Rewrote CSVReader calls --- .../ColoredSwitchGraphFactory.java | 27 +++++++--------- .../c/colored_switches/ColoredSwitches.java | 7 +---- .../bomb/modules/dh/hexamaze/Hexamaze.java | 3 +- .../hexalgorithm/factory/MazeFactory.java | 24 ++++++++------ .../hexalgorithm/maze_finding/MazeSearch.java | 5 ++- .../hexamaze/hexalgorithm/storage/Maze.java | 12 ++----- .../bomb/modules/il/ice_cream/Person.java | 27 ++++++++-------- .../modules/m/murder/LocationMapFactory.java | 31 ++++++++++++------- .../java/bomb/modules/m/murder/Murder.java | 13 ++------ .../t/translated/LanguageCSVReader.java | 27 +++++++++------- .../TranslatedModuleController.java | 2 +- .../data/structures/queue/BufferedQueue.java | 2 +- .../factory/MorseCodeGraphFactory.java | 14 ++++----- 13 files changed, 93 insertions(+), 101 deletions(-) diff --git a/src/main/java/bomb/modules/c/colored_switches/ColoredSwitchGraphFactory.java b/src/main/java/bomb/modules/c/colored_switches/ColoredSwitchGraphFactory.java index a7dc8386..65dc901f 100644 --- a/src/main/java/bomb/modules/c/colored_switches/ColoredSwitchGraphFactory.java +++ b/src/main/java/bomb/modules/c/colored_switches/ColoredSwitchGraphFactory.java @@ -2,6 +2,7 @@ import bomb.tools.filter.Regex; import com.opencsv.CSVReader; +import org.jetbrains.annotations.NotNull; import org.jgrapht.Graph; import org.jgrapht.graph.DefaultEdge; import org.jgrapht.graph.SimpleDirectedGraph; @@ -9,27 +10,30 @@ import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; -import java.io.Reader; import java.util.ArrayList; import java.util.Arrays; import java.util.List; +@SuppressWarnings("ConstantConditions") public class ColoredSwitchGraphFactory { private static final byte OUTGOING_STATE = 1, COLOR_CONDITIONS = 2, SWITCH_TO_FLIP = 3; private static final String FILENAME = "graph.csv"; - public static Graph makeGraph() throws IOException { + public static @NotNull Graph makeGraph() throws IllegalStateException { return buildGraph(createFromFile()); } - private static List createFromFile() throws IOException { - List output = new ArrayList<>(); - CSVReader csvReader = createReader(); + private static List createFromFile() throws IllegalStateException { + List output = new ArrayList<>(32); Regex connectionFinder = new Regex("\\[(\\d{1,2})\\((\\d{1,3})\\)([1-5])]"); + InputStream in = ColoredSwitchGraphFactory.class.getResourceAsStream(FILENAME); - csvReader.forEach(record -> output.add(buildNode(record, connectionFinder))); - csvReader.close(); - return output; + try (CSVReader csvReader = new CSVReader(new InputStreamReader(in))) { + csvReader.forEach(record -> output.add(buildNode(record, connectionFinder))); + return output; + } catch (IOException e) { + throw new IllegalStateException(e); + } } private static Graph buildGraph(List nodeList) { @@ -47,13 +51,6 @@ private static Graph buildGraph(List producePreemptiveMoveList(byte startingState) throws IllegalArgumentException { diff --git a/src/main/java/bomb/modules/dh/hexamaze/Hexamaze.java b/src/main/java/bomb/modules/dh/hexamaze/Hexamaze.java index 7f7591f6..056eeca9 100644 --- a/src/main/java/bomb/modules/dh/hexamaze/Hexamaze.java +++ b/src/main/java/bomb/modules/dh/hexamaze/Hexamaze.java @@ -48,7 +48,8 @@ public class Hexamaze extends Widget { @NotNull Grid, @Nullable String, @Nullable Integer, - @Nullable List>solve(@NotNull List nodeList) throws IllegalArgumentException { + @Nullable List> solve(@NotNull List nodeList) + throws IllegalArgumentException, IllegalStateException { Maze maze = new Maze(); Grid original = new Grid(new HexagonalPlane(nodeList)); diff --git a/src/main/java/bomb/modules/dh/hexamaze/hexalgorithm/factory/MazeFactory.java b/src/main/java/bomb/modules/dh/hexamaze/hexalgorithm/factory/MazeFactory.java index 9dd769fb..88ce675a 100644 --- a/src/main/java/bomb/modules/dh/hexamaze/hexalgorithm/factory/MazeFactory.java +++ b/src/main/java/bomb/modules/dh/hexamaze/hexalgorithm/factory/MazeFactory.java @@ -6,6 +6,7 @@ import com.opencsv.CSVReader; import com.opencsv.exceptions.CsvException; import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; import java.io.IOException; import java.io.InputStream; @@ -20,22 +21,27 @@ import static bomb.modules.dh.hexamaze.hexalgorithm.storage.HexNode.HexShape.LEFT_TRIANGLE; import static bomb.modules.dh.hexamaze.hexalgorithm.storage.HexNode.HexShape.RIGHT_TRIANGLE; import static bomb.modules.dh.hexamaze.hexalgorithm.storage.HexNode.HexShape.UP_TRIANGLE; +import static java.nio.charset.StandardCharsets.UTF_8; import static java.util.Arrays.stream; import static java.util.stream.Collectors.toCollection; @SuppressWarnings("ConstantConditions") public class MazeFactory { - public static @NotNull List createMaze() throws IOException, CsvException { + public static @NotNull List createMaze() throws IllegalStateException { InputStream in = MazeFactory.class.getResourceAsStream("maze.csv"); - CSVReader csvReader = new CSVReader(new InputStreamReader(in)); - return csvReader.readAll().stream() - .flatMap(Arrays::stream) - .map(line -> line.split(" ")) - .map(data -> new HexNode(decodeShape(data[1]), decodeWalls(data[0]))) - .toList(); + + try (CSVReader csvReader = new CSVReader(new InputStreamReader(in, UTF_8))) { + return csvReader.readAll().stream() + .flatMap(Arrays::stream) + .map(line -> line.split(" ")) + .map(data -> new HexNode(decodeShape(data[1]), decodeWalls(data[0]))) + .toList(); + } catch (CsvException | IOException e) { + throw new IllegalStateException(e); + } } - public static HexShape decodeShape(String code) { + public static @Nullable HexShape decodeShape(@NotNull String code) { return switch(code) { case "c" -> CIRCLE; case "h" -> HEXAGON; @@ -47,7 +53,7 @@ public static HexShape decodeShape(String code) { }; } - public static EnumSet decodeWalls(String code) { + public static @NotNull EnumSet decodeWalls(@NotNull String code) { HexWall[] allWalls = HexWall.values(); return stream(code.split("")) diff --git a/src/main/java/bomb/modules/dh/hexamaze/hexalgorithm/maze_finding/MazeSearch.java b/src/main/java/bomb/modules/dh/hexamaze/hexalgorithm/maze_finding/MazeSearch.java index 7836a5dc..2ae38a6b 100644 --- a/src/main/java/bomb/modules/dh/hexamaze/hexalgorithm/maze_finding/MazeSearch.java +++ b/src/main/java/bomb/modules/dh/hexamaze/hexalgorithm/maze_finding/MazeSearch.java @@ -15,7 +15,7 @@ import static bomb.modules.dh.hexamaze.hexalgorithm.storage.AbstractHexagon.calculateColumnLengthArray; public class MazeSearch { - public static final int ROTATION_COUNT = 6; + private static final int ROTATION_COUNT = 6; public static Optional search(@NotNull Maze maze, @NotNull Grid grid) { int gridSpan = grid.getHexagon().getSpan(); @@ -139,8 +139,7 @@ private static List convertToHexShapes(HexagonalPlane structure) { .toList(); } - private static void moveToNextSegment(BufferedQueue> pillar, - HexagonalPlane copy) { + private static void moveToNextSegment(BufferedQueue> pillar, HexagonalPlane copy) { BufferedQueue> copiedQueues = copy.getBufferedQueues(); for (BufferedQueue column : copiedQueues) column.removeFirst(); diff --git a/src/main/java/bomb/modules/dh/hexamaze/hexalgorithm/storage/Maze.java b/src/main/java/bomb/modules/dh/hexamaze/hexalgorithm/storage/Maze.java index 4475ec14..84ae1994 100644 --- a/src/main/java/bomb/modules/dh/hexamaze/hexalgorithm/storage/Maze.java +++ b/src/main/java/bomb/modules/dh/hexamaze/hexalgorithm/storage/Maze.java @@ -1,20 +1,12 @@ package bomb.modules.dh.hexamaze.hexalgorithm.storage; import bomb.modules.dh.hexamaze.hexalgorithm.factory.MazeFactory; -import com.opencsv.exceptions.CsvException; - -import java.io.IOException; public class Maze extends AbstractHexagon { private static final int FULL_MAZE_SIDE_LENGTH = 12; - public Maze() throws IllegalArgumentException { + public Maze() throws IllegalArgumentException, IllegalStateException { super(new HexagonalPlane(FULL_MAZE_SIDE_LENGTH)); - - try { - hexagon.readInNodeList(MazeFactory.createMaze()); - } catch (IOException | CsvException e) { - throw new IllegalArgumentException(e); - } + hexagon.readInNodeList(MazeFactory.createMaze()); } } diff --git a/src/main/java/bomb/modules/il/ice_cream/Person.java b/src/main/java/bomb/modules/il/ice_cream/Person.java index 20fbdf60..dd0dd08b 100644 --- a/src/main/java/bomb/modules/il/ice_cream/Person.java +++ b/src/main/java/bomb/modules/il/ice_cream/Person.java @@ -9,6 +9,7 @@ import java.util.EnumMap; import java.util.EnumSet; +import static java.nio.charset.StandardCharsets.UTF_8; import static java.util.stream.Collectors.toCollection; @SuppressWarnings("ConstantConditions") @@ -23,22 +24,22 @@ public enum Person { } public static EnumMap> getPersonAllergens(int index) throws IllegalStateException { + int counter = 0; + Person[] people = values(); InputStream in = Person.class.getResourceAsStream(FILENAME); - CSVReader reader = new CSVReader(new InputStreamReader(in)); EnumMap> output = new EnumMap<>(Person.class); - Person[] people = values(); - int counter = 0; - for (String[] line : reader) { - output.put(people[counter++], - Arrays.stream(line[index].split("")) - .mapToInt(Integer::parseInt) - .mapToObj(Allergen::getByIndex) - .collect(toCollection(() -> EnumSet.noneOf(Allergen.class))) - ); - } - try { - reader.close(); + try (CSVReader csvReader = new CSVReader(new InputStreamReader(in, UTF_8))) { + for (String[] line : csvReader) { + output.put( + people[counter++], + Arrays.stream(line[index].split("")) + .mapToInt(Integer::parseInt) + .mapToObj(Allergen::getByIndex) + .collect(toCollection(() -> EnumSet.noneOf(Allergen.class))) + ); + } + return output; } catch (IOException e) { throw new IllegalStateException(e); diff --git a/src/main/java/bomb/modules/m/murder/LocationMapFactory.java b/src/main/java/bomb/modules/m/murder/LocationMapFactory.java index f720bbb9..1330007f 100644 --- a/src/main/java/bomb/modules/m/murder/LocationMapFactory.java +++ b/src/main/java/bomb/modules/m/murder/LocationMapFactory.java @@ -4,19 +4,23 @@ import com.opencsv.exceptions.CsvException; import org.javatuples.Pair; +import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; +import java.io.Reader; import java.util.Arrays; import java.util.EnumMap; import java.util.List; +import static java.nio.charset.StandardCharsets.UTF_8; + @SuppressWarnings("ConstantConditions") public class LocationMapFactory { private static final String FILENAME = "location_list.csv"; static Pair>, EnumMap>> createMaps() - throws IOException, CsvException { + throws IllegalStateException { EnumMap> suspectMap = new EnumMap<>(Suspect.class); EnumMap> weaponMap = new EnumMap<>(Weapon.class); @@ -35,17 +39,20 @@ static Pair>, EnumMap>> c return new Pair<>(suspectMap, weaponMap); } - private static List> createLocationLists() throws IOException, CsvException { + private static List> createLocationLists() throws IllegalStateException { InputStream in = Location.class.getResourceAsStream(FILENAME); - CSVReader reader = new CSVReader(new InputStreamReader(in)); - - return reader.readAll() - .stream() - .map(Arrays::stream) - .map(stream -> stream - .map(Location::valueOf) - .toList() - ) - .toList(); + + try (CSVReader csvReader = new CSVReader(new InputStreamReader(in, UTF_8))) { + return csvReader.readAll() + .stream() + .map(Arrays::stream) + .map(stream -> stream + .map(Location::valueOf) + .toList() + ) + .toList(); + } catch (IOException | CsvException e) { + throw new IllegalStateException(e); + } } } diff --git a/src/main/java/bomb/modules/m/murder/Murder.java b/src/main/java/bomb/modules/m/murder/Murder.java index 7ae87b28..424334e6 100644 --- a/src/main/java/bomb/modules/m/murder/Murder.java +++ b/src/main/java/bomb/modules/m/murder/Murder.java @@ -1,12 +1,10 @@ package bomb.modules.m.murder; import bomb.Widget; -import com.opencsv.exceptions.CsvException; import org.javatuples.Pair; import org.javatuples.Triplet; import org.jetbrains.annotations.NotNull; -import java.io.IOException; import java.util.EnumMap; import java.util.EnumSet; import java.util.List; @@ -30,16 +28,11 @@ public class Murder extends Widget { public static @NotNull String solve(@NotNull Location bodyFoundRoom, @NotNull EnumSet possibleWeapons, - @NotNull EnumSet possibleSuspects) throws IllegalArgumentException { + @NotNull EnumSet possibleSuspects) throws IllegalStateException { validateInput(possibleWeapons, possibleSuspects, bodyFoundRoom); - Pair>, EnumMap>> mapPair; - - try { - mapPair = LocationMapFactory.createMaps(); - } catch (IOException | CsvException e) { - throw new IllegalArgumentException(e); - } + Pair>, EnumMap>> mapPair = + LocationMapFactory.createMaps(); EnumMap locationsToSuspect = getLocationsToType(mapPair.getValue0(), possibleSuspects, getSuspectRow(bodyFoundRoom) - 1); diff --git a/src/main/java/bomb/modules/t/translated/LanguageCSVReader.java b/src/main/java/bomb/modules/t/translated/LanguageCSVReader.java index 5c04e6af..a7446c78 100644 --- a/src/main/java/bomb/modules/t/translated/LanguageCSVReader.java +++ b/src/main/java/bomb/modules/t/translated/LanguageCSVReader.java @@ -2,29 +2,32 @@ import com.opencsv.CSVReader; import com.opencsv.exceptions.CsvException; +import org.jetbrains.annotations.NotNull; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; -import java.nio.charset.StandardCharsets; import java.util.List; +import static java.nio.charset.StandardCharsets.UTF_8; + @SuppressWarnings("ConstantConditions") public class LanguageCSVReader { - public static List getLanguageContent(LanguageColumn languageColumn) - throws CsvException, IOException, IllegalArgumentException { - if (languageColumn == null) throw new IllegalArgumentException("Language is null"); + public static List getLanguageContent(@NotNull LanguageColumn languageColumn) + throws IllegalArgumentException, IllegalStateException { + if (languageColumn == null) throw new IllegalArgumentException("Language cannot be empty"); int columnIndex = languageColumn.getColumnIndex(); InputStream in = LanguageCSVReader.class.getResourceAsStream("dictionary.csv"); - CSVReader csvReader = new CSVReader(new InputStreamReader(in, StandardCharsets.UTF_8)); - List dictionaryContent = csvReader.readAll() - .stream() - .map(array -> array[columnIndex]) - .toList(); - - csvReader.close(); - return dictionaryContent; + + try (CSVReader csvReader = new CSVReader(new InputStreamReader(in, UTF_8))) { + return csvReader.readAll() + .stream() + .map(array -> array[columnIndex]) + .toList(); + } catch (IOException | CsvException e) { + throw new IllegalStateException(e); + } } public enum LanguageRow { diff --git a/src/main/java/bomb/modules/t/translated/TranslatedModuleController.java b/src/main/java/bomb/modules/t/translated/TranslatedModuleController.java index 879193c6..4edd3909 100644 --- a/src/main/java/bomb/modules/t/translated/TranslatedModuleController.java +++ b/src/main/java/bomb/modules/t/translated/TranslatedModuleController.java @@ -60,7 +60,7 @@ private EventHandler createButtonAction() { passwordUI.setContent(languageContent); ventGasUI.setContent(languageContent); if (translatedModuleTab.isDisabled()) translatedModuleTab.setDisable(false); - } catch (IOException | CsvException e) { + } catch (IllegalArgumentException | IllegalStateException e) { FacadeFX.setAlert(Alert.AlertType.ERROR, e.getMessage()); } }; diff --git a/src/main/java/bomb/tools/data/structures/queue/BufferedQueue.java b/src/main/java/bomb/tools/data/structures/queue/BufferedQueue.java index 70631b7a..02db57c9 100644 --- a/src/main/java/bomb/tools/data/structures/queue/BufferedQueue.java +++ b/src/main/java/bomb/tools/data/structures/queue/BufferedQueue.java @@ -74,7 +74,7 @@ public E removeFirst() { public List removeCount(int count) throws IllegalArgumentException { if (count >= dataDeque.size() || count <= 0) throw new IllegalArgumentException("Invalid count"); - List removalList = new ArrayList<>(); + List removalList = new ArrayList<>(count); for (int i = 0; i < count; i++) removalList.add(dataDeque.pollFirst()); diff --git a/src/main/java/bomb/tools/pattern/factory/MorseCodeGraphFactory.java b/src/main/java/bomb/tools/pattern/factory/MorseCodeGraphFactory.java index b6e6af81..07f18c33 100644 --- a/src/main/java/bomb/tools/pattern/factory/MorseCodeGraphFactory.java +++ b/src/main/java/bomb/tools/pattern/factory/MorseCodeGraphFactory.java @@ -18,17 +18,15 @@ private MorseCodeGraphFactory() {} public static ListGraph createGraph() throws IllegalStateException { ListGraph graph = new ListGraph<>(true); InputStream in = MorseCodeGraphFactory.class.getResourceAsStream(FILENAME); - CSVReader reader = new CSVReader(new InputStreamReader(in, UTF_8)); - for (String[] line : reader) { - String letters = line[1]; - for (String letter : letters.split("_")) { - graph.addEdge(line[0], letter); + try (CSVReader csvReader = new CSVReader(new InputStreamReader(in, UTF_8))) { + for (String[] line : csvReader) { + String[] alphaNumericChars = line[1].split("_"); + for (String s : alphaNumericChars) { + graph.addEdge(line[0], s); + } } - } - try { - reader.close(); return graph; } catch (IOException e) { throw new IllegalStateException(e); From 394027643c65752c4288ba3fb400269521a5ecec Mon Sep 17 00:00:00 2001 From: "Mr. J" <45538844+Ultraviolet-Ninja@users.noreply.github.com> Date: Sat, 19 Feb 2022 20:30:17 -0600 Subject: [PATCH 27/86] Added complexities for all puzzles --- build.gradle | 2 +- manuals/Centurion Puzzle Difficulty.xlsx | Bin 0 -> 13011 bytes 2 files changed, 1 insertion(+), 1 deletion(-) create mode 100644 manuals/Centurion Puzzle Difficulty.xlsx diff --git a/build.gradle b/build.gradle index 871ca309..99d27da0 100644 --- a/build.gradle +++ b/build.gradle @@ -58,7 +58,7 @@ dependencies { } testImplementation 'org.testng:testng:7.5' - testImplementation 'org.slf4j:slf4j-api:1.7.35' + testImplementation 'org.slf4j:slf4j-api:1.7.36' testImplementation 'org.slf4j:slf4j-simple:1.7.36' testImplementation 'nl.jqno.equalsverifier:equalsverifier:3.9' } diff --git a/manuals/Centurion Puzzle Difficulty.xlsx b/manuals/Centurion Puzzle Difficulty.xlsx new file mode 100644 index 0000000000000000000000000000000000000000..811a9aed4622e389f81b4242938b12c82e053807 GIT binary patch literal 13011 zcmeHNWka3GlExvpyE`PfySuvtcb9{EaEIVda0sr!A-DyH;0_5+aECo4GdpuLv%g^P z`S41guBZDg>*}gjlmUl82Y~{C0RaIa0pVb3kMjZr0SSTx0YL+S0edTAZ|7`k=d7>l z;b7{dOYd%LL!1WzMx6r!2JHXe-~VF{l&i|vcQe9wC@lJw0J1C$LM_v&@vk`TB&&&# zaT}v85~$hXpB|TgOt6At1jyu5o?cfIAPpQ8$*UtzaAt%HEn>ZzU$!(Jk@X(u_Z%k` zQdTcp)EexCQjC(gcI#Q_2dBihWkSP<^NT}0hs6#4cy4f8;E=1-+nJlFw*#jZ;C*=g z!Q}Xje<5K5wh^m$pfH`a^y*w&yBafxI(gNS7o8eq;&sCiMvY=~?H!TSI7aZ0P^ zqjLoRyD3djMU`THY%_QjVk2YfZKW{~Ha+ncrzC(0dPvgg&F8NQjP+E-x<{KGP550F zl9aR)#a8pJI&)_O!F|ikVxENCQ!~Bjh0)BeRrm0IZBfkhfp~D1k7DbH1igGv%)V7A z$cEf7aqMjC71M-5t*Ngu1Qo(t8{3-Sbfx^7WlcSm!;PfpPG_ zxKgN(KK6hL5QIXEz0j;9!uHtK(RH;jPlxgedfSh~eFwD4=Vx#b#s9F`1~o>q3!oy( z0!%TH%e}A0)ZjWG#=qa_8s*O-l(# z7I!S)=tXgzy_~&DlaThHc5RQPEo&;tl^I$i6Q4d6twA2A*T8*+R)`;h$(QD@-7lxL zYIIWxIxDPlR1s3$$dR+3FrMKzmt3@mAP~kSdpMPbG3aDuzEJ5sXhU*&i>sz$!DU%( zlnvk}_0Tu5`Ft*#(TVoxO(&l@s7%U=dc!;}F+h=X>8D-KdODKj(aZ6wr)==YP(UP6 z$trO9`lpeEuy(<^frEe~1J^kuAZOfd7~Jdu)<*XB)-Q`%x!R;%J~y&Y=hPGU84qNj zKLneu5Xg%3QK?nkkxbz*WU)IOr?qTC>7rk!F^pwvv$km~9tz%4&&HQ8X&X1^MU_!h zlyB+Nak?egnKct412~XaE?nZ$&`jzh*dZ%Kd(3vz8g|cziv42dg!xzDPAxzLr^ggO z&d}DEvomPPEs@n2A!NP@F8>%%=v}>-WKwS-)32(l6=Qp^F6R*l6{JWQK$0wzT_?J& zJBrKpPEuV7@?t5zY7wPk49UOjqxYe@8T~$n;PQDy*>^&892dfDepcbBd)VbwgYkLE zChr?#JScN-H2kCX(r?Y^6`G}F?><3Ic|92~b>Ha1u-`Lr!iQ_d^Eqbq5WL>=d!N+V zbEe-_{WxHOT`+4+5wz}uJi6rQG%<7)@B3DMVPgi)I1|(6@=aLhp`Q zX{Agd>F|2>V33XKX9X2^klGt<%K}&q=c1Zd2(;N8Aio10lN9&@d8FDb*A$XX0=BTi z!(E(l3bAB35UGL7aCK$Ae_L$Gd!I}2wc;qf&gGsKp`DeTqm8B)R|f`cT%`ZJ$@LY< zpyqWkN1Gx=7+fnTGXB+*=|e8W@O<|Cgi020 z+z>4$hg1c{ChZ$DZc6K4$Hk{#KTEr*!yjpn`y|GZh&&>CXs`1}ZW(h`02EuYJ$q!vt_H1E3RkZm>iOkUYwPGvb>n0on8o~9^bSHBg*vV_x97k85 zoQ;Q(+sy~Tr8;Lvw*&$!{Hy_~`i90Q4sP`ie0*2wb^Vzi9-#ltM*aB{Q_g|5*#cb1 za6w=|fj0VUE&IEr{<*G!0%K61rT_o_l`G51^fDs1!##yEx@EXxpe#5ukRGZXAi)gP z(=1Vvu=rlA;nB9}YJQbr0JjhEI2j#qy=Ft)1V_8DJRem}wFLUHUc`2naT?#~*Ip$->ms*@@xjjp@a|XC@5AvZcFy=%(IF283%H(Hx##Yb*$i6h~SOy^2a|c})#x zES-ba62H=sBjA_Vm5F-bu5qgFrZ}NdePMZdJAGC@+QkkML!4U&X`6X)PF>8!XEz5-dFsf2{E9iicFOETCeZF~%8yC7_f=AJuSGB2+} zno}5gM<>oJ|A|tGUinW`?Vi*W(%TI8@^~HAH79T*O~hD%8Ub#eNvB(G($cW`6_vVS z+ZN@w9gkx5VNFeO$M=3PJ+*_Mr4XTSLZtcCQ8Sh`hw$D!65DtNA}pDn<(I?WamY>g znWQHR;g}x~8xOH-Ryz}Zi3eoynJ*ogp*`o9nNpkvg;s|7x8#h!(XUILv}m|MyrbB# zS?lXPU2(Gz;uORXA2OK8`Wi}d3K?o-qWyu9vDx7a0?%S8ppt6$R6q|>1U<|S_GGI} zdynpM_C2hXugwaF&l4D6jWcnyo2$Ex=4{^uPCZ9PiAR=Ka~G55hFlu46R#yozu(Gq zCp|#ke8U8@7=C&PvHbOpV4)~}#q|Dl>Ndv)R9D~`viFC9TW8GLH`$0$_bzc&8v;L- z+QuPIhd+~F!e3txM@)+i|KB^AseZP_xp z0KbpV{nOpu)6wnY?cUw_$r_S?z=x^5jiV3WiR=%a`FEy!uCK?7Gl@c{dpa$>eQz)3 z{MPi=^z{77^*eaK?OizgEa>R7XQa*9w^isrUe-s=omUkf-1brE^Th8_a#a!eja2*E z4Kng3f5bCtGo81w4S^G#$2jP`PIMCJzJq&>!u}SIL?}qNOBA~SCZi(yJxO<^0ckmg zMrrlJA`CdNuUycSeVA6{%j-OW8zfq;#S6{G>Wb}z_X>urh$>yTnKjvR>ph{N1}lnH zCkf`S20YK$>es2X1(C^J-nL=)49%eqQVB+TSfrQ8QtLzBpCv`N$0TWkVTRCY(vTA> z4g1AWg)I4rDe|V+WWURjz8QsPLQbj7#TA1vi|Cb2Vf1s&@nH0#h)e$#2q13J6>&j~ z%cRL;3AS=x_YkZkpPKeoL=bJVruGbnkVDCR#dM5oR$_vZ_bt$hcv!awKIx6}j5jj4 z;W2KJQf-*hxlq)-cg;9WrJ=YqCX*F^s*1zsmJlm+l>FwpU3lx0vD$Nk(Z=J~^$3DU z`MLN6QG{PEw0cW!4G>}yGOSC~QJB)n#98F+Dsw|3!Y1)Ga=BQg%?UhbxJ0AAg-u2! zL|CVaSI%76OBU5Kr&h{*u;g(4{WiGy}ttXe>}Wo z+}_&g62c;QAuIKNfdJ(JlIi0a3#PY*l!i!7k{oY@I;2l6^bvjbMy9diFM(2?VN=Zy zLnj~=gDxnsF2N=h3zeJ%rP;?VvX3Ga8-EfD>GzCNr90lVd}qOj3H`(Y^btiYYD}zTNzUK_I8OkiSi^!u*q-%+$24K5~Uqom`JgO_whfJf* zPSgv7BLhl5?U4f?D6s#f~Qtca+`w-#9*8)c@Z|#9}pFBc`qGGl|&=HHeu3j z&=5Ye)<>YT5wXI)AhQ9RB`1N3fq)@WU=fW@_s1-NjS)W^eO}|vG1 zDxEjz){~0q_Q={s0$+fVE3wA*ru+Mlx};*Sf!MNGy1=;twf7hJE-I3^wfoGMHHM#^ zX9Xi#e(EuW@(bK_FQ+?CO&B_x{@duE^Tj0d4$ymJ~m(#`;DEN=))7HW&6WT@J97z1|;4 zd8KC9tjQ$ilBvJ5_i&aL5$;-vN?5p`op!-%VEP^%Ez3V$!Z0M?TZGr&{ha6T36(A^ zsvF-%mo!lPSwqhw(*T-!VR>)1V z67d^89V)4_Fvqvyp@C6wT`E%-6s8E<^CeCRf+MtF#J(c0-y@o&8l5Mr*dfobk=Axa zh?ID0FD|~$_Vqk>KAmb$^^{13>yA&>?@&DB%Z!>&C7(|Av*x5`^;VEfj6yMeWp@kr z=0RrZgD(KZb_ix*9{g6+CO4T#iff4$vkxXDuIaNGr~evd)PQ6+*$2!4e1gE$RLs|f z$`#mT@i%$_Mv7iO%p_!o2uad@ULV^OHkjgs5u&KqG)ikIa%;AFYK6msca@I`NEXiw zvzd4ZH@&8=sZmjVEp90uzhgBrU{0!2ita#ZiP+^lGdIf`cxz5No$Ym5O%cNcYI_yx zgO}(GTpm1XcYc~G2DM-fNGkd?&wY?&_udde@oqM^RpUf$1aoylU$?HApfomkE=Sd` zI)n(mWnB!eN{EJErzbSatl0cuE(cxzZO@#{k)C4Xg|(un6rd@DKDfckt$7i{q?b=uwA`EWau()oPKeObM^ zjKR?1b9T0ufVJjx`CTEFU~vhbAoT}Hc+HQ>4dWBaNJD?b`%_SXtX@Xp-grTjUDuN1 zkwGxMx5WG1F4affOZb}okZru3)(b5}r_JOsX;tDikjutVuGnte>!s-uZ6>r079A{OTsD23%6yTBvLCxWk7%e371>Qncl8EF&bwpDr}RoI>B z7(q>2R9ZU`mUBRLr0F8>r}>7_a26i!^N&f3t=KBgQT^Cnjr>lU6NW4!-I4ND z`}XuckvoIh^t-5k-K%S&H`bmO*~_0D;>(@BdZ;<+&E7oUmzquM@mHCSS*M+A_g`LJ z3R$JKdHWAjo}BGwE40<@u#hAkk3jad3cLA0v`t1qGnOnVwNN!%fsT>hq_d^ISxzLQ z+j687pkiK(oq*RCFdr!$V_XpG@*3mAM8&=QxqEE%w7hw9c}x07ILP>0 zcN(2&kre5oU2VRT)ry$|-(6KVtrRHgg=uU!KN_7z402-tdej-)r@^q=n8fD>NH5;{jOqqmfXo#Ym}| z{3$6_CVF}7ZX2v%8fnQ`t#8qGv3us+p_<8N-eTpcG`ZqPW!v4j87AXk)rN{Da_c0> z4?{7~6O3$}f`&uZge~7Sg+N59oPQOTn+&6;?QiW`~`iEWeo-_0jIn zI4A6d@@ylNor%oU(iYl1%F_WVt?8Q)QD;4*+csu=BEh>D={|g6meXpJ?}@0ZQ(CHL zc>@ElFvEUh>mts{cUnm$Fqrj4+ePrrfppf*-SBeTtQoYMKd+~QA7`=huA;Dg3K{j? z6y9JWyFuh~f>t!lS{oM?-Lo%^4fKliJY6ELVJEU`pmHwCr?OyIZ1s`HYMp%-TBLP@ zI3*p#>4Q5^9m5GRSIeq_Ir`(R9lFtAl*mX~{V!Mz8+V%>It$*8Cn&^O_YK22TDGoM z!DbD7)DZ3R`4fjL;b z>%u6mXJa7te3R2>jRT$!`D4j?8kTM_A!!>r#!l;(ds~$oCnTC^kKnX*@^eH{kCSsE zKglG1MnEH#DA~Jp+Vd;z#t~x0oorT3-SA`w&5yx0)gd33Axo1WG=^=gG?7C$-dHg1 zWQ%CB?{tD%R=1sKccRNhvaKkKUv?RJl+dIQx#>u@nF=<<7Bz|buqH6=@0=pP_5sL? z$j~H~Tw<(4zlF=vk~C8?+mw5_ z-dlsBX^-TI0J(%`XyDGtp6|4(OQ9eS8@=s4m9=XkHPKK4b4T8nLM5*U))& zwBzj(lS_@fP~l=16R*)x=yg&GqGvq-GqEe zI1$G~zDoMn(6{9mbfV?D>RwW}kK*Vvd#N!H=~?=+U2L$FTAd^7j~`lwIN_vo*!e#A zEXliIfaR029jC5lVzQj@K835+Td#BB)bme5=hBIO%Nl6>mK$wGNl)BuhjGF7LoBNx z?fU!Z{)&;0O79b|&gkP_5cw0SR>h-@5rdrY0)R082abpVsfJE*DEG0pBh$>{s1H&UMHvl}L@pR2~AwtYi=}VWKfqvCF=q zS6b$IV4QP%c@QEQzQ_h0R1&I7zjU&YaQ$7p2aa3e>vC*|pBD!hYcSoA>UDmn>j+0@ z)Msc@>B5Sxd!Wb6reD0vDxzl+pHumAp20C1E#IJ0$KNK{geGU|p zI>h0l37;L@uFsp4OvDxEEx^|9W2(YK_$9tP@ipIDvSzub%XeQ4aFx$OQf)D2McwBw zor>H_VOW5bGeY?K_v&LuBW`faN?NacwTcze#8Km#m9*#QEVG?OKro|)i0&v-CpJku zFlb1HvuA;|o-K+|*ha}ldrzs-9r%@+tXe&v`3GpUKbP(nRt=|@D0m%q0GkM-%5G9% z)FN&ch_x!62^*#ao>kW{PfZ18f!X?e`L$VdJ{* zCeU_9nhTrME4YDu7#;kgoA?eV#2bqrWuSQq3ssKyRtp`zwXn}`>@D}Ve;bYnrNg}s zZ|d4fz$%*Bww}+$^3bRKrax>Um3}qJLK1@VW)G0oHzJm4trm_;SMl`y7#ns^P)_6NH^J>08TvOYrdIW{8*G{y-S_elQs zELci@RNmHzG)j%p6ojN#Ambm=Z8GI>Y$u(F9J)grZ4T&X0NyrQNt`%3-arSPO=sBm z(KzeNQjn3Y2Ym9Q$lL6U&6uX*Ee^ukCaj~hGVl<@yQ*BRnDVBQh94;{we7kd+B6 z(IGKgSt~`vLdSg8WTLM-ApN2J$j;mEp2|;g)zX*7h3SsKjb9SRO_Hanj1ImHepd8J zQP1L-OvU-8d*-`&fbURb!Wnc|z;vB{pEYZ~^^! zWG_|Yd=Crg8UE=zggS2w7J&Z@0|N@OU%um|X7ooH;8zjpuVTQ@5>k0wmprf}E(k1% zi)`~qwSo&k_mW>vXE#6TJ? z@`&Vq*P@fySZ;$F=CVudl>i?gyj)dJs)0~jT^x(gEw1qj`&MGAf`7sX7&85nGY0Z{ z?>+#zvJCXBRKGam0CcC$rT`UFXXh8c%JADe6TOk8-J!~;{E{H@Q)UjVqlE_uA_i(P zERCfyawuW^{KqIG9`~$O1RQ^gt%k4cuoX?`>OOIVUY7cKkL;Gn&=EnqxuIhgzOKCI zqhpnGJ?O9~!fhd;5clqpBGRGOkp4pAx*H1HHud`6knD^46M*&gf#lW9>5lH;>AZG_ z#ThiC8I#CsZ-B3e=2D*KeZobT#^e2NCDE9x52P$uI7o>Xu6h)|_lnHtA2eMeH z;*O|D4<-wSYQ9qi9_spa;mxv6QO?=LY-Qc1G2B~oo8AqOjWkYL#8JYCBuQf#6eT>D zUeH;Ped^X|yUpco#SfG`vQP7FfuYC8|E~R5?~t+>fHhNVpp5@mIh_rSfB`eZ&)cs8 zn5vR}1|zojhx+Gt562)OAmPHar~#^$=|zS2p!BJ|xbuVTbbIyB9pmJMqi4032!89W z=PPNmD--NvXe#M4aio6VNJ7Jv)phWdFSc?&zXH_f=H*4BzY(J(NRjxe%$Gob_M<4dv=AzJe|=w`NqdjXxX4y#(<5$4nSKJta3T2_Y)bjE z?!5OvO=Kxq$M9CZYaBcy{w&0fBo zlS7Ap+?9>us-feCz~|GBORHW?eV&517N`)#T0gnAbN)pAfka>O8it7xGT*!8#2;@) zb!K8@SmXfXDEf`NaVns4@=2w#RnPL{msQ0cddclP>+(^6g{m08h4~?^9$^IlES_#$ zJt6{c&`LQ=3rR4TXGrsdb!(E`8thSGEf%F1reXQH$5XPrLpar%C>(>MJ>%8QX5mrQ}CLJanR}1N` zBq)IjDP!})L%4RF1wEWT9wWs(zHp_I+{Kx#LOQL^uuQ?V7bW%Vk;s{hS6kuWA z#NJpDVDI3>U~CUCec6=(&zb$V9uH()RJ^WC4z* zdh(M`M(0APM^`6uOBL#$;208|R;j+Xk$Qm|Lr z1fPqa6BqG!U7sxH6&MLN?dEiM?GJ#%xFL_PH}A%@KnpO%_NoExdnD&}M%U=4A>5p- zsM*;}r~*|HuB-|8Oo4>o_<06Vv|d7*iTEg`jOQIXwv}Q|;J^ZTPvC+>!7S_o^`Y!&6UaM3BHpdTd$?mvT#ZFm7pm-BpRYSW2HAM-cfXi zBxW0CkvbP)_z|h~aS!RSx0-+3Qq~V5FVfDkX#p_ia8ND%?>TL9Cq&6ks>;Ha(iYM~ z@g|4N#@pZWqkoupAS~;b_`LT+rO8h;)gaphRs43dn~?acko$W=-caflayU@`P=HGu z^56B((81xq>Ic-jKYp3pf*iVx)3!eMY+g|Q>qEajP-1-;qC;Jq`ck<97A@HoRu9Dp6S9ENDUR9DWk&1Gpa;HsYLUB=mDKQXnzHQ!)gOhE)2DywZv zb|8jfn@QP2r!MMMQy@a9$S1h@;pip{Uq0KI*j5*ElYCcP$7N(wa^qXQo|G9GvG>V9 zzcxRgJ}I-&$~rof4f>$p9fD#FYM<~+b$zrWPQ$+CY+zw3oU@<1tw!FBEizQ5^aUjk zT38L#(o9r?f~1x}-$N7~NN&7MYKSq{^_caw7=r{j*7trA12Dr4e8=yD;7?ZUl+!%D zBV4D0jHmLPOaAuUPGcN;X$p5#UIeWs-EqMxmp#Ge-jc2E)-ZZ=9{j3HUrkDGA>|MF z5oY-8neRzVR?@3O?`F?C8F``zPVcy&h;2e>?H}JK^u=9{(a;fcoF#GJl?e{GIqe4`lsC z3IgH-`;++pIG*)8&hMvm{z9q-=J@`vGdsVd{9cy(3k4G6UyF3V1N@#?{0krm|0lp- zX~y44e@{;QMe0TTi}d$Y#qS8eZ&Ch2Xe9rg2miWZ`5o~0$o?ii?c8AzZO Rzodx~KrDcUpvLg>_CHR+&fEY1 literal 0 HcmV?d00001 From 8af38d120502699bed7295f27d0811ceb479ee75 Mon Sep 17 00:00:00 2001 From: "Mr. J" <45538844+Ultraviolet-Ninja@users.noreply.github.com> Date: Wed, 23 Feb 2022 13:32:25 -0600 Subject: [PATCH 28/86] Changed access of some methods in Widget Created a map inside LogicOperator mapping the string symbols to the enum --- src/main/java/bomb/Widget.java | 22 +++++--- .../java/bomb/tools/logic/LogicOperator.java | 55 ++++++++++++++----- 2 files changed, 55 insertions(+), 22 deletions(-) diff --git a/src/main/java/bomb/Widget.java b/src/main/java/bomb/Widget.java index c119e564..fd5c8901 100644 --- a/src/main/java/bomb/Widget.java +++ b/src/main/java/bomb/Widget.java @@ -112,6 +112,10 @@ public static int getPortQuantity(@NotNull Port which) { return portArray[which.ordinal()]; } + public static String getSerialCode() { + return serialCode; + } + public static int countPortTypes() { return (int) stream(portArray) .filter(port -> port > 0) @@ -138,7 +142,7 @@ public static String getTwoFactor() { return twoFactor; } - public static void checkSerialCode() throws IllegalArgumentException { + protected static void checkSerialCode() throws IllegalArgumentException { SERIAL_CODE_PATTERN.loadText(serialCode); if (!SERIAL_CODE_PATTERN.matchesRegex()) throw new IllegalArgumentException(""" @@ -161,7 +165,7 @@ protected static boolean hasEvenNumberInSerialCode() { * * @return An int of the last digit from a String */ - protected static int getSerialCodeLastDigit() { + public static int getSerialCodeLastDigit() { return Character.getNumericValue(serialCode.charAt(serialCode.length() - 1)); } @@ -184,7 +188,7 @@ protected static boolean hasFollowingIndicators(Indicator @NotNull ... indicator * @param ind The Indicator to check * @return True if the Indicator is found */ - protected static boolean hasIndicator(@NotNull Indicator ind) { + public static boolean hasIndicator(@NotNull Indicator ind) { return hasLitIndicator(ind) || hasUnlitIndicator(ind); } @@ -208,7 +212,7 @@ protected static boolean hasUnlitIndicator(@NotNull Indicator ind) { return INDICATOR_ARRAY[ind.ordinal()].getState() == OFF; } - protected static boolean hasVowelInSerialCode() { + public static boolean hasVowelInSerialCode() { return !EMPTY_FILTER_RESULTS.test(serialCode, VOWEL_FILTER); } @@ -217,7 +221,7 @@ protected static boolean hasVowelInSerialCode() { * * @return The number of letters */ - protected static int countLettersInSerialCode() { + public static int countLettersInSerialCode() { return filter(serialCode, CHAR_FILTER).length(); } @@ -226,7 +230,7 @@ protected static int countLettersInSerialCode() { * * @return The number of numbers */ - protected static int countNumbersInSerialCode() { + public static int countNumbersInSerialCode() { return filter(serialCode, NUMBER_PATTERN).length(); } @@ -241,7 +245,7 @@ protected static boolean hasMorePortsThanSpecified(@NotNull Port port, int howMa return portArray[port.ordinal()] > howMany; } - protected static int calculateTotalPorts() { + public static int calculateTotalPorts() { return stream(portArray).sum(); } @@ -257,7 +261,7 @@ protected static EnumSet getFilteredSetOfIndicators(IndicatorFilter f EnumSet.copyOf(tempList); } - protected static boolean doesPortExists(@NotNull Port port) { + public static boolean doesPortExists(@NotNull Port port) { return portArray[port.ordinal()] > 0; } @@ -267,7 +271,7 @@ protected static boolean doesPortExists(@NotNull Port port) { * @param filter Indicates what indicators should be counted, whether ON, OFF or both * @return The number of indicators */ - protected static int countIndicators(IndicatorFilter filter) { + public static int countIndicators(IndicatorFilter filter) { return getFilteredSetOfIndicators(filter).size(); } diff --git a/src/main/java/bomb/tools/logic/LogicOperator.java b/src/main/java/bomb/tools/logic/LogicOperator.java index 8effe2c1..57c569c6 100644 --- a/src/main/java/bomb/tools/logic/LogicOperator.java +++ b/src/main/java/bomb/tools/logic/LogicOperator.java @@ -1,58 +1,87 @@ package bomb.tools.logic; +import java.util.EnumSet; +import java.util.Map; +import java.util.TreeMap; + +import static java.util.function.UnaryOperator.identity; +import static java.util.stream.Collectors.toMap; + public enum LogicOperator implements BooleanOperation { - AND { + NOT { @Override public boolean test(boolean bitOne, boolean bitTwo) { - return bitOne && bitTwo; + return !bitOne; } }, - OR { + AND("∧") { @Override public boolean test(boolean bitOne, boolean bitTwo) { - return bitOne || bitTwo; + return bitOne && bitTwo; } }, - XOR { + OR("∨") { @Override public boolean test(boolean bitOne, boolean bitTwo) { - return ((bitOne && !bitTwo) || (!bitOne && bitTwo)); + return bitOne || bitTwo; } }, - NOT { + XOR("âŠģ") { @Override public boolean test(boolean bitOne, boolean bitTwo) { - return !bitOne; + return ((bitOne && !bitTwo) || (!bitOne && bitTwo)); } }, - NOR { + NOR("↓") { @Override public boolean test(boolean bitOne, boolean bitTwo) { return !OR.test(bitOne, bitTwo); } }, - NAND { + NAND("|") { @Override public boolean test(boolean bitOne, boolean bitTwo) { return !AND.test(bitOne, bitTwo); } }, - XNOR { + XNOR("↔") { @Override public boolean test(boolean bitOne, boolean bitTwo) { return !XOR.test(bitOne, bitTwo); } }, - IMPLIES { + IMPLIES("→") { @Override public boolean test(boolean bitOne, boolean bitTwo) { return !(bitOne && !bitTwo); } }, - IMPLIED_BY { + IMPLIED_BY("←") { @Override public boolean test(boolean bitOne, boolean bitTwo) { return !(!bitOne && bitTwo); } + }; + + private final String symbol; + + LogicOperator() { + symbol = null; + } + + LogicOperator(String symbol) { + this.symbol = symbol; + } + + public static final Map LOGIC_SYMBOL_TO_ENUM_MAP; + + static { + LOGIC_SYMBOL_TO_ENUM_MAP = new TreeMap<>(EnumSet.range(AND, IMPLIED_BY) + .stream() + .collect(toMap( + logicSymbol -> logicSymbol.symbol, + identity() + )) + ); } } From bdf68a508391215de8de0c2f75b3279faa6b7521 Mon Sep 17 00:00:00 2001 From: "Mr. J" <45538844+Ultraviolet-Ninja@users.noreply.github.com> Date: Wed, 23 Feb 2022 14:22:33 -0600 Subject: [PATCH 29/86] Finished draft of Logic --- .../bomb/modules/il/logic/LetterRecord.java | 10 + .../java/bomb/modules/il/logic/Logic.java | 47 +++++ .../bomb/modules/il/logic/LogicLetter.java | 190 ++++++++++++++++++ 3 files changed, 247 insertions(+) create mode 100644 src/main/java/bomb/modules/il/logic/LetterRecord.java create mode 100644 src/main/java/bomb/modules/il/logic/Logic.java create mode 100644 src/main/java/bomb/modules/il/logic/LogicLetter.java diff --git a/src/main/java/bomb/modules/il/logic/LetterRecord.java b/src/main/java/bomb/modules/il/logic/LetterRecord.java new file mode 100644 index 00000000..18174f06 --- /dev/null +++ b/src/main/java/bomb/modules/il/logic/LetterRecord.java @@ -0,0 +1,10 @@ +package bomb.modules.il.logic; + +import org.jetbrains.annotations.NotNull; + +public record LetterRecord(boolean isNegated, @NotNull LogicLetter letter) { + public boolean getBooleanValue() { + return ((isNegated && !letter.getAsBoolean()) || + (!isNegated && letter.getAsBoolean())); + } +} diff --git a/src/main/java/bomb/modules/il/logic/Logic.java b/src/main/java/bomb/modules/il/logic/Logic.java new file mode 100644 index 00000000..80ebfc99 --- /dev/null +++ b/src/main/java/bomb/modules/il/logic/Logic.java @@ -0,0 +1,47 @@ +package bomb.modules.il.logic; + +import bomb.Widget; +import bomb.tools.logic.LogicOperator; +import org.jetbrains.annotations.NotNull; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + +import static java.util.Arrays.asList; + +public class Logic extends Widget { + public static boolean solve(@NotNull LetterRecord @NotNull[] letters, + @NotNull LogicOperator @NotNull[] intermediateOperators, + boolean isPriorityOnFirstTwo) throws IllegalArgumentException { + checkSerialCode(); + List letterList = new ArrayList<>(asList(letters)); + List operators = new ArrayList<>(asList(intermediateOperators)); + + validateInput(letterList, operators); + if (!isPriorityOnFirstTwo) { + Collections.reverse(operators); + LetterRecord lastRecord = letterList.remove(0); + letterList.add(lastRecord); + } + + boolean firstHalf = operators.get(0).test( + letterList.get(0).getBooleanValue(), + letterList.get(1).getBooleanValue() + ); + + return operators.get(1).test( + firstHalf, + letterList.get(2).getBooleanValue() + ); + } + + private static void validateInput(List letters, List intermediateOperators) + throws IllegalArgumentException { + if (letters.size() != 3) + throw new IllegalArgumentException("There must be 3 letters in the array"); + + if (intermediateOperators.size() != 2) + throw new IllegalArgumentException("There must be 2 operators in the array"); + } +} diff --git a/src/main/java/bomb/modules/il/logic/LogicLetter.java b/src/main/java/bomb/modules/il/logic/LogicLetter.java new file mode 100644 index 00000000..3e3f17d1 --- /dev/null +++ b/src/main/java/bomb/modules/il/logic/LogicLetter.java @@ -0,0 +1,190 @@ +package bomb.modules.il.logic; + +import bomb.Widget; +import bomb.enumerations.Port; + +import java.util.function.BooleanSupplier; + +import static bomb.Widget.IndicatorFilter.ALL_PRESENT; +import static bomb.Widget.IndicatorFilter.LIT; +import static bomb.Widget.IndicatorFilter.UNLIT; +import static bomb.enumerations.Indicator.FRK; +import static bomb.enumerations.Indicator.IND; +import static bomb.enumerations.Indicator.MSA; +import static bomb.enumerations.Port.PARALLEL; +import static bomb.enumerations.Port.PS2; +import static bomb.tools.filter.RegexFilter.NUMBER_PATTERN; +import static bomb.tools.filter.RegexFilter.filter; + +public enum LogicLetter implements BooleanSupplier { + A { + @Override + public boolean getAsBoolean() { + return Widget.getAllBatteries() == Widget.countIndicators(ALL_PRESENT); + } + }, + B { + @Override + public boolean getAsBoolean() { + return Widget.countLettersInSerialCode() > Widget.countLettersInSerialCode(); + } + }, + C { + @Override + public boolean getAsBoolean() { + return Widget.hasIndicator(IND); + } + }, + D { + @Override + public boolean getAsBoolean() { + return Widget.hasIndicator(FRK); + } + }, + E { + @Override + public boolean getAsBoolean() { + return Widget.countIndicators(UNLIT) == 1; + } + }, + F { + @Override + public boolean getAsBoolean() { + return Widget.countPortTypes() > 1; + } + }, + G { + @Override + public boolean getAsBoolean() { + return Widget.getAllBatteries() >= 2; + } + }, + H { + @Override + public boolean getAsBoolean() { + return !G.getAsBoolean(); + } + }, + I { + @Override + public boolean getAsBoolean() { + return Widget.getSerialCodeLastDigit() % 2 == 1; + } + }, + J { + @Override + public boolean getAsBoolean() { + return Widget.getAllBatteries() > 4; + } + }, + K { + @Override + public boolean getAsBoolean() { + return Widget.countIndicators(LIT) == 1; + } + }, + L { + @Override + public boolean getAsBoolean() { + return Widget.countIndicators(ALL_PRESENT) > 2; + } + }, + M { + @Override + public boolean getAsBoolean() { + Port[] ports = Port.values(); + + for (Port port : ports) { + int count = Widget.getPortQuantity(port); + if (count > 1) + return false; + } + + return true; + } + }, + N { + @Override + public boolean getAsBoolean() { + return Widget.getNumHolders() > 2; + } + }, + O { + @Override + public boolean getAsBoolean() { + return Widget.countIndicators(LIT) > 0 && + Widget.countIndicators(UNLIT) > 0; + } + }, + P { + @Override + public boolean getAsBoolean() { + return Widget.doesPortExists(PARALLEL); + } + }, + Q { + @Override + public boolean getAsBoolean() { + return Widget.calculateTotalPorts() == 2; + } + }, + R { + @Override + public boolean getAsBoolean() { + return Widget.doesPortExists(PS2); + } + }, + S { + @Override + public boolean getAsBoolean() { + int count = filter(Widget.getSerialCode(), NUMBER_PATTERN) + .chars() + .mapToObj(i->(char)i) + .mapToInt(Character::getNumericValue) + .sum(); + return count > 10; + } + }, + T { + @Override + public boolean getAsBoolean() { + return Widget.hasIndicator(MSA); + } + }, + U { + @Override + public boolean getAsBoolean() { + return Widget.getNumHolders() == 1; + } + }, + V { + @Override + public boolean getAsBoolean() { + return Widget.hasVowelInSerialCode(); + } + }, + W { + @Override + public boolean getAsBoolean() { + return Widget.countIndicators(ALL_PRESENT) == 1; + } + }, + X { + @Override + public boolean getAsBoolean() { + return Widget.countIndicators(ALL_PRESENT) == 0; + } + }, + Y { + @Override + public boolean getAsBoolean() { + return Widget.calculateTotalPorts() > 5; + } + }, + Z { + @Override + public boolean getAsBoolean() { + return Widget.calculateTotalPorts() < 2; + } + } +} From 968998838cb48deb81d4fec46e10a59c9c459393 Mon Sep 17 00:00:00 2001 From: "Mr. J" <45538844+Ultraviolet-Ninja@users.noreply.github.com> Date: Wed, 23 Feb 2022 14:32:15 -0600 Subject: [PATCH 30/86] Created LogicTest --- .../java/bomb/modules/il/logic/LogicTest.java | 162 ++++++++++++++++++ 1 file changed, 162 insertions(+) create mode 100644 src/test/java/bomb/modules/il/logic/LogicTest.java diff --git a/src/test/java/bomb/modules/il/logic/LogicTest.java b/src/test/java/bomb/modules/il/logic/LogicTest.java new file mode 100644 index 00000000..359654f1 --- /dev/null +++ b/src/test/java/bomb/modules/il/logic/LogicTest.java @@ -0,0 +1,162 @@ +package bomb.modules.il.logic; + +import bomb.Widget; +import bomb.tools.logic.LogicOperator; +import org.testng.annotations.AfterClass; +import org.testng.annotations.BeforeMethod; +import org.testng.annotations.DataProvider; +import org.testng.annotations.Test; + +import static bomb.enumerations.Indicator.CAR; +import static bomb.enumerations.Indicator.FRK; +import static bomb.enumerations.Indicator.NSA; +import static bomb.enumerations.Port.DVI; +import static bomb.enumerations.Port.PS2; +import static bomb.enumerations.Port.RJ45; +import static bomb.enumerations.TrinarySwitch.OFF; +import static bomb.enumerations.TrinarySwitch.ON; +import static bomb.modules.il.logic.LogicLetter.A; +import static bomb.modules.il.logic.LogicLetter.B; +import static bomb.modules.il.logic.LogicLetter.C; +import static bomb.modules.il.logic.LogicLetter.D; +import static bomb.modules.il.logic.LogicLetter.E; +import static bomb.modules.il.logic.LogicLetter.G; +import static bomb.modules.il.logic.LogicLetter.H; +import static bomb.modules.il.logic.LogicLetter.I; +import static bomb.modules.il.logic.LogicLetter.L; +import static bomb.modules.il.logic.LogicLetter.N; +import static bomb.modules.il.logic.LogicLetter.O; +import static bomb.modules.il.logic.LogicLetter.P; +import static bomb.modules.il.logic.LogicLetter.T; +import static bomb.modules.il.logic.LogicLetter.U; +import static bomb.tools.logic.LogicOperator.AND; +import static bomb.tools.logic.LogicOperator.IMPLIED_BY; +import static bomb.tools.logic.LogicOperator.IMPLIES; +import static bomb.tools.logic.LogicOperator.OR; +import static bomb.tools.logic.LogicOperator.XNOR; +import static bomb.tools.logic.LogicOperator.XOR; +import static org.testng.Assert.assertEquals; + +public class LogicTest { + @BeforeMethod + public void setUp() { + Widget.resetProperties(); + } + + @Test(expectedExceptions = IllegalArgumentException.class, + expectedExceptionsMessageRegExp = "Serial Code is required\n.*") + public void serialCodeExceptionTest() { + Logic.solve(new LetterRecord[]{}, new LogicOperator[]{}, false); + } + + @DataProvider + public Object[][] exceptionTestProvider() { + LetterRecord a = recordOf(false, A); + LetterRecord b = recordOf(false, B); + LetterRecord c = recordOf(true, C); + LetterRecord d = recordOf(true, D); + + return new Object[][] { + {new LetterRecord[]{a}, new LogicOperator[]{XOR}}, + {new LetterRecord[]{a, b, c, d}, new LogicOperator[]{XOR}}, + {new LetterRecord[]{a, b, c}, new LogicOperator[]{XOR}}, + {new LetterRecord[]{a, b, c}, new LogicOperator[]{XOR, AND, AND}} + }; + } + + @Test(dataProvider = "exceptionTestProvider", expectedExceptions = IllegalArgumentException.class) + public void exceptionTest(LetterRecord[] letters, LogicOperator[] operators) { + Widget.setSerialCode("VX1GJ6"); + + Logic.solve(letters, operators, false); + } + + @DataProvider + public Object[][] videoTestProvider() { + return new Object[][] { + {new LetterRecord[]{recordOf(false, G), recordOf(true, E), recordOf(true, G)}, + new LogicOperator[]{XNOR, XOR}, false, true}, + + {new LetterRecord[]{recordOf(false, O), recordOf(true, C), recordOf(false, C)}, + new LogicOperator[]{OR, XNOR}, true, false}, + + {new LetterRecord[]{recordOf(true, I), recordOf(false, U), recordOf(false, I)}, + new LogicOperator[]{XNOR, IMPLIES}, false, true}, + + {new LetterRecord[]{recordOf(false, T), recordOf(true, L), recordOf(true, A)}, + new LogicOperator[]{AND, AND}, false, false} + }; + } + + @Test(dataProvider = "videoTestProvider") + public void videoTest(LetterRecord[] letters, LogicOperator[] operators, + boolean priorityToggle, boolean expected) { + firstEdgeWorkSetup(); + + boolean actual = Logic.solve(letters, operators, priorityToggle); + + assertEquals(actual, expected); + } + + private static void firstEdgeWorkSetup() { + Widget.setDBatteries(2); + Widget.setDoubleAs(2); + Widget.setNumHolders(3); + Widget.setPortValue(DVI, 3); + Widget.setPortValue(PS2, 2); + Widget.setPortValue(RJ45, 2); + Widget.setNumberOfPlates(4); + Widget.setSerialCode("VX1GJ6"); + } + + @DataProvider + public Object[][] videoSecondTestProvider() { + return new Object[][] { + {new LetterRecord[]{recordOf(true, I), recordOf(false, P), recordOf(false, T)}, + new LogicOperator[]{AND, IMPLIED_BY}, false, false}, + + {new LetterRecord[]{recordOf(true, N), recordOf(false, B), recordOf(true, D)}, + new LogicOperator[]{IMPLIED_BY, IMPLIED_BY}, false, false}, +// {new LetterRecord[]{}, new LogicOperator[]{}, , }, +// {new LetterRecord[]{}, new LogicOperator[]{}, , }, +// {new LetterRecord[]{}, new LogicOperator[]{}, , }, +// {new LetterRecord[]{}, new LogicOperator[]{}, , }, +// {new LetterRecord[]{}, new LogicOperator[]{}, , }, +// {new LetterRecord[]{}, new LogicOperator[]{}, , }, +// {new LetterRecord[]{}, new LogicOperator[]{}, , }, +// {new LetterRecord[]{}, new LogicOperator[]{}, , }, +// {new LetterRecord[]{}, new LogicOperator[]{}, , }, +// {new LetterRecord[]{}, new LogicOperator[]{}, , }, +// {new LetterRecord[]{}, new LogicOperator[]{}, , } + }; + } + + @Test(enabled = false, dataProvider = "videoSecondTestProvider") + public void videoSecondTest(LetterRecord[] letters, LogicOperator[] operators, + boolean priorityToggle, boolean expected) { + secondEdgeWorkSetup(); + + boolean actual = Logic.solve(letters, operators, priorityToggle); + + assertEquals(actual, expected); + } + + private static void secondEdgeWorkSetup() { + Widget.setDBatteries(3); + Widget.setDoubleAs(2); + Widget.setNumHolders(4); + Widget.setSerialCode("AD4MB7"); + Widget.setIndicator(ON, FRK); + Widget.setIndicator(OFF, CAR); + Widget.setIndicator(OFF, NSA); + } + + private static LetterRecord recordOf(boolean isNegated, LogicLetter letter) { + return new LetterRecord(isNegated, letter); + } + + @AfterClass + public void tearDown() { + Widget.resetProperties(); + } +} From 63f7cb68fd7d3044f83b3a74686c85fe5997514b Mon Sep 17 00:00:00 2001 From: "Mr. J" <45538844+Ultraviolet-Ninja@users.noreply.github.com> Date: Wed, 23 Feb 2022 15:40:29 -0600 Subject: [PATCH 31/86] Added more tests --- .../java/bomb/modules/il/logic/Logic.java | 13 ++++- .../java/bomb/modules/il/logic/LogicTest.java | 58 ++++++++++++++----- 2 files changed, 56 insertions(+), 15 deletions(-) diff --git a/src/main/java/bomb/modules/il/logic/Logic.java b/src/main/java/bomb/modules/il/logic/Logic.java index 80ebfc99..393d2ee8 100644 --- a/src/main/java/bomb/modules/il/logic/Logic.java +++ b/src/main/java/bomb/modules/il/logic/Logic.java @@ -8,6 +8,8 @@ import java.util.Collections; import java.util.List; +import static bomb.tools.logic.LogicOperator.IMPLIED_BY; +import static bomb.tools.logic.LogicOperator.IMPLIES; import static java.util.Arrays.asList; public class Logic extends Widget { @@ -19,10 +21,19 @@ public static boolean solve(@NotNull LetterRecord @NotNull[] letters, List operators = new ArrayList<>(asList(intermediateOperators)); validateInput(letterList, operators); + if (!isPriorityOnFirstTwo) { - Collections.reverse(operators); LetterRecord lastRecord = letterList.remove(0); letterList.add(lastRecord); + + Collections.reverse(operators); + LogicOperator reversedOperator = operators.get(1); + + if (reversedOperator == IMPLIES) { + operators.set(1, IMPLIED_BY); + } else if (reversedOperator == IMPLIED_BY) { + operators.set(1, IMPLIES); + } } boolean firstHalf = operators.get(0).test( diff --git a/src/test/java/bomb/modules/il/logic/LogicTest.java b/src/test/java/bomb/modules/il/logic/LogicTest.java index 359654f1..c4877b28 100644 --- a/src/test/java/bomb/modules/il/logic/LogicTest.java +++ b/src/test/java/bomb/modules/il/logic/LogicTest.java @@ -20,18 +20,29 @@ import static bomb.modules.il.logic.LogicLetter.C; import static bomb.modules.il.logic.LogicLetter.D; import static bomb.modules.il.logic.LogicLetter.E; +import static bomb.modules.il.logic.LogicLetter.F; import static bomb.modules.il.logic.LogicLetter.G; -import static bomb.modules.il.logic.LogicLetter.H; import static bomb.modules.il.logic.LogicLetter.I; +import static bomb.modules.il.logic.LogicLetter.J; +import static bomb.modules.il.logic.LogicLetter.K; import static bomb.modules.il.logic.LogicLetter.L; import static bomb.modules.il.logic.LogicLetter.N; import static bomb.modules.il.logic.LogicLetter.O; import static bomb.modules.il.logic.LogicLetter.P; +import static bomb.modules.il.logic.LogicLetter.Q; +import static bomb.modules.il.logic.LogicLetter.R; +import static bomb.modules.il.logic.LogicLetter.S; import static bomb.modules.il.logic.LogicLetter.T; import static bomb.modules.il.logic.LogicLetter.U; +import static bomb.modules.il.logic.LogicLetter.V; +import static bomb.modules.il.logic.LogicLetter.W; +import static bomb.modules.il.logic.LogicLetter.X; +import static bomb.modules.il.logic.LogicLetter.Y; import static bomb.tools.logic.LogicOperator.AND; import static bomb.tools.logic.LogicOperator.IMPLIED_BY; import static bomb.tools.logic.LogicOperator.IMPLIES; +import static bomb.tools.logic.LogicOperator.NAND; +import static bomb.tools.logic.LogicOperator.NOR; import static bomb.tools.logic.LogicOperator.OR; import static bomb.tools.logic.LogicOperator.XNOR; import static bomb.tools.logic.LogicOperator.XOR; @@ -117,23 +128,42 @@ public Object[][] videoSecondTestProvider() { {new LetterRecord[]{recordOf(true, N), recordOf(false, B), recordOf(true, D)}, new LogicOperator[]{IMPLIED_BY, IMPLIED_BY}, false, false}, -// {new LetterRecord[]{}, new LogicOperator[]{}, , }, -// {new LetterRecord[]{}, new LogicOperator[]{}, , }, -// {new LetterRecord[]{}, new LogicOperator[]{}, , }, -// {new LetterRecord[]{}, new LogicOperator[]{}, , }, -// {new LetterRecord[]{}, new LogicOperator[]{}, , }, -// {new LetterRecord[]{}, new LogicOperator[]{}, , }, -// {new LetterRecord[]{}, new LogicOperator[]{}, , }, -// {new LetterRecord[]{}, new LogicOperator[]{}, , }, -// {new LetterRecord[]{}, new LogicOperator[]{}, , }, -// {new LetterRecord[]{}, new LogicOperator[]{}, , }, -// {new LetterRecord[]{}, new LogicOperator[]{}, , } + + {new LetterRecord[]{recordOf(true, N), recordOf(false, Q), recordOf(false, C)}, + new LogicOperator[]{XOR, NOR}, true, true}, + + {new LetterRecord[]{recordOf(false, J), recordOf(false, F), recordOf(true, G)}, + new LogicOperator[]{IMPLIED_BY, XOR}, true, true}, + + {new LetterRecord[]{recordOf(true, E), recordOf(true, W), recordOf(false, X)}, + new LogicOperator[]{IMPLIES, AND}, true, false}, + + {new LetterRecord[]{recordOf(false, C), recordOf(true, S), recordOf(true, L)}, + new LogicOperator[]{IMPLIED_BY, NAND}, true, true}, + + {new LetterRecord[]{recordOf(false, W), recordOf(false, X), recordOf(false, R)}, + new LogicOperator[]{NOR, NAND}, false, false}, + + {new LetterRecord[]{recordOf(true, B), recordOf(false, C), recordOf(true, I)}, + new LogicOperator[]{IMPLIED_BY, NAND}, true, true}, + +// {new LetterRecord[]{recordOf(true, Y), recordOf(true, E), recordOf(false, B)}, +// new LogicOperator[]{IMPLIED_BY, XOR}, true, false}, //TODO + + {new LetterRecord[]{recordOf(true, W), recordOf(true, W), recordOf(true, X)}, + new LogicOperator[]{OR, OR}, false, true}, + + {new LetterRecord[]{recordOf(true, E), recordOf(true, V), recordOf(false, K)}, + new LogicOperator[]{NOR, NAND}, false, false}, + + {new LetterRecord[]{recordOf(true, R), recordOf(true, J), recordOf(true, E)}, + new LogicOperator[]{NAND, AND}, false, true} }; } - @Test(enabled = false, dataProvider = "videoSecondTestProvider") + @Test(dataProvider = "videoSecondTestProvider") public void videoSecondTest(LetterRecord[] letters, LogicOperator[] operators, - boolean priorityToggle, boolean expected) { + boolean priorityToggle, boolean expected) { secondEdgeWorkSetup(); boolean actual = Logic.solve(letters, operators, priorityToggle); From 1bc756fbd3ca9aff3cd7be351304c31060907e50 Mon Sep 17 00:00:00 2001 From: "Mr. J" <45538844+Ultraviolet-Ninja@users.noreply.github.com> Date: Wed, 23 Feb 2022 16:35:09 -0600 Subject: [PATCH 32/86] Added LogicTest to the test suite for jacoco and updated Progress.md --- Progress.md | 6 +++--- src/test/resources/suites/suiteTwo.xml | 1 + 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/Progress.md b/Progress.md index 93af5fe5..05aefcb9 100644 --- a/Progress.md +++ b/Progress.md @@ -30,6 +30,7 @@ - Cheap Checkout - Color Flash - Ice Cream +- Logic - Morsematics - Murder - Translated Vanilla Modules (9/15 Supported languages) @@ -38,7 +39,7 @@ - Square Button - Word Search -12/100 +13/100 ### Untouched Modules - 3D Maze @@ -70,7 +71,6 @@ - Letter Keys - Light Cycle - Listening -- Logic Gates - Math is Hard - MineSweeper - Modules Against Humanity @@ -109,4 +109,4 @@ - Yahtzee - Zoo -67/100 +66/100 diff --git a/src/test/resources/suites/suiteTwo.xml b/src/test/resources/suites/suiteTwo.xml index e066bb20..04745bfb 100644 --- a/src/test/resources/suites/suiteTwo.xml +++ b/src/test/resources/suites/suiteTwo.xml @@ -18,6 +18,7 @@ + From 807e389cf4ffbbc3f08e6f7f4a2b74618fd19f4d Mon Sep 17 00:00:00 2001 From: "Mr. J" <45538844+Ultraviolet-Ninja@users.noreply.github.com> Date: Wed, 23 Feb 2022 21:19:56 -0600 Subject: [PATCH 33/86] Minor update to the Trie --- src/main/java/bomb/tools/data/structures/trie/Trie.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/bomb/tools/data/structures/trie/Trie.java b/src/main/java/bomb/tools/data/structures/trie/Trie.java index 8442fb5c..075e4f92 100644 --- a/src/main/java/bomb/tools/data/structures/trie/Trie.java +++ b/src/main/java/bomb/tools/data/structures/trie/Trie.java @@ -25,7 +25,7 @@ public Trie(@NotNull Collection startWords) { public void addWords(@NotNull Collection words) { for (String word : words) - addWord(word); + addWord(word.toLowerCase(), 0, root); } public void addWord(final @NotNull String word) { From a6051ae6cba27d76f9dea777e5720575f865f163 Mon Sep 17 00:00:00 2001 From: "Mr. J" <45538844+Ultraviolet-Ninja@users.noreply.github.com> Date: Fri, 25 Feb 2022 09:04:33 -0600 Subject: [PATCH 34/86] Found the bug --- src/main/java/bomb/modules/il/logic/LogicLetter.java | 2 +- src/test/java/bomb/modules/il/logic/LogicTest.java | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/bomb/modules/il/logic/LogicLetter.java b/src/main/java/bomb/modules/il/logic/LogicLetter.java index 3e3f17d1..035e454c 100644 --- a/src/main/java/bomb/modules/il/logic/LogicLetter.java +++ b/src/main/java/bomb/modules/il/logic/LogicLetter.java @@ -26,7 +26,7 @@ public boolean getAsBoolean() { B { @Override public boolean getAsBoolean() { - return Widget.countLettersInSerialCode() > Widget.countLettersInSerialCode(); + return Widget.countLettersInSerialCode() > Widget.countNumbersInSerialCode(); } }, C { diff --git a/src/test/java/bomb/modules/il/logic/LogicTest.java b/src/test/java/bomb/modules/il/logic/LogicTest.java index c4877b28..adf35ce7 100644 --- a/src/test/java/bomb/modules/il/logic/LogicTest.java +++ b/src/test/java/bomb/modules/il/logic/LogicTest.java @@ -147,8 +147,8 @@ public Object[][] videoSecondTestProvider() { {new LetterRecord[]{recordOf(true, B), recordOf(false, C), recordOf(true, I)}, new LogicOperator[]{IMPLIED_BY, NAND}, true, true}, -// {new LetterRecord[]{recordOf(true, Y), recordOf(true, E), recordOf(false, B)}, -// new LogicOperator[]{IMPLIED_BY, XOR}, true, false}, //TODO + {new LetterRecord[]{recordOf(true, Y), recordOf(true, E), recordOf(false, B)}, + new LogicOperator[]{IMPLIED_BY, XOR}, true, false}, {new LetterRecord[]{recordOf(true, W), recordOf(true, W), recordOf(true, X)}, new LogicOperator[]{OR, OR}, false, true}, From f8c18559d04f03d47245273a9becfb979b490c87 Mon Sep 17 00:00:00 2001 From: "Mr. J" <45538844+Ultraviolet-Ninja@users.noreply.github.com> Date: Fri, 25 Feb 2022 09:15:31 -0600 Subject: [PATCH 35/86] Created an extra test to check H and Z --- src/test/java/bomb/modules/il/logic/LogicTest.java | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/test/java/bomb/modules/il/logic/LogicTest.java b/src/test/java/bomb/modules/il/logic/LogicTest.java index adf35ce7..24e9b3a1 100644 --- a/src/test/java/bomb/modules/il/logic/LogicTest.java +++ b/src/test/java/bomb/modules/il/logic/LogicTest.java @@ -22,6 +22,7 @@ import static bomb.modules.il.logic.LogicLetter.E; import static bomb.modules.il.logic.LogicLetter.F; import static bomb.modules.il.logic.LogicLetter.G; +import static bomb.modules.il.logic.LogicLetter.H; import static bomb.modules.il.logic.LogicLetter.I; import static bomb.modules.il.logic.LogicLetter.J; import static bomb.modules.il.logic.LogicLetter.K; @@ -38,6 +39,7 @@ import static bomb.modules.il.logic.LogicLetter.W; import static bomb.modules.il.logic.LogicLetter.X; import static bomb.modules.il.logic.LogicLetter.Y; +import static bomb.modules.il.logic.LogicLetter.Z; import static bomb.tools.logic.LogicOperator.AND; import static bomb.tools.logic.LogicOperator.IMPLIED_BY; import static bomb.tools.logic.LogicOperator.IMPLIES; @@ -47,6 +49,7 @@ import static bomb.tools.logic.LogicOperator.XNOR; import static bomb.tools.logic.LogicOperator.XOR; import static org.testng.Assert.assertEquals; +import static org.testng.Assert.assertFalse; public class LogicTest { @BeforeMethod @@ -181,6 +184,17 @@ private static void secondEdgeWorkSetup() { Widget.setIndicator(OFF, NSA); } + @Test + public void extraHZTest() { + Widget.setSerialCode("AD4MB7"); + LetterRecord[] letters = {recordOf(false, H), recordOf(true, Z), recordOf(false, K)}; + LogicOperator[] operators = {NAND, IMPLIES}; + + boolean actual = Logic.solve(letters, operators, true); + + assertFalse(actual); + } + private static LetterRecord recordOf(boolean isNegated, LogicLetter letter) { return new LetterRecord(isNegated, letter); } From 64e04b70d5ac9877a74e000cc0b59dc92d3e4c28 Mon Sep 17 00:00:00 2001 From: "Mr. J" <45538844+Ultraviolet-Ninja@users.noreply.github.com> Date: Fri, 25 Feb 2022 09:50:50 -0600 Subject: [PATCH 36/86] Made some rewrites to BooleanVenn --- .../modules/ab/boolean_venn/BooleanVenn.java | 65 ++++++------------- 1 file changed, 19 insertions(+), 46 deletions(-) diff --git a/src/main/java/bomb/modules/ab/boolean_venn/BooleanVenn.java b/src/main/java/bomb/modules/ab/boolean_venn/BooleanVenn.java index 3a3c5abe..e93f8dc2 100644 --- a/src/main/java/bomb/modules/ab/boolean_venn/BooleanVenn.java +++ b/src/main/java/bomb/modules/ab/boolean_venn/BooleanVenn.java @@ -1,7 +1,6 @@ package bomb.modules.ab.boolean_venn; import bomb.Widget; -import bomb.tools.filter.Regex; import bomb.tools.logic.LogicOperator; import org.intellij.lang.annotations.Language; import org.jetbrains.annotations.NotNull; @@ -9,14 +8,8 @@ import static bomb.tools.filter.RegexFilter.LOGIC_REGEX; import static bomb.tools.filter.RegexFilter.LOGIC_SYMBOL_FILTER; import static bomb.tools.filter.RegexFilter.filter; -import static bomb.tools.logic.LogicOperator.AND; -import static bomb.tools.logic.LogicOperator.IMPLIED_BY; -import static bomb.tools.logic.LogicOperator.IMPLIES; -import static bomb.tools.logic.LogicOperator.NAND; -import static bomb.tools.logic.LogicOperator.NOR; -import static bomb.tools.logic.LogicOperator.OR; +import static bomb.tools.logic.LogicOperator.LOGIC_SYMBOL_TO_ENUM_MAP; import static bomb.tools.logic.LogicOperator.XNOR; -import static bomb.tools.logic.LogicOperator.XOR; /** * This class deals with the Boolean Venn Diagram module. @@ -42,7 +35,8 @@ public class BooleanVenn extends Widget { {false, true, true}, {true, false, true}, {true, true, false}, - {true, true, true}}; + {true, true, true} + }; } /** @@ -71,12 +65,11 @@ public class BooleanVenn extends Widget { * @throws IllegalArgumentException Format mismatch for the input equation */ private static boolean checkFormat(String equation) throws IllegalArgumentException { - String abPriority = filter(equation, new Regex(AB_PRIORITY_PATTERN)); - String bcPriority = filter(equation, new Regex(BC_PRIORITY_PATTERN)); + boolean doesMatchABPriority = equation.matches(AB_PRIORITY_PATTERN); - if (XNOR.test(abPriority.isEmpty(), bcPriority.isEmpty())) - throw new IllegalArgumentException("Format mismatch!!"); - return !abPriority.isEmpty(); + if (XNOR.test(doesMatchABPriority, equation.matches(BC_PRIORITY_PATTERN))) + throw new IllegalArgumentException("Format given does not match the format specified"); + return doesMatchABPriority; } /** @@ -89,7 +82,7 @@ private static boolean checkFormat(String equation) throws IllegalArgumentExcept private static String interpretAB(String operation) { String logicSymbols = filter(operation, LOGIC_SYMBOL_FILTER); StringBuilder builder = new StringBuilder(); - boolean[] priorityCases = priorityOutputs(logicSymbols.substring(0, 1), A + B); + boolean[] priorityCases = priorityOutputs(logicSymbols.substring(0, 1), B); for (int i = 0; i < TEST_CASES.length; i++) builder.append(outsideOutputs(logicSymbols.substring(1), priorityCases[i], TEST_CASES[i][C])); @@ -123,13 +116,16 @@ private static String interpretBC(String operation) { */ private static boolean[] priorityOutputs(String func, int priorityNum) { boolean[] out = new boolean[TEST_CASES.length]; - if (priorityNum == 1) { - for (int i = 0; i < TEST_CASES.length; i++) - out[i] = functionMap(func, TEST_CASES[i][A], TEST_CASES[i][B]); - } else { - for (int i = 0; i < TEST_CASES.length; i++) - out[i] = functionMap(func, TEST_CASES[i][B], TEST_CASES[i][C]); + LogicOperator operator = LOGIC_SYMBOL_TO_ENUM_MAP.get(func); + + boolean isPriorityOnFirstTwo = priorityNum == B; + int firstIndex = isPriorityOnFirstTwo ? A : B; + int secondIndex = isPriorityOnFirstTwo ? B : C; + + for (int i = 0; i < TEST_CASES.length; i++) { + out[i] = operator.test(TEST_CASES[i][firstIndex], TEST_CASES[i][secondIndex]); } + return out; } @@ -141,30 +137,7 @@ private static boolean[] priorityOutputs(String func, int priorityNum) { * @param y 2nd bit * @return 1 or 0 based on their respective booleans */ - private static String outsideOutputs(String func, boolean x, boolean y) { - return functionMap(func, x, y) ? "1" : "0"; - } - - /** - * Selects the bitwise operation to be executed - * - * @param func The number selector - * @param x 1st bit - * @param y 2nd bit - * @return The result of the operation - */ - private static boolean functionMap(String func, boolean x, boolean y) { - LogicOperator operator = switch (func) { - case "∧" -> AND; - case "∨" -> OR; - case "↓" -> NOR; - case "âŠģ" -> XOR; - case "|" -> NAND; - case "↔" -> XNOR; - case "→" -> IMPLIES; - default -> IMPLIED_BY; - }; - - return operator.test(x, y); + private static char outsideOutputs(String func, boolean x, boolean y) { + return LOGIC_SYMBOL_TO_ENUM_MAP.get(func).test(x, y) ? '1' : '0'; } } From 442599890ff084989782f4498c151fa6f4177a76 Mon Sep 17 00:00:00 2001 From: "Mr. J" <45538844+Ultraviolet-Ninja@users.noreply.github.com> Date: Fri, 25 Feb 2022 16:27:51 -0600 Subject: [PATCH 37/86] Added documentation to FastMath for operation context Removed comments from private methods in BooleanVenn --- .../modules/ab/boolean_venn/BooleanVenn.java | 90 ++++++------------- .../bomb/modules/dh/fast_math/FastMath.java | 39 ++++---- src/test/java/bomb/BombSimulations.java | 2 +- 3 files changed, 51 insertions(+), 80 deletions(-) diff --git a/src/main/java/bomb/modules/ab/boolean_venn/BooleanVenn.java b/src/main/java/bomb/modules/ab/boolean_venn/BooleanVenn.java index e93f8dc2..1ef714aa 100644 --- a/src/main/java/bomb/modules/ab/boolean_venn/BooleanVenn.java +++ b/src/main/java/bomb/modules/ab/boolean_venn/BooleanVenn.java @@ -23,22 +23,6 @@ public class BooleanVenn extends Widget { @Language("regexp") private static final String AB_PRIORITY_PATTERN, BC_PRIORITY_PATTERN; - static { - AB_PRIORITY_PATTERN = "\\(A" + LOGIC_REGEX + "B\\)" + LOGIC_REGEX + "C"; - BC_PRIORITY_PATTERN = "A" + LOGIC_REGEX + "\\(B" + LOGIC_REGEX + "C\\)"; - - TEST_CASES = new boolean[][]{ - {false, false, false}, - {false, false, true}, - {false, true, false}, - {true, false, false}, - {false, true, true}, - {true, false, true}, - {true, true, false}, - {true, true, true} - }; - } - /** * Turns the String operation into a String code for the Venn Diagram to decode by choosing * the correct method depending on which side of the operation has the priority, that being @@ -52,18 +36,10 @@ public class BooleanVenn extends Widget { public static @NotNull String resultCode(@NotNull String operation) throws IllegalArgumentException { if (operation.isEmpty()) throw new IllegalArgumentException("Cannot have empty String"); return checkFormat(operation) ? - interpretAB(operation) : - interpretBC(operation); + interpretABPriority(operation) : + interpretBCPriority(operation); } - /** - * Checks the formatting of the equation to see if it fits either of (AB)C or A(BC) - * with logic symbols in between AB and BC - * - * @param equation The valid or invalid equation - * @return Whether the equation matches the - * @throws IllegalArgumentException Format mismatch for the input equation - */ private static boolean checkFormat(String equation) throws IllegalArgumentException { boolean doesMatchABPriority = equation.matches(AB_PRIORITY_PATTERN); @@ -72,51 +48,29 @@ private static boolean checkFormat(String equation) throws IllegalArgumentExcept return doesMatchABPriority; } - /** - * Interprets (AB)C - * - * @param operation The appropriate equation - * @return A String code that represents the state of each Venn Diagram section - * The output order is not, c, b, a, bc, ac, ab, all - */ - private static String interpretAB(String operation) { + private static String interpretABPriority(String operation) { String logicSymbols = filter(operation, LOGIC_SYMBOL_FILTER); StringBuilder builder = new StringBuilder(); boolean[] priorityCases = priorityOutputs(logicSymbols.substring(0, 1), B); for (int i = 0; i < TEST_CASES.length; i++) - builder.append(outsideOutputs(logicSymbols.substring(1), priorityCases[i], TEST_CASES[i][C])); + builder.append(appendCharacter(logicSymbols.substring(1), priorityCases[i], TEST_CASES[i][C])); return builder.toString(); } - /** - * Interprets A(BC) - * - * @param operation The appropriate equation - * @return A String code that represents the state of each Venn Diagram section - * The output order is not, c, b, a, bc, ac, ab, all - */ - private static String interpretBC(String operation) { + private static String interpretBCPriority(String operation) { String logicSymbols = filter(operation, LOGIC_SYMBOL_FILTER); StringBuilder builder = new StringBuilder(); boolean[] priorityCases = priorityOutputs(logicSymbols.substring(1), B + C); for (int i = 0; i < TEST_CASES.length; i++) - builder.append(outsideOutputs(logicSymbols.substring(0, 1), TEST_CASES[i][A], priorityCases[i])); + builder.append(appendCharacter(logicSymbols.substring(0, 1), TEST_CASES[i][A], priorityCases[i])); return builder.toString(); } - /** - * Performs the operation on the two variables inside the original equation's () - * and returns the outputs from those test cases - * - * @param func The logic selector - * @param priorityNum The determining number to reflect whether the method call came from ab or bc - * @return A set of booleans that reflect all test cases possible for the operation inside the () - */ - private static boolean[] priorityOutputs(String func, int priorityNum) { + private static boolean[] priorityOutputs(String textOperator, int priorityNum) { boolean[] out = new boolean[TEST_CASES.length]; - LogicOperator operator = LOGIC_SYMBOL_TO_ENUM_MAP.get(func); + LogicOperator operator = LOGIC_SYMBOL_TO_ENUM_MAP.get(textOperator); boolean isPriorityOnFirstTwo = priorityNum == B; int firstIndex = isPriorityOnFirstTwo ? A : B; @@ -129,15 +83,23 @@ private static boolean[] priorityOutputs(String func, int priorityNum) { return out; } - /** - * Returns 0 or 1 based on the boolean operation that gets past in - * - * @param func The logic selector - * @param x 1st bit - * @param y 2nd bit - * @return 1 or 0 based on their respective booleans - */ - private static char outsideOutputs(String func, boolean x, boolean y) { - return LOGIC_SYMBOL_TO_ENUM_MAP.get(func).test(x, y) ? '1' : '0'; + private static char appendCharacter(String textOperator, boolean x, boolean y) { + return LOGIC_SYMBOL_TO_ENUM_MAP.get(textOperator).test(x, y) ? '1' : '0'; + } + + static { + AB_PRIORITY_PATTERN = "\\(A" + LOGIC_REGEX + "B\\)" + LOGIC_REGEX + "C"; + BC_PRIORITY_PATTERN = "A" + LOGIC_REGEX + "\\(B" + LOGIC_REGEX + "C\\)"; + + TEST_CASES = new boolean[][]{ + {false, false, false}, + {false, false, true}, + {false, true, false}, + {true, false, false}, + {false, true, true}, + {true, false, true}, + {true, true, false}, + {true, true, true} + }; } } diff --git a/src/main/java/bomb/modules/dh/fast_math/FastMath.java b/src/main/java/bomb/modules/dh/fast_math/FastMath.java index c917b579..521c5324 100644 --- a/src/main/java/bomb/modules/dh/fast_math/FastMath.java +++ b/src/main/java/bomb/modules/dh/fast_math/FastMath.java @@ -12,33 +12,42 @@ public class FastMath extends Widget { private static final int[][] INTERNAL_GRID; + /** + * Turns the 2 letter combination of input turns it to a 2 number combination based on certain edgework + * and what letters are set as input + * + * @param letters The 2 letters that must be input (Case insensitive) + * @return The combination of numbers that the expert gives back to the defuser + * @throws IllegalArgumentException If the input doesn't match specifications OR the serial code isn't given + */ public static @NotNull String solve(@NotNull String letters) throws IllegalArgumentException { checkSerialCode(); letters = letters.toUpperCase(); if (!letters.matches("[ABCDEGKNPSTXZ]{2}")) throw new IllegalArgumentException("Input 2 of the following letters: [A B C D E G K N P S T X Z]"); + int preconditions = evaluateEdgework(); - int leftNum = translateLetter(letters.substring(0, 1)); - int rightNum = translateLetter(letters.substring(1)); + int leftNum = translateLetter(letters.charAt(0)); + int rightNum = translateLetter(letters.charAt(1)); String outputValue = String.valueOf(postConditions(INTERNAL_GRID[leftNum][rightNum] + preconditions)); return (outputValue.length() == 1 ? "0" : "") + outputValue; } - private static int translateLetter(String letter) throws IllegalArgumentException { + private static int translateLetter(char letter) { return switch (letter) { - case "A" -> 0; - case "B" -> 1; - case "C" -> 2; - case "D" -> 3; - case "E" -> 4; - case "G" -> 5; - case "K" -> 6; - case "N" -> 7; - case "P" -> 8; - case "S" -> 9; - case "T" -> 10; - case "X" -> 11; + case 'A' -> 0; + case 'B' -> 1; + case 'C' -> 2; + case 'D' -> 3; + case 'E' -> 4; + case 'G' -> 5; + case 'K' -> 6; + case 'N' -> 7; + case 'P' -> 8; + case 'S' -> 9; + case 'T' -> 10; + case 'X' -> 11; default -> 12; }; } diff --git a/src/test/java/bomb/BombSimulations.java b/src/test/java/bomb/BombSimulations.java index 029a517c..968a7194 100644 --- a/src/test/java/bomb/BombSimulations.java +++ b/src/test/java/bomb/BombSimulations.java @@ -23,7 +23,7 @@ public static void thanksBobCenturion() { Widget.setDoubleAs(4); Widget.setNumHolders(2); Widget.setIndicator(ON, BOB); - Widget.setSerialCode("ag42w5"); + Widget.setSerialCode("AG4KW5"); centurionDefaults(); } From 39d4e4e9ab8453b7f427e36dc2076dde92261b81 Mon Sep 17 00:00:00 2001 From: "Mr. J" <45538844+Ultraviolet-Ninja@users.noreply.github.com> Date: Tue, 1 Mar 2022 18:12:10 -0600 Subject: [PATCH 38/86] Timer enabled --- src/main/java/bomb/ManualController.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/bomb/ManualController.java b/src/main/java/bomb/ManualController.java index 7cbd91ba..6717e592 100644 --- a/src/main/java/bomb/ManualController.java +++ b/src/main/java/bomb/ManualController.java @@ -89,10 +89,10 @@ public void initialize() throws ExecutionException, InterruptedException { ); ObserverHub.addObserver(FORGET_ME_NOT_TOGGLE, new ForgetMeNotToggleObserver(forgetMeNot)); ObserverHub.addObserver(SOUVENIR_TOGGLE, new SouvenirToggleObserver(souvenir)); -// long start = System.nanoTime(); + long start = System.nanoTime(); regionMap = setupRegionMap().get(); -// long stop = System.nanoTime(); -// System.out.printf("Timer: %,d%n", stop - start); + long stop = System.nanoTime(); + System.out.printf("Timer: %,d%n", stop - start); } private CompletableFuture> setupRegionMap() throws ExecutionException, InterruptedException { From a22595b3124c2ee82714da5876983956c7f50960 Mon Sep 17 00:00:00 2001 From: "Mr. J" <45538844+Ultraviolet-Ninja@users.noreply.github.com> Date: Mon, 18 Apr 2022 14:16:13 -0500 Subject: [PATCH 39/86] More Changes --- build.gradle | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/build.gradle b/build.gradle index 3feeef52..0a1a744f 100644 --- a/build.gradle +++ b/build.gradle @@ -44,10 +44,10 @@ repositories { } dependencies { - implementation 'com.opencsv:opencsv:5.5.2' + implementation 'com.opencsv:opencsv:5.6' implementation 'org.javatuples:javatuples:1.2' implementation 'org.jgrapht:jgrapht-ext:1.5.1' - implementation 'org.jetbrains:annotations:22.0.0' + implementation 'org.jetbrains:annotations:23.0.0' //implementation 'io.github.fvarrui:javpackager:1.5.1' implementation('com.jfoenix:jfoenix:9.0.4') { @@ -60,7 +60,7 @@ dependencies { testImplementation 'org.testng:testng:7.5' testImplementation 'org.slf4j:slf4j-api:1.7.36' testImplementation 'org.slf4j:slf4j-simple:1.7.36' - testImplementation 'nl.jqno.equalsverifier:equalsverifier:3.9' + testImplementation 'nl.jqno.equalsverifier:equalsverifier:3.10' } def firstInstance = project.hasProperty('thread0') From 6668adf4f9e33b745a2d2d91efc0e5ea411beb43 Mon Sep 17 00:00:00 2001 From: "Mr. J" <45538844+Ultraviolet-Ninja@users.noreply.github.com> Date: Thu, 28 Apr 2022 13:04:40 -0500 Subject: [PATCH 40/86] Minor change --- src/main/java/bomb/modules/s/simon/screams/Star.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main/java/bomb/modules/s/simon/screams/Star.java b/src/main/java/bomb/modules/s/simon/screams/Star.java index fb4f5ab6..f2936b47 100644 --- a/src/main/java/bomb/modules/s/simon/screams/Star.java +++ b/src/main/java/bomb/modules/s/simon/screams/Star.java @@ -66,8 +66,10 @@ public boolean primaryRule(ScreamColor[] flashOrder) { default -> { } } + if (counter == 2) + return false; } - return counter < 2; + return true; } //Complementary Color Not Flashed Rule From 89c6d2b5f1cfec88fa6b1d52eeea35bf9a5422e5 Mon Sep 17 00:00:00 2001 From: "Mr. J" <45538844+Ultraviolet-Ninja@users.noreply.github.com> Date: Thu, 28 Apr 2022 13:09:15 -0500 Subject: [PATCH 41/86] Minor change pt 2 --- src/main/java/bomb/modules/s/simon/screams/Star.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/bomb/modules/s/simon/screams/Star.java b/src/main/java/bomb/modules/s/simon/screams/Star.java index f2936b47..f7befb06 100644 --- a/src/main/java/bomb/modules/s/simon/screams/Star.java +++ b/src/main/java/bomb/modules/s/simon/screams/Star.java @@ -15,13 +15,13 @@ public class Star { private final ArrayRing colorOrder; - public Star(@NotNull ScreamColor[] order) { + public Star(@NotNull ScreamColor[] order) throws IllegalArgumentException { checkUniqueColors(order); colorOrder = new ArrayRing<>(LIMIT); for (ScreamColor instance : order) colorOrder.add(instance); } - private static void checkUniqueColors(ScreamColor[] order) { + private static void checkUniqueColors(ScreamColor[] order) throws IllegalArgumentException { Set set = EnumSet.copyOf(asList(order)); if (set.size() != LIMIT) throw new IllegalArgumentException("Size doesn't equal 6"); } From aa5a5208e029e2f012596428d72d16b53296877e Mon Sep 17 00:00:00 2001 From: "Mr. J" <45538844+Ultraviolet-Ninja@users.noreply.github.com> Date: Mon, 30 May 2022 08:26:06 -0400 Subject: [PATCH 42/86] Started on FizzBuzz --- manuals/Centurion Puzzle Difficulty.xlsx | Bin 13011 -> 13853 bytes .../bomb/modules/dh/fizzbuzz/FizzBuzz.java | 147 ++++++++++++++++++ 2 files changed, 147 insertions(+) create mode 100644 src/main/java/bomb/modules/dh/fizzbuzz/FizzBuzz.java diff --git a/manuals/Centurion Puzzle Difficulty.xlsx b/manuals/Centurion Puzzle Difficulty.xlsx index 811a9aed4622e389f81b4242938b12c82e053807..48d33fbcdc4b7574c3229a0f02880f025a6835ee 100644 GIT binary patch delta 7427 zcmZ8mWmFzblf~VFy9ReBSdc()3GVLh&IEUTkl+a(+}+)S+k?BiBoJWX-96vCyY*wv z^qG6kbl=d{8FrNLVpTg+Y#kcyT!Qt-7 z3qtB&FT%WqX2rfHQ)6ttr{Is?PyJdFSBiM{Hi_yh)Z;VniT8>0j{3u@z zM9{{9y)o-ocNVdUG}$1e%x+0myD*2vKrb^tDuCyXDMa{1s>3oQj%wr(?_dk#3;mk{ z9?ruP>l>Q>T$PyPaOx4v_fzJ>px+55R5ui`Kt?YyaagdOXii$iW_B`y@G!%o39N(R z&>u4{nCYW>OtCBBh`saX=DicwVQcT!%;a!rPi=bE`G@0uQ(y0gmibSl-x`n%WxHOax|C1?z45XC#{9^qQHyjWd7uzy89otFE5!K z;ZngtmX%3t8!uYkXd$f>zmy~~WSft#IDulUt23}z@WC_p^##6{v~e>Zp%z~xmQ8f~ z>G(U2hAre7-GP}^Cc8v28W#7}H-Bf?7X1&t z-fDS{9%y%1Nwda`li0|1gktzwoTLqmR>2(_&1l}w3#gYM&4#zV!&o_c5?wNZO#%`) z-M!~43VFB<^5`yBnBvMju|MIGwkF`j&}4@^jrBX04Twhi$lM7iJXIsFJS5iQ{dEZYxh z`_SzXrN}$lhzhG?WM)>lk1Zk(%Lu?rTyL#ItYcFg*JvaHH(tJHpw3A;iwUKuGWhG) zbDx^(kFg}^bX&x`xRO|dk=qbD{^>r?2nEu6`wpgVzeg2G^-NlUbj$;RCh-8*PPE%^ z=kE6zqo)HE3S{Z5Z3=E{9*Qp++o+!mW~j2R!Bixm(WpQD2_5@Of1g=C&VRsZ37@gt zcX%;zKk4xHKH;`N=gxUT1y#Stu8l(CghJahzGndtHaH_sCSK*&ey7)>oDkk80whV?A_-~MHivN z&&8AAGrH+0;SMB;FuKx%-9&*WT{sh&vTeIzqE#``IK#uthLP5+HfMzhxUy}u?|3E(XNtzg)s^3gjF?eOAcT$ZSmZ@%$!EzPR z`1>Z>bz}X>Nl0Oz5MTeeIT%)~6zv`3l9b1dl1$Q2&O$kl@0{T(e2SAO8eApJ`3>cE z=QeJNec!mB{oR8#&?9Yw%=Gd?qz1FE@^SIgTeSa!vWRk zK9f0Dy8IK&Q%Y5%gYDMuBX}-y;_pa#eTQd^s`hB|K~s6riTbD|X$=88Q*0!!0=iD;h558)uIM5*;mg5D*YA zFaJD}GIZ=$_%I|Ijc=f~Qa-gqfxDV&-}Rc18>ERY56QWc{nWJ1XpDqi>+JeqZXY>o zlyKzV=e(Tx3um{?tlqAtk}aGn8idWP-ro*VbDq7mXL_G1i^3i?B(h0NnG&KTTCU+; zIwjh6PewBpT3nGEYt5QqYs@IK&V;ur( zdmIU@ka)2+-EkQ_23*q+XUzH(w!}UyEpf=Ki)L|P(hP^o*I-J!<0gJj|L@UsRsqZfmx_jfHQea zj(bRZ(8;>DskzpfR6ZR};FwQ=aNt)K&W)*gN%tgwEGYDyvqg+x+I*hqFuwu_Bp^8g zl`3mBkfoO9X|zzc!mf{tKP^IZS0=Q7wlPklwq93R+OfYM8Oksa~+RYOujPCx}2siTPOJX13)_ z!pwX3EJWoLK!GZwo5m-P>jx@sz|ww16fs1woc9h|a3i)T=hQ#XQUEg*z*Qde+3gy) zt%2>qaz!(?;u5U<(JIW6$L*($0w=pk^th?g;+E|ebu4U|@{SqmG-#fHWxJ>zw25~B z1^Gk~hmnX``aHO6$iR?K@cVdD1oZs!Z2)_FmsvVwqm|hfSJ9;n5pI+YpmiJgx` zQ25mTj1MS$u}7%KxT z#M!XCbvwR!v)_@GJ%IqN7u1IZr%WFS$(Nuxpr>3X&GQQ32|fB5mW9@VOEJ#{)r2N) z5-`4DWrN|m&r!&WgLKQJ(R(lX0wpdY=*EbpP|e}qP5m|`T$xCYn3*Mf>TA+BlnO%6 zdv&vRUJiaWGK$qjQlVUCAd_Q96ad!KYw^QU`4_8WSa1KlsE&y9GW`JKrLJNUQDOP!%z5+beQ ztKjnXr}PV1HHluisz38Jy6{v4V}6^XuI!gS4(T+;TDRE&V~h8 zY=Ypv&88-Jo5kwv^(OF;9uW3cgo`=Yq41he_`W&su6;n$ zJg%f2*m&jkIwBq}V;X+Q8=tr;Z)*rsjP8XE<=SJniEnyaAN!qY#$h+p37pwm z3`s75o^)lzOc=3#VLMTAaAM*$Wwr(HexX4rj%HpMdyN810RE!*%`@gFX|G|@w4NJ; z9l1T5B*Zy_iys;ESpMe1AR$iw*8tm4seA?Q?WbMVz6uiY(eI69Tp#nlOlV#os=ML=xEy-3 z9*L6ACDA6d0`=Xf{{e9)raiAdoHHHiKL#E#T+3$-#?}ZZ)#z``mCMfw! zcHY{_Ar!rx!^zItTOVHtS$E!?yWYw&$Bnp%CpsJN@dwt)E)Km6w0;xajH|sKz7aBt z5P^Tm@@4(7hi>GC-gD1yK-Sn7z&g5ZbVb>)n}w? zG`bEWi~XG(>Ud3ZGbTm(uQbdXS4Q`|GSBy>Rcj;zf;XpB5xq@bH?k~x4mR}bA~_uv ze3_P?Ss9CCnmL>7a5cZM7k_MR6+vlb?A*A9NM<28ANZ;F3h#x53)_w@dS!__qB6P< zHgv6zu2^)7KbBJ^x?01Bo?}B)J?&Th;Y3vv3ljHf7uZ2%ee=VbfPKdPWpdVb5XE2| zi`Up`D`@XAa5c@zx$yqapPNdv&O&fp129f^|GZtA1^m0a$;D0~1&Uxu0A}B6ZLnz( z0LW0t7-<*?2)%a@5U8&>Pg_p9u}mbfgC?kIswl)_?i`H7Xg8oylM>7=V5!R`fjo%^DMi zA3U9Sz^SDS>45Z8#@MiwC!hkGx_KZ@hP2O!4@ssc`24-x$O*NWOs@U0b^LG*WoS8p zg}H^XxEeZ5$+%4*Hpoe& zCg^?qUmj^?%;3wQTHd3W#L$3T50usYUxgvql0Io=A<|D25E58&_91O}vc9mS_RZ!h zPyMY_#B>Q{V})ruU%cRS;Ztg{MP-ioSP(62`s2&Vska3_$0iuIuU;ji*v9oiIPq}_ z37t(GwBk4Qf{6q>8$8RaGjzz3|82+$5Wk)!LuK|< zowD|P*V%tXNykjXXC(QdQN zEtbD*Qxn;ehO{j(Hh{1}2YQZ0vtIB-g)Hd5d&K&WsJUc>+co>y*^&bW`Saqv0AIdpZbih2k z+kQ-uQs91E(P8v`na+KOdkUL+(SGK(4C^-0|DHcd1Kfrdah=m68{}p9CuFjrz~hEnQFtYq;9gqWeZ9LDYZ`#h>jKuG^#agg6*zJN>xh-TvQW?5nSB`m7Fq^9-$plrs}JyHa+?s`66x9I;o%Vsv5CEL<&MRTe(`v8>XGKTdKH`+KZ`4Svz);ap_F zGnvM<$9Df52dQrGbyW97CQXnNhXG3B=B{tGW^6BC+uvFbOT1@zULzm3uuFDA1+K8i z8f$cLVCRR)FP)7}7k0AHi+(5Dp4k3UxsFwW=y~0apIG4V@~%y*7avz5KYKRL%$T{aFZiPC|00Fb*{`AD@bLCGt7l9ZXX>ddaWsVhw1 z@uXNrEKNmo#NCc`b|m>BkWY}J^yUw59zPBphNY_aa`G$Aub7^%>6?8mtiwrrpn0s* zY5yYxO$H?WOlp90s3G;cGrHSGS2>5SD!=5_!VLy;kpZyK(sT(`hL^^5vu@cz7F&7$^a(Gu5~zh0MQmLor6 z?V%}#USH#!hFUIS)c^(`^iROt&J_VDQP)1MPzHQZdPa(uf2w<5cWc=l``fZ zSQi*EY27!5CpFdtUrD!c!;RKHWQNbWbOi+k+Y~7Xog}3wcoo8@_M{!R8V*i}#Q2P7 z;Y2X&JSKZ~nT^P**j%BWOh&a-VsEpW)lten9uQz`BdELbk8dBo-_f4S{mfWeFC=Ce zzgbWc%zGSf4LzD#qg*KIDW~SpfAAR%dlOh2AtwG|q#i%i+>19yL;j)>5%01Dc0!A0 z*GzXV_RXcT!I9sEv1e(61WZ_`4OCWPh918lZ)sxTEwFuzHCa?Tw6!1a!qUdI6^DzW zGEP-mV&DkrvK!AI@@tPO=fM8dMP%b!WEWCJxP=9&xt|sQolKb%6C=lHI)N&ma0t+} zd;;;dTR1q1uKsTJiSB0aQs51r8GSosQ$>h*>IpbR@@{2k`(MQmw&VX2BVoH?^NkrtG98d859tgn zDm0l$!A1RyA|Vbx^)ryGv3in6%43!T9d8$6b|HzPAGaTiGyyr$)tai(1+&aOZCnFa z$0@%{BLXGY;a>gP)FJu)^WL-5Pxs%L_@>1Lp#)B(xB8k@f(sD}XPWH9-S%Zku`MG##g~Mpt)POm2#p%_3s< zN9Jmh=OnP!7hDCpoa5(iqo{m%5fG4i^0KpGfQ3gZjbmpcW}?U5Z#eZ7CU`Fhx1S-u z7HPqbJ@mPjUP2zvw<6BqX}{I5=l<~osI7X>3W*ez+;3D41p#454?3h~0kjQlW<@Yw z?9L+V11S;IbI^RN$e(|PpBG3lWiL1i9U_KcO2>Zzr8QwPpgf$NMkd2@S@YGfii+uV@Y3Ogfc^eUNCMGV87SO}_> ze%TiELwl;=IN`OgQ6=I}eZXKccN?v$1ML}CRKiPP(yjQj(iXE& zJhwZ|kM_`D_gW%Qu|tk9P|(nevk}r>-B>>(!w)_lx4%ZWt&Z;AI-Dl?6t+b+TO@DH zbNsc4D0jX|zMERG*rYobJ7Kzc={$I1%BAR|>s@Wjw5uH6J3K<2aA1aQ96iP}rH3J> z{2UHC zmH%psmlHxVm8IeHkpV{hxd#*6XvW`3YYU!%aFsG%dK|Jrp6j!im50#*;%UL1%-gne z^1}p-v(u!C1juO9h*a71TF77O#Z=@g#3MP$^+qe0T?#*?_7#t5_tskbsg4&g3|6vx zcWYr_z`z9HL$+I=Pkr9kKCqzGM&0#hL-Av^t!q=J@h0iqM+JUc<&oTEKEsUPDW9vw zUt_LZK33}S!{-u-ZjgO4+?>9(;jP_eIPkUzq^zJNr9#*t@0waglpt)RL%KX1)Isv? z7~{_6zRc_44B>0Q#zBM%?DC>iDv>K#W4!dYzJ%xdt~)JtF6$Njxd}e*F4=Rqsf|oL zlH8FLp$h1~lVq%%ZN>|U@_tcnYYe|m_F9@kPpA6RDc1IbAEBwQL^?%7-Htc2w5}K9 zH|*Q)hbUvj#i{iw-%-#QEeW9KkimxSms9uh_3s(f9;dQYf03$HdP)5wB+It}LPOJx z6xU^7om(1I=(qF`%6j)lCM;IV(OU^|*-EIwPG?SFUd4@ClBX+2eJI;na|HOT6O%Y4d5S;d zXMr_{c$$3$NrEx&_ryvrl-ybPZXuWK=N@|7ws)r?MQP;%Z(LBkq*|c4)%dgzY|bwH zMfSoMx~U^Zh*}BoRl48g!9#D_c! zuRm#s=Wa9Xgh|a6;};<0hryHRyoitG+1d?45mCiJ>{+J)Hnj~_Qp@p*n_(1gy8BU> zX9qaK;sS4FH2_sk?B_Qy(Z(HQxV5*gmu2e@5H8L+7igY(85pT=B%;pmm{F~z!u)Wg zZCslzuoSNt%UMHR=^^<6ayXP0PrR4g(`{p9#m(Ftg5d-deF{)CG#?cDE2%RViqZ~o zwfFr|`q;Wna!Oz0xQp!+Udlwd7>BU99Sk!lsv8>oNk20YB-A)FioAkiGTLt$k#LnA z`VFIPx=)ngPr&x(cW3dFBIQ_>#6mugOs-g{#FX~}Q%ToD`3*?+H3DwlfM~ap*AJCFK33IUeD4y$OmqF<+N!I(GNh3bzI)ZK)y^)Dl;#c!rNOncn+_9RamKY! zH+o!0FDg$t@(7$%q`w?AOle&84maY%JLa4*Sl=Oc26r9nZQ*OIq z;ym%Rn<;y>q&_#rtEoYtN1l#>9e^vT?ydKIVOOw2BH>zBR-XtJb~!-2_UbPa9xB#A zPc1j9ra?dyl(Ya%I+R_T1O9-5t%y@9Oc>hMh$hhQ$G6OF-}HOOri-3pK{H@K(I-~G za3%Uv-Deqg$_!SWdkA{A+3zAgVOC<7l?y>?XFDRVHw`6Mtu(I7gIP5N_>VlVaXxI%g3$5f=WV-7H~3z>fRSNqW~Y1(a*J069-Y2-8M$n$=eZ&%r$!xtUVJN zI73pctB5bvv=@*3y;S6R81b*UZbZlZr7AOzgW8G^#HBEtsN^n9(ER6s@^9KX6gr+Y z*^a@MS|+UV2%Ql@76$rPj=|44`F|n*X(Qw_2|)j^p5Fnh0!$_n1OzApi4gRY9fRoq zb{Jl(+yB@v5Wpq@6@v?+z`+55*)WLz|DpRoNC*^C5Ij2>@&7NB{{?)d1c|YWKn>7< zg4wx=|J@NGAZY&uy}oVGf=;RFLC@?M#Q(`Vua);()%~wcGk~UOaX}&+7{vdm1`-0o f=`}&UUIqLw(_;qNatJ|fu!2fCDB*HA-ah>o(?1Tt delta 6531 zcmZ8mbzD?k^Iy7qsiixV5|&g#LL`=w5b2N(X=LF_NQ1xv(%mHp2-1xp-Q6OMNJ;;e z=Xswue&>(-nKNhRJ9B2{GxwZ()9uGCD}Q3*1Pis}dZK|qiHKjARKTcXt~jx8>)0*Y zZwZV*e{`s!3}{hlzr?nBUpc=YqtFXa)J_FaG6%GpW7{--)wgVuy9aZl@%pi680H#Fc zjB2?J!$Ao2ouZBg#>sr#r#X`HAtL|MV)&lUYu+7l>4oF)(x3ETYIph!Nuj4>SGWsH zCc`s|_3%IDG?-R!GTQy-lFhH+a=j9kcV95ad~VI>JN_7A3jw#Y0nT#W4_ z&cGefi;e6bnOb~su1zvX0b9)2-K4H42SJyGFfoo9H6YM_t(Wx@Wk^wK0Av5fSJnF9 z3?|gsMG5i3)FbqH)7}VO2;bS6)y_qs>Eo+xx~cO0lxp`YZh~eZVUZ@TE{Fj(>ac9j zalHo)(>J~ILXjqQwotrA6k^)5Tg&Tg^!}NQnGvmQOrcupw_(i7?qd%ht+#zp88Np| zXrF+FeFVhO8!YxX@(L}QS0_9*R;Gp(#vj}%dFtTr>ks?J$1=&@5PIvcNJgxiiAlZuYU^%A#C0;CJUL6L?n%qM#sY!v?$AK$ z%4q0_es0T1EUVBnidOkG8GqZzpJJBUf-;8VT_qpz@)c3*&+diDggoX#4c;-r3WDRkPEm=}P ze0v({u9xnSj;H#FZsm#1>Bac(vcYy?P&8w9HHJgl?lI@*9F%T{BA+eif+>YJA(^iM zhS??1r)%a(h3B+tEZvsRo;`J>H{EJTME#;qOYY_vL}mT8^U{IE$0wib2pjgsRrJh% zq~uu_?8{j5TTV8m4ZbTFO^aRCA>Q|TM#@0l0MEAxN9&$SO1Qb@6^5Z3)@2thH}W;1 z_4Tm_R{(bB=WlJ#39cK6sCDfL;U(Lu{c?BL(W0ld zjHooZLZ8V<`cw$h5k`oag?=VK|5xYV=rq>z0TmouM^Z)@vfxlh+{5)!{cWC`NgxK- z*3W)X#P=4}Wmz8C_ewv)1G4oj|VMj`M98x++OFj=%xrHBe+hlCv3T%h+$&iJ$OLa{^9`W_kcA z(D)pxaV!&g1+N7pmLFfsYGTgd20~N+`tBh4_9YMg`2%o{*Cq3 zb{R^#d$kh(dkho_q?$2}xpYcna7nP@DAU1eh;z!=Y&Sz2oS4g2vItXi0{S916imk~ zkCj(sS471uAEG#l!nFe_Z~`KkJKry;R#ShrNSg>zrm2@E9}!fV}Ka-ldW9DH)OEIh<{d?UT(4eW#-KR zB-j{np9B27uXag80%7-|`Nu|apazm#M73k7xiIk|bTmu~l8y|>Cx>_(4)SUBNn!zU zcgKVnnu=`9vd~ek3I&dPaobR;^fg;IT-~V0@>a3PthbO<05o-(1oORUNyErEgdlLg zghwEaMIepEquCrlxPwDS#T<9;)u~d3|GiIY?&^PBD^k!n{IPE9_B3TUUG-*EokT$V zS>%wS>)&2@@@~a$R%DwYEwd>6Y$Lc$X}M3e@Wbv!8F==MHg8RBnJOv(S5!J{smDU3*_8OlxWC>Pt{ZKta8!c z3Dtyyp$tN}_s~!zTX7Uw90cUDdDc;2o`1Q4WQPC6^nC!C&LQX0mzX}mQX45z)Htp+ ztYMZn>{M}xKu(a!E3%`4^Zd6>LuUC0NNg2KL!`4rK#Bj~=v$;j3U*!-1Iv7WNl!|L zH~dx2Y?}9Y<6WX&5>=sKsPU_)zZ`}z%YRfHy(e*vkz_rEA#zKm^;Ju$rF@6y=EH8{ z%eVO7{H8oe8~lpD2B}e=S~gSH_1yj9x|7Op_3gj7?S%ozu3WuJE`|+^sX_AxkVob3 z_#hAglIvy9=j!HdZ|TbGcy*C3qg;PK$zglmBQO zxN^|?<4VL8<^4W+g%vm^l=D73W&jiuB>7$HIOJH~t#BWo>DPT{RR577q-PkG=&V=# z-o7%pcmbm%0bRG>-d2w|Wc8sn|Bnn=J>eg%C^nT%hx)Bx)d=XKrow5vnRgM_M+Q#= z#U@MX+7AWwa=tm#1DL3V6w_w@kOWPE0{SIHqSH04AFrI&_^p)X+Jv6cyv?v zn{%TUQX7ckZ|SJ3rpM(N)3^ya>*B}k(i2H0-oxE2d;_FjUL*Zlr_@hOFyp@A{jLG4 zDCV`hn}|JFt!IL*Lj)TVCW(AsljlgHsE9F zTNckpYKyQhS-XLc955r)x(Lc?uP61*?*eGldthggQQOing~VPdibied1nYy@7@cpv zk@Sx4+ytJ%)?~r2a?xRvek%**G2|N?qlg|GSbSmR1jL?w+tH~-zvfpXxxVberj7g& z%y}S^ELtKMr7bb2N&->WI!!s_8|5_(j=I&eq<;ZgZvobcc^~1^Wu#JF3#4??x5M83 zuItQckz55FJn^qHINax=oaa9WhIx^FcRceSrE>};`@t1dlbW(tXk+szJ4kyCwf<8p zjDff{s%=!yBqNrH_p$S5wnu$2-cqS0eT@ECK3NXWk_)b>chO!?X5NTlbar0H`|6Kf zF-bW{hQa{B{$A4B-UKfev;`s4|69+&1HrjBrT;;2p&GZ4SP{zw<1PeBRPtd z%_Fy&-dnes9rc=>m$Ac<`~><-K0Pn_{O91#qM5H&*X?72!JF+M)?4P6$R=9>4OR@BgJK00g&6YAAI>7qe=2n1iK|U5d}slDL{Np^^Ypzq z&u#ViF47v=hGnUgU*3MD5#o2^cX_Hyc8FG4esrEI9&|Q+G(!m$?r*K-fhYikQ&8?- zYPwOryXpxo3iwgp1BZE1SgN zSm#fVyvm(FlD&9NZjD;TkM8H+WlR-CxGFNKXty|J`$0yJT3c*V(MeLY)M1i<;59dT zR7-&lqec9#No^9IlOV3$WI;5bwn36X7Q?R95je%kQmK>s=odgW`pp|>h?lU z^Jaf|2oK~ctiJsRg0f(2!)_*<(%YDO)41RIdCJ+SAX6~O!)=%3?(gzxcG_VOp7N

)Gncwb zlVo1WFQ0iKC$GbuGKRAREV!ZFw!t0)^4fHaySO|-=JII*Pu( z^?+Ka1L|i>3mpHDaQWEXODY;m&d_($Q-5^kNlj;aIZ!Kys!_4HyL_gEKbOUPr4V8( z*xe$PH}cGAZjW;B+|A&}>;<>7zWfDFeIhvT=o>{!lbDAOlkn~^&KvH56o4s$yiGPT;Y6?O@s(zK0bI0{OO$ zTsx(5*~p*80pES!PSQQzrmSvd=R+Yhff>EaL;-;okPU(ZgkXSj0ef15uz6|X+q5j) zH`d-DLUPhVTrL|;;t=|{nc_$@39s}e0&0J@_1Y<6-17Qk9p6}b9~?+S6!u6uK}RlzXi@n#opcW82Wb1w41-OoG3 zrclpxZlqz_c;*ZU1+LLET&C+(bYxuYpUw4jTtqT0t5RZZ@b+vSvk?>-MsA&s=86=E zY|Oph7j)^;`v6y*@0QqP&{!rOd!Iv*+sWQW-1 zrUNvbQu(RinKgIst`9)Lps=UhqyaB%QVQ~~P+|$ zj~A0C7e|DL$h1O*I)`Dn=PHyTG63x&&^i#I^5`BIw;5-(V^LJn6KS>fSJnD{I#2y(SFJdRtmK9SX} z;&3eY4#brVC0EtUiqKtwnv_^NF#s3Ib>Dt7w#f(+IoC(AG+|%UI+1gLz903_%RI@YV)Rz4qS45vcwkArlUH#g$F6M9#rlQ3q_x!^w-J503u+wC zuugb5%{N=k^p`}^?`%#LM9_sx_8FnUykrjn zvs?UDz6_&=5}W*aLmX*KUJNoqFa8R+5Y2v6iy}o6MS+eOeb_#;-9abw0bJW(u4z8~ z7lRLTYw5TY>Z34}m&QM{np6)N5?x^#Pv*+JF6jcq9lz@kRIx^3eY0<0lA2g}i9}XH?=NcJUzy zHX&j}Dg`m}9`?_`AV&}jvC;njE80KHAW#r3LPLmw_TPs(JP-){pH(E~!-$9!l18m# zMGOf+Y5%vs|F_^M8?xJr(f+%eAYTCg3slR2IN+v0ghPq{t{OxplpK|U8}SAD1U2y? N;uOk^sm*tf_ numberList = new ArrayList<>(7); + + if (numHolders > 2) + numberList.add(interpretFirstCondition(color)); + + if (doesPortExists(Port.SERIAL) && doesPortExists(Port.PARALLEL)) + numberList.add(interpretSecondCondition(color)); + + if (countNumbersInSerialCode() == 3) + numberList.add(interpretThirdCondition(color)); + + if (doesPortExists(Port.DVI) && doesPortExists(Port.RCA)) + numberList.add(interpretFourthCondition(color)); + + if (strikeCount == 2) + numberList.add(interpretFifthCondition(color)); + + if (getAllBatteries() > 4) + numberList.add(interpretSixthCondition(color)); + + int offset = numberList.isEmpty() ? + interpretNoneApplyCondition(color): + numberList.stream() + .mapToInt(i -> i) + .sum(); + + return calculateResults(numberText, offset); + } + + private static void validateInput(String numberText, FizzBuzzColor color, int strikeCount) { + if (numberText == null || !numberText.matches("\\d{7}")) { + throw new IllegalArgumentException("Text input must be a 7 digit number"); + } + + if (color == null) { + throw new IllegalArgumentException("FizzBuzz color cannot be null"); + } + + if (strikeCount < 0 || strikeCount > 2) { + throw new IllegalArgumentException("Invalid strike count"); + } + } + + private static int interpretFirstCondition(FizzBuzzColor color) { + return switch(color) { + case RED -> 7; + case BLUE -> 2; + case YELLOW -> 4; + case GREEN -> 3; + default -> 5; + }; + } + + private static int interpretSecondCondition(FizzBuzzColor color) { + return switch(color) { + case RED -> 3; + case BLUE -> 9; + case YELLOW -> 2; + case GREEN -> 4; + default -> 8; + }; + } + + private static int interpretThirdCondition(FizzBuzzColor color) { + return switch(color) { + case RED -> 4; + case BLUE, YELLOW -> 8; + case GREEN -> 5; + default -> 2; + }; + } + + private static int interpretFourthCondition(FizzBuzzColor color) { + return switch(color) { + case RED -> 2; + case BLUE -> 7; + case YELLOW -> 9; + case GREEN -> 3; + default -> 1; + }; + } + + private static int interpretFifthCondition(FizzBuzzColor color) { + return switch(color) { + case RED, GREEN -> 6; + case BLUE -> 1; + case YELLOW -> 2; + default -> 8; + }; + } + + private static int interpretSixthCondition(FizzBuzzColor color) { + return switch(color) { + case RED -> 1; + case BLUE, GREEN -> 2; + case YELLOW -> 5; + default -> 3; + }; + } + + private static int interpretNoneApplyCondition(FizzBuzzColor color) { + return switch(color) { + case RED, YELLOW -> 3; + case BLUE -> 8; + case GREEN -> 1; + default -> 4; + }; + } + + private static String calculateResults(String text, int offset) { + StringBuilder newNumberString = new StringBuilder(), + output = new StringBuilder(); + for (char c : text.toCharArray()) { + int numberValue = (Character.getNumericValue(c) + offset) % 10; + newNumberString.append(numberValue); + } + + int newValue = Integer.parseInt(newNumberString.toString()); + + if (newValue % 3 == 0) + output.append("FIZZ"); + if (newValue % 5 == 0) + output.append("BUZZ"); + + return output.isEmpty() ? + text : + output.toString(); + } + + public enum FizzBuzzColor { + RED, YELLOW, GREEN, BLUE, WHITE + } +} From 21f8af7214ef35082fd96e6767e8c939f3ef7940 Mon Sep 17 00:00:00 2001 From: "Mr. J" <45538844+Ultraviolet-Ninja@users.noreply.github.com> Date: Mon, 30 May 2022 16:32:57 -0400 Subject: [PATCH 43/86] Started on FizzBuzzTest --- src/test/java/bomb/modules/dh/fizzbuzz/FizzBuzzTest.java | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 src/test/java/bomb/modules/dh/fizzbuzz/FizzBuzzTest.java diff --git a/src/test/java/bomb/modules/dh/fizzbuzz/FizzBuzzTest.java b/src/test/java/bomb/modules/dh/fizzbuzz/FizzBuzzTest.java new file mode 100644 index 00000000..84d641c2 --- /dev/null +++ b/src/test/java/bomb/modules/dh/fizzbuzz/FizzBuzzTest.java @@ -0,0 +1,5 @@ +package bomb.modules.dh.fizzbuzz; + +public class FizzBuzzTest { + +} From 70c765aeab221a3261cd587efff9ce066ceac0fa Mon Sep 17 00:00:00 2001 From: jasmine-jragon Date: Mon, 30 May 2022 15:44:27 -0500 Subject: [PATCH 44/86] Minor change in LetterRecord --- src/main/java/bomb/modules/il/logic/LetterRecord.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/main/java/bomb/modules/il/logic/LetterRecord.java b/src/main/java/bomb/modules/il/logic/LetterRecord.java index 18174f06..1ed9ad71 100644 --- a/src/main/java/bomb/modules/il/logic/LetterRecord.java +++ b/src/main/java/bomb/modules/il/logic/LetterRecord.java @@ -2,9 +2,10 @@ import org.jetbrains.annotations.NotNull; +import static bomb.tools.logic.LogicOperator.XOR; + public record LetterRecord(boolean isNegated, @NotNull LogicLetter letter) { public boolean getBooleanValue() { - return ((isNegated && !letter.getAsBoolean()) || - (!isNegated && letter.getAsBoolean())); + return XOR.test(isNegated, letter.getAsBoolean()); } } From 1ccc9982d71bdf99d9e6d6f88939eb4ceeaa2499 Mon Sep 17 00:00:00 2001 From: jasmine-jragon Date: Mon, 30 May 2022 16:24:00 -0500 Subject: [PATCH 45/86] Finished initial FizzBuzz testing --- .../bomb/modules/dh/fizzbuzz/FizzBuzz.java | 25 +++--- src/test/java/bomb/BombSimulations.java | 4 +- .../modules/dh/fizzbuzz/FizzBuzzTest.java | 90 +++++++++++++++++++ src/test/resources/suites/suiteTwo.xml | 1 + 4 files changed, 108 insertions(+), 12 deletions(-) diff --git a/src/main/java/bomb/modules/dh/fizzbuzz/FizzBuzz.java b/src/main/java/bomb/modules/dh/fizzbuzz/FizzBuzz.java index 14c5c033..497bcfd3 100644 --- a/src/main/java/bomb/modules/dh/fizzbuzz/FizzBuzz.java +++ b/src/main/java/bomb/modules/dh/fizzbuzz/FizzBuzz.java @@ -9,8 +9,8 @@ import java.util.List; public class FizzBuzz extends Widget { - public static String solve(@NotNull String numberText, @NotNull FizzBuzzColor color, - @Range(from=0, to=2) int strikeCount) throws IllegalArgumentException { + public static @NotNull String solve(@NotNull String numberText, @NotNull FizzBuzzColor color, + @Range(from=0, to=2) int strikeCount) throws IllegalArgumentException { validateInput(numberText, color, strikeCount); List numberList = new ArrayList<>(7); @@ -122,22 +122,27 @@ private static int interpretNoneApplyCondition(FizzBuzzColor color) { } private static String calculateResults(String text, int offset) { - StringBuilder newNumberString = new StringBuilder(), - output = new StringBuilder(); - for (char c : text.toCharArray()) { - int numberValue = (Character.getNumericValue(c) + offset) % 10; - newNumberString.append(numberValue); + int newValue; + offset %= 10; + StringBuilder output = new StringBuilder(); + if (offset != 0) { + StringBuilder newNumberString = new StringBuilder(); + for (char c : text.toCharArray()) { + int numberValue = (Character.getNumericValue(c) + offset) % 10; + newNumberString.append(numberValue); + } + newValue = Integer.parseInt(newNumberString.toString()); + } else { + newValue = Integer.parseInt(text); } - int newValue = Integer.parseInt(newNumberString.toString()); - if (newValue % 3 == 0) output.append("FIZZ"); if (newValue % 5 == 0) output.append("BUZZ"); return output.isEmpty() ? - text : + "NUMBER" : output.toString(); } diff --git a/src/test/java/bomb/BombSimulations.java b/src/test/java/bomb/BombSimulations.java index 968a7194..e2e314e3 100644 --- a/src/test/java/bomb/BombSimulations.java +++ b/src/test/java/bomb/BombSimulations.java @@ -29,7 +29,7 @@ public static void thanksBobCenturion() { /** * The Great Berate's first Centurion widget details - * https://www.youtube.com/watch?v=ixlWDV0CVmM&t=4537s + * ... */ public static void theGreatBerateVideoOne() { Widget.resetProperties(); @@ -45,7 +45,7 @@ public static void theGreatBerateVideoOne() { /** * The Great Berate's second Centurion widget details - * https://www.youtube.com/watch?v=dAJp9nRgIbM + * ... */ public static void theGreatBerateVideoTwo() { Widget.resetProperties(); diff --git a/src/test/java/bomb/modules/dh/fizzbuzz/FizzBuzzTest.java b/src/test/java/bomb/modules/dh/fizzbuzz/FizzBuzzTest.java index 84d641c2..bb6ec240 100644 --- a/src/test/java/bomb/modules/dh/fizzbuzz/FizzBuzzTest.java +++ b/src/test/java/bomb/modules/dh/fizzbuzz/FizzBuzzTest.java @@ -1,5 +1,95 @@ package bomb.modules.dh.fizzbuzz; +import bomb.ConditionSetter; +import bomb.Widget; +import org.testng.annotations.AfterClass; +import org.testng.annotations.BeforeMethod; +import org.testng.annotations.DataProvider; +import org.testng.annotations.Test; + +import static bomb.enumerations.Indicator.BOB; +import static bomb.enumerations.Indicator.IND; +import static bomb.enumerations.Port.DVI; +import static bomb.enumerations.Port.PS2; +import static bomb.enumerations.Port.RCA; +import static bomb.enumerations.Port.RJ45; +import static bomb.enumerations.Port.SERIAL; +import static bomb.enumerations.TrinarySwitch.OFF; +import static bomb.modules.dh.fizzbuzz.FizzBuzz.FizzBuzzColor.BLUE; +import static bomb.modules.dh.fizzbuzz.FizzBuzz.FizzBuzzColor.GREEN; +import static bomb.modules.dh.fizzbuzz.FizzBuzz.FizzBuzzColor.RED; +import static bomb.modules.dh.fizzbuzz.FizzBuzz.FizzBuzzColor.WHITE; +import static org.testng.Assert.assertEquals; + public class FizzBuzzTest { + @BeforeMethod + public void setUp() { + Widget.resetProperties(); + } + + @DataProvider + public Object[][] exceptionTestProvider() { + String validNumber = "4193160"; + return new Object[][]{ + {null, null, 0}, {"", null, 0}, {"19205437", null, 0}, {"192u537", null, 0}, {"192(437", null, 0}, + {validNumber, null, 0}, {validNumber, WHITE, -1}, {validNumber, WHITE, 3} + }; + } + + @Test(dataProvider = "exceptionTestProvider", expectedExceptions = IllegalArgumentException.class) + public void exceptionTest(String inputText, FizzBuzz.FizzBuzzColor color, int strikeCount) { + FizzBuzz.solve(inputText, color, strikeCount); + } + + @DataProvider + public Object[][] videoTestProvider() { + ConditionSetter widgetSetupOne = () -> { + Widget.setDoubleAs(8); + Widget.setDBatteries(2); + Widget.setNumHolders(6); + + Widget.setIndicator(OFF, IND); + Widget.setIndicator(OFF, BOB); + + Widget.setSerialCode("3a3qb0"); + }; + + ConditionSetter widgetSetupTwo = () -> { + Widget.setPortValue(RCA, 1); + Widget.setPortValue(DVI, 1); + Widget.setPortValue(PS2, 1); + Widget.setPortValue(SERIAL, 1); + Widget.setPortValue(RJ45, 1); + + Widget.setNumHolders(3); + Widget.setDBatteries(2); + Widget.setDoubleAs(2); + + Widget.setSerialCode("0u1ea2"); + }; + + + return new Object[][]{ + {widgetSetupOne, "4193160", RED, 0, "NUMBER"}, + {widgetSetupOne, "1480918", BLUE, 0, "FIZZBUZZ"}, + {widgetSetupOne, "4124939", WHITE, 0, "NUMBER"}, + + {widgetSetupTwo, "2185547", BLUE, 0, "NUMBER"}, + {widgetSetupTwo, "3905781", RED, 0, "FIZZ"}, + {widgetSetupTwo, "1720785", GREEN, 0, "NUMBER"} + }; + } + + @Test(dataProvider = "videoTestProvider") + public void videoTest(ConditionSetter widgetSetup, String inputText, FizzBuzz.FizzBuzzColor color, + int strikeCount, String expectedOutput) { + widgetSetup.setCondition(); + + assertEquals(FizzBuzz.solve(inputText, color, strikeCount), expectedOutput); + } + @AfterClass + public void tearDown() { + Widget.resetProperties(); + } } diff --git a/src/test/resources/suites/suiteTwo.xml b/src/test/resources/suites/suiteTwo.xml index 04745bfb..55845514 100644 --- a/src/test/resources/suites/suiteTwo.xml +++ b/src/test/resources/suites/suiteTwo.xml @@ -6,6 +6,7 @@ + From 49edfd10b9c6648ccb3ea15733dba241691c15ce Mon Sep 17 00:00:00 2001 From: "Mr. J" <45538844+Ultraviolet-Ninja@users.noreply.github.com> Date: Wed, 20 Jul 2022 13:43:03 -0400 Subject: [PATCH 46/86] Update build.gradle --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index 0a1a744f..7a9160a0 100644 --- a/build.gradle +++ b/build.gradle @@ -57,7 +57,7 @@ dependencies { exclude group: "org.javafx" } - testImplementation 'org.testng:testng:7.5' + testImplementation 'org.testng:testng:7.6.0' testImplementation 'org.slf4j:slf4j-api:1.7.36' testImplementation 'org.slf4j:slf4j-simple:1.7.36' testImplementation 'nl.jqno.equalsverifier:equalsverifier:3.10' From b77ea1c7c54bf3f626048d06d9f33d986bf8ca1b Mon Sep 17 00:00:00 2001 From: "Mr. J" <45538844+Ultraviolet-Ninja@users.noreply.github.com> Date: Thu, 21 Jul 2022 09:25:49 -0400 Subject: [PATCH 47/86] Potentially fixing an LGTM issue --- .../bomb/modules/s/simon/screams/Star.java | 21 +++++++------------ 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/src/main/java/bomb/modules/s/simon/screams/Star.java b/src/main/java/bomb/modules/s/simon/screams/Star.java index f7befb06..266d19c4 100644 --- a/src/main/java/bomb/modules/s/simon/screams/Star.java +++ b/src/main/java/bomb/modules/s/simon/screams/Star.java @@ -8,6 +8,9 @@ import java.util.EnumSet; import java.util.Set; +import static bomb.modules.s.simon.SimonColors.ScreamColor.BLUE; +import static bomb.modules.s.simon.SimonColors.ScreamColor.RED; +import static bomb.modules.s.simon.SimonColors.ScreamColor.YELLOW; import static java.util.Arrays.asList; public class Star { @@ -56,20 +59,12 @@ private int sameColor(ScreamColor[] flashOrder) { //If there are one or less primary colors are flashing public boolean primaryRule(ScreamColor[] flashOrder) { - Set unique = EnumSet.noneOf(ScreamColor.class); - Collections.addAll(unique, flashOrder); + Set uniqueFlashes = EnumSet.noneOf(ScreamColor.class); + Collections.addAll(uniqueFlashes, flashOrder); - int counter = 0; - for (ScreamColor instance : unique) { - switch (instance) { - case RED, BLUE, YELLOW -> counter++; - default -> { - } - } - if (counter == 2) - return false; - } - return true; + return uniqueFlashes.stream() + .filter(color -> color == RED || color == BLUE || color == YELLOW) + .count() < 2; } //Complementary Color Not Flashed Rule From 076c2e891c9547faf8fac2a2b468b0b2bc40067a Mon Sep 17 00:00:00 2001 From: "Mr. J" <45538844+Ultraviolet-Ninja@users.noreply.github.com> Date: Thu, 3 Nov 2022 13:50:23 -0500 Subject: [PATCH 48/86] Build upgrades --- build.gradle | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/build.gradle b/build.gradle index 7a9160a0..aabe4a53 100644 --- a/build.gradle +++ b/build.gradle @@ -5,7 +5,7 @@ plugins { id 'org.beryx.jlink' version '2.24.4' id 'com.palantir.docker' version '0.28.0' id 'info.solidsoft.pitest' version '1.7.0' - id 'org.openjfx.javafxplugin' version '0.0.11' + id 'org.openjfx.javafxplugin' version '0.0.13' id 'org.javamodularity.moduleplugin' version '1.8.10' id 'com.github.breadmoirai.github-release' version '2.2.12' } @@ -44,7 +44,7 @@ repositories { } dependencies { - implementation 'com.opencsv:opencsv:5.6' + implementation 'com.opencsv:opencsv:5.7.0' implementation 'org.javatuples:javatuples:1.2' implementation 'org.jgrapht:jgrapht-ext:1.5.1' implementation 'org.jetbrains:annotations:23.0.0' @@ -57,10 +57,10 @@ dependencies { exclude group: "org.javafx" } - testImplementation 'org.testng:testng:7.6.0' - testImplementation 'org.slf4j:slf4j-api:1.7.36' - testImplementation 'org.slf4j:slf4j-simple:1.7.36' - testImplementation 'nl.jqno.equalsverifier:equalsverifier:3.10' + testImplementation 'org.testng:testng:7.6.1' + testImplementation 'org.slf4j:slf4j-api:2.0.3' + testImplementation 'org.slf4j:slf4j-simple:2.0.3' + testImplementation 'nl.jqno.equalsverifier:equalsverifier:3.10.1' } def firstInstance = project.hasProperty('thread0') From f775b50056ea85cf946728f9b11f10d45de89332 Mon Sep 17 00:00:00 2001 From: "Mr. J" <45538844+Ultraviolet-Ninja@users.noreply.github.com> Date: Mon, 7 Nov 2022 22:45:20 -0600 Subject: [PATCH 49/86] Commenting shit --- .../hexalgorithm/maze_finding/MazeSearch.java | 72 +++++++++++++++++++ .../hexalgorithm/pathfinding/ExitChecker.java | 9 +++ .../hexalgorithm/pathfinding/MazeRunner.java | 8 +++ 3 files changed, 89 insertions(+) diff --git a/src/main/java/bomb/modules/dh/hexamaze/hexalgorithm/maze_finding/MazeSearch.java b/src/main/java/bomb/modules/dh/hexamaze/hexalgorithm/maze_finding/MazeSearch.java index 2ae38a6b..7f068a91 100644 --- a/src/main/java/bomb/modules/dh/hexamaze/hexalgorithm/maze_finding/MazeSearch.java +++ b/src/main/java/bomb/modules/dh/hexamaze/hexalgorithm/maze_finding/MazeSearch.java @@ -17,6 +17,15 @@ public class MazeSearch { private static final int ROTATION_COUNT = 6; + /** + * Finds the smaller hexagon grid in the full maze so that output has the boundary + * walls for each node. + * + * @param maze The full maze that we're iterating through + * @param grid The smaller hexagon containing the shapes of each node + * @return An optional of the found grid or empty if the entire maze has been + * traversed and has not found the Grid with the current shape configuration + */ public static Optional search(@NotNull Maze maze, @NotNull Grid grid) { int gridSpan = grid.getHexagon().getSpan(); int lastIndex = maze.getHexagon().getSpan() - gridSpan; @@ -32,6 +41,14 @@ public static Optional search(@NotNull Maze maze, @NotNull Grid grid) { return Optional.empty(); } + /** + * Creates a pillar that fits the span of the smaller grid + * + * @param maze The full maze that we're iterating through + * @param gridSpan How wide the smaller hexagon is + * @param offset How many columns away from the first column + * @return The columns that represent a slice of the full maze that fits the grid + */ private static BufferedQueue> generatePillar(Maze maze, int gridSpan, int offset) { BufferedQueue> queues = maze.getHexagon().getBufferedQueues(); BufferedQueue> output = new BufferedQueue<>(gridSpan); @@ -43,6 +60,12 @@ private static BufferedQueue> generatePillar(Maze maze, i return output; } + /** + * Copies the information of each node in a queue so that the original information is not altered + * + * @param original The original queue + * @return A full copy of the queue information + */ private static BufferedQueue deepCopyQueue(BufferedQueue original) { BufferedQueue output = new BufferedQueue<>(original.getCapacity()); for (HexNode node : original) @@ -50,6 +73,15 @@ private static BufferedQueue deepCopyQueue(BufferedQueue origi return output; } + /** + * Searches an entire pillar of the full maze to find the Grid that matches the shapes + * of the input Grid + * + * @param pillar The generated pillar coming from the full maze + * @param grid The smaller hexagon containing the shapes of each node + * @return Null if the grid couldn't be matched with any section of the pillar or + * a valid grid containing shapes and wall information + */ private static Grid searchPillar(BufferedQueue> pillar, Grid grid) { int gridSideLength = grid.getHexagon().getSideLength(); trimPillar(pillar); @@ -67,12 +99,23 @@ private static Grid searchPillar(BufferedQueue> pillar, G return output; } + /** + * Determines if the pillar has no elements left in the set of queues + * + * @param pillar The set columns to pull information from + * @return Whether both ends of the pillar are not empty + */ private static boolean isNotColumnEmpty(BufferedQueue> pillar) { int firstSize = pillar.get(0).size(); int secondSize = pillar.get(pillar.getCapacity() - 1).size(); return firstSize != 0 && secondSize != 0; } + /** + * Trims the pillar based on its location in + * + * @param pillar The set of columns + */ private static void trimPillar(BufferedQueue> pillar) { int length = pillar.getCapacity(); int start = 0; @@ -105,6 +148,13 @@ private static void trimPillar(BufferedQueue> pillar) { } } + /** + * Creates the starting Grid from the top of the pillar + * + * @param pillar The generated set of columns + * @param gridSideLength The side length of a grid to calculate + * @return The queues that make up the underlying start Grid + */ private static BufferedQueue> createInitialCopy( BufferedQueue> pillar, int gridSideLength) { int[] columnLengths = calculateColumnLengthArray(gridSideLength); @@ -120,6 +170,15 @@ private static BufferedQueue> createInitialCopy( return copiedGrid; } + /** + * Compares the shapes between the original hexagon and the copied segment from the pillar + * 6 times to see if the original shape order matches any of the rotation configurations + * of the copied segment + * + * @param original The original grid from the user + * @param copy The copied segment from the pillar of queues + * @return Null if the grid is not found within the copy + */ private static Grid compareFullRotation(HexagonalPlane original, HexagonalPlane copy) { int rotation = 0; final List originalShapes = convertToHexShapes(original); @@ -131,6 +190,12 @@ private static Grid compareFullRotation(HexagonalPlane original, HexagonalPlane return null; } + /** + * Extracts the shape order from all the queues in the hexagon + * + * @param structure The underlying hexagonal structure from a Grid class + * @return The list of shapes from the hexagon + */ private static List convertToHexShapes(HexagonalPlane structure) { return structure.getBufferedQueues() .stream() @@ -139,6 +204,13 @@ private static List convertToHexShapes(HexagonalPlane structure) { .toList(); } + /** + * Manipulates the underlying queues of the copy Hexagonal Plane to remove from the top layer + * and add another set of nodes to the end of each queue + * + * @param pillar The queues that are being pulled from + * @param copy The cloned hexagon + */ private static void moveToNextSegment(BufferedQueue> pillar, HexagonalPlane copy) { BufferedQueue> copiedQueues = copy.getBufferedQueues(); for (BufferedQueue column : copiedQueues) diff --git a/src/main/java/bomb/modules/dh/hexamaze/hexalgorithm/pathfinding/ExitChecker.java b/src/main/java/bomb/modules/dh/hexamaze/hexalgorithm/pathfinding/ExitChecker.java index f2f17a3c..421ec4f4 100644 --- a/src/main/java/bomb/modules/dh/hexamaze/hexalgorithm/pathfinding/ExitChecker.java +++ b/src/main/java/bomb/modules/dh/hexamaze/hexalgorithm/pathfinding/ExitChecker.java @@ -28,6 +28,15 @@ import static bomb.modules.dh.hexamaze.hexalgorithm.storage.HexagonalPlane.CALCULATE_SPAN; public class ExitChecker { + /** + * Determines the possible exits and the exit description from the grid that was found in the + * MazeSearch search function + * + * @param grid The grid with all shape, peg color and wall information + * @return An empty Optional if there is no player peg on the board or + * all possible exits based on the peg color and the direction the player must exit from + * @throws IllegalArgumentException If there's more than one peg on the board + */ public static Optional>> findPossibleExits(@NotNull Grid grid) throws IllegalArgumentException { int pegCount = countPegsOnGrid(grid.getHexagon().getBufferedQueues()); diff --git a/src/main/java/bomb/modules/dh/hexamaze/hexalgorithm/pathfinding/MazeRunner.java b/src/main/java/bomb/modules/dh/hexamaze/hexalgorithm/pathfinding/MazeRunner.java index d6448872..da184790 100644 --- a/src/main/java/bomb/modules/dh/hexamaze/hexalgorithm/pathfinding/MazeRunner.java +++ b/src/main/java/bomb/modules/dh/hexamaze/hexalgorithm/pathfinding/MazeRunner.java @@ -26,6 +26,14 @@ public class MazeRunner { private static final Coordinates MOVE_DOWN, MOVE_RIGHT, LEFT_SIDE_MOVE_DOWN_RIGHT, RIGHT_SIDE_MOVE_TOP_RIGHT; + /** + * Runs the maze through Dijkstra's algorithm for every exit that's possible + * + * @param grid The grid with all shape and wall information + * @param possibleExits The list of coordinates for all possible exits + * @return The coordinate list of the shortest path from the player location to the best possible exit + * @throws IllegalArgumentException If there is no possible exit, which ideally shouldn't happen + */ public static @NotNull List runMaze(@NotNull Grid grid, @NotNull List possibleExits) throws IllegalArgumentException { Coordinates startingLocation = findStartingLocation(grid); From 935e7fe822643fbec287007418908a971c7f5867 Mon Sep 17 00:00:00 2001 From: "Mr. J" <45538844+Ultraviolet-Ninja@users.noreply.github.com> Date: Wed, 9 Nov 2022 20:42:00 -0600 Subject: [PATCH 50/86] More upgrades --- build.gradle | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build.gradle b/build.gradle index aabe4a53..ff5a9ab5 100644 --- a/build.gradle +++ b/build.gradle @@ -44,7 +44,7 @@ repositories { } dependencies { - implementation 'com.opencsv:opencsv:5.7.0' + implementation 'com.opencsv:opencsv:5.7.1' implementation 'org.javatuples:javatuples:1.2' implementation 'org.jgrapht:jgrapht-ext:1.5.1' implementation 'org.jetbrains:annotations:23.0.0' @@ -60,7 +60,7 @@ dependencies { testImplementation 'org.testng:testng:7.6.1' testImplementation 'org.slf4j:slf4j-api:2.0.3' testImplementation 'org.slf4j:slf4j-simple:2.0.3' - testImplementation 'nl.jqno.equalsverifier:equalsverifier:3.10.1' + testImplementation 'nl.jqno.equalsverifier:equalsverifier:3.11' } def firstInstance = project.hasProperty('thread0') From 8ae44146f8048dde3b9809357de906473d4afc38 Mon Sep 17 00:00:00 2001 From: "Mr. J" <45538844+Ultraviolet-Ninja@users.noreply.github.com> Date: Sun, 11 Dec 2022 19:45:10 -0600 Subject: [PATCH 51/86] Upgraded plugins in build.gradle --- build.gradle | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build.gradle b/build.gradle index aabe4a53..bd5594f8 100644 --- a/build.gradle +++ b/build.gradle @@ -3,11 +3,11 @@ plugins { id 'jacoco' id 'application' id 'org.beryx.jlink' version '2.24.4' - id 'com.palantir.docker' version '0.28.0' + id 'com.palantir.docker' version '0.34.0' id 'info.solidsoft.pitest' version '1.7.0' id 'org.openjfx.javafxplugin' version '0.0.13' id 'org.javamodularity.moduleplugin' version '1.8.10' - id 'com.github.breadmoirai.github-release' version '2.2.12' + id 'com.github.breadmoirai.github-release' version '2.4.1' } group 'jasmine.jragon' From 33f79053cd2f8f15bec1f2ea75f5eeed437a7475 Mon Sep 17 00:00:00 2001 From: "Mr. J" <45538844+Ultraviolet-Ninja@users.noreply.github.com> Date: Sun, 11 Dec 2022 22:51:51 -0600 Subject: [PATCH 52/86] Slight correction in Colored Switches graph file --- build.gradle | 6 +++--- .../resources/bomb/modules/c/colored_switches/graph.csv | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/build.gradle b/build.gradle index bd5594f8..2e03ab13 100644 --- a/build.gradle +++ b/build.gradle @@ -2,11 +2,11 @@ plugins { id 'java' id 'jacoco' id 'application' - id 'org.beryx.jlink' version '2.24.4' + id 'org.beryx.jlink' version '2.25.0' id 'com.palantir.docker' version '0.34.0' - id 'info.solidsoft.pitest' version '1.7.0' + id 'info.solidsoft.pitest' version '1.9.11' id 'org.openjfx.javafxplugin' version '0.0.13' - id 'org.javamodularity.moduleplugin' version '1.8.10' + id 'org.javamodularity.moduleplugin' version '1.8.12' id 'com.github.breadmoirai.github-release' version '2.4.1' } diff --git a/src/main/resources/bomb/modules/c/colored_switches/graph.csv b/src/main/resources/bomb/modules/c/colored_switches/graph.csv index 618ef089..97856cdb 100644 --- a/src/main/resources/bomb/modules/c/colored_switches/graph.csv +++ b/src/main/resources/bomb/modules/c/colored_switches/graph.csv @@ -23,7 +23,7 @@ 22,[23(6)5],[18(2)3], 23,[21(6)4],, 24,[26(6)4],[8(6)1], -25,[9(6)1],[24(245)4],[27(1)4] +25,[9(6)1],[24(245)5],[27(1)4] 26,[18(6)2],[24(6)4],[10(025)1] 27,[11(6)1],[26(013)5], 28,[29(6)5],[20(34)2],[30(125)4] From 28af9b256c233adb5ff2230537e0eff375d512f7 Mon Sep 17 00:00:00 2001 From: "Mr. J" <45538844+Ultraviolet-Ninja@users.noreply.github.com> Date: Thu, 15 Dec 2022 15:47:29 -0600 Subject: [PATCH 53/86] Upgrades and spelling mistakes --- .github/workflows/gradle.yml | 2 +- build.gradle | 54 +++++++++++++++++++--------------- src/main/java/module-info.java | 2 +- 3 files changed, 33 insertions(+), 25 deletions(-) diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml index 1a62b9af..c81cdd02 100644 --- a/.github/workflows/gradle.yml +++ b/.github/workflows/gradle.yml @@ -44,5 +44,5 @@ jobs: id: docker_build run: ./gradlew dockerPushDockerHub - - name: Auto-Upload Relseases + - name: Auto-Upload Releases run: ./gradlew releaseToGitHub -PauthToken=${{ secrets.GITHUB_TOKEN }} \ No newline at end of file diff --git a/build.gradle b/build.gradle index 2e03ab13..59659dc2 100644 --- a/build.gradle +++ b/build.gradle @@ -11,7 +11,7 @@ plugins { } group 'jasmine.jragon' -version '0.22.0' +version '0.22.1' java { toolchain { @@ -24,7 +24,7 @@ application { 'bomb.TestingArea' : 'bomb.Main' - mainModule.set('bomb') + mainModule.set('centurion') } compileJava { @@ -44,7 +44,7 @@ repositories { } dependencies { - implementation 'com.opencsv:opencsv:5.7.0' + implementation 'com.opencsv:opencsv:5.7.1' implementation 'org.javatuples:javatuples:1.2' implementation 'org.jgrapht:jgrapht-ext:1.5.1' implementation 'org.jetbrains:annotations:23.0.0' @@ -57,10 +57,10 @@ dependencies { exclude group: "org.javafx" } - testImplementation 'org.testng:testng:7.6.1' - testImplementation 'org.slf4j:slf4j-api:2.0.3' - testImplementation 'org.slf4j:slf4j-simple:2.0.3' - testImplementation 'nl.jqno.equalsverifier:equalsverifier:3.10.1' + testImplementation 'org.testng:testng:7.7.0' + testImplementation 'org.slf4j:slf4j-api:2.0.5' + testImplementation 'org.slf4j:slf4j-simple:2.0.5' + testImplementation 'nl.jqno.equalsverifier:equalsverifier:3.11.1' } def firstInstance = project.hasProperty('thread0') @@ -148,9 +148,17 @@ javafx { modules = ['javafx.controls', 'javafx.fxml'] } -jar.manifest.attributes(['Main-Class': "${mainClassName}"]) +jar { + manifest.attributes(['Main-Class': "${mainClassName}"]) + +// from { +// duplicatesStrategy = DuplicatesStrategy.EXCLUDE +// configurations.runtimeClasspath.collect { it.isDirectory() ? it : zipTree(it) } +// } +} jlink { + imageZip = project.file("${buildDir}/distributions/app-${javafx.platform.classifier}.zip") options = ['--strip-debug', '--compress', '2', '--no-header-files', '--no-man-pages'] launcher { name = "${project.name}" @@ -184,21 +192,21 @@ dockerfileZip { destinationDirectory = file("${buildDir}/zip/docker") } -distZip { - from projectDir - include 'src/main/**/*' - include 'gradle/wrapper/*' - include 'markdown/*' - include 'build.gradle', 'gradlew', 'gradlew.bat', 'README.md', 'Progress.md', 'Learned.md' -} - -distTar { - from projectDir - include 'src/main/**/*' - include 'gradle/wrapper/*' - include 'markdown/*' - include 'build.gradle', 'gradlew', 'gradlew.bat', 'README.md', 'Progress.md', 'Learned.md' -} +//distZip { +// from projectDir +// include 'src/main/**/*' +// include 'gradle/wrapper/*' +// include 'markdown/*' +// include 'build.gradle', 'gradlew', 'gradlew.bat', 'README.md', 'Progress.md', 'Learned.md' +//} +// +//distTar { +// from projectDir +// include 'src/main/**/*' +// include 'gradle/wrapper/*' +// include 'markdown/*' +// include 'build.gradle', 'gradlew', 'gradlew.bat', 'README.md', 'Progress.md', 'Learned.md' +//} githubRelease { String baseFileName = "${buildDir}/distributions/${project.name}-${project.version}" diff --git a/src/main/java/module-info.java b/src/main/java/module-info.java index 55a22078..82cee910 100644 --- a/src/main/java/module-info.java +++ b/src/main/java/module-info.java @@ -1,4 +1,4 @@ -open module bomb { +open module centurion { requires javafx.controls; requires javafx.fxml; From 0e79c4f2720bee712c36ca2abd361cc13b15ccbd Mon Sep 17 00:00:00 2001 From: "Mr. J" <45538844+Ultraviolet-Ninja@users.noreply.github.com> Date: Fri, 16 Dec 2022 13:42:46 -0600 Subject: [PATCH 54/86] Tweaks to the build.gradle --- build.gradle | 43 +++++++++++++------------------------------ 1 file changed, 13 insertions(+), 30 deletions(-) diff --git a/build.gradle b/build.gradle index 59659dc2..eb4ded0a 100644 --- a/build.gradle +++ b/build.gradle @@ -8,6 +8,8 @@ plugins { id 'org.openjfx.javafxplugin' version '0.0.13' id 'org.javamodularity.moduleplugin' version '1.8.12' id 'com.github.breadmoirai.github-release' version '2.4.1' +// Another packing plugin to "check out" +// id "io.ktor.plugin" version "2.2.1" } group 'jasmine.jragon' @@ -50,12 +52,14 @@ dependencies { implementation 'org.jetbrains:annotations:23.0.0' //implementation 'io.github.fvarrui:javpackager:1.5.1' - implementation('com.jfoenix:jfoenix:9.0.4') { - exclude group: "org.javafx" - } - implementation('io.github.palexdev:materialfx:11.12.0') { - exclude group: "org.javafx" - } + implementation('com.jfoenix:jfoenix:9.0.4') +// { +// exclude group: "org.javafx" +// } + implementation('io.github.palexdev:materialfx:11.12.0') +// { +// exclude group: "org.javafx" +// } testImplementation 'org.testng:testng:7.7.0' testImplementation 'org.slf4j:slf4j-api:2.0.5' @@ -144,42 +148,21 @@ pitest { } javafx { - version = '17.0.1' + version = '17.0.2' modules = ['javafx.controls', 'javafx.fxml'] } -jar { - manifest.attributes(['Main-Class': "${mainClassName}"]) - -// from { -// duplicatesStrategy = DuplicatesStrategy.EXCLUDE -// configurations.runtimeClasspath.collect { it.isDirectory() ? it : zipTree(it) } -// } -} +jar.manifest.attributes(['Main-Class': "${mainClassName}"]) jlink { imageZip = project.file("${buildDir}/distributions/app-${javafx.platform.classifier}.zip") options = ['--strip-debug', '--compress', '2', '--no-header-files', '--no-man-pages'] + addExtraDependencies("javafx") launcher { name = "${project.name}" } } -//task fatJar(type: Jar) { -// manifest.from jar.manifest -// from { -// configurations.runtimeClasspath.collect {it.isDirectory() ? it : zipTree(it)} -// } { -// exclude "META-INF/*.SF" -// exclude "META-INF/*.DSA" -// exclude "META-INF/*.RSA" -// } -//} -// -//artifacts { -// archives fatJar -//} - docker { dependsOn(jar) name "${project.name.toLowerCase()}:${project.version}" From 64266c00cb2c3e1f7052ce23fab5b80ec0d753fa Mon Sep 17 00:00:00 2001 From: "Mr. J" <45538844+Ultraviolet-Ninja@users.noreply.github.com> Date: Sat, 17 Dec 2022 16:05:56 -0600 Subject: [PATCH 55/86] Failed experiment of Dockerfile changes New Annotation idea for the loading of the project --- Dockerfile | 30 ++++++- build.gradle | 24 +++-- src/main/java/bomb/ManualControllerTwo.java | 88 +++++++++++++++++++ src/main/java/bomb/annotations/Puzzle.java | 12 +++ .../bomb/modules/ab/alphabet/Alphabet.java | 2 + .../bomb/modules/ab/astrology/Astrology.java | 2 + .../java/bomb/modules/ab/bitwise/Bitwise.java | 2 + .../modules/ab/blind_alley/BlindAlley.java | 2 + 8 files changed, 149 insertions(+), 13 deletions(-) create mode 100644 src/main/java/bomb/ManualControllerTwo.java create mode 100644 src/main/java/bomb/annotations/Puzzle.java diff --git a/Dockerfile b/Dockerfile index 58384bda..48b67919 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,28 @@ -FROM openjdk:16-alpine +#V1 of the Dockerfile +#FROM openjdk:16-alpine +# +#ARG JAR_FILE +#COPY $JAR_FILE app.jar +# +#ENTRYPOINT ["java", "-jar", "app.jar"] -ARG JAR_FILE -COPY $JAR_FILE app.jar +FROM gradle:7.4.0-jdk17-alpine -ENTRYPOINT ["java", "-jar", "app.jar"] \ No newline at end of file +ENV APP_HOME=/usr/app/ +WORKDIR $APP_HOME + +COPY necessaryFiles/build.gradle necessaryFiles/settings.gradle $APP_HOME + +COPY necessaryFiles/wrapper ${APP_HOME}gradle/wrapper +COPY --chown=gradle:gradle . /home/gradle/src +USER root +RUN chown -R gradle /home/gradle/src + +#COPY necessaryFiles/java/module-info.java ${APP_HOME}src/main/java + +RUN gradle build -i --stacktrace +COPY necessaryFiles/java ${APP_HOME}src/main/java +COPY necessaryFiles/resources ${APP_HOME}src/main/resources +RUN gradle clean build + +ENTRYPOINT gradle run \ No newline at end of file diff --git a/build.gradle b/build.gradle index eb4ded0a..343eb48c 100644 --- a/build.gradle +++ b/build.gradle @@ -16,9 +16,8 @@ group 'jasmine.jragon' version '0.22.1' java { - toolchain { - languageVersion = JavaLanguageVersion.of(16) - } + sourceCompatibility(16) + targetCompatibility(16) } application { @@ -49,7 +48,7 @@ dependencies { implementation 'com.opencsv:opencsv:5.7.1' implementation 'org.javatuples:javatuples:1.2' implementation 'org.jgrapht:jgrapht-ext:1.5.1' - implementation 'org.jetbrains:annotations:23.0.0' + implementation 'org.jetbrains:annotations:23.1.0' //implementation 'io.github.fvarrui:javpackager:1.5.1' implementation('com.jfoenix:jfoenix:9.0.4') @@ -64,7 +63,7 @@ dependencies { testImplementation 'org.testng:testng:7.7.0' testImplementation 'org.slf4j:slf4j-api:2.0.5' testImplementation 'org.slf4j:slf4j-simple:2.0.5' - testImplementation 'nl.jqno.equalsverifier:equalsverifier:3.11.1' + testImplementation 'nl.jqno.equalsverifier:equalsverifier:3.12.2' } def firstInstance = project.hasProperty('thread0') @@ -163,12 +162,19 @@ jlink { } } +//docker { +// dependsOn(jar) +// name "${project.name.toLowerCase()}:${project.version}" +// files "${buildDir}/libs/${project.name}-${project.version}.jar" +// buildArgs([JAR_FILE: "${project.name}-${project.version}.jar"]) +// tag('DockerHub', "jasminejragon/${project.name.replace("C", "-c").toLowerCase()}:${project.version}") +//} + docker { dependsOn(jar) - name "${project.name.toLowerCase()}:${project.version}" - files "${buildDir}/libs/${project.name}-${project.version}.jar" - buildArgs([JAR_FILE: "${project.name}-${project.version}.jar"]) - tag('DockerHub', "jasminejragon/${project.name.replace("C", "-c").toLowerCase()}:${project.version}") + name "${project.name.replace("C", "-c").toLowerCase()}:${project.version}" + copySpec.from("src/main").from("gradle").into("necessaryFiles") + files 'build.gradle', 'settings.gradle' } dockerfileZip { diff --git a/src/main/java/bomb/ManualControllerTwo.java b/src/main/java/bomb/ManualControllerTwo.java new file mode 100644 index 00000000..62c06c36 --- /dev/null +++ b/src/main/java/bomb/ManualControllerTwo.java @@ -0,0 +1,88 @@ +package bomb; + +import bomb.annotations.Puzzle; +import bomb.tools.pattern.observer.ForgetMeNotToggleObserver; +import bomb.tools.pattern.observer.ObserverHub; +import bomb.tools.pattern.observer.SouvenirToggleObserver; +import com.jfoenix.controls.JFXRadioButton; +import javafx.fxml.FXML; +import javafx.scene.Node; +import javafx.scene.control.RadioButton; +import javafx.scene.control.TextField; +import javafx.scene.control.Toggle; +import javafx.scene.control.ToggleGroup; +import javafx.scene.layout.GridPane; +import javafx.scene.layout.Region; +import javafx.scene.layout.VBox; + +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.ExecutionException; + +import static bomb.tools.pattern.facade.FacadeFX.GET_TOGGLE_NAME; +import static bomb.tools.pattern.factory.TextFormatterFactory.createSearchBarFormatter; +import static bomb.tools.pattern.observer.ObserverHub.ObserverIndex.FORGET_ME_NOT_TOGGLE; +import static bomb.tools.pattern.observer.ObserverHub.ObserverIndex.SOUVENIR_TOGGLE; +import static java.util.concurrent.CompletableFuture.supplyAsync; +import static java.util.function.UnaryOperator.identity; +import static java.util.stream.Collectors.toMap; + +public class ManualControllerTwo { + private Map regionMap; + private List observableRadioList; + private final List allRadioButtons; + + @FXML + private GridPane base; + + @FXML + private JFXRadioButton forgetMeNot, souvenir; + + @FXML + private TextField searchBar; + + @FXML + private ToggleGroup options; + + @FXML + private VBox menuVBox, radioButtonHouse; + + public ManualControllerTwo() { + allRadioButtons = new ArrayList<>(); + } + + public void initialize() throws ExecutionException, InterruptedException { + searchBar.setTextFormatter(createSearchBarFormatter()); + observableRadioList = radioButtonHouse.getChildren(); + allRadioButtons.addAll( + observableRadioList.stream() + .map(node -> (RadioButton) node) + .toList() + ); + ObserverHub.addObserver(FORGET_ME_NOT_TOGGLE, new ForgetMeNotToggleObserver(forgetMeNot)); + ObserverHub.addObserver(SOUVENIR_TOGGLE, new SouvenirToggleObserver(souvenir)); + +// regionMap = setupRegionMap().get(); + + } + + private CompletableFuture> setupRegionMap() throws ExecutionException, InterruptedException { + return null; + } + + private static CompletableFuture> createRadioButtonNameFuture(List radioButtonList) { + return supplyAsync(radioButtonList::stream) + .thenApply(stream -> stream.collect(toMap( + toggle -> GET_TOGGLE_NAME.apply(toggle) + .replaceAll("[ -]", "_") + .replaceAll("[()']", "") + .toLowerCase(), + identity() + ))); + } + + private void createResourceFuture() { + } +} diff --git a/src/main/java/bomb/annotations/Puzzle.java b/src/main/java/bomb/annotations/Puzzle.java new file mode 100644 index 00000000..d3d0e12d --- /dev/null +++ b/src/main/java/bomb/annotations/Puzzle.java @@ -0,0 +1,12 @@ +package bomb.annotations; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +@Retention(RetentionPolicy.RUNTIME) +@Target(ElementType.TYPE) +public @interface Puzzle { + String resource(); +} diff --git a/src/main/java/bomb/modules/ab/alphabet/Alphabet.java b/src/main/java/bomb/modules/ab/alphabet/Alphabet.java index 00d1ee1d..89645a17 100644 --- a/src/main/java/bomb/modules/ab/alphabet/Alphabet.java +++ b/src/main/java/bomb/modules/ab/alphabet/Alphabet.java @@ -1,6 +1,7 @@ package bomb.modules.ab.alphabet; import bomb.Widget; +import bomb.annotations.Puzzle; import bomb.tools.filter.Regex; import org.jetbrains.annotations.NotNull; @@ -17,6 +18,7 @@ * if the letters appear in those 4 tiles. * But if no set matches the 4 tiles, the tiles are to be pressed in alphabetical order. */ +@Puzzle(resource = "alphabet.fxml") public class Alphabet extends Widget { private static final String[] WORD_BANK; diff --git a/src/main/java/bomb/modules/ab/astrology/Astrology.java b/src/main/java/bomb/modules/ab/astrology/Astrology.java index ce95c779..1eb95962 100644 --- a/src/main/java/bomb/modules/ab/astrology/Astrology.java +++ b/src/main/java/bomb/modules/ab/astrology/Astrology.java @@ -1,6 +1,7 @@ package bomb.modules.ab.astrology; import bomb.Widget; +import bomb.annotations.Puzzle; import bomb.tools.filter.Regex; import org.jetbrains.annotations.NotNull; @@ -23,6 +24,7 @@ * The quantity of the number is used to determine when to press the button. * (i.e. Bad Omen at 5 means that you need to press "Bad Omen" when the bomb timer has a 5 in it) */ +@Puzzle(resource = "alphabet.fxml") public class Astrology extends Widget { public static final byte ELEMENT_INDEX = 0, CELESTIAL_INDEX = 1, ZODIAC_INDEX = 2, EXPECTED_SIZE = 3; public static final String GOOD_OMEN = "Good Omen at ", POOR_OMEN = "Poor Omen at ", NO_OMEN = "No Omen"; diff --git a/src/main/java/bomb/modules/ab/bitwise/Bitwise.java b/src/main/java/bomb/modules/ab/bitwise/Bitwise.java index 33c27374..7d84d654 100644 --- a/src/main/java/bomb/modules/ab/bitwise/Bitwise.java +++ b/src/main/java/bomb/modules/ab/bitwise/Bitwise.java @@ -1,6 +1,7 @@ package bomb.modules.ab.bitwise; import bomb.Widget; +import bomb.annotations.Puzzle; import bomb.tools.logic.LogicOperator; import org.jetbrains.annotations.NotNull; @@ -17,6 +18,7 @@ * number line with a specific boolean operator that the Defuser reads to the expert. The class evaluates * which bits will be 1 or 0 in the byte line. */ +@Puzzle(resource = "bitwise.fxml") public class Bitwise extends Widget { /** * Turns the edgework conditions into a byte that the Defuser will input into the bomb module diff --git a/src/main/java/bomb/modules/ab/blind_alley/BlindAlley.java b/src/main/java/bomb/modules/ab/blind_alley/BlindAlley.java index 3a467ff0..3e991a08 100644 --- a/src/main/java/bomb/modules/ab/blind_alley/BlindAlley.java +++ b/src/main/java/bomb/modules/ab/blind_alley/BlindAlley.java @@ -1,6 +1,7 @@ package bomb.modules.ab.blind_alley; import bomb.Widget; +import bomb.annotations.Puzzle; import static bomb.enumerations.Indicator.BOB; import static bomb.enumerations.Indicator.CAR; @@ -27,6 +28,7 @@ * the 'Blind Alley' tab pane. Blind Alley in a widget-dependant module that require you to press * specific sections of the module based on the indicators, LED's, ports and batteries are on the bomb. */ +@Puzzle(resource = "blind_alley.fxml") public class BlindAlley extends Widget { private static int[][] alleyCat = new int[3][3]; From e288575f22f1b9349d6ec32a671dd3da25adfc47 Mon Sep 17 00:00:00 2001 From: "Mr. J" <45538844+Ultraviolet-Ninja@users.noreply.github.com> Date: Sat, 17 Dec 2022 16:19:35 -0600 Subject: [PATCH 56/86] Reverted the pitest plugin back to a functional version --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index 343eb48c..05c0491b 100644 --- a/build.gradle +++ b/build.gradle @@ -4,7 +4,7 @@ plugins { id 'application' id 'org.beryx.jlink' version '2.25.0' id 'com.palantir.docker' version '0.34.0' - id 'info.solidsoft.pitest' version '1.9.11' + id 'info.solidsoft.pitest' version '1.7.4' id 'org.openjfx.javafxplugin' version '0.0.13' id 'org.javamodularity.moduleplugin' version '1.8.12' id 'com.github.breadmoirai.github-release' version '2.4.1' From 1be543ede0c6e4c849cc02a1abb26d90cb7bdd46 Mon Sep 17 00:00:00 2001 From: "Mr. J" <45538844+Ultraviolet-Ninja@users.noreply.github.com> Date: Sat, 17 Dec 2022 17:51:08 -0600 Subject: [PATCH 57/86] An idea --- build.gradle | 2 +- src/main/java/bomb/ManualControllerTwo.java | 1 - src/main/java/bomb/TestingArea.java | 36 ++++++++++++++++++- .../Puzzle.java | 2 +- .../bomb/initialization/PuzzleSupplier.java | 12 +++++++ .../bomb/modules/ab/alphabet/Alphabet.java | 2 +- .../bomb/modules/ab/astrology/Astrology.java | 2 +- .../java/bomb/modules/ab/bitwise/Bitwise.java | 2 +- .../modules/ab/blind_alley/BlindAlley.java | 2 +- 9 files changed, 53 insertions(+), 8 deletions(-) rename src/main/java/bomb/{annotations => initialization}/Puzzle.java (90%) create mode 100644 src/main/java/bomb/initialization/PuzzleSupplier.java diff --git a/build.gradle b/build.gradle index 05c0491b..09687a92 100644 --- a/build.gradle +++ b/build.gradle @@ -23,7 +23,7 @@ java { application { mainClassName = project.hasProperty('testingArea') ? 'bomb.TestingArea' : - 'bomb.Main' + 'bomb.TestingArea' mainModule.set('centurion') } diff --git a/src/main/java/bomb/ManualControllerTwo.java b/src/main/java/bomb/ManualControllerTwo.java index 62c06c36..5a98f118 100644 --- a/src/main/java/bomb/ManualControllerTwo.java +++ b/src/main/java/bomb/ManualControllerTwo.java @@ -1,6 +1,5 @@ package bomb; -import bomb.annotations.Puzzle; import bomb.tools.pattern.observer.ForgetMeNotToggleObserver; import bomb.tools.pattern.observer.ObserverHub; import bomb.tools.pattern.observer.SouvenirToggleObserver; diff --git a/src/main/java/bomb/TestingArea.java b/src/main/java/bomb/TestingArea.java index 73044b70..95fce459 100644 --- a/src/main/java/bomb/TestingArea.java +++ b/src/main/java/bomb/TestingArea.java @@ -1,11 +1,45 @@ package bomb; +import bomb.initialization.Puzzle; +import bomb.initialization.PuzzleSupplier; import bomb.tools.filter.Regex; +import java.io.File; +import java.io.IOException; +import java.net.URL; +import java.net.URLClassLoader; +import java.util.Enumeration; + public class TestingArea { - public static void main(String[] args) { + public static void main(String[] args) throws IOException, ClassNotFoundException { Regex labelFilter = new Regex("\"([^\"]*)\",?"); Regex frequencyFilter = new Regex("frequencies\\.put\\(\"([^\"]+)\", (\\d\\.\\d{1,3})\\);"); Regex whoMapFilter = new Regex("stepTwoMap\\.put\\(\"([^\"]+)\", \"([^\"]+)\"\\);"); + + for (var cls : PuzzleSupplier.provideClassList()) { + System.out.println(cls); + System.out.println(cls.isAnnotationPresent(Puzzle.class)); + } + + // Get the ClassLoader for the current thread +// ClassLoader classLoader = Thread.currentThread().getContextClassLoader(); +// +//// Get a list of all the class files in the package and its subpackages +// Enumeration resources = classLoader.getResources("bomb/modules"); +// while (resources.hasMoreElements()) { +// URL url = resources.nextElement(); +// // Load the classes from the URL and check if they are annotated with the given annotation +// URLClassLoader urlClassLoader = new URLClassLoader(new URL[] { url }); +// File dir = new File(url.getFile()); +// for (File file : dir.listFiles()) { +// if (file.getName().endsWith(".class")) { +// String className = file.getName().substring(0, file.getName().length() - 6); +// Class cls = urlClassLoader.loadClass("my.package." + className); +// if (cls.isAnnotationPresent(Puzzle.class)) { +// // cls is annotated with the MyAnnotation annotation +// } +// } +// } +// } } } \ No newline at end of file diff --git a/src/main/java/bomb/annotations/Puzzle.java b/src/main/java/bomb/initialization/Puzzle.java similarity index 90% rename from src/main/java/bomb/annotations/Puzzle.java rename to src/main/java/bomb/initialization/Puzzle.java index d3d0e12d..851caec0 100644 --- a/src/main/java/bomb/annotations/Puzzle.java +++ b/src/main/java/bomb/initialization/Puzzle.java @@ -1,4 +1,4 @@ -package bomb.annotations; +package bomb.initialization; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; diff --git a/src/main/java/bomb/initialization/PuzzleSupplier.java b/src/main/java/bomb/initialization/PuzzleSupplier.java new file mode 100644 index 00000000..e68e36a0 --- /dev/null +++ b/src/main/java/bomb/initialization/PuzzleSupplier.java @@ -0,0 +1,12 @@ +package bomb.initialization; + +import bomb.modules.ab.alphabet.Alphabet; +import bomb.modules.ab.astrology.Astrology; + +import java.util.List; + +public class PuzzleSupplier { + public static List> provideClassList() { + return List.of(Alphabet.class, Astrology.class); + } +} diff --git a/src/main/java/bomb/modules/ab/alphabet/Alphabet.java b/src/main/java/bomb/modules/ab/alphabet/Alphabet.java index 89645a17..33cff144 100644 --- a/src/main/java/bomb/modules/ab/alphabet/Alphabet.java +++ b/src/main/java/bomb/modules/ab/alphabet/Alphabet.java @@ -1,7 +1,7 @@ package bomb.modules.ab.alphabet; import bomb.Widget; -import bomb.annotations.Puzzle; +import bomb.initialization.Puzzle; import bomb.tools.filter.Regex; import org.jetbrains.annotations.NotNull; diff --git a/src/main/java/bomb/modules/ab/astrology/Astrology.java b/src/main/java/bomb/modules/ab/astrology/Astrology.java index 1eb95962..17f75330 100644 --- a/src/main/java/bomb/modules/ab/astrology/Astrology.java +++ b/src/main/java/bomb/modules/ab/astrology/Astrology.java @@ -1,7 +1,7 @@ package bomb.modules.ab.astrology; import bomb.Widget; -import bomb.annotations.Puzzle; +import bomb.initialization.Puzzle; import bomb.tools.filter.Regex; import org.jetbrains.annotations.NotNull; diff --git a/src/main/java/bomb/modules/ab/bitwise/Bitwise.java b/src/main/java/bomb/modules/ab/bitwise/Bitwise.java index 7d84d654..7c11c756 100644 --- a/src/main/java/bomb/modules/ab/bitwise/Bitwise.java +++ b/src/main/java/bomb/modules/ab/bitwise/Bitwise.java @@ -1,7 +1,7 @@ package bomb.modules.ab.bitwise; import bomb.Widget; -import bomb.annotations.Puzzle; +import bomb.initialization.Puzzle; import bomb.tools.logic.LogicOperator; import org.jetbrains.annotations.NotNull; diff --git a/src/main/java/bomb/modules/ab/blind_alley/BlindAlley.java b/src/main/java/bomb/modules/ab/blind_alley/BlindAlley.java index 3e991a08..de7310ee 100644 --- a/src/main/java/bomb/modules/ab/blind_alley/BlindAlley.java +++ b/src/main/java/bomb/modules/ab/blind_alley/BlindAlley.java @@ -1,7 +1,7 @@ package bomb.modules.ab.blind_alley; import bomb.Widget; -import bomb.annotations.Puzzle; +import bomb.initialization.Puzzle; import static bomb.enumerations.Indicator.BOB; import static bomb.enumerations.Indicator.CAR; From 17d61276dc9a3abcc2342e5577ae578142a737f8 Mon Sep 17 00:00:00 2001 From: "Mr. J" <45538844+Ultraviolet-Ninja@users.noreply.github.com> Date: Sat, 17 Dec 2022 17:54:39 -0600 Subject: [PATCH 58/86] A test of LGTM --- .lgtm.yml | 2 +- build.gradle | 2 +- src/main/java/bomb/Main.java | 1 + 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.lgtm.yml b/.lgtm.yml index eb2eacaa..1ac15329 100644 --- a/.lgtm.yml +++ b/.lgtm.yml @@ -1,4 +1,4 @@ extraction: java: index: - java_version: 16 \ No newline at end of file + java_version: 17 \ No newline at end of file diff --git a/build.gradle b/build.gradle index eb4ded0a..04808316 100644 --- a/build.gradle +++ b/build.gradle @@ -17,7 +17,7 @@ version '0.22.1' java { toolchain { - languageVersion = JavaLanguageVersion.of(16) + languageVersion = JavaLanguageVersion.of(17) } } diff --git a/src/main/java/bomb/Main.java b/src/main/java/bomb/Main.java index eb4bc4a7..08051bb1 100644 --- a/src/main/java/bomb/Main.java +++ b/src/main/java/bomb/Main.java @@ -29,6 +29,7 @@ public class Main extends Application { @Override public void start(Stage primaryStage) throws Exception { + Widget.class.getPermittedSubclasses(); FXMLLoader loader = new FXMLLoader(Main.class.getResource("manual.fxml")); Parent root = loader.load(); Scene scene = new Scene(root); From f47fb30a366aa892c0d009a96230d040dadefb24 Mon Sep 17 00:00:00 2001 From: "Mr. J" <45538844+Ultraviolet-Ninja@users.noreply.github.com> Date: Sat, 17 Dec 2022 17:55:16 -0600 Subject: [PATCH 59/86] Revert of Pitest version --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index 04808316..ff1dfe3c 100644 --- a/build.gradle +++ b/build.gradle @@ -4,7 +4,7 @@ plugins { id 'application' id 'org.beryx.jlink' version '2.25.0' id 'com.palantir.docker' version '0.34.0' - id 'info.solidsoft.pitest' version '1.9.11' + id 'info.solidsoft.pitest' version '1.7.4' id 'org.openjfx.javafxplugin' version '0.0.13' id 'org.javamodularity.moduleplugin' version '1.8.12' id 'com.github.breadmoirai.github-release' version '2.4.1' From 8572d5d81837b368713174812db243db07455309 Mon Sep 17 00:00:00 2001 From: "Mr. J" <45538844+Ultraviolet-Ninja@users.noreply.github.com> Date: Sat, 17 Dec 2022 18:40:08 -0600 Subject: [PATCH 60/86] Found a way to grab the annotations easily --- .circleci/config.yml | 2 +- build.gradle | 8 ++-- src/main/java/bomb/TestingArea.java | 44 +++++------------ src/main/java/bomb/Widget.java | 47 ++++++++++++++++++- .../Puzzle.java | 2 +- .../bomb/initialization/PuzzleSupplier.java | 12 ----- .../bomb/modules/ab/alphabet/Alphabet.java | 4 +- .../bomb/modules/ab/astrology/Astrology.java | 4 +- .../modules/ab/battleship/Battleship.java | 2 +- .../java/bomb/modules/ab/bitwise/Bitwise.java | 4 +- .../modules/ab/blind_alley/BlindAlley.java | 4 +- .../modules/ab/boolean_venn/BooleanVenn.java | 2 +- .../java/bomb/modules/c/caesar/Caesar.java | 2 +- .../c/cheap_checkout/CheapCheckout.java | 2 +- src/main/java/bomb/modules/c/chess/Chess.java | 2 +- .../bomb/modules/c/chords/ChordQualities.java | 2 +- .../modules/c/color_flash/ColorFlash.java | 2 +- .../c/colored_switches/ColoredSwitches.java | 2 +- .../java/bomb/modules/dh/emoji/EmojiMath.java | 2 +- .../bomb/modules/dh/fast_math/FastMath.java | 2 +- .../bomb/modules/dh/fizzbuzz/FizzBuzz.java | 2 +- .../modules/dh/forget_me/ForgetMeNot.java | 2 +- .../bomb/modules/dh/hexamaze/Hexamaze.java | 2 +- .../bomb/modules/il/ice_cream/IceCream.java | 2 +- .../java/bomb/modules/il/laundry/Laundry.java | 2 +- .../il/led_encryption/LEDEncryption.java | 2 +- .../java/bomb/modules/il/logic/Logic.java | 2 +- .../m/microcontroller/MicroController.java | 2 +- .../modules/m/monsplode/MonslopeFight.java | 2 +- .../modules/m/morsematics/Morsematics.java | 2 +- .../java/bomb/modules/m/murder/Murder.java | 2 +- .../np/neutralization/Neutralization.java | 2 +- .../bomb/modules/np/number_pad/NumberPad.java | 2 +- .../modules/r/round_keypads/RoundKeypads.java | 2 +- .../bomb/modules/s/seashells/Seashells.java | 2 +- .../bomb/modules/s/semaphore/Semaphore.java | 2 +- .../modules/s/shape_shift/ShapeShift.java | 2 +- .../modules/s/simon/screams/SimonScreams.java | 2 +- .../modules/s/simon/states/SimonStates.java | 2 +- .../bomb/modules/s/souvenir/Souvenir.java | 2 +- .../bomb/modules/s/square/SquareButton.java | 2 +- .../bomb/modules/s/switches/Switches.java | 3 +- .../java/bomb/modules/t/bulb/TheBulb.java | 2 +- .../bomb/modules/t/translated/Button.java | 2 +- .../java/bomb/modules/t/translated/Morse.java | 2 +- .../bomb/modules/t/translated/OnFirst.java | 2 +- .../bomb/modules/t/translated/Passwords.java | 2 +- .../t/translated/TranslationCenter.java | 2 +- .../bomb/modules/t/translated/VentGas.java | 2 +- .../t/translated/solutions/button/Button.java | 2 +- .../java/bomb/modules/t/two_bit/TwoBit.java | 2 +- .../modules/wz/word_search/WordSearch.java | 2 +- src/main/java/bomb/modules/wz/zoo/Zoo.java | 2 +- .../java/bomb/tools/event/HoverHandler.java | 1 - .../observer/BlindAlleyPaneObserver.java | 1 - .../observer/ForgetMeNotToggleObserver.java | 1 - 56 files changed, 115 insertions(+), 106 deletions(-) rename src/main/java/bomb/{initialization => annotation}/Puzzle.java (90%) delete mode 100644 src/main/java/bomb/initialization/PuzzleSupplier.java diff --git a/.circleci/config.yml b/.circleci/config.yml index 8f2e8959..c42601a6 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -7,7 +7,7 @@ jobs: jacoco: docker: # specify the version you desire here - - image: cimg/openjdk:17.0.1 + - image: cimg/openjdk:17.0.2 # Specify service dependencies here if necessary # CircleCI maintains a library of pre-built images diff --git a/build.gradle b/build.gradle index 09687a92..7e456075 100644 --- a/build.gradle +++ b/build.gradle @@ -13,17 +13,17 @@ plugins { } group 'jasmine.jragon' -version '0.22.1' +version '0.22.2' java { - sourceCompatibility(16) - targetCompatibility(16) + sourceCompatibility(17) + targetCompatibility(17) } application { mainClassName = project.hasProperty('testingArea') ? 'bomb.TestingArea' : - 'bomb.TestingArea' + 'bomb.Main' mainModule.set('centurion') } diff --git a/src/main/java/bomb/TestingArea.java b/src/main/java/bomb/TestingArea.java index 95fce459..c7e88df0 100644 --- a/src/main/java/bomb/TestingArea.java +++ b/src/main/java/bomb/TestingArea.java @@ -1,45 +1,23 @@ package bomb; -import bomb.initialization.Puzzle; -import bomb.initialization.PuzzleSupplier; import bomb.tools.filter.Regex; -import java.io.File; -import java.io.IOException; -import java.net.URL; -import java.net.URLClassLoader; -import java.util.Enumeration; - public class TestingArea { - public static void main(String[] args) throws IOException, ClassNotFoundException { + public static void main(String[] args) { Regex labelFilter = new Regex("\"([^\"]*)\",?"); Regex frequencyFilter = new Regex("frequencies\\.put\\(\"([^\"]+)\", (\\d\\.\\d{1,3})\\);"); Regex whoMapFilter = new Regex("stepTwoMap\\.put\\(\"([^\"]+)\", \"([^\"]+)\"\\);"); - for (var cls : PuzzleSupplier.provideClassList()) { - System.out.println(cls); - System.out.println(cls.isAnnotationPresent(Puzzle.class)); - } + method(Widget.class); + } - // Get the ClassLoader for the current thread -// ClassLoader classLoader = Thread.currentThread().getContextClassLoader(); -// -//// Get a list of all the class files in the package and its subpackages -// Enumeration resources = classLoader.getResources("bomb/modules"); -// while (resources.hasMoreElements()) { -// URL url = resources.nextElement(); -// // Load the classes from the URL and check if they are annotated with the given annotation -// URLClassLoader urlClassLoader = new URLClassLoader(new URL[] { url }); -// File dir = new File(url.getFile()); -// for (File file : dir.listFiles()) { -// if (file.getName().endsWith(".class")) { -// String className = file.getName().substring(0, file.getName().length() - 6); -// Class cls = urlClassLoader.loadClass("my.package." + className); -// if (cls.isAnnotationPresent(Puzzle.class)) { -// // cls is annotated with the MyAnnotation annotation -// } -// } -// } -// } + public static void method(Class cls) { + System.out.println(cls); + var subClasses = cls.getPermittedSubclasses(); + if (subClasses != null) { + for (Class cl : subClasses) { + method(cl); + } + } } } \ No newline at end of file diff --git a/src/main/java/bomb/Widget.java b/src/main/java/bomb/Widget.java index fd5c8901..349d072c 100644 --- a/src/main/java/bomb/Widget.java +++ b/src/main/java/bomb/Widget.java @@ -3,7 +3,48 @@ import bomb.enumerations.Indicator; import bomb.enumerations.Port; import bomb.enumerations.TrinarySwitch; +import bomb.modules.ab.alphabet.Alphabet; +import bomb.modules.ab.astrology.Astrology; +import bomb.modules.ab.battleship.Battleship; +import bomb.modules.ab.blind_alley.BlindAlley; +import bomb.modules.ab.bitwise.Bitwise; +import bomb.modules.ab.boolean_venn.BooleanVenn; +import bomb.modules.c.caesar.Caesar; +import bomb.modules.c.cheap_checkout.CheapCheckout; +import bomb.modules.c.chess.Chess; +import bomb.modules.c.chords.ChordQualities; +import bomb.modules.c.color_flash.ColorFlash; +import bomb.modules.dh.emoji.EmojiMath; +import bomb.modules.dh.fast_math.FastMath; +import bomb.modules.dh.fizzbuzz.FizzBuzz; import bomb.modules.dh.forget_me.ForgetMeNot; +import bomb.modules.dh.hexamaze.Hexamaze; +import bomb.modules.il.ice_cream.IceCream; +import bomb.modules.il.laundry.Laundry; +import bomb.modules.il.led_encryption.LEDEncryption; +import bomb.modules.il.logic.Logic; +import bomb.modules.m.microcontroller.MicroController; +import bomb.modules.m.monsplode.MonslopeFight; +import bomb.modules.m.morsematics.Morsematics; +import bomb.modules.m.murder.Murder; +import bomb.modules.np.neutralization.Neutralization; +import bomb.modules.np.number_pad.NumberPad; +import bomb.modules.r.round_keypads.RoundKeypads; +import bomb.modules.s.seashells.Seashells; +import bomb.modules.s.semaphore.Semaphore; +import bomb.modules.s.shape_shift.ShapeShift; +import bomb.modules.s.simon.screams.SimonScreams; +import bomb.modules.s.simon.states.SimonStates; +import bomb.modules.s.souvenir.Souvenir; +import bomb.modules.s.square.SquareButton; +import bomb.modules.s.switches.Switches; +import bomb.modules.t.bulb.TheBulb; + +import bomb.modules.t.translated.TranslationCenter; +import bomb.modules.t.translated.solutions.button.Button; +import bomb.modules.t.two_bit.TwoBit; +import bomb.modules.wz.word_search.WordSearch; +import bomb.modules.wz.zoo.Zoo; import org.jetbrains.annotations.NotNull; import java.util.EnumSet; @@ -26,7 +67,11 @@ * This class is extended by the Module classes, and all bomb widgets are accessible by those classes, * as well as the MainController to add/subtract to the widgets. */ -public class Widget { +public sealed class Widget permits Alphabet, Astrology, Battleship, Bitwise, BlindAlley, BooleanVenn, Caesar, + CheapCheckout, Chess, ChordQualities, ColorFlash, EmojiMath, FastMath, FizzBuzz, ForgetMeNot, Hexamaze, + IceCream, Laundry, LEDEncryption, Logic, MicroController, MonslopeFight, Morsematics, Murder, + Neutralization, NumberPad, RoundKeypads, Seashells, Semaphore, ShapeShift, SimonScreams, SimonStates, Souvenir, + SquareButton, Switches, TheBulb, Button, TranslationCenter, TwoBit, WordSearch, Zoo { protected static boolean isSouvenirActive, isForgetMeNotActive; protected static int numDoubleAs, numDBatteries, numHolders, numModules, numPortPlates, numStartingMinutes; protected static String serialCode = "", twoFactor = ""; diff --git a/src/main/java/bomb/initialization/Puzzle.java b/src/main/java/bomb/annotation/Puzzle.java similarity index 90% rename from src/main/java/bomb/initialization/Puzzle.java rename to src/main/java/bomb/annotation/Puzzle.java index 851caec0..1395be3d 100644 --- a/src/main/java/bomb/initialization/Puzzle.java +++ b/src/main/java/bomb/annotation/Puzzle.java @@ -1,4 +1,4 @@ -package bomb.initialization; +package bomb.annotation; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; diff --git a/src/main/java/bomb/initialization/PuzzleSupplier.java b/src/main/java/bomb/initialization/PuzzleSupplier.java deleted file mode 100644 index e68e36a0..00000000 --- a/src/main/java/bomb/initialization/PuzzleSupplier.java +++ /dev/null @@ -1,12 +0,0 @@ -package bomb.initialization; - -import bomb.modules.ab.alphabet.Alphabet; -import bomb.modules.ab.astrology.Astrology; - -import java.util.List; - -public class PuzzleSupplier { - public static List> provideClassList() { - return List.of(Alphabet.class, Astrology.class); - } -} diff --git a/src/main/java/bomb/modules/ab/alphabet/Alphabet.java b/src/main/java/bomb/modules/ab/alphabet/Alphabet.java index 33cff144..1d188091 100644 --- a/src/main/java/bomb/modules/ab/alphabet/Alphabet.java +++ b/src/main/java/bomb/modules/ab/alphabet/Alphabet.java @@ -1,7 +1,7 @@ package bomb.modules.ab.alphabet; import bomb.Widget; -import bomb.initialization.Puzzle; +import bomb.annotation.Puzzle; import bomb.tools.filter.Regex; import org.jetbrains.annotations.NotNull; @@ -19,7 +19,7 @@ * But if no set matches the 4 tiles, the tiles are to be pressed in alphabetical order. */ @Puzzle(resource = "alphabet.fxml") -public class Alphabet extends Widget { +public final class Alphabet extends Widget { private static final String[] WORD_BANK; static { diff --git a/src/main/java/bomb/modules/ab/astrology/Astrology.java b/src/main/java/bomb/modules/ab/astrology/Astrology.java index 17f75330..0966dbed 100644 --- a/src/main/java/bomb/modules/ab/astrology/Astrology.java +++ b/src/main/java/bomb/modules/ab/astrology/Astrology.java @@ -1,7 +1,7 @@ package bomb.modules.ab.astrology; import bomb.Widget; -import bomb.initialization.Puzzle; +import bomb.annotation.Puzzle; import bomb.tools.filter.Regex; import org.jetbrains.annotations.NotNull; @@ -25,7 +25,7 @@ * (i.e. Bad Omen at 5 means that you need to press "Bad Omen" when the bomb timer has a 5 in it) */ @Puzzle(resource = "alphabet.fxml") -public class Astrology extends Widget { +public final class Astrology extends Widget { public static final byte ELEMENT_INDEX = 0, CELESTIAL_INDEX = 1, ZODIAC_INDEX = 2, EXPECTED_SIZE = 3; public static final String GOOD_OMEN = "Good Omen at ", POOR_OMEN = "Poor Omen at ", NO_OMEN = "No Omen"; diff --git a/src/main/java/bomb/modules/ab/battleship/Battleship.java b/src/main/java/bomb/modules/ab/battleship/Battleship.java index 87a65d57..12ab7b0b 100644 --- a/src/main/java/bomb/modules/ab/battleship/Battleship.java +++ b/src/main/java/bomb/modules/ab/battleship/Battleship.java @@ -21,7 +21,7 @@ import static bomb.tools.string.StringFormat.INDEX_ZERO_LOWERCASE_LETTER; import static java.util.Arrays.stream; -public class Battleship extends Widget { +public final class Battleship extends Widget { private static Ocean ocean; private static int[] rowCounters, columnCounters; private static int numberOfRadarSpots; diff --git a/src/main/java/bomb/modules/ab/bitwise/Bitwise.java b/src/main/java/bomb/modules/ab/bitwise/Bitwise.java index 7c11c756..7f30cbe3 100644 --- a/src/main/java/bomb/modules/ab/bitwise/Bitwise.java +++ b/src/main/java/bomb/modules/ab/bitwise/Bitwise.java @@ -1,7 +1,7 @@ package bomb.modules.ab.bitwise; import bomb.Widget; -import bomb.initialization.Puzzle; +import bomb.annotation.Puzzle; import bomb.tools.logic.LogicOperator; import org.jetbrains.annotations.NotNull; @@ -19,7 +19,7 @@ * which bits will be 1 or 0 in the byte line. */ @Puzzle(resource = "bitwise.fxml") -public class Bitwise extends Widget { +public final class Bitwise extends Widget { /** * Turns the edgework conditions into a byte that the Defuser will input into the bomb module * diff --git a/src/main/java/bomb/modules/ab/blind_alley/BlindAlley.java b/src/main/java/bomb/modules/ab/blind_alley/BlindAlley.java index de7310ee..92f3b831 100644 --- a/src/main/java/bomb/modules/ab/blind_alley/BlindAlley.java +++ b/src/main/java/bomb/modules/ab/blind_alley/BlindAlley.java @@ -1,7 +1,7 @@ package bomb.modules.ab.blind_alley; import bomb.Widget; -import bomb.initialization.Puzzle; +import bomb.annotation.Puzzle; import static bomb.enumerations.Indicator.BOB; import static bomb.enumerations.Indicator.CAR; @@ -29,7 +29,7 @@ * specific sections of the module based on the indicators, LED's, ports and batteries are on the bomb. */ @Puzzle(resource = "blind_alley.fxml") -public class BlindAlley extends Widget { +public final class BlindAlley extends Widget { private static int[][] alleyCat = new int[3][3]; private static void alleyUpdate() { diff --git a/src/main/java/bomb/modules/ab/boolean_venn/BooleanVenn.java b/src/main/java/bomb/modules/ab/boolean_venn/BooleanVenn.java index 1ef714aa..90c11d4a 100644 --- a/src/main/java/bomb/modules/ab/boolean_venn/BooleanVenn.java +++ b/src/main/java/bomb/modules/ab/boolean_venn/BooleanVenn.java @@ -16,7 +16,7 @@ * The concept is based on the basics of Discrete Mathematics and uses basic boolean operators * to determine the state of each section of the triple venn diagram, green being true and red for false. */ -public class BooleanVenn extends Widget { +public final class BooleanVenn extends Widget { private static final boolean[][] TEST_CASES; private static final byte A = 0, B = 1, C = 2; diff --git a/src/main/java/bomb/modules/c/caesar/Caesar.java b/src/main/java/bomb/modules/c/caesar/Caesar.java index ee3713f0..242cc55b 100644 --- a/src/main/java/bomb/modules/c/caesar/Caesar.java +++ b/src/main/java/bomb/modules/c/caesar/Caesar.java @@ -9,7 +9,7 @@ import static bomb.enumerations.Indicator.NSA; import static bomb.enumerations.Port.PARALLEL; -public class Caesar extends Widget { +public final class Caesar extends Widget { private static final int MAX_LETTER_COUNT = 26; public static @NotNull String reshuffle(@NotNull String input) throws IllegalArgumentException { diff --git a/src/main/java/bomb/modules/c/cheap_checkout/CheapCheckout.java b/src/main/java/bomb/modules/c/cheap_checkout/CheapCheckout.java index 6e284099..8fccd86c 100644 --- a/src/main/java/bomb/modules/c/cheap_checkout/CheapCheckout.java +++ b/src/main/java/bomb/modules/c/cheap_checkout/CheapCheckout.java @@ -12,7 +12,7 @@ import static bomb.tools.number.MathUtils.digitalRoot; import static bomb.tools.number.MathUtils.roundToNPlaces; -public class CheapCheckout extends Widget { +public final class CheapCheckout extends Widget { private static final double SUNDAY_ADDITION, THURSDAY_SALE, FRIDAY_MARK_UP, SATURDAY_SALE; private static final int REQUIRED_ITEM_COUNT, REQUIRED_WEIGHT_COUNT; private static final ToDoubleFunction> TO_SUM; diff --git a/src/main/java/bomb/modules/c/chess/Chess.java b/src/main/java/bomb/modules/c/chess/Chess.java index 52b9bb78..f40e7aad 100644 --- a/src/main/java/bomb/modules/c/chess/Chess.java +++ b/src/main/java/bomb/modules/c/chess/Chess.java @@ -21,7 +21,7 @@ import static java.util.Arrays.asList; import static java.util.stream.Collectors.toUnmodifiableSet; -public class Chess extends Widget { +public final class Chess extends Widget { @Language("regexp") public static final String VALIDITY_PATTERN; diff --git a/src/main/java/bomb/modules/c/chords/ChordQualities.java b/src/main/java/bomb/modules/c/chords/ChordQualities.java index 1f2f389c..618ca81d 100644 --- a/src/main/java/bomb/modules/c/chords/ChordQualities.java +++ b/src/main/java/bomb/modules/c/chords/ChordQualities.java @@ -8,7 +8,7 @@ import java.util.Set; import java.util.TreeSet; -public class ChordQualities extends Widget { +public final class ChordQualities extends Widget { public static final String NEW_CHORD; private static final ArrayRing ALL_NOTES; diff --git a/src/main/java/bomb/modules/c/color_flash/ColorFlash.java b/src/main/java/bomb/modules/c/color_flash/ColorFlash.java index f89329ff..2da38e9e 100644 --- a/src/main/java/bomb/modules/c/color_flash/ColorFlash.java +++ b/src/main/java/bomb/modules/c/color_flash/ColorFlash.java @@ -17,7 +17,7 @@ /** * */ -public class ColorFlash extends Widget { +public final class ColorFlash extends Widget { private static final int COMBO_LIMIT; private static final String RESULT_IS_COLOR_OR_WORD; diff --git a/src/main/java/bomb/modules/c/colored_switches/ColoredSwitches.java b/src/main/java/bomb/modules/c/colored_switches/ColoredSwitches.java index 0ec8ba28..46682bf9 100644 --- a/src/main/java/bomb/modules/c/colored_switches/ColoredSwitches.java +++ b/src/main/java/bomb/modules/c/colored_switches/ColoredSwitches.java @@ -14,7 +14,7 @@ import static bomb.modules.c.colored_switches.SwitchColor.NEUTRAL; -public class ColoredSwitches extends Switches { +public final class ColoredSwitches extends Switches { private static final double WRONG_PATH_VALUE; private static final Graph INTERNAL_GRAPH; private static final BiFunction> HEURISTIC_FUNCTION; diff --git a/src/main/java/bomb/modules/dh/emoji/EmojiMath.java b/src/main/java/bomb/modules/dh/emoji/EmojiMath.java index ce817439..e6cc3570 100644 --- a/src/main/java/bomb/modules/dh/emoji/EmojiMath.java +++ b/src/main/java/bomb/modules/dh/emoji/EmojiMath.java @@ -11,7 +11,7 @@ * This class deals with the Emoji Math module. * It's simple math, but replacing numbers with text emojis. */ -public class EmojiMath extends Widget { +public final class EmojiMath extends Widget { @Language("regexp") private static final String EMOJI_PATTERN, VALIDATION_PATTERN; diff --git a/src/main/java/bomb/modules/dh/fast_math/FastMath.java b/src/main/java/bomb/modules/dh/fast_math/FastMath.java index 521c5324..bc9f3867 100644 --- a/src/main/java/bomb/modules/dh/fast_math/FastMath.java +++ b/src/main/java/bomb/modules/dh/fast_math/FastMath.java @@ -9,7 +9,7 @@ import static bomb.enumerations.Port.SERIAL; import static bomb.tools.filter.RegexFilter.EMPTY_FILTER_RESULTS; -public class FastMath extends Widget { +public final class FastMath extends Widget { private static final int[][] INTERNAL_GRID; /** diff --git a/src/main/java/bomb/modules/dh/fizzbuzz/FizzBuzz.java b/src/main/java/bomb/modules/dh/fizzbuzz/FizzBuzz.java index 497bcfd3..1c187520 100644 --- a/src/main/java/bomb/modules/dh/fizzbuzz/FizzBuzz.java +++ b/src/main/java/bomb/modules/dh/fizzbuzz/FizzBuzz.java @@ -8,7 +8,7 @@ import java.util.ArrayList; import java.util.List; -public class FizzBuzz extends Widget { +public final class FizzBuzz extends Widget { public static @NotNull String solve(@NotNull String numberText, @NotNull FizzBuzzColor color, @Range(from=0, to=2) int strikeCount) throws IllegalArgumentException { validateInput(numberText, color, strikeCount); diff --git a/src/main/java/bomb/modules/dh/forget_me/ForgetMeNot.java b/src/main/java/bomb/modules/dh/forget_me/ForgetMeNot.java index 1633ae47..b628ab25 100644 --- a/src/main/java/bomb/modules/dh/forget_me/ForgetMeNot.java +++ b/src/main/java/bomb/modules/dh/forget_me/ForgetMeNot.java @@ -14,7 +14,7 @@ import static bomb.enumerations.Indicator.CAR; import static bomb.enumerations.Port.SERIAL; -public class ForgetMeNot extends Widget { +public final class ForgetMeNot extends Widget { private static final IntUnaryOperator LEAST_SIG_DIGIT, MOST_SIG_DIGIT; private static final List FINAL_CODE; diff --git a/src/main/java/bomb/modules/dh/hexamaze/Hexamaze.java b/src/main/java/bomb/modules/dh/hexamaze/Hexamaze.java index 056eeca9..dbd04935 100644 --- a/src/main/java/bomb/modules/dh/hexamaze/Hexamaze.java +++ b/src/main/java/bomb/modules/dh/hexamaze/Hexamaze.java @@ -27,7 +27,7 @@ import static javafx.scene.paint.Color.RED; import static javafx.scene.paint.Color.YELLOW; -public class Hexamaze extends Widget { +public final class Hexamaze extends Widget { public static final Map COLOR_MAP; public static final Color PEG_COLOR; diff --git a/src/main/java/bomb/modules/il/ice_cream/IceCream.java b/src/main/java/bomb/modules/il/ice_cream/IceCream.java index 54c5842f..b975c552 100644 --- a/src/main/java/bomb/modules/il/ice_cream/IceCream.java +++ b/src/main/java/bomb/modules/il/ice_cream/IceCream.java @@ -20,7 +20,7 @@ import static bomb.modules.il.ice_cream.Flavor.TUTTI_FRUTTI; import static bomb.modules.il.ice_cream.Flavor.VANILLA; -public class IceCream extends Widget { +public final class IceCream extends Widget { public static @NotNull Flavor findFlavor(@NotNull Person person, @NotNull EnumSet possibleFlavors, boolean hasEmptyPortPlate) throws IllegalArgumentException, IllegalStateException { diff --git a/src/main/java/bomb/modules/il/laundry/Laundry.java b/src/main/java/bomb/modules/il/laundry/Laundry.java index f87704c1..3c45e720 100644 --- a/src/main/java/bomb/modules/il/laundry/Laundry.java +++ b/src/main/java/bomb/modules/il/laundry/Laundry.java @@ -38,7 +38,7 @@ * item, material, and color. These will lead to the instructions for washing, drying, ironing, * and dry cleaning your clothing. */ -public class Laundry extends Widget { +public final class Laundry extends Widget { public static final String THANKS_BOB = "Thanks, Bob! :)"; private static final int NUMBER_OF_OPTIONS = 6; diff --git a/src/main/java/bomb/modules/il/led_encryption/LEDEncryption.java b/src/main/java/bomb/modules/il/led_encryption/LEDEncryption.java index e4715ab4..21a53765 100644 --- a/src/main/java/bomb/modules/il/led_encryption/LEDEncryption.java +++ b/src/main/java/bomb/modules/il/led_encryption/LEDEncryption.java @@ -2,5 +2,5 @@ import bomb.Widget; -public class LEDEncryption extends Widget { +public final class LEDEncryption extends Widget { } diff --git a/src/main/java/bomb/modules/il/logic/Logic.java b/src/main/java/bomb/modules/il/logic/Logic.java index 393d2ee8..d5d0e81a 100644 --- a/src/main/java/bomb/modules/il/logic/Logic.java +++ b/src/main/java/bomb/modules/il/logic/Logic.java @@ -12,7 +12,7 @@ import static bomb.tools.logic.LogicOperator.IMPLIES; import static java.util.Arrays.asList; -public class Logic extends Widget { +public final class Logic extends Widget { public static boolean solve(@NotNull LetterRecord @NotNull[] letters, @NotNull LogicOperator @NotNull[] intermediateOperators, boolean isPriorityOnFirstTwo) throws IllegalArgumentException { diff --git a/src/main/java/bomb/modules/m/microcontroller/MicroController.java b/src/main/java/bomb/modules/m/microcontroller/MicroController.java index 436b2535..207f97d0 100644 --- a/src/main/java/bomb/modules/m/microcontroller/MicroController.java +++ b/src/main/java/bomb/modules/m/microcontroller/MicroController.java @@ -12,7 +12,7 @@ import static bomb.enumerations.Port.RJ45; import static bomb.tools.filter.RegexFilter.filter; -public class MicroController extends Widget { +public final class MicroController extends Widget { public static @NotNull List getPinColors(@NotNull String moduleSerialNumbers, @NotNull AbstractController controller) throws IllegalArgumentException { diff --git a/src/main/java/bomb/modules/m/monsplode/MonslopeFight.java b/src/main/java/bomb/modules/m/monsplode/MonslopeFight.java index 76ab7890..17a23b82 100644 --- a/src/main/java/bomb/modules/m/monsplode/MonslopeFight.java +++ b/src/main/java/bomb/modules/m/monsplode/MonslopeFight.java @@ -2,5 +2,5 @@ import bomb.Widget; -public class MonslopeFight extends Widget { +public final class MonslopeFight extends Widget { } diff --git a/src/main/java/bomb/modules/m/morsematics/Morsematics.java b/src/main/java/bomb/modules/m/morsematics/Morsematics.java index 6e361e6e..679ed766 100644 --- a/src/main/java/bomb/modules/m/morsematics/Morsematics.java +++ b/src/main/java/bomb/modules/m/morsematics/Morsematics.java @@ -20,7 +20,7 @@ import static bomb.Widget.IndicatorFilter.UNLIT; import static bomb.tools.number.MathUtils.isPerfectSquare; -public class Morsematics extends Widget { +public final class Morsematics extends Widget { public static @NotNull String solve(@NotNull LinkedHashSet inputSet) throws IllegalArgumentException { checkSerialCode(); ListGraph morseGraph = MorseCodeGraphFactory.createGraph(); diff --git a/src/main/java/bomb/modules/m/murder/Murder.java b/src/main/java/bomb/modules/m/murder/Murder.java index 424334e6..43e6a732 100644 --- a/src/main/java/bomb/modules/m/murder/Murder.java +++ b/src/main/java/bomb/modules/m/murder/Murder.java @@ -26,7 +26,7 @@ import static java.util.stream.Collectors.joining; import static java.util.stream.Collectors.toMap; -public class Murder extends Widget { +public final class Murder extends Widget { public static @NotNull String solve(@NotNull Location bodyFoundRoom, @NotNull EnumSet possibleWeapons, @NotNull EnumSet possibleSuspects) throws IllegalStateException { validateInput(possibleWeapons, possibleSuspects, bodyFoundRoom); diff --git a/src/main/java/bomb/modules/np/neutralization/Neutralization.java b/src/main/java/bomb/modules/np/neutralization/Neutralization.java index e27fc504..5cabbd9c 100644 --- a/src/main/java/bomb/modules/np/neutralization/Neutralization.java +++ b/src/main/java/bomb/modules/np/neutralization/Neutralization.java @@ -38,7 +38,7 @@ * acid there is in the test tube. The Expert must then find the base that will titrate the acid with a specific * drop count and determine if the titration needs a filter or not. */ -public class Neutralization extends Widget { +public final class Neutralization extends Widget { public static final String NO_FILTER_TEXT, FILTER_TEXT; static final String OUTPUT_SEPARATOR; diff --git a/src/main/java/bomb/modules/np/number_pad/NumberPad.java b/src/main/java/bomb/modules/np/number_pad/NumberPad.java index 1f5b7285..98f61706 100644 --- a/src/main/java/bomb/modules/np/number_pad/NumberPad.java +++ b/src/main/java/bomb/modules/np/number_pad/NumberPad.java @@ -2,6 +2,6 @@ import bomb.Widget; -public class NumberPad extends Widget { +public final class NumberPad extends Widget { } diff --git a/src/main/java/bomb/modules/r/round_keypads/RoundKeypads.java b/src/main/java/bomb/modules/r/round_keypads/RoundKeypads.java index 45cc7f3e..dad8c604 100644 --- a/src/main/java/bomb/modules/r/round_keypads/RoundKeypads.java +++ b/src/main/java/bomb/modules/r/round_keypads/RoundKeypads.java @@ -16,7 +16,7 @@ import static java.util.stream.Collectors.counting; import static java.util.stream.Collectors.groupingBy; -public class RoundKeypads extends Widget { +public final class RoundKeypads extends Widget { private static final int IMAGES_PER_COLUMN = 7; private static final UnaryOperator HIGHLIGHT_COMMAND; diff --git a/src/main/java/bomb/modules/s/seashells/Seashells.java b/src/main/java/bomb/modules/s/seashells/Seashells.java index e7704000..d08503db 100644 --- a/src/main/java/bomb/modules/s/seashells/Seashells.java +++ b/src/main/java/bomb/modules/s/seashells/Seashells.java @@ -2,5 +2,5 @@ import bomb.Widget; -public class Seashells extends Widget { +public final class Seashells extends Widget { } diff --git a/src/main/java/bomb/modules/s/semaphore/Semaphore.java b/src/main/java/bomb/modules/s/semaphore/Semaphore.java index 30a17a87..b4219bd7 100644 --- a/src/main/java/bomb/modules/s/semaphore/Semaphore.java +++ b/src/main/java/bomb/modules/s/semaphore/Semaphore.java @@ -2,5 +2,5 @@ import bomb.Widget; -public class Semaphore extends Widget { +public final class Semaphore extends Widget { } diff --git a/src/main/java/bomb/modules/s/shape_shift/ShapeShift.java b/src/main/java/bomb/modules/s/shape_shift/ShapeShift.java index 72befacb..80467919 100644 --- a/src/main/java/bomb/modules/s/shape_shift/ShapeShift.java +++ b/src/main/java/bomb/modules/s/shape_shift/ShapeShift.java @@ -23,7 +23,7 @@ import static bomb.modules.s.shape_shift.ShapeEnd.SHAPE_END_ARRAY; import static bomb.tools.logic.BitConverter.TO_INT; -public class ShapeShift extends Widget { +public final class ShapeShift extends Widget { private static final int[][] COUNT_TRACKER; private static ListGraph> graph; diff --git a/src/main/java/bomb/modules/s/simon/screams/SimonScreams.java b/src/main/java/bomb/modules/s/simon/screams/SimonScreams.java index 2b63f973..3fe4ba0f 100644 --- a/src/main/java/bomb/modules/s/simon/screams/SimonScreams.java +++ b/src/main/java/bomb/modules/s/simon/screams/SimonScreams.java @@ -9,7 +9,7 @@ import static java.util.stream.Collectors.joining; -public class SimonScreams extends Widget { +public final class SimonScreams extends Widget { private static final int MAX_OUTPUT_RULES; private static final List CURRENT_OUTPUT_NUMBERS; private static final String[][] RESULTING_COLORS, CATEGORIES; diff --git a/src/main/java/bomb/modules/s/simon/states/SimonStates.java b/src/main/java/bomb/modules/s/simon/states/SimonStates.java index 346c978f..be44c967 100644 --- a/src/main/java/bomb/modules/s/simon/states/SimonStates.java +++ b/src/main/java/bomb/modules/s/simon/states/SimonStates.java @@ -22,7 +22,7 @@ import static java.util.Collections.reverse; import static java.util.stream.Collectors.joining; -public class SimonStates extends Widget { +public final class SimonStates extends Widget { private static final int HIGH = 1, LOW = 2, LOWEST = 3; private static final List PRESSED_COLOR_HISTORY; private static final String ERROR_MESSAGE = "The element does not exist"; diff --git a/src/main/java/bomb/modules/s/souvenir/Souvenir.java b/src/main/java/bomb/modules/s/souvenir/Souvenir.java index 5592f178..d95c0c73 100644 --- a/src/main/java/bomb/modules/s/souvenir/Souvenir.java +++ b/src/main/java/bomb/modules/s/souvenir/Souvenir.java @@ -8,7 +8,7 @@ import java.util.List; import java.util.Map; -public class Souvenir extends Widget { +public final class Souvenir extends Widget { private static final Map MODULE_ARTIFACTS; static { diff --git a/src/main/java/bomb/modules/s/square/SquareButton.java b/src/main/java/bomb/modules/s/square/SquareButton.java index 879b4f3d..34c2dc0b 100644 --- a/src/main/java/bomb/modules/s/square/SquareButton.java +++ b/src/main/java/bomb/modules/s/square/SquareButton.java @@ -22,7 +22,7 @@ import static java.util.Arrays.asList; import static java.util.stream.Collectors.joining; -public class SquareButton extends Widget { +public final class SquareButton extends Widget { //Button colors public static final int BLUE, YELLOW, DARK_GRAY, WHITE; //Held button light colors diff --git a/src/main/java/bomb/modules/s/switches/Switches.java b/src/main/java/bomb/modules/s/switches/Switches.java index a08d542a..da1d7aa7 100644 --- a/src/main/java/bomb/modules/s/switches/Switches.java +++ b/src/main/java/bomb/modules/s/switches/Switches.java @@ -1,6 +1,7 @@ package bomb.modules.s.switches; import bomb.Widget; +import bomb.modules.c.colored_switches.ColoredSwitches; import org.jetbrains.annotations.NotNull; import java.util.ArrayList; @@ -13,7 +14,7 @@ import static java.util.Arrays.asList; -public class Switches extends Widget { +public sealed class Switches extends Widget permits ColoredSwitches { protected static final byte BIT_LENGTH = 5; private static final Set FORBIDDEN_MOVES; private static final Map SPECIAL_CONDITIONS; diff --git a/src/main/java/bomb/modules/t/bulb/TheBulb.java b/src/main/java/bomb/modules/t/bulb/TheBulb.java index 7fa7f8de..7b5fab0f 100644 --- a/src/main/java/bomb/modules/t/bulb/TheBulb.java +++ b/src/main/java/bomb/modules/t/bulb/TheBulb.java @@ -33,7 +33,7 @@ import static bomb.modules.t.bulb.Bulb.Position.SCREWED; import static bomb.modules.t.bulb.Bulb.Position.UNSCREWED; -public class TheBulb extends Widget { +public final class TheBulb extends Widget { public static final String PRESS_I, PRESS_O, SCREW, UNSCREW; static { diff --git a/src/main/java/bomb/modules/t/translated/Button.java b/src/main/java/bomb/modules/t/translated/Button.java index 3006c20b..1059b157 100644 --- a/src/main/java/bomb/modules/t/translated/Button.java +++ b/src/main/java/bomb/modules/t/translated/Button.java @@ -14,7 +14,7 @@ /** * Button class deals with a button module */ -public class Button extends TranslationCenter { +public final class Button extends TranslationCenter { private static final byte COLOR_INDEX = 0, LABEL_INDEX = 1; /** diff --git a/src/main/java/bomb/modules/t/translated/Morse.java b/src/main/java/bomb/modules/t/translated/Morse.java index 760e6cad..907b2c49 100644 --- a/src/main/java/bomb/modules/t/translated/Morse.java +++ b/src/main/java/bomb/modules/t/translated/Morse.java @@ -19,7 +19,7 @@ /** * Morse class deals with the Morse Code module. */ -public class Morse extends TranslationCenter { +public final class Morse extends TranslationCenter { private static final AVLTree CODE_TREE = new AVLTree<>(); private static final String ABSOLUTE_PATH = System.getProperty("user.dir") + "\\src\\main\\resources\\bomb\\modules\\t\\translated\\morsecode.txt"; diff --git a/src/main/java/bomb/modules/t/translated/OnFirst.java b/src/main/java/bomb/modules/t/translated/OnFirst.java index 047989ec..2fa1b269 100644 --- a/src/main/java/bomb/modules/t/translated/OnFirst.java +++ b/src/main/java/bomb/modules/t/translated/OnFirst.java @@ -13,7 +13,7 @@ /** * OnFirst class refers to the Who's on First module. */ -public class OnFirst extends TranslationCenter { +public final class OnFirst extends TranslationCenter { /** * findPanel() finds the correct panel for Step 1 of the module diff --git a/src/main/java/bomb/modules/t/translated/Passwords.java b/src/main/java/bomb/modules/t/translated/Passwords.java index 5bf9cabf..ef43f468 100644 --- a/src/main/java/bomb/modules/t/translated/Passwords.java +++ b/src/main/java/bomb/modules/t/translated/Passwords.java @@ -13,7 +13,7 @@ /** * Password class refers to the Password module */ -public class Passwords extends TranslationCenter { +public final class Passwords extends TranslationCenter { /** * solve() solves the password module from gathering the letters of any column and diff --git a/src/main/java/bomb/modules/t/translated/TranslationCenter.java b/src/main/java/bomb/modules/t/translated/TranslationCenter.java index d3fca3c4..b73da1ca 100644 --- a/src/main/java/bomb/modules/t/translated/TranslationCenter.java +++ b/src/main/java/bomb/modules/t/translated/TranslationCenter.java @@ -14,7 +14,7 @@ import java.util.HashMap; -public class TranslationCenter extends Widget { +public sealed class TranslationCenter extends Widget permits Button, Morse, OnFirst, Passwords, VentGas { public static String[] moduleNames, buttonNames; protected static String[] passwords; diff --git a/src/main/java/bomb/modules/t/translated/VentGas.java b/src/main/java/bomb/modules/t/translated/VentGas.java index 91c8409f..2430574d 100644 --- a/src/main/java/bomb/modules/t/translated/VentGas.java +++ b/src/main/java/bomb/modules/t/translated/VentGas.java @@ -1,6 +1,6 @@ package bomb.modules.t.translated; -public class VentGas extends TranslationCenter { +public final class VentGas extends TranslationCenter { public static String writeYes() { return yes; } diff --git a/src/main/java/bomb/modules/t/translated/solutions/button/Button.java b/src/main/java/bomb/modules/t/translated/solutions/button/Button.java index 55ebba88..d145ab7b 100644 --- a/src/main/java/bomb/modules/t/translated/solutions/button/Button.java +++ b/src/main/java/bomb/modules/t/translated/solutions/button/Button.java @@ -15,7 +15,7 @@ /** * Button class deals with a button module */ -public class Button extends Widget { +public final class Button extends Widget { public static final byte COLOR_INDEX = 0, LABEL_INDEX = 1; /** diff --git a/src/main/java/bomb/modules/t/two_bit/TwoBit.java b/src/main/java/bomb/modules/t/two_bit/TwoBit.java index 3f2d72a4..87b58efa 100644 --- a/src/main/java/bomb/modules/t/two_bit/TwoBit.java +++ b/src/main/java/bomb/modules/t/two_bit/TwoBit.java @@ -17,7 +17,7 @@ /** * */ -public class TwoBit extends Widget { +public final class TwoBit extends Widget { public static final String QUERY_TEXT, SUBMIT_TEXT; private static final String[][] CODE_GRID; diff --git a/src/main/java/bomb/modules/wz/word_search/WordSearch.java b/src/main/java/bomb/modules/wz/word_search/WordSearch.java index 7321343e..f6ce2ea7 100644 --- a/src/main/java/bomb/modules/wz/word_search/WordSearch.java +++ b/src/main/java/bomb/modules/wz/word_search/WordSearch.java @@ -14,7 +14,7 @@ import static java.util.stream.Collectors.toUnmodifiableMap; @SuppressWarnings("ConstantConditions") -public class WordSearch extends Widget { +public final class WordSearch extends Widget { private static final int ARRAY_SIZE; private static final String FILENAME; diff --git a/src/main/java/bomb/modules/wz/zoo/Zoo.java b/src/main/java/bomb/modules/wz/zoo/Zoo.java index 9ad1fa5f..03a5d348 100644 --- a/src/main/java/bomb/modules/wz/zoo/Zoo.java +++ b/src/main/java/bomb/modules/wz/zoo/Zoo.java @@ -2,5 +2,5 @@ import bomb.Widget; -public class Zoo extends Widget { +public final class Zoo extends Widget { } diff --git a/src/main/java/bomb/tools/event/HoverHandler.java b/src/main/java/bomb/tools/event/HoverHandler.java index 413e9ba7..4a2a16a9 100644 --- a/src/main/java/bomb/tools/event/HoverHandler.java +++ b/src/main/java/bomb/tools/event/HoverHandler.java @@ -5,7 +5,6 @@ import java.util.function.Consumer; -@SuppressWarnings("ClassCanBeRecord") public class HoverHandler implements EventHandler { private final Consumer action; diff --git a/src/main/java/bomb/tools/pattern/observer/BlindAlleyPaneObserver.java b/src/main/java/bomb/tools/pattern/observer/BlindAlleyPaneObserver.java index ead7af8f..c7cd959f 100644 --- a/src/main/java/bomb/tools/pattern/observer/BlindAlleyPaneObserver.java +++ b/src/main/java/bomb/tools/pattern/observer/BlindAlleyPaneObserver.java @@ -2,7 +2,6 @@ import bomb.modules.ab.blind_alley.BlindAlleyController; -@SuppressWarnings("ClassCanBeRecord") public class BlindAlleyPaneObserver implements Observer { private final BlindAlleyController controller; diff --git a/src/main/java/bomb/tools/pattern/observer/ForgetMeNotToggleObserver.java b/src/main/java/bomb/tools/pattern/observer/ForgetMeNotToggleObserver.java index 462c4dab..ae29b1c4 100644 --- a/src/main/java/bomb/tools/pattern/observer/ForgetMeNotToggleObserver.java +++ b/src/main/java/bomb/tools/pattern/observer/ForgetMeNotToggleObserver.java @@ -3,7 +3,6 @@ import bomb.Widget; import javafx.scene.control.RadioButton; -@SuppressWarnings("ClassCanBeRecord") public class ForgetMeNotToggleObserver implements Observer { private final RadioButton forgetMeNot; From f3a45e728a76421f49fec401b058b12377f36543 Mon Sep 17 00:00:00 2001 From: "Mr. J" <45538844+Ultraviolet-Ninja@users.noreply.github.com> Date: Sat, 17 Dec 2022 18:45:57 -0600 Subject: [PATCH 61/86] Removal of LGTM references --- .lgtm.yml | 4 ---- Learned.md | 2 +- README.md | 7 +++---- 3 files changed, 4 insertions(+), 9 deletions(-) delete mode 100644 .lgtm.yml diff --git a/.lgtm.yml b/.lgtm.yml deleted file mode 100644 index eb2eacaa..00000000 --- a/.lgtm.yml +++ /dev/null @@ -1,4 +0,0 @@ -extraction: - java: - index: - java_version: 16 \ No newline at end of file diff --git a/Learned.md b/Learned.md index 904d04d3..2b009d76 100644 --- a/Learned.md +++ b/Learned.md @@ -11,7 +11,7 @@ Another thing we talked about while he was on the project was moving back to Jav - Using the build.gradle file to organize dependencies and plugins, facilitate testing, set up distributions in zip and tar files, and releases for GitHub. - Making custom tasks and using parameters for CI pipelines to test certain parts of the code. - Automating tests with CircleCI using this [video](https://www.youtube.com/watch?v=9PgZCJNzY9M) as a guide. -- Coming across [LGTM](https://lgtm.com/) and taking advantage of its code quality checking for flaws in my Java code. +- Coming across ~~LGTM~~ (when it was still around) and taking advantage of its code quality checking for flaws in my Java code. ## Graphs and their Algorithms - Creating graphs by looking up the concept or using the JGraphT library. - Making use of Dijkstra's Shortest Path and A* to solve different problems. diff --git a/README.md b/README.md index 4cf54287..ee8ac45c 100644 --- a/README.md +++ b/README.md @@ -2,8 +2,7 @@ *101 modules, 100 minutes, exponentially more problems.* [![CircleCI](https://circleci.com/gh/Ultraviolet-Ninja/GradleCenturion/tree/main.svg?style=shield)](https://circleci.com/gh/Ultraviolet-Ninja/GradleCenturion/tree/main) -[![Language grade: Java](https://img.shields.io/lgtm/grade/java/g/Ultraviolet-Ninja/GradleCenturion.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/Ultraviolet-Ninja/GradleCenturion/context:java) -![Project Version](https://img.shields.io/badge/version-0.22.0-blueviolet) +![Project Version](https://img.shields.io/badge/version-0.22.2-blueviolet) ## Intro This project is designed to solve all puzzles found on the Centurion Bomb from Keep Talking and Nobody Explodes, which is a combination of many community-made puzzles and some from the base game set in different languages.
@@ -11,7 +10,7 @@ This project is designed to solve all puzzles found on the Centurion Bomb from K This is a huge project for one man to tackle, but I've [learned a lot](Learned.md) from the challenges I've faced. ## Technologies -- Java 16 +- Java 17 - Gradle 7.4 ### Plugins - JavaFX @@ -32,7 +31,7 @@ This is a huge project for one man to tackle, but I've [learned a lot](Learned.m See the running list of modules [here](Progress.md) ## How to run the program -*Disclaimer:* Make sure you have Java [16](https://www.oracle.com/java/technologies/javase/jdk16-archive-downloads.html) or [17](https://www.oracle.com/java/technologies/javase/jdk17-archive-downloads.html) +*Disclaimer:* Make sure you have Java [17](https://www.oracle.com/java/technologies/javase/jdk17-archive-downloads.html) and the JAVA_HOME is set. 1. Grab the latest .zip/tar of the GradleCenturion-X.X.X and unzip it 2. Using the command line, navigate to the unzipped directory From 6187d3affbfc335785a709fbb557c90e7c324e1e Mon Sep 17 00:00:00 2001 From: "Mr. J" <45538844+Ultraviolet-Ninja@users.noreply.github.com> Date: Sat, 17 Dec 2022 18:47:13 -0600 Subject: [PATCH 62/86] Another removal --- README.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/README.md b/README.md index ee8ac45c..265ab83e 100644 --- a/README.md +++ b/README.md @@ -24,7 +24,6 @@ This is a huge project for one man to tackle, but I've [learned a lot](Learned.m - OpenCSV ver. 5.5.2 ### Other Technologies - Circle CI -- LGTM Code Quality - CodeMR Free Trial ## Status - In progress @@ -40,7 +39,7 @@ and the JAVA_HOME is set. - Linux: `./gradlew run` ## Inspiration -After my first manual turning out to be successful in solving the main-game bombs, I thought "Why stop there?". +After my first manual turning out to be successful in solving the main-game bombs, I thought "*Why stop there?*". I started creating this project working on the auto-solver for the vanilla game, which was, by comparison, much easier. ### Example Bomb From aa9cc7c771fd6748fad1e5828afb285a5479a9bc Mon Sep 17 00:00:00 2001 From: "Mr. J" <45538844+Ultraviolet-Ninja@users.noreply.github.com> Date: Sun, 18 Dec 2022 01:46:13 -0600 Subject: [PATCH 63/86] Idea works: Annotated puzzle classes Started the implementation into the ManualController class --- src/main/java/bomb/ManualController.java | 44 +++++++++++++++++++ src/main/java/bomb/annotation/Puzzle.java | 2 + .../bomb/modules/ab/alphabet/Alphabet.java | 2 +- .../bomb/modules/ab/astrology/Astrology.java | 2 +- .../modules/ab/battleship/Battleship.java | 2 + .../java/bomb/modules/ab/bitwise/Bitwise.java | 2 +- .../modules/ab/blind_alley/BlindAlley.java | 2 +- .../modules/ab/boolean_venn/BooleanVenn.java | 2 + .../java/bomb/modules/c/caesar/Caesar.java | 2 + .../c/cheap_checkout/CheapCheckout.java | 2 + src/main/java/bomb/modules/c/chess/Chess.java | 2 + .../bomb/modules/c/chords/ChordQualities.java | 2 + .../modules/c/color_flash/ColorFlash.java | 2 + .../c/colored_switches/ColoredSwitches.java | 2 + .../java/bomb/modules/dh/emoji/EmojiMath.java | 2 + .../bomb/modules/dh/fast_math/FastMath.java | 2 + .../bomb/modules/dh/fizzbuzz/FizzBuzz.java | 2 + .../modules/dh/forget_me/ForgetMeNot.java | 2 + .../bomb/modules/dh/hexamaze/Hexamaze.java | 2 + .../bomb/modules/il/ice_cream/IceCream.java | 2 + .../java/bomb/modules/il/laundry/Laundry.java | 2 + .../il/led_encryption/LEDEncryption.java | 2 + .../java/bomb/modules/il/logic/Logic.java | 2 + .../m/microcontroller/MicroController.java | 2 + .../modules/m/monsplode/MonslopeFight.java | 2 + .../modules/m/morsematics/Morsematics.java | 2 + .../java/bomb/modules/m/murder/Murder.java | 2 + .../np/neutralization/Neutralization.java | 2 + .../bomb/modules/np/number_pad/NumberPad.java | 2 + .../modules/r/round_keypads/RoundKeypads.java | 2 + .../bomb/modules/s/seashells/Seashells.java | 2 + .../bomb/modules/s/semaphore/Semaphore.java | 2 + .../modules/s/shape_shift/ShapeShift.java | 2 + .../modules/s/simon/screams/SimonScreams.java | 2 + .../modules/s/simon/states/SimonStates.java | 2 + .../bomb/modules/s/souvenir/Souvenir.java | 2 + .../bomb/modules/s/square/SquareButton.java | 2 + .../bomb/modules/s/switches/Switches.java | 2 + .../java/bomb/modules/t/bulb/TheBulb.java | 2 + .../modules/t/three_d_maze/ThreeDMaze.java | 3 ++ .../java/bomb/modules/t/two_bit/TwoBit.java | 2 + .../modules/wz/word_search/WordSearch.java | 2 + src/main/java/bomb/modules/wz/zoo/Zoo.java | 2 + .../bomb/fxml/{ab => t}/3d_maze.fxml | 0 44 files changed, 125 insertions(+), 4 deletions(-) rename src/main/resources/bomb/fxml/{ab => t}/3d_maze.fxml (100%) diff --git a/src/main/java/bomb/ManualController.java b/src/main/java/bomb/ManualController.java index 6717e592..8f37b9d3 100644 --- a/src/main/java/bomb/ManualController.java +++ b/src/main/java/bomb/ManualController.java @@ -1,5 +1,7 @@ package bomb; +import bomb.annotation.Puzzle; +import bomb.modules.ab.battleship.Battleship; import bomb.modules.ab.blind_alley.BlindAlleyController; import bomb.modules.s.souvenir.SouvenirController; import bomb.tools.filter.Regex; @@ -22,6 +24,7 @@ import javafx.scene.layout.GridPane; import javafx.scene.layout.Region; import javafx.scene.layout.VBox; +import org.javatuples.Pair; import java.io.File; import java.net.MalformedURLException; @@ -99,6 +102,9 @@ private CompletableFuture> setupRegionMap() throws Execution CompletableFuture> radioButtonNameFuture = createRadioButtonNameFuture(options.getToggles()); + createFXMLMap(); + + //TODO - This is what we're looking to replace return createFilePathFuture().thenApply(filePathFuture -> filePathFuture.thenCombine(radioButtonNameFuture, (filePathMap, radioButtonMap) -> createRegionMap(radioButtonMap, filePathMap))) @@ -116,6 +122,7 @@ private static CompletableFuture> createRadioButtonNameFutur ))); } + //TODO - Method to replace private static CompletableFuture>> createFilePathFuture() { URI uri = toURI(ManualController.class.getResource(FXML_DIRECTORY)); @@ -123,6 +130,7 @@ private static CompletableFuture>> createF .thenApply(ManualController::convertFilesToRegions); } + //TODO - Method to replace private static CompletableFuture> convertFilesToRegions(List fileList) { ResetObserver resetObserver = new ResetObserver(); Regex filenamePattern = new Regex("\\w+(?=\\.fxml)"); @@ -147,6 +155,7 @@ private static CompletableFuture> convertFilesToRegions(List return fileToRegionMapFuture; } + //TODO - Method to replace private static Region createSingleRegion(URI uri, ResetObserver resetObserver) throws IllegalArgumentException { FXMLLoader loader; @@ -173,6 +182,7 @@ private static void loadSouvenirController(SouvenirController controller) { ObserverHub.addObserver(SOUVENIR_PANE, new SouvenirPaneObserver(controller)); } + //TODO - Method to replace private static List getFilesFromDirectory(final File topLevelDirectory) { List list = new ArrayList<>(); ArrayDeque files = new ArrayDeque<>(asList(topLevelDirectory.listFiles())); @@ -206,6 +216,40 @@ private static URI toURI(URL url) throws IllegalArgumentException { } } + private static LinkedHashMap createFXMLMap() { + var e = Battleship.class.getResource("battleship.fxml"); + return getWidgetSubClasses() + .stream() + .map(cls -> new Pair<>(cls.getAnnotation(Puzzle.class), cls)) + .map(pair -> pair.setAt1(pair.getValue1().getResource(pair.getValue0().resource()))) + .map(pair -> pair.setAt0(pair.getValue0().buttonLinkerName())) + .sorted() + .collect(toMap( + Pair::getValue0, + pair -> new FXMLLoader(pair.getValue1()), + (x, y) -> y, + LinkedHashMap::new + )); + } + + private static List> getWidgetSubClasses() { + List> list = new ArrayList<>(); + ArrayDeque> files = new ArrayDeque<>(asList(Widget.class.getPermittedSubclasses())); + Class temp; + + while ((temp = files.poll()) != null) { + Class[] nextSubLevel = temp.getPermittedSubclasses(); + if (nextSubLevel != null) { + files.addAll(asList(nextSubLevel)); + } + + if (temp.isAnnotationPresent(Puzzle.class)) { + list.add(temp); + } + } + return list; + } + @FXML public void switchPaneByButtonPress() { Toggle selected = options.getSelectedToggle(); diff --git a/src/main/java/bomb/annotation/Puzzle.java b/src/main/java/bomb/annotation/Puzzle.java index 1395be3d..f8328840 100644 --- a/src/main/java/bomb/annotation/Puzzle.java +++ b/src/main/java/bomb/annotation/Puzzle.java @@ -9,4 +9,6 @@ @Target(ElementType.TYPE) public @interface Puzzle { String resource(); + + String buttonLinkerName(); } diff --git a/src/main/java/bomb/modules/ab/alphabet/Alphabet.java b/src/main/java/bomb/modules/ab/alphabet/Alphabet.java index 1d188091..f9dcc3c3 100644 --- a/src/main/java/bomb/modules/ab/alphabet/Alphabet.java +++ b/src/main/java/bomb/modules/ab/alphabet/Alphabet.java @@ -18,7 +18,7 @@ * if the letters appear in those 4 tiles. * But if no set matches the 4 tiles, the tiles are to be pressed in alphabetical order. */ -@Puzzle(resource = "alphabet.fxml") +@Puzzle(resource = "alphabet.fxml", buttonLinkerName = "Alphabet") public final class Alphabet extends Widget { private static final String[] WORD_BANK; diff --git a/src/main/java/bomb/modules/ab/astrology/Astrology.java b/src/main/java/bomb/modules/ab/astrology/Astrology.java index 0966dbed..0aff8a54 100644 --- a/src/main/java/bomb/modules/ab/astrology/Astrology.java +++ b/src/main/java/bomb/modules/ab/astrology/Astrology.java @@ -24,7 +24,7 @@ * The quantity of the number is used to determine when to press the button. * (i.e. Bad Omen at 5 means that you need to press "Bad Omen" when the bomb timer has a 5 in it) */ -@Puzzle(resource = "alphabet.fxml") +@Puzzle(resource = "alphabet.fxml", buttonLinkerName = "Astrology") public final class Astrology extends Widget { public static final byte ELEMENT_INDEX = 0, CELESTIAL_INDEX = 1, ZODIAC_INDEX = 2, EXPECTED_SIZE = 3; public static final String GOOD_OMEN = "Good Omen at ", POOR_OMEN = "Poor Omen at ", NO_OMEN = "No Omen"; diff --git a/src/main/java/bomb/modules/ab/battleship/Battleship.java b/src/main/java/bomb/modules/ab/battleship/Battleship.java index 12ab7b0b..a135af8c 100644 --- a/src/main/java/bomb/modules/ab/battleship/Battleship.java +++ b/src/main/java/bomb/modules/ab/battleship/Battleship.java @@ -1,6 +1,7 @@ package bomb.modules.ab.battleship; import bomb.Widget; +import bomb.annotation.Puzzle; import org.jetbrains.annotations.NotNull; import java.util.ArrayList; @@ -21,6 +22,7 @@ import static bomb.tools.string.StringFormat.INDEX_ZERO_LOWERCASE_LETTER; import static java.util.Arrays.stream; +@Puzzle(resource = "battleship.fxml", buttonLinkerName = "Battleship") public final class Battleship extends Widget { private static Ocean ocean; private static int[] rowCounters, columnCounters; diff --git a/src/main/java/bomb/modules/ab/bitwise/Bitwise.java b/src/main/java/bomb/modules/ab/bitwise/Bitwise.java index 7f30cbe3..bc72adc1 100644 --- a/src/main/java/bomb/modules/ab/bitwise/Bitwise.java +++ b/src/main/java/bomb/modules/ab/bitwise/Bitwise.java @@ -18,7 +18,7 @@ * number line with a specific boolean operator that the Defuser reads to the expert. The class evaluates * which bits will be 1 or 0 in the byte line. */ -@Puzzle(resource = "bitwise.fxml") +@Puzzle(resource = "bitwise.fxml", buttonLinkerName = "Bitwise Ops") public final class Bitwise extends Widget { /** * Turns the edgework conditions into a byte that the Defuser will input into the bomb module diff --git a/src/main/java/bomb/modules/ab/blind_alley/BlindAlley.java b/src/main/java/bomb/modules/ab/blind_alley/BlindAlley.java index 92f3b831..6b2b97fa 100644 --- a/src/main/java/bomb/modules/ab/blind_alley/BlindAlley.java +++ b/src/main/java/bomb/modules/ab/blind_alley/BlindAlley.java @@ -28,7 +28,7 @@ * the 'Blind Alley' tab pane. Blind Alley in a widget-dependant module that require you to press * specific sections of the module based on the indicators, LED's, ports and batteries are on the bomb. */ -@Puzzle(resource = "blind_alley.fxml") +@Puzzle(resource = "blind_alley.fxml", buttonLinkerName = "Blind Alley") public final class BlindAlley extends Widget { private static int[][] alleyCat = new int[3][3]; diff --git a/src/main/java/bomb/modules/ab/boolean_venn/BooleanVenn.java b/src/main/java/bomb/modules/ab/boolean_venn/BooleanVenn.java index 90c11d4a..82204bb2 100644 --- a/src/main/java/bomb/modules/ab/boolean_venn/BooleanVenn.java +++ b/src/main/java/bomb/modules/ab/boolean_venn/BooleanVenn.java @@ -1,6 +1,7 @@ package bomb.modules.ab.boolean_venn; import bomb.Widget; +import bomb.annotation.Puzzle; import bomb.tools.logic.LogicOperator; import org.intellij.lang.annotations.Language; import org.jetbrains.annotations.NotNull; @@ -16,6 +17,7 @@ * The concept is based on the basics of Discrete Mathematics and uses basic boolean operators * to determine the state of each section of the triple venn diagram, green being true and red for false. */ +@Puzzle(resource = "boolean_venn_diagram.fxml", buttonLinkerName = "Boolean Venn Diagram") public final class BooleanVenn extends Widget { private static final boolean[][] TEST_CASES; private static final byte A = 0, B = 1, C = 2; diff --git a/src/main/java/bomb/modules/c/caesar/Caesar.java b/src/main/java/bomb/modules/c/caesar/Caesar.java index 242cc55b..856a36fd 100644 --- a/src/main/java/bomb/modules/c/caesar/Caesar.java +++ b/src/main/java/bomb/modules/c/caesar/Caesar.java @@ -1,6 +1,7 @@ package bomb.modules.c.caesar; import bomb.Widget; +import bomb.annotation.Puzzle; import org.jetbrains.annotations.NotNull; import java.util.stream.IntStream; @@ -9,6 +10,7 @@ import static bomb.enumerations.Indicator.NSA; import static bomb.enumerations.Port.PARALLEL; +@Puzzle(resource = "caesar.fxml", buttonLinkerName = "Caesar Cipher") public final class Caesar extends Widget { private static final int MAX_LETTER_COUNT = 26; diff --git a/src/main/java/bomb/modules/c/cheap_checkout/CheapCheckout.java b/src/main/java/bomb/modules/c/cheap_checkout/CheapCheckout.java index 8fccd86c..c32fa65a 100644 --- a/src/main/java/bomb/modules/c/cheap_checkout/CheapCheckout.java +++ b/src/main/java/bomb/modules/c/cheap_checkout/CheapCheckout.java @@ -1,6 +1,7 @@ package bomb.modules.c.cheap_checkout; import bomb.Widget; +import bomb.annotation.Puzzle; import org.jetbrains.annotations.NotNull; import java.time.DayOfWeek; @@ -12,6 +13,7 @@ import static bomb.tools.number.MathUtils.digitalRoot; import static bomb.tools.number.MathUtils.roundToNPlaces; +@Puzzle(resource = "cheap_checkout.fxml", buttonLinkerName = "Cheap Checkout") public final class CheapCheckout extends Widget { private static final double SUNDAY_ADDITION, THURSDAY_SALE, FRIDAY_MARK_UP, SATURDAY_SALE; private static final int REQUIRED_ITEM_COUNT, REQUIRED_WEIGHT_COUNT; diff --git a/src/main/java/bomb/modules/c/chess/Chess.java b/src/main/java/bomb/modules/c/chess/Chess.java index f40e7aad..fe121579 100644 --- a/src/main/java/bomb/modules/c/chess/Chess.java +++ b/src/main/java/bomb/modules/c/chess/Chess.java @@ -1,6 +1,7 @@ package bomb.modules.c.chess; import bomb.Widget; +import bomb.annotation.Puzzle; import bomb.modules.s.souvenir.Souvenir; import bomb.tools.Coordinates; import org.intellij.lang.annotations.Language; @@ -21,6 +22,7 @@ import static java.util.Arrays.asList; import static java.util.stream.Collectors.toUnmodifiableSet; +@Puzzle(resource = "chess.fxml", buttonLinkerName = "Chess") public final class Chess extends Widget { @Language("regexp") public static final String VALIDITY_PATTERN; diff --git a/src/main/java/bomb/modules/c/chords/ChordQualities.java b/src/main/java/bomb/modules/c/chords/ChordQualities.java index 618ca81d..719b5211 100644 --- a/src/main/java/bomb/modules/c/chords/ChordQualities.java +++ b/src/main/java/bomb/modules/c/chords/ChordQualities.java @@ -1,6 +1,7 @@ package bomb.modules.c.chords; import bomb.Widget; +import bomb.annotation.Puzzle; import bomb.modules.s.souvenir.Souvenir; import bomb.tools.data.structures.ring.ArrayRing; import org.jetbrains.annotations.NotNull; @@ -8,6 +9,7 @@ import java.util.Set; import java.util.TreeSet; +@Puzzle(resource = "chord_qualities.fxml", buttonLinkerName = "Chord Qualities") public final class ChordQualities extends Widget { public static final String NEW_CHORD; diff --git a/src/main/java/bomb/modules/c/color_flash/ColorFlash.java b/src/main/java/bomb/modules/c/color_flash/ColorFlash.java index 2da38e9e..ddd3d9f4 100644 --- a/src/main/java/bomb/modules/c/color_flash/ColorFlash.java +++ b/src/main/java/bomb/modules/c/color_flash/ColorFlash.java @@ -1,6 +1,7 @@ package bomb.modules.c.color_flash; import bomb.Widget; +import bomb.annotation.Puzzle; import org.javatuples.Pair; import org.jetbrains.annotations.NotNull; @@ -17,6 +18,7 @@ /** * */ +@Puzzle(resource = "color_flash.fxml", buttonLinkerName = "Color Flash") public final class ColorFlash extends Widget { private static final int COMBO_LIMIT; diff --git a/src/main/java/bomb/modules/c/colored_switches/ColoredSwitches.java b/src/main/java/bomb/modules/c/colored_switches/ColoredSwitches.java index 46682bf9..f8ee6b87 100644 --- a/src/main/java/bomb/modules/c/colored_switches/ColoredSwitches.java +++ b/src/main/java/bomb/modules/c/colored_switches/ColoredSwitches.java @@ -1,5 +1,6 @@ package bomb.modules.c.colored_switches; +import bomb.annotation.Puzzle; import bomb.modules.s.switches.Switches; import org.javatuples.Pair; import org.jetbrains.annotations.NotNull; @@ -14,6 +15,7 @@ import static bomb.modules.c.colored_switches.SwitchColor.NEUTRAL; +@Puzzle(resource = "colored_switches.fxml", buttonLinkerName = "Colored Switches") public final class ColoredSwitches extends Switches { private static final double WRONG_PATH_VALUE; private static final Graph INTERNAL_GRAPH; diff --git a/src/main/java/bomb/modules/dh/emoji/EmojiMath.java b/src/main/java/bomb/modules/dh/emoji/EmojiMath.java index e6cc3570..077ad4f0 100644 --- a/src/main/java/bomb/modules/dh/emoji/EmojiMath.java +++ b/src/main/java/bomb/modules/dh/emoji/EmojiMath.java @@ -1,6 +1,7 @@ package bomb.modules.dh.emoji; import bomb.Widget; +import bomb.annotation.Puzzle; import bomb.tools.filter.Regex; import org.intellij.lang.annotations.Language; import org.jetbrains.annotations.NotNull; @@ -11,6 +12,7 @@ * This class deals with the Emoji Math module. * It's simple math, but replacing numbers with text emojis. */ +@Puzzle(resource = "emoji_math.fxml", buttonLinkerName = "Emoji Math") public final class EmojiMath extends Widget { @Language("regexp") private static final String EMOJI_PATTERN, VALIDATION_PATTERN; diff --git a/src/main/java/bomb/modules/dh/fast_math/FastMath.java b/src/main/java/bomb/modules/dh/fast_math/FastMath.java index bc9f3867..d563ca61 100644 --- a/src/main/java/bomb/modules/dh/fast_math/FastMath.java +++ b/src/main/java/bomb/modules/dh/fast_math/FastMath.java @@ -1,6 +1,7 @@ package bomb.modules.dh.fast_math; import bomb.Widget; +import bomb.annotation.Puzzle; import bomb.tools.filter.Regex; import org.jetbrains.annotations.NotNull; @@ -9,6 +10,7 @@ import static bomb.enumerations.Port.SERIAL; import static bomb.tools.filter.RegexFilter.EMPTY_FILTER_RESULTS; +@Puzzle(resource = "fast_math.fxml", buttonLinkerName = "Fast Math") public final class FastMath extends Widget { private static final int[][] INTERNAL_GRID; diff --git a/src/main/java/bomb/modules/dh/fizzbuzz/FizzBuzz.java b/src/main/java/bomb/modules/dh/fizzbuzz/FizzBuzz.java index 1c187520..c32ad276 100644 --- a/src/main/java/bomb/modules/dh/fizzbuzz/FizzBuzz.java +++ b/src/main/java/bomb/modules/dh/fizzbuzz/FizzBuzz.java @@ -1,6 +1,7 @@ package bomb.modules.dh.fizzbuzz; import bomb.Widget; +import bomb.annotation.Puzzle; import bomb.enumerations.Port; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Range; @@ -8,6 +9,7 @@ import java.util.ArrayList; import java.util.List; +@Puzzle(resource = "fizzbuzz.fxml", buttonLinkerName = "FizzBuzz") public final class FizzBuzz extends Widget { public static @NotNull String solve(@NotNull String numberText, @NotNull FizzBuzzColor color, @Range(from=0, to=2) int strikeCount) throws IllegalArgumentException { diff --git a/src/main/java/bomb/modules/dh/forget_me/ForgetMeNot.java b/src/main/java/bomb/modules/dh/forget_me/ForgetMeNot.java index b628ab25..39fd4128 100644 --- a/src/main/java/bomb/modules/dh/forget_me/ForgetMeNot.java +++ b/src/main/java/bomb/modules/dh/forget_me/ForgetMeNot.java @@ -1,6 +1,7 @@ package bomb.modules.dh.forget_me; import bomb.Widget; +import bomb.annotation.Puzzle; import bomb.tools.filter.Regex; import bomb.tools.filter.RegexFilter; import org.jetbrains.annotations.NotNull; @@ -14,6 +15,7 @@ import static bomb.enumerations.Indicator.CAR; import static bomb.enumerations.Port.SERIAL; +@Puzzle(resource = "forget_me_not.fxml", buttonLinkerName = "Forget Me Not") public final class ForgetMeNot extends Widget { private static final IntUnaryOperator LEAST_SIG_DIGIT, MOST_SIG_DIGIT; private static final List FINAL_CODE; diff --git a/src/main/java/bomb/modules/dh/hexamaze/Hexamaze.java b/src/main/java/bomb/modules/dh/hexamaze/Hexamaze.java index dbd04935..5cb83465 100644 --- a/src/main/java/bomb/modules/dh/hexamaze/Hexamaze.java +++ b/src/main/java/bomb/modules/dh/hexamaze/Hexamaze.java @@ -1,6 +1,7 @@ package bomb.modules.dh.hexamaze; import bomb.Widget; +import bomb.annotation.Puzzle; import bomb.modules.dh.hexamaze.hexalgorithm.maze_finding.MazeSearch; import bomb.modules.dh.hexamaze.hexalgorithm.pathfinding.ExitChecker; import bomb.modules.dh.hexamaze.hexalgorithm.pathfinding.MazeRunner; @@ -27,6 +28,7 @@ import static javafx.scene.paint.Color.RED; import static javafx.scene.paint.Color.YELLOW; +@Puzzle(resource = "hexamaze.fxml", buttonLinkerName = "Hexamaze") public final class Hexamaze extends Widget { public static final Map COLOR_MAP; public static final Color PEG_COLOR; diff --git a/src/main/java/bomb/modules/il/ice_cream/IceCream.java b/src/main/java/bomb/modules/il/ice_cream/IceCream.java index b975c552..d29af04b 100644 --- a/src/main/java/bomb/modules/il/ice_cream/IceCream.java +++ b/src/main/java/bomb/modules/il/ice_cream/IceCream.java @@ -1,6 +1,7 @@ package bomb.modules.il.ice_cream; import bomb.Widget; +import bomb.annotation.Puzzle; import org.jetbrains.annotations.NotNull; import java.util.EnumMap; @@ -20,6 +21,7 @@ import static bomb.modules.il.ice_cream.Flavor.TUTTI_FRUTTI; import static bomb.modules.il.ice_cream.Flavor.VANILLA; +@Puzzle(resource = "ice_cream.fxml", buttonLinkerName = "Ice Cream") public final class IceCream extends Widget { public static @NotNull Flavor findFlavor(@NotNull Person person, @NotNull EnumSet possibleFlavors, boolean hasEmptyPortPlate) diff --git a/src/main/java/bomb/modules/il/laundry/Laundry.java b/src/main/java/bomb/modules/il/laundry/Laundry.java index 3c45e720..71aa0230 100644 --- a/src/main/java/bomb/modules/il/laundry/Laundry.java +++ b/src/main/java/bomb/modules/il/laundry/Laundry.java @@ -1,6 +1,7 @@ package bomb.modules.il.laundry; import bomb.Widget; +import bomb.annotation.Puzzle; import org.jetbrains.annotations.NotNull; import java.util.Set; @@ -38,6 +39,7 @@ * item, material, and color. These will lead to the instructions for washing, drying, ironing, * and dry cleaning your clothing. */ +@Puzzle(resource = "laundry.fxml", buttonLinkerName = "Laundry") public final class Laundry extends Widget { public static final String THANKS_BOB = "Thanks, Bob! :)"; diff --git a/src/main/java/bomb/modules/il/led_encryption/LEDEncryption.java b/src/main/java/bomb/modules/il/led_encryption/LEDEncryption.java index 21a53765..922b5d7f 100644 --- a/src/main/java/bomb/modules/il/led_encryption/LEDEncryption.java +++ b/src/main/java/bomb/modules/il/led_encryption/LEDEncryption.java @@ -1,6 +1,8 @@ package bomb.modules.il.led_encryption; import bomb.Widget; +import bomb.annotation.Puzzle; +@Puzzle(resource = "led_encryption.fxml", buttonLinkerName = "LED Encryption") public final class LEDEncryption extends Widget { } diff --git a/src/main/java/bomb/modules/il/logic/Logic.java b/src/main/java/bomb/modules/il/logic/Logic.java index d5d0e81a..e3dc5a6a 100644 --- a/src/main/java/bomb/modules/il/logic/Logic.java +++ b/src/main/java/bomb/modules/il/logic/Logic.java @@ -1,6 +1,7 @@ package bomb.modules.il.logic; import bomb.Widget; +import bomb.annotation.Puzzle; import bomb.tools.logic.LogicOperator; import org.jetbrains.annotations.NotNull; @@ -12,6 +13,7 @@ import static bomb.tools.logic.LogicOperator.IMPLIES; import static java.util.Arrays.asList; +@Puzzle(resource = "logic.fxml", buttonLinkerName = "Logic") public final class Logic extends Widget { public static boolean solve(@NotNull LetterRecord @NotNull[] letters, @NotNull LogicOperator @NotNull[] intermediateOperators, diff --git a/src/main/java/bomb/modules/m/microcontroller/MicroController.java b/src/main/java/bomb/modules/m/microcontroller/MicroController.java index 207f97d0..c6a19cf4 100644 --- a/src/main/java/bomb/modules/m/microcontroller/MicroController.java +++ b/src/main/java/bomb/modules/m/microcontroller/MicroController.java @@ -1,6 +1,7 @@ package bomb.modules.m.microcontroller; import bomb.Widget; +import bomb.annotation.Puzzle; import bomb.modules.m.microcontroller.chip.AbstractController; import bomb.tools.filter.Regex; import javafx.scene.paint.Color; @@ -12,6 +13,7 @@ import static bomb.enumerations.Port.RJ45; import static bomb.tools.filter.RegexFilter.filter; +@Puzzle(resource = "microcontroller.fxml", buttonLinkerName = "MicroController") public final class MicroController extends Widget { public static @NotNull List getPinColors(@NotNull String moduleSerialNumbers, @NotNull AbstractController controller) diff --git a/src/main/java/bomb/modules/m/monsplode/MonslopeFight.java b/src/main/java/bomb/modules/m/monsplode/MonslopeFight.java index 17a23b82..c142b8ca 100644 --- a/src/main/java/bomb/modules/m/monsplode/MonslopeFight.java +++ b/src/main/java/bomb/modules/m/monsplode/MonslopeFight.java @@ -1,6 +1,8 @@ package bomb.modules.m.monsplode; import bomb.Widget; +import bomb.annotation.Puzzle; +@Puzzle(resource = "monsplode_fight.fxml", buttonLinkerName = "Monslope Fight") public final class MonslopeFight extends Widget { } diff --git a/src/main/java/bomb/modules/m/morsematics/Morsematics.java b/src/main/java/bomb/modules/m/morsematics/Morsematics.java index 679ed766..e0b0d22f 100644 --- a/src/main/java/bomb/modules/m/morsematics/Morsematics.java +++ b/src/main/java/bomb/modules/m/morsematics/Morsematics.java @@ -1,6 +1,7 @@ package bomb.modules.m.morsematics; import bomb.Widget; +import bomb.annotation.Puzzle; import bomb.enumerations.Indicator; import bomb.tools.data.structures.graph.list.ListGraph; import bomb.tools.data.structures.ring.ArrayRing; @@ -20,6 +21,7 @@ import static bomb.Widget.IndicatorFilter.UNLIT; import static bomb.tools.number.MathUtils.isPerfectSquare; +@Puzzle(resource = "morsematics.fxml", buttonLinkerName = "Morsematics") public final class Morsematics extends Widget { public static @NotNull String solve(@NotNull LinkedHashSet inputSet) throws IllegalArgumentException { checkSerialCode(); diff --git a/src/main/java/bomb/modules/m/murder/Murder.java b/src/main/java/bomb/modules/m/murder/Murder.java index 43e6a732..90fe2af3 100644 --- a/src/main/java/bomb/modules/m/murder/Murder.java +++ b/src/main/java/bomb/modules/m/murder/Murder.java @@ -1,6 +1,7 @@ package bomb.modules.m.murder; import bomb.Widget; +import bomb.annotation.Puzzle; import org.javatuples.Pair; import org.javatuples.Triplet; import org.jetbrains.annotations.NotNull; @@ -26,6 +27,7 @@ import static java.util.stream.Collectors.joining; import static java.util.stream.Collectors.toMap; +@Puzzle(resource = "murder.fxml", buttonLinkerName = "Murder") public final class Murder extends Widget { public static @NotNull String solve(@NotNull Location bodyFoundRoom, @NotNull EnumSet possibleWeapons, @NotNull EnumSet possibleSuspects) throws IllegalStateException { diff --git a/src/main/java/bomb/modules/np/neutralization/Neutralization.java b/src/main/java/bomb/modules/np/neutralization/Neutralization.java index 5cabbd9c..e3235c49 100644 --- a/src/main/java/bomb/modules/np/neutralization/Neutralization.java +++ b/src/main/java/bomb/modules/np/neutralization/Neutralization.java @@ -1,6 +1,7 @@ package bomb.modules.np.neutralization; import bomb.Widget; +import bomb.annotation.Puzzle; import bomb.modules.np.neutralization.Chemical.Acid; import bomb.modules.np.neutralization.Chemical.Base; import bomb.modules.s.souvenir.Souvenir; @@ -38,6 +39,7 @@ * acid there is in the test tube. The Expert must then find the base that will titrate the acid with a specific * drop count and determine if the titration needs a filter or not. */ +@Puzzle(resource = "neutralization.fxml", buttonLinkerName = "Neutralization") public final class Neutralization extends Widget { public static final String NO_FILTER_TEXT, FILTER_TEXT; diff --git a/src/main/java/bomb/modules/np/number_pad/NumberPad.java b/src/main/java/bomb/modules/np/number_pad/NumberPad.java index 98f61706..8d2e51ea 100644 --- a/src/main/java/bomb/modules/np/number_pad/NumberPad.java +++ b/src/main/java/bomb/modules/np/number_pad/NumberPad.java @@ -1,7 +1,9 @@ package bomb.modules.np.number_pad; import bomb.Widget; +import bomb.annotation.Puzzle; +@Puzzle(resource = "number_pad.fxml", buttonLinkerName = "Number Pad") public final class NumberPad extends Widget { } diff --git a/src/main/java/bomb/modules/r/round_keypads/RoundKeypads.java b/src/main/java/bomb/modules/r/round_keypads/RoundKeypads.java index dad8c604..bf7a3de3 100644 --- a/src/main/java/bomb/modules/r/round_keypads/RoundKeypads.java +++ b/src/main/java/bomb/modules/r/round_keypads/RoundKeypads.java @@ -2,6 +2,7 @@ import bomb.Widget; import bomb.abstractions.Flaggable; +import bomb.annotation.Puzzle; import javafx.scene.image.Image; import javafx.scene.image.WritableImage; import javafx.scene.paint.Color; @@ -16,6 +17,7 @@ import static java.util.stream.Collectors.counting; import static java.util.stream.Collectors.groupingBy; +@Puzzle(resource = "round_keypads.fxml", buttonLinkerName = "Round Keypads") public final class RoundKeypads extends Widget { private static final int IMAGES_PER_COLUMN = 7; private static final UnaryOperator HIGHLIGHT_COMMAND; diff --git a/src/main/java/bomb/modules/s/seashells/Seashells.java b/src/main/java/bomb/modules/s/seashells/Seashells.java index d08503db..f4028019 100644 --- a/src/main/java/bomb/modules/s/seashells/Seashells.java +++ b/src/main/java/bomb/modules/s/seashells/Seashells.java @@ -1,6 +1,8 @@ package bomb.modules.s.seashells; import bomb.Widget; +import bomb.annotation.Puzzle; +@Puzzle(resource = "seashells.fxml", buttonLinkerName = "Seashells") public final class Seashells extends Widget { } diff --git a/src/main/java/bomb/modules/s/semaphore/Semaphore.java b/src/main/java/bomb/modules/s/semaphore/Semaphore.java index b4219bd7..36878cb5 100644 --- a/src/main/java/bomb/modules/s/semaphore/Semaphore.java +++ b/src/main/java/bomb/modules/s/semaphore/Semaphore.java @@ -1,6 +1,8 @@ package bomb.modules.s.semaphore; import bomb.Widget; +import bomb.annotation.Puzzle; +@Puzzle(resource = "semaphore.fxml", buttonLinkerName = "Semaphore") public final class Semaphore extends Widget { } diff --git a/src/main/java/bomb/modules/s/shape_shift/ShapeShift.java b/src/main/java/bomb/modules/s/shape_shift/ShapeShift.java index 80467919..ab34d64b 100644 --- a/src/main/java/bomb/modules/s/shape_shift/ShapeShift.java +++ b/src/main/java/bomb/modules/s/shape_shift/ShapeShift.java @@ -1,6 +1,7 @@ package bomb.modules.s.shape_shift; import bomb.Widget; +import bomb.annotation.Puzzle; import bomb.tools.data.structures.graph.list.ListGraph; import org.javatuples.Pair; import org.jetbrains.annotations.NotNull; @@ -23,6 +24,7 @@ import static bomb.modules.s.shape_shift.ShapeEnd.SHAPE_END_ARRAY; import static bomb.tools.logic.BitConverter.TO_INT; +@Puzzle(resource = "shape_shift.fxml", buttonLinkerName = "Shape Shift") public final class ShapeShift extends Widget { private static final int[][] COUNT_TRACKER; diff --git a/src/main/java/bomb/modules/s/simon/screams/SimonScreams.java b/src/main/java/bomb/modules/s/simon/screams/SimonScreams.java index 3fe4ba0f..51119ab5 100644 --- a/src/main/java/bomb/modules/s/simon/screams/SimonScreams.java +++ b/src/main/java/bomb/modules/s/simon/screams/SimonScreams.java @@ -1,6 +1,7 @@ package bomb.modules.s.simon.screams; import bomb.Widget; +import bomb.annotation.Puzzle; import bomb.modules.s.simon.SimonColors.ScreamColor; import org.jetbrains.annotations.NotNull; @@ -9,6 +10,7 @@ import static java.util.stream.Collectors.joining; +@Puzzle(resource = "simon_screams.fxml", buttonLinkerName = "Simon Screams") public final class SimonScreams extends Widget { private static final int MAX_OUTPUT_RULES; private static final List CURRENT_OUTPUT_NUMBERS; diff --git a/src/main/java/bomb/modules/s/simon/states/SimonStates.java b/src/main/java/bomb/modules/s/simon/states/SimonStates.java index be44c967..7773b649 100644 --- a/src/main/java/bomb/modules/s/simon/states/SimonStates.java +++ b/src/main/java/bomb/modules/s/simon/states/SimonStates.java @@ -1,6 +1,7 @@ package bomb.modules.s.simon.states; import bomb.Widget; +import bomb.annotation.Puzzle; import bomb.modules.s.simon.SimonColors.StateColor; import bomb.modules.s.souvenir.Souvenir; import org.jetbrains.annotations.NotNull; @@ -22,6 +23,7 @@ import static java.util.Collections.reverse; import static java.util.stream.Collectors.joining; +@Puzzle(resource = "simon_states.fxml", buttonLinkerName = "Simon States") public final class SimonStates extends Widget { private static final int HIGH = 1, LOW = 2, LOWEST = 3; private static final List PRESSED_COLOR_HISTORY; diff --git a/src/main/java/bomb/modules/s/souvenir/Souvenir.java b/src/main/java/bomb/modules/s/souvenir/Souvenir.java index d95c0c73..709bf139 100644 --- a/src/main/java/bomb/modules/s/souvenir/Souvenir.java +++ b/src/main/java/bomb/modules/s/souvenir/Souvenir.java @@ -1,6 +1,7 @@ package bomb.modules.s.souvenir; import bomb.Widget; +import bomb.annotation.Puzzle; import org.javatuples.Pair; import org.jetbrains.annotations.NotNull; @@ -8,6 +9,7 @@ import java.util.List; import java.util.Map; +@Puzzle(resource = "souvenir.fxml", buttonLinkerName = "Souvenir") public final class Souvenir extends Widget { private static final Map MODULE_ARTIFACTS; diff --git a/src/main/java/bomb/modules/s/square/SquareButton.java b/src/main/java/bomb/modules/s/square/SquareButton.java index 34c2dc0b..fb6638cc 100644 --- a/src/main/java/bomb/modules/s/square/SquareButton.java +++ b/src/main/java/bomb/modules/s/square/SquareButton.java @@ -1,6 +1,7 @@ package bomb.modules.s.square; import bomb.Widget; +import bomb.annotation.Puzzle; import bomb.tools.number.MathUtils; import org.jetbrains.annotations.NotNull; @@ -22,6 +23,7 @@ import static java.util.Arrays.asList; import static java.util.stream.Collectors.joining; +@Puzzle(resource = "square_button.fxml", buttonLinkerName = "Square Button") public final class SquareButton extends Widget { //Button colors public static final int BLUE, YELLOW, DARK_GRAY, WHITE; diff --git a/src/main/java/bomb/modules/s/switches/Switches.java b/src/main/java/bomb/modules/s/switches/Switches.java index da1d7aa7..a8842557 100644 --- a/src/main/java/bomb/modules/s/switches/Switches.java +++ b/src/main/java/bomb/modules/s/switches/Switches.java @@ -1,6 +1,7 @@ package bomb.modules.s.switches; import bomb.Widget; +import bomb.annotation.Puzzle; import bomb.modules.c.colored_switches.ColoredSwitches; import org.jetbrains.annotations.NotNull; @@ -14,6 +15,7 @@ import static java.util.Arrays.asList; +@Puzzle(resource = "switches.fxml", buttonLinkerName = "Switches") public sealed class Switches extends Widget permits ColoredSwitches { protected static final byte BIT_LENGTH = 5; private static final Set FORBIDDEN_MOVES; diff --git a/src/main/java/bomb/modules/t/bulb/TheBulb.java b/src/main/java/bomb/modules/t/bulb/TheBulb.java index 7b5fab0f..e9b51e69 100644 --- a/src/main/java/bomb/modules/t/bulb/TheBulb.java +++ b/src/main/java/bomb/modules/t/bulb/TheBulb.java @@ -1,6 +1,7 @@ package bomb.modules.t.bulb; import bomb.Widget; +import bomb.annotation.Puzzle; import bomb.enumerations.Indicator; import bomb.modules.s.souvenir.Souvenir; import bomb.tools.filter.Regex; @@ -33,6 +34,7 @@ import static bomb.modules.t.bulb.Bulb.Position.SCREWED; import static bomb.modules.t.bulb.Bulb.Position.UNSCREWED; +@Puzzle(resource = "the_bulb.fxml", buttonLinkerName = "The Bulb") public final class TheBulb extends Widget { public static final String PRESS_I, PRESS_O, SCREW, UNSCREW; diff --git a/src/main/java/bomb/modules/t/three_d_maze/ThreeDMaze.java b/src/main/java/bomb/modules/t/three_d_maze/ThreeDMaze.java index 04e77993..3a47c793 100644 --- a/src/main/java/bomb/modules/t/three_d_maze/ThreeDMaze.java +++ b/src/main/java/bomb/modules/t/three_d_maze/ThreeDMaze.java @@ -1,4 +1,7 @@ package bomb.modules.t.three_d_maze; +import bomb.annotation.Puzzle; + +@Puzzle(resource = "3d_maze.fxml", buttonLinkerName = "3D Maze") public class ThreeDMaze { } diff --git a/src/main/java/bomb/modules/t/two_bit/TwoBit.java b/src/main/java/bomb/modules/t/two_bit/TwoBit.java index 87b58efa..3cb997df 100644 --- a/src/main/java/bomb/modules/t/two_bit/TwoBit.java +++ b/src/main/java/bomb/modules/t/two_bit/TwoBit.java @@ -1,6 +1,7 @@ package bomb.modules.t.two_bit; import bomb.Widget; +import bomb.annotation.Puzzle; import bomb.modules.s.souvenir.Souvenir; import org.jetbrains.annotations.NotNull; @@ -17,6 +18,7 @@ /** * */ +@Puzzle(resource = "two_bit.fxml", buttonLinkerName = "Two Bit") public final class TwoBit extends Widget { public static final String QUERY_TEXT, SUBMIT_TEXT; diff --git a/src/main/java/bomb/modules/wz/word_search/WordSearch.java b/src/main/java/bomb/modules/wz/word_search/WordSearch.java index f6ce2ea7..53152aff 100644 --- a/src/main/java/bomb/modules/wz/word_search/WordSearch.java +++ b/src/main/java/bomb/modules/wz/word_search/WordSearch.java @@ -1,6 +1,7 @@ package bomb.modules.wz.word_search; import bomb.Widget; +import bomb.annotation.Puzzle; import org.jetbrains.annotations.NotNull; import java.io.BufferedReader; @@ -14,6 +15,7 @@ import static java.util.stream.Collectors.toUnmodifiableMap; @SuppressWarnings("ConstantConditions") +@Puzzle(resource = "word_search.fxml", buttonLinkerName = "Word Search") public final class WordSearch extends Widget { private static final int ARRAY_SIZE; private static final String FILENAME; diff --git a/src/main/java/bomb/modules/wz/zoo/Zoo.java b/src/main/java/bomb/modules/wz/zoo/Zoo.java index 03a5d348..44e6d70d 100644 --- a/src/main/java/bomb/modules/wz/zoo/Zoo.java +++ b/src/main/java/bomb/modules/wz/zoo/Zoo.java @@ -1,6 +1,8 @@ package bomb.modules.wz.zoo; import bomb.Widget; +import bomb.annotation.Puzzle; +@Puzzle(resource = "zoo.fxml", buttonLinkerName = "Zoo") public final class Zoo extends Widget { } diff --git a/src/main/resources/bomb/fxml/ab/3d_maze.fxml b/src/main/resources/bomb/fxml/t/3d_maze.fxml similarity index 100% rename from src/main/resources/bomb/fxml/ab/3d_maze.fxml rename to src/main/resources/bomb/fxml/t/3d_maze.fxml From 3ee94d9812ff8a8a0de9dbb805e76b0ea2aacb96 Mon Sep 17 00:00:00 2001 From: "Mr. J" <45538844+Ultraviolet-Ninja@users.noreply.github.com> Date: Sun, 18 Dec 2022 15:45:14 -0600 Subject: [PATCH 64/86] Setting up the publishing script for JLink --- .github/workflows/build_publish.yml | 51 +++++++++++++++++++++++++++++ .github/workflows/gradle.yml | 48 --------------------------- 2 files changed, 51 insertions(+), 48 deletions(-) create mode 100644 .github/workflows/build_publish.yml delete mode 100644 .github/workflows/gradle.yml diff --git a/.github/workflows/build_publish.yml b/.github/workflows/build_publish.yml new file mode 100644 index 00000000..38afc604 --- /dev/null +++ b/.github/workflows/build_publish.yml @@ -0,0 +1,51 @@ +# This workflow will build a Java project with Gradle +# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-gradle + +name: Java CI with Gradle + +on: + push: + branches: [ main ] + +jobs: + build: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + + - name: Set up JDK 17 + uses: actions/setup-java@v2 + with: + java-version: 17 + distribution: 'adopt' + check-latest: true + + - name: Grant execute permission for gradlew + run: chmod +x gradlew + + - name: Build with Gradle + run: ./gradlew build + + - name: Linking Dependencies with Gradle + run: ./gradlew jlink + +# - name: Set up QEMU +# uses: docker/setup-qemu-action@v1 +# +# - name: Set up Docker Buildx +# uses: docker/setup-buildx-action@v1 +# +# - name: Login to DockerHub +# uses: docker/login-action@v1 +# with: +# username: ${{ secrets.DOCKER_USERNAME }} +# password: ${{ secrets.DOCKER_PASSWORD }} +# +# - name: Docker Build and Push +# id: docker_build +# run: ./gradlew dockerPushDockerHub +# +# - name: Auto-Upload Releases +# run: ./gradlew releaseToGitHub -PauthToken=${{ secrets.GITHUB_TOKEN }} \ No newline at end of file diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml deleted file mode 100644 index c81cdd02..00000000 --- a/.github/workflows/gradle.yml +++ /dev/null @@ -1,48 +0,0 @@ -# This workflow will build a Java project with Gradle -# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-gradle - -name: Java CI with Gradle - -on: - push: - branches: [ main ] - -jobs: - build: - - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v2 - - - name: Set up JDK 17 - uses: actions/setup-java@v2 - with: - java-version: 17 - distribution: 'adopt' - check-latest: true - - - name: Grant execute permission for gradlew - run: chmod +x gradlew - - - name: Assemble with Gradle - run: ./gradlew assemble - - - name: Set up QEMU - uses: docker/setup-qemu-action@v1 - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v1 - - - name: Login to DockerHub - uses: docker/login-action@v1 - with: - username: ${{ secrets.DOCKER_USERNAME }} - password: ${{ secrets.DOCKER_PASSWORD }} - - - name: Docker Build and Push - id: docker_build - run: ./gradlew dockerPushDockerHub - - - name: Auto-Upload Releases - run: ./gradlew releaseToGitHub -PauthToken=${{ secrets.GITHUB_TOKEN }} \ No newline at end of file From 051b895fe7b553ce5227f3d12e47752f0fd85026 Mon Sep 17 00:00:00 2001 From: "Mr. J" <45538844+Ultraviolet-Ninja@users.noreply.github.com> Date: Sun, 18 Dec 2022 15:56:34 -0600 Subject: [PATCH 65/86] Changed the annotation name to DisplayComponent Added fxml files in the correct spot --- src/main/java/bomb/ManualController.java | 14 +- .../{Puzzle.java => DisplayComponent.java} | 2 +- .../bomb/modules/ab/alphabet/Alphabet.java | 4 +- .../bomb/modules/ab/astrology/Astrology.java | 4 +- .../modules/ab/battleship/Battleship.java | 4 +- .../java/bomb/modules/ab/bitwise/Bitwise.java | 4 +- .../modules/ab/blind_alley/BlindAlley.java | 4 +- .../modules/ab/boolean_venn/BooleanVenn.java | 4 +- .../java/bomb/modules/c/caesar/Caesar.java | 4 +- .../c/cheap_checkout/CheapCheckout.java | 4 +- src/main/java/bomb/modules/c/chess/Chess.java | 4 +- .../bomb/modules/c/chords/ChordQualities.java | 4 +- .../modules/c/color_flash/ColorFlash.java | 4 +- .../c/colored_switches/ColoredSwitches.java | 4 +- .../java/bomb/modules/dh/emoji/EmojiMath.java | 4 +- .../bomb/modules/dh/fast_math/FastMath.java | 4 +- .../bomb/modules/dh/fizzbuzz/FizzBuzz.java | 4 +- .../modules/dh/forget_me/ForgetMeNot.java | 4 +- .../bomb/modules/dh/hexamaze/Hexamaze.java | 4 +- .../bomb/modules/il/ice_cream/IceCream.java | 4 +- .../java/bomb/modules/il/laundry/Laundry.java | 4 +- .../il/led_encryption/LEDEncryption.java | 4 +- .../java/bomb/modules/il/logic/Logic.java | 4 +- .../m/microcontroller/MicroController.java | 4 +- .../modules/m/monsplode/MonslopeFight.java | 4 +- .../modules/m/morsematics/Morsematics.java | 4 +- .../java/bomb/modules/m/murder/Murder.java | 4 +- .../np/neutralization/Neutralization.java | 4 +- .../bomb/modules/np/number_pad/NumberPad.java | 4 +- .../modules/r/round_keypads/RoundKeypads.java | 4 +- .../bomb/modules/s/seashells/Seashells.java | 4 +- .../bomb/modules/s/semaphore/Semaphore.java | 4 +- .../modules/s/shape_shift/ShapeShift.java | 4 +- .../modules/s/simon/screams/SimonScreams.java | 4 +- .../modules/s/simon/states/SimonStates.java | 4 +- .../bomb/modules/s/souvenir/Souvenir.java | 4 +- .../bomb/modules/s/square/SquareButton.java | 4 +- .../bomb/modules/s/switches/Switches.java | 4 +- .../java/bomb/modules/t/bulb/TheBulb.java | 4 +- .../modules/t/three_d_maze/ThreeDMaze.java | 4 +- .../java/bomb/modules/t/two_bit/TwoBit.java | 4 +- .../modules/wz/word_search/WordSearch.java | 4 +- src/main/java/bomb/modules/wz/zoo/Zoo.java | 4 +- .../java/bomb/tools/note/NoteController.java | 2 + src/main/resources/bomb/empty_view.fxml | 13 + .../modules/ab/adjacent/adjacent_letters.fxml | 13 + .../bomb/modules/ab/alphabet/alphabet.fxml | 77 +++++ .../bomb/modules/ab/astrology/astrology.fxml | 289 ++++++++++++++++++ .../modules/ab/battleship/battleship.fxml | 13 + .../bomb/modules/ab/bitwise/bitwise_ops.fxml | 43 +++ .../modules/ab/blind_alley/blind_alley.fxml | 86 ++++++ .../ab/boolean_venn/boolean_venn_diagram.fxml | 125 ++++++++ .../bomb/tools/note/extra_notes.fxml | 31 ++ 53 files changed, 782 insertions(+), 90 deletions(-) rename src/main/java/bomb/annotation/{Puzzle.java => DisplayComponent.java} (89%) create mode 100644 src/main/resources/bomb/empty_view.fxml create mode 100644 src/main/resources/bomb/modules/ab/adjacent/adjacent_letters.fxml create mode 100644 src/main/resources/bomb/modules/ab/alphabet/alphabet.fxml create mode 100644 src/main/resources/bomb/modules/ab/astrology/astrology.fxml create mode 100644 src/main/resources/bomb/modules/ab/battleship/battleship.fxml create mode 100644 src/main/resources/bomb/modules/ab/bitwise/bitwise_ops.fxml create mode 100644 src/main/resources/bomb/modules/ab/blind_alley/blind_alley.fxml create mode 100644 src/main/resources/bomb/modules/ab/boolean_venn/boolean_venn_diagram.fxml create mode 100644 src/main/resources/bomb/tools/note/extra_notes.fxml diff --git a/src/main/java/bomb/ManualController.java b/src/main/java/bomb/ManualController.java index 8f37b9d3..67703604 100644 --- a/src/main/java/bomb/ManualController.java +++ b/src/main/java/bomb/ManualController.java @@ -1,10 +1,10 @@ package bomb; -import bomb.annotation.Puzzle; -import bomb.modules.ab.battleship.Battleship; +import bomb.annotation.DisplayComponent; import bomb.modules.ab.blind_alley.BlindAlleyController; import bomb.modules.s.souvenir.SouvenirController; import bomb.tools.filter.Regex; +import bomb.tools.note.NoteController; import bomb.tools.pattern.facade.FacadeFX; import bomb.tools.pattern.observer.BlindAlleyPaneObserver; import bomb.tools.pattern.observer.ForgetMeNotToggleObserver; @@ -103,6 +103,7 @@ private CompletableFuture> setupRegionMap() throws Execution createRadioButtonNameFuture(options.getToggles()); createFXMLMap(); +// var fxmlMapFuture = supplyAsync(ManualController::createFXMLMap); //TODO - This is what we're looking to replace return createFilePathFuture().thenApply(filePathFuture -> @@ -217,10 +218,9 @@ private static URI toURI(URL url) throws IllegalArgumentException { } private static LinkedHashMap createFXMLMap() { - var e = Battleship.class.getResource("battleship.fxml"); return getWidgetSubClasses() .stream() - .map(cls -> new Pair<>(cls.getAnnotation(Puzzle.class), cls)) + .map(cls -> new Pair<>(cls.getAnnotation(DisplayComponent.class), cls)) .map(pair -> pair.setAt1(pair.getValue1().getResource(pair.getValue0().resource()))) .map(pair -> pair.setAt0(pair.getValue0().buttonLinkerName())) .sorted() @@ -233,17 +233,17 @@ private static LinkedHashMap createFXMLMap() { } private static List> getWidgetSubClasses() { - List> list = new ArrayList<>(); + List> list = new ArrayList<>(List.of(NoteController.class)); ArrayDeque> files = new ArrayDeque<>(asList(Widget.class.getPermittedSubclasses())); - Class temp; + Class temp; while ((temp = files.poll()) != null) { Class[] nextSubLevel = temp.getPermittedSubclasses(); if (nextSubLevel != null) { files.addAll(asList(nextSubLevel)); } - if (temp.isAnnotationPresent(Puzzle.class)) { + if (temp.isAnnotationPresent(DisplayComponent.class)) { list.add(temp); } } diff --git a/src/main/java/bomb/annotation/Puzzle.java b/src/main/java/bomb/annotation/DisplayComponent.java similarity index 89% rename from src/main/java/bomb/annotation/Puzzle.java rename to src/main/java/bomb/annotation/DisplayComponent.java index f8328840..5ebcaa0a 100644 --- a/src/main/java/bomb/annotation/Puzzle.java +++ b/src/main/java/bomb/annotation/DisplayComponent.java @@ -7,7 +7,7 @@ @Retention(RetentionPolicy.RUNTIME) @Target(ElementType.TYPE) -public @interface Puzzle { +public @interface DisplayComponent { String resource(); String buttonLinkerName(); diff --git a/src/main/java/bomb/modules/ab/alphabet/Alphabet.java b/src/main/java/bomb/modules/ab/alphabet/Alphabet.java index f9dcc3c3..fce4e3d3 100644 --- a/src/main/java/bomb/modules/ab/alphabet/Alphabet.java +++ b/src/main/java/bomb/modules/ab/alphabet/Alphabet.java @@ -1,7 +1,7 @@ package bomb.modules.ab.alphabet; import bomb.Widget; -import bomb.annotation.Puzzle; +import bomb.annotation.DisplayComponent; import bomb.tools.filter.Regex; import org.jetbrains.annotations.NotNull; @@ -18,7 +18,7 @@ * if the letters appear in those 4 tiles. * But if no set matches the 4 tiles, the tiles are to be pressed in alphabetical order. */ -@Puzzle(resource = "alphabet.fxml", buttonLinkerName = "Alphabet") +@DisplayComponent(resource = "alphabet.fxml", buttonLinkerName = "Alphabet") public final class Alphabet extends Widget { private static final String[] WORD_BANK; diff --git a/src/main/java/bomb/modules/ab/astrology/Astrology.java b/src/main/java/bomb/modules/ab/astrology/Astrology.java index 0aff8a54..35933fc4 100644 --- a/src/main/java/bomb/modules/ab/astrology/Astrology.java +++ b/src/main/java/bomb/modules/ab/astrology/Astrology.java @@ -1,7 +1,7 @@ package bomb.modules.ab.astrology; import bomb.Widget; -import bomb.annotation.Puzzle; +import bomb.annotation.DisplayComponent; import bomb.tools.filter.Regex; import org.jetbrains.annotations.NotNull; @@ -24,7 +24,7 @@ * The quantity of the number is used to determine when to press the button. * (i.e. Bad Omen at 5 means that you need to press "Bad Omen" when the bomb timer has a 5 in it) */ -@Puzzle(resource = "alphabet.fxml", buttonLinkerName = "Astrology") +@DisplayComponent(resource = "alphabet.fxml", buttonLinkerName = "Astrology") public final class Astrology extends Widget { public static final byte ELEMENT_INDEX = 0, CELESTIAL_INDEX = 1, ZODIAC_INDEX = 2, EXPECTED_SIZE = 3; public static final String GOOD_OMEN = "Good Omen at ", POOR_OMEN = "Poor Omen at ", NO_OMEN = "No Omen"; diff --git a/src/main/java/bomb/modules/ab/battleship/Battleship.java b/src/main/java/bomb/modules/ab/battleship/Battleship.java index a135af8c..fb8a4560 100644 --- a/src/main/java/bomb/modules/ab/battleship/Battleship.java +++ b/src/main/java/bomb/modules/ab/battleship/Battleship.java @@ -1,7 +1,7 @@ package bomb.modules.ab.battleship; import bomb.Widget; -import bomb.annotation.Puzzle; +import bomb.annotation.DisplayComponent; import org.jetbrains.annotations.NotNull; import java.util.ArrayList; @@ -22,7 +22,7 @@ import static bomb.tools.string.StringFormat.INDEX_ZERO_LOWERCASE_LETTER; import static java.util.Arrays.stream; -@Puzzle(resource = "battleship.fxml", buttonLinkerName = "Battleship") +@DisplayComponent(resource = "battleship.fxml", buttonLinkerName = "Battleship") public final class Battleship extends Widget { private static Ocean ocean; private static int[] rowCounters, columnCounters; diff --git a/src/main/java/bomb/modules/ab/bitwise/Bitwise.java b/src/main/java/bomb/modules/ab/bitwise/Bitwise.java index bc72adc1..4c014d5d 100644 --- a/src/main/java/bomb/modules/ab/bitwise/Bitwise.java +++ b/src/main/java/bomb/modules/ab/bitwise/Bitwise.java @@ -1,7 +1,7 @@ package bomb.modules.ab.bitwise; import bomb.Widget; -import bomb.annotation.Puzzle; +import bomb.annotation.DisplayComponent; import bomb.tools.logic.LogicOperator; import org.jetbrains.annotations.NotNull; @@ -18,7 +18,7 @@ * number line with a specific boolean operator that the Defuser reads to the expert. The class evaluates * which bits will be 1 or 0 in the byte line. */ -@Puzzle(resource = "bitwise.fxml", buttonLinkerName = "Bitwise Ops") +@DisplayComponent(resource = "bitwise.fxml", buttonLinkerName = "Bitwise Ops") public final class Bitwise extends Widget { /** * Turns the edgework conditions into a byte that the Defuser will input into the bomb module diff --git a/src/main/java/bomb/modules/ab/blind_alley/BlindAlley.java b/src/main/java/bomb/modules/ab/blind_alley/BlindAlley.java index 6b2b97fa..ab5185c9 100644 --- a/src/main/java/bomb/modules/ab/blind_alley/BlindAlley.java +++ b/src/main/java/bomb/modules/ab/blind_alley/BlindAlley.java @@ -1,7 +1,7 @@ package bomb.modules.ab.blind_alley; import bomb.Widget; -import bomb.annotation.Puzzle; +import bomb.annotation.DisplayComponent; import static bomb.enumerations.Indicator.BOB; import static bomb.enumerations.Indicator.CAR; @@ -28,7 +28,7 @@ * the 'Blind Alley' tab pane. Blind Alley in a widget-dependant module that require you to press * specific sections of the module based on the indicators, LED's, ports and batteries are on the bomb. */ -@Puzzle(resource = "blind_alley.fxml", buttonLinkerName = "Blind Alley") +@DisplayComponent(resource = "blind_alley.fxml", buttonLinkerName = "Blind Alley") public final class BlindAlley extends Widget { private static int[][] alleyCat = new int[3][3]; diff --git a/src/main/java/bomb/modules/ab/boolean_venn/BooleanVenn.java b/src/main/java/bomb/modules/ab/boolean_venn/BooleanVenn.java index 82204bb2..68360ea9 100644 --- a/src/main/java/bomb/modules/ab/boolean_venn/BooleanVenn.java +++ b/src/main/java/bomb/modules/ab/boolean_venn/BooleanVenn.java @@ -1,7 +1,7 @@ package bomb.modules.ab.boolean_venn; import bomb.Widget; -import bomb.annotation.Puzzle; +import bomb.annotation.DisplayComponent; import bomb.tools.logic.LogicOperator; import org.intellij.lang.annotations.Language; import org.jetbrains.annotations.NotNull; @@ -17,7 +17,7 @@ * The concept is based on the basics of Discrete Mathematics and uses basic boolean operators * to determine the state of each section of the triple venn diagram, green being true and red for false. */ -@Puzzle(resource = "boolean_venn_diagram.fxml", buttonLinkerName = "Boolean Venn Diagram") +@DisplayComponent(resource = "boolean_venn_diagram.fxml", buttonLinkerName = "Boolean Venn Diagram") public final class BooleanVenn extends Widget { private static final boolean[][] TEST_CASES; private static final byte A = 0, B = 1, C = 2; diff --git a/src/main/java/bomb/modules/c/caesar/Caesar.java b/src/main/java/bomb/modules/c/caesar/Caesar.java index 856a36fd..65b32703 100644 --- a/src/main/java/bomb/modules/c/caesar/Caesar.java +++ b/src/main/java/bomb/modules/c/caesar/Caesar.java @@ -1,7 +1,7 @@ package bomb.modules.c.caesar; import bomb.Widget; -import bomb.annotation.Puzzle; +import bomb.annotation.DisplayComponent; import org.jetbrains.annotations.NotNull; import java.util.stream.IntStream; @@ -10,7 +10,7 @@ import static bomb.enumerations.Indicator.NSA; import static bomb.enumerations.Port.PARALLEL; -@Puzzle(resource = "caesar.fxml", buttonLinkerName = "Caesar Cipher") +@DisplayComponent(resource = "caesar.fxml", buttonLinkerName = "Caesar Cipher") public final class Caesar extends Widget { private static final int MAX_LETTER_COUNT = 26; diff --git a/src/main/java/bomb/modules/c/cheap_checkout/CheapCheckout.java b/src/main/java/bomb/modules/c/cheap_checkout/CheapCheckout.java index c32fa65a..2fb655dd 100644 --- a/src/main/java/bomb/modules/c/cheap_checkout/CheapCheckout.java +++ b/src/main/java/bomb/modules/c/cheap_checkout/CheapCheckout.java @@ -1,7 +1,7 @@ package bomb.modules.c.cheap_checkout; import bomb.Widget; -import bomb.annotation.Puzzle; +import bomb.annotation.DisplayComponent; import org.jetbrains.annotations.NotNull; import java.time.DayOfWeek; @@ -13,7 +13,7 @@ import static bomb.tools.number.MathUtils.digitalRoot; import static bomb.tools.number.MathUtils.roundToNPlaces; -@Puzzle(resource = "cheap_checkout.fxml", buttonLinkerName = "Cheap Checkout") +@DisplayComponent(resource = "cheap_checkout.fxml", buttonLinkerName = "Cheap Checkout") public final class CheapCheckout extends Widget { private static final double SUNDAY_ADDITION, THURSDAY_SALE, FRIDAY_MARK_UP, SATURDAY_SALE; private static final int REQUIRED_ITEM_COUNT, REQUIRED_WEIGHT_COUNT; diff --git a/src/main/java/bomb/modules/c/chess/Chess.java b/src/main/java/bomb/modules/c/chess/Chess.java index fe121579..600bf369 100644 --- a/src/main/java/bomb/modules/c/chess/Chess.java +++ b/src/main/java/bomb/modules/c/chess/Chess.java @@ -1,7 +1,7 @@ package bomb.modules.c.chess; import bomb.Widget; -import bomb.annotation.Puzzle; +import bomb.annotation.DisplayComponent; import bomb.modules.s.souvenir.Souvenir; import bomb.tools.Coordinates; import org.intellij.lang.annotations.Language; @@ -22,7 +22,7 @@ import static java.util.Arrays.asList; import static java.util.stream.Collectors.toUnmodifiableSet; -@Puzzle(resource = "chess.fxml", buttonLinkerName = "Chess") +@DisplayComponent(resource = "chess.fxml", buttonLinkerName = "Chess") public final class Chess extends Widget { @Language("regexp") public static final String VALIDITY_PATTERN; diff --git a/src/main/java/bomb/modules/c/chords/ChordQualities.java b/src/main/java/bomb/modules/c/chords/ChordQualities.java index 719b5211..bc271d43 100644 --- a/src/main/java/bomb/modules/c/chords/ChordQualities.java +++ b/src/main/java/bomb/modules/c/chords/ChordQualities.java @@ -1,7 +1,7 @@ package bomb.modules.c.chords; import bomb.Widget; -import bomb.annotation.Puzzle; +import bomb.annotation.DisplayComponent; import bomb.modules.s.souvenir.Souvenir; import bomb.tools.data.structures.ring.ArrayRing; import org.jetbrains.annotations.NotNull; @@ -9,7 +9,7 @@ import java.util.Set; import java.util.TreeSet; -@Puzzle(resource = "chord_qualities.fxml", buttonLinkerName = "Chord Qualities") +@DisplayComponent(resource = "chord_qualities.fxml", buttonLinkerName = "Chord Qualities") public final class ChordQualities extends Widget { public static final String NEW_CHORD; diff --git a/src/main/java/bomb/modules/c/color_flash/ColorFlash.java b/src/main/java/bomb/modules/c/color_flash/ColorFlash.java index ddd3d9f4..125c7274 100644 --- a/src/main/java/bomb/modules/c/color_flash/ColorFlash.java +++ b/src/main/java/bomb/modules/c/color_flash/ColorFlash.java @@ -1,7 +1,7 @@ package bomb.modules.c.color_flash; import bomb.Widget; -import bomb.annotation.Puzzle; +import bomb.annotation.DisplayComponent; import org.javatuples.Pair; import org.jetbrains.annotations.NotNull; @@ -18,7 +18,7 @@ /** * */ -@Puzzle(resource = "color_flash.fxml", buttonLinkerName = "Color Flash") +@DisplayComponent(resource = "color_flash.fxml", buttonLinkerName = "Color Flash") public final class ColorFlash extends Widget { private static final int COMBO_LIMIT; diff --git a/src/main/java/bomb/modules/c/colored_switches/ColoredSwitches.java b/src/main/java/bomb/modules/c/colored_switches/ColoredSwitches.java index f8ee6b87..5f89e243 100644 --- a/src/main/java/bomb/modules/c/colored_switches/ColoredSwitches.java +++ b/src/main/java/bomb/modules/c/colored_switches/ColoredSwitches.java @@ -1,6 +1,6 @@ package bomb.modules.c.colored_switches; -import bomb.annotation.Puzzle; +import bomb.annotation.DisplayComponent; import bomb.modules.s.switches.Switches; import org.javatuples.Pair; import org.jetbrains.annotations.NotNull; @@ -15,7 +15,7 @@ import static bomb.modules.c.colored_switches.SwitchColor.NEUTRAL; -@Puzzle(resource = "colored_switches.fxml", buttonLinkerName = "Colored Switches") +@DisplayComponent(resource = "colored_switches.fxml", buttonLinkerName = "Colored Switches") public final class ColoredSwitches extends Switches { private static final double WRONG_PATH_VALUE; private static final Graph INTERNAL_GRAPH; diff --git a/src/main/java/bomb/modules/dh/emoji/EmojiMath.java b/src/main/java/bomb/modules/dh/emoji/EmojiMath.java index 077ad4f0..b1dae289 100644 --- a/src/main/java/bomb/modules/dh/emoji/EmojiMath.java +++ b/src/main/java/bomb/modules/dh/emoji/EmojiMath.java @@ -1,7 +1,7 @@ package bomb.modules.dh.emoji; import bomb.Widget; -import bomb.annotation.Puzzle; +import bomb.annotation.DisplayComponent; import bomb.tools.filter.Regex; import org.intellij.lang.annotations.Language; import org.jetbrains.annotations.NotNull; @@ -12,7 +12,7 @@ * This class deals with the Emoji Math module. * It's simple math, but replacing numbers with text emojis. */ -@Puzzle(resource = "emoji_math.fxml", buttonLinkerName = "Emoji Math") +@DisplayComponent(resource = "emoji_math.fxml", buttonLinkerName = "Emoji Math") public final class EmojiMath extends Widget { @Language("regexp") private static final String EMOJI_PATTERN, VALIDATION_PATTERN; diff --git a/src/main/java/bomb/modules/dh/fast_math/FastMath.java b/src/main/java/bomb/modules/dh/fast_math/FastMath.java index d563ca61..04659058 100644 --- a/src/main/java/bomb/modules/dh/fast_math/FastMath.java +++ b/src/main/java/bomb/modules/dh/fast_math/FastMath.java @@ -1,7 +1,7 @@ package bomb.modules.dh.fast_math; import bomb.Widget; -import bomb.annotation.Puzzle; +import bomb.annotation.DisplayComponent; import bomb.tools.filter.Regex; import org.jetbrains.annotations.NotNull; @@ -10,7 +10,7 @@ import static bomb.enumerations.Port.SERIAL; import static bomb.tools.filter.RegexFilter.EMPTY_FILTER_RESULTS; -@Puzzle(resource = "fast_math.fxml", buttonLinkerName = "Fast Math") +@DisplayComponent(resource = "fast_math.fxml", buttonLinkerName = "Fast Math") public final class FastMath extends Widget { private static final int[][] INTERNAL_GRID; diff --git a/src/main/java/bomb/modules/dh/fizzbuzz/FizzBuzz.java b/src/main/java/bomb/modules/dh/fizzbuzz/FizzBuzz.java index c32ad276..49b0d5f9 100644 --- a/src/main/java/bomb/modules/dh/fizzbuzz/FizzBuzz.java +++ b/src/main/java/bomb/modules/dh/fizzbuzz/FizzBuzz.java @@ -1,7 +1,7 @@ package bomb.modules.dh.fizzbuzz; import bomb.Widget; -import bomb.annotation.Puzzle; +import bomb.annotation.DisplayComponent; import bomb.enumerations.Port; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Range; @@ -9,7 +9,7 @@ import java.util.ArrayList; import java.util.List; -@Puzzle(resource = "fizzbuzz.fxml", buttonLinkerName = "FizzBuzz") +@DisplayComponent(resource = "fizzbuzz.fxml", buttonLinkerName = "FizzBuzz") public final class FizzBuzz extends Widget { public static @NotNull String solve(@NotNull String numberText, @NotNull FizzBuzzColor color, @Range(from=0, to=2) int strikeCount) throws IllegalArgumentException { diff --git a/src/main/java/bomb/modules/dh/forget_me/ForgetMeNot.java b/src/main/java/bomb/modules/dh/forget_me/ForgetMeNot.java index 39fd4128..f872d473 100644 --- a/src/main/java/bomb/modules/dh/forget_me/ForgetMeNot.java +++ b/src/main/java/bomb/modules/dh/forget_me/ForgetMeNot.java @@ -1,7 +1,7 @@ package bomb.modules.dh.forget_me; import bomb.Widget; -import bomb.annotation.Puzzle; +import bomb.annotation.DisplayComponent; import bomb.tools.filter.Regex; import bomb.tools.filter.RegexFilter; import org.jetbrains.annotations.NotNull; @@ -15,7 +15,7 @@ import static bomb.enumerations.Indicator.CAR; import static bomb.enumerations.Port.SERIAL; -@Puzzle(resource = "forget_me_not.fxml", buttonLinkerName = "Forget Me Not") +@DisplayComponent(resource = "forget_me_not.fxml", buttonLinkerName = "Forget Me Not") public final class ForgetMeNot extends Widget { private static final IntUnaryOperator LEAST_SIG_DIGIT, MOST_SIG_DIGIT; private static final List FINAL_CODE; diff --git a/src/main/java/bomb/modules/dh/hexamaze/Hexamaze.java b/src/main/java/bomb/modules/dh/hexamaze/Hexamaze.java index 5cb83465..4429587c 100644 --- a/src/main/java/bomb/modules/dh/hexamaze/Hexamaze.java +++ b/src/main/java/bomb/modules/dh/hexamaze/Hexamaze.java @@ -1,7 +1,7 @@ package bomb.modules.dh.hexamaze; import bomb.Widget; -import bomb.annotation.Puzzle; +import bomb.annotation.DisplayComponent; import bomb.modules.dh.hexamaze.hexalgorithm.maze_finding.MazeSearch; import bomb.modules.dh.hexamaze.hexalgorithm.pathfinding.ExitChecker; import bomb.modules.dh.hexamaze.hexalgorithm.pathfinding.MazeRunner; @@ -28,7 +28,7 @@ import static javafx.scene.paint.Color.RED; import static javafx.scene.paint.Color.YELLOW; -@Puzzle(resource = "hexamaze.fxml", buttonLinkerName = "Hexamaze") +@DisplayComponent(resource = "hexamaze.fxml", buttonLinkerName = "Hexamaze") public final class Hexamaze extends Widget { public static final Map COLOR_MAP; public static final Color PEG_COLOR; diff --git a/src/main/java/bomb/modules/il/ice_cream/IceCream.java b/src/main/java/bomb/modules/il/ice_cream/IceCream.java index d29af04b..0a9264df 100644 --- a/src/main/java/bomb/modules/il/ice_cream/IceCream.java +++ b/src/main/java/bomb/modules/il/ice_cream/IceCream.java @@ -1,7 +1,7 @@ package bomb.modules.il.ice_cream; import bomb.Widget; -import bomb.annotation.Puzzle; +import bomb.annotation.DisplayComponent; import org.jetbrains.annotations.NotNull; import java.util.EnumMap; @@ -21,7 +21,7 @@ import static bomb.modules.il.ice_cream.Flavor.TUTTI_FRUTTI; import static bomb.modules.il.ice_cream.Flavor.VANILLA; -@Puzzle(resource = "ice_cream.fxml", buttonLinkerName = "Ice Cream") +@DisplayComponent(resource = "ice_cream.fxml", buttonLinkerName = "Ice Cream") public final class IceCream extends Widget { public static @NotNull Flavor findFlavor(@NotNull Person person, @NotNull EnumSet possibleFlavors, boolean hasEmptyPortPlate) diff --git a/src/main/java/bomb/modules/il/laundry/Laundry.java b/src/main/java/bomb/modules/il/laundry/Laundry.java index 71aa0230..79cad1b1 100644 --- a/src/main/java/bomb/modules/il/laundry/Laundry.java +++ b/src/main/java/bomb/modules/il/laundry/Laundry.java @@ -1,7 +1,7 @@ package bomb.modules.il.laundry; import bomb.Widget; -import bomb.annotation.Puzzle; +import bomb.annotation.DisplayComponent; import org.jetbrains.annotations.NotNull; import java.util.Set; @@ -39,7 +39,7 @@ * item, material, and color. These will lead to the instructions for washing, drying, ironing, * and dry cleaning your clothing. */ -@Puzzle(resource = "laundry.fxml", buttonLinkerName = "Laundry") +@DisplayComponent(resource = "laundry.fxml", buttonLinkerName = "Laundry") public final class Laundry extends Widget { public static final String THANKS_BOB = "Thanks, Bob! :)"; diff --git a/src/main/java/bomb/modules/il/led_encryption/LEDEncryption.java b/src/main/java/bomb/modules/il/led_encryption/LEDEncryption.java index 922b5d7f..42dd15d5 100644 --- a/src/main/java/bomb/modules/il/led_encryption/LEDEncryption.java +++ b/src/main/java/bomb/modules/il/led_encryption/LEDEncryption.java @@ -1,8 +1,8 @@ package bomb.modules.il.led_encryption; import bomb.Widget; -import bomb.annotation.Puzzle; +import bomb.annotation.DisplayComponent; -@Puzzle(resource = "led_encryption.fxml", buttonLinkerName = "LED Encryption") +@DisplayComponent(resource = "led_encryption.fxml", buttonLinkerName = "LED Encryption") public final class LEDEncryption extends Widget { } diff --git a/src/main/java/bomb/modules/il/logic/Logic.java b/src/main/java/bomb/modules/il/logic/Logic.java index e3dc5a6a..cfe0147d 100644 --- a/src/main/java/bomb/modules/il/logic/Logic.java +++ b/src/main/java/bomb/modules/il/logic/Logic.java @@ -1,7 +1,7 @@ package bomb.modules.il.logic; import bomb.Widget; -import bomb.annotation.Puzzle; +import bomb.annotation.DisplayComponent; import bomb.tools.logic.LogicOperator; import org.jetbrains.annotations.NotNull; @@ -13,7 +13,7 @@ import static bomb.tools.logic.LogicOperator.IMPLIES; import static java.util.Arrays.asList; -@Puzzle(resource = "logic.fxml", buttonLinkerName = "Logic") +@DisplayComponent(resource = "logic.fxml", buttonLinkerName = "Logic") public final class Logic extends Widget { public static boolean solve(@NotNull LetterRecord @NotNull[] letters, @NotNull LogicOperator @NotNull[] intermediateOperators, diff --git a/src/main/java/bomb/modules/m/microcontroller/MicroController.java b/src/main/java/bomb/modules/m/microcontroller/MicroController.java index c6a19cf4..1e2efdcc 100644 --- a/src/main/java/bomb/modules/m/microcontroller/MicroController.java +++ b/src/main/java/bomb/modules/m/microcontroller/MicroController.java @@ -1,7 +1,7 @@ package bomb.modules.m.microcontroller; import bomb.Widget; -import bomb.annotation.Puzzle; +import bomb.annotation.DisplayComponent; import bomb.modules.m.microcontroller.chip.AbstractController; import bomb.tools.filter.Regex; import javafx.scene.paint.Color; @@ -13,7 +13,7 @@ import static bomb.enumerations.Port.RJ45; import static bomb.tools.filter.RegexFilter.filter; -@Puzzle(resource = "microcontroller.fxml", buttonLinkerName = "MicroController") +@DisplayComponent(resource = "microcontroller.fxml", buttonLinkerName = "MicroController") public final class MicroController extends Widget { public static @NotNull List getPinColors(@NotNull String moduleSerialNumbers, @NotNull AbstractController controller) diff --git a/src/main/java/bomb/modules/m/monsplode/MonslopeFight.java b/src/main/java/bomb/modules/m/monsplode/MonslopeFight.java index c142b8ca..e435ce64 100644 --- a/src/main/java/bomb/modules/m/monsplode/MonslopeFight.java +++ b/src/main/java/bomb/modules/m/monsplode/MonslopeFight.java @@ -1,8 +1,8 @@ package bomb.modules.m.monsplode; import bomb.Widget; -import bomb.annotation.Puzzle; +import bomb.annotation.DisplayComponent; -@Puzzle(resource = "monsplode_fight.fxml", buttonLinkerName = "Monslope Fight") +@DisplayComponent(resource = "monsplode_fight.fxml", buttonLinkerName = "Monslope Fight") public final class MonslopeFight extends Widget { } diff --git a/src/main/java/bomb/modules/m/morsematics/Morsematics.java b/src/main/java/bomb/modules/m/morsematics/Morsematics.java index e0b0d22f..42e262bb 100644 --- a/src/main/java/bomb/modules/m/morsematics/Morsematics.java +++ b/src/main/java/bomb/modules/m/morsematics/Morsematics.java @@ -1,7 +1,7 @@ package bomb.modules.m.morsematics; import bomb.Widget; -import bomb.annotation.Puzzle; +import bomb.annotation.DisplayComponent; import bomb.enumerations.Indicator; import bomb.tools.data.structures.graph.list.ListGraph; import bomb.tools.data.structures.ring.ArrayRing; @@ -21,7 +21,7 @@ import static bomb.Widget.IndicatorFilter.UNLIT; import static bomb.tools.number.MathUtils.isPerfectSquare; -@Puzzle(resource = "morsematics.fxml", buttonLinkerName = "Morsematics") +@DisplayComponent(resource = "morsematics.fxml", buttonLinkerName = "Morsematics") public final class Morsematics extends Widget { public static @NotNull String solve(@NotNull LinkedHashSet inputSet) throws IllegalArgumentException { checkSerialCode(); diff --git a/src/main/java/bomb/modules/m/murder/Murder.java b/src/main/java/bomb/modules/m/murder/Murder.java index 90fe2af3..0b24cc43 100644 --- a/src/main/java/bomb/modules/m/murder/Murder.java +++ b/src/main/java/bomb/modules/m/murder/Murder.java @@ -1,7 +1,7 @@ package bomb.modules.m.murder; import bomb.Widget; -import bomb.annotation.Puzzle; +import bomb.annotation.DisplayComponent; import org.javatuples.Pair; import org.javatuples.Triplet; import org.jetbrains.annotations.NotNull; @@ -27,7 +27,7 @@ import static java.util.stream.Collectors.joining; import static java.util.stream.Collectors.toMap; -@Puzzle(resource = "murder.fxml", buttonLinkerName = "Murder") +@DisplayComponent(resource = "murder.fxml", buttonLinkerName = "Murder") public final class Murder extends Widget { public static @NotNull String solve(@NotNull Location bodyFoundRoom, @NotNull EnumSet possibleWeapons, @NotNull EnumSet possibleSuspects) throws IllegalStateException { diff --git a/src/main/java/bomb/modules/np/neutralization/Neutralization.java b/src/main/java/bomb/modules/np/neutralization/Neutralization.java index e3235c49..ff424341 100644 --- a/src/main/java/bomb/modules/np/neutralization/Neutralization.java +++ b/src/main/java/bomb/modules/np/neutralization/Neutralization.java @@ -1,7 +1,7 @@ package bomb.modules.np.neutralization; import bomb.Widget; -import bomb.annotation.Puzzle; +import bomb.annotation.DisplayComponent; import bomb.modules.np.neutralization.Chemical.Acid; import bomb.modules.np.neutralization.Chemical.Base; import bomb.modules.s.souvenir.Souvenir; @@ -39,7 +39,7 @@ * acid there is in the test tube. The Expert must then find the base that will titrate the acid with a specific * drop count and determine if the titration needs a filter or not. */ -@Puzzle(resource = "neutralization.fxml", buttonLinkerName = "Neutralization") +@DisplayComponent(resource = "neutralization.fxml", buttonLinkerName = "Neutralization") public final class Neutralization extends Widget { public static final String NO_FILTER_TEXT, FILTER_TEXT; diff --git a/src/main/java/bomb/modules/np/number_pad/NumberPad.java b/src/main/java/bomb/modules/np/number_pad/NumberPad.java index 8d2e51ea..f32f1599 100644 --- a/src/main/java/bomb/modules/np/number_pad/NumberPad.java +++ b/src/main/java/bomb/modules/np/number_pad/NumberPad.java @@ -1,9 +1,9 @@ package bomb.modules.np.number_pad; import bomb.Widget; -import bomb.annotation.Puzzle; +import bomb.annotation.DisplayComponent; -@Puzzle(resource = "number_pad.fxml", buttonLinkerName = "Number Pad") +@DisplayComponent(resource = "number_pad.fxml", buttonLinkerName = "Number Pad") public final class NumberPad extends Widget { } diff --git a/src/main/java/bomb/modules/r/round_keypads/RoundKeypads.java b/src/main/java/bomb/modules/r/round_keypads/RoundKeypads.java index bf7a3de3..ba9be1e1 100644 --- a/src/main/java/bomb/modules/r/round_keypads/RoundKeypads.java +++ b/src/main/java/bomb/modules/r/round_keypads/RoundKeypads.java @@ -2,7 +2,7 @@ import bomb.Widget; import bomb.abstractions.Flaggable; -import bomb.annotation.Puzzle; +import bomb.annotation.DisplayComponent; import javafx.scene.image.Image; import javafx.scene.image.WritableImage; import javafx.scene.paint.Color; @@ -17,7 +17,7 @@ import static java.util.stream.Collectors.counting; import static java.util.stream.Collectors.groupingBy; -@Puzzle(resource = "round_keypads.fxml", buttonLinkerName = "Round Keypads") +@DisplayComponent(resource = "round_keypads.fxml", buttonLinkerName = "Round Keypads") public final class RoundKeypads extends Widget { private static final int IMAGES_PER_COLUMN = 7; private static final UnaryOperator HIGHLIGHT_COMMAND; diff --git a/src/main/java/bomb/modules/s/seashells/Seashells.java b/src/main/java/bomb/modules/s/seashells/Seashells.java index f4028019..9999e2f1 100644 --- a/src/main/java/bomb/modules/s/seashells/Seashells.java +++ b/src/main/java/bomb/modules/s/seashells/Seashells.java @@ -1,8 +1,8 @@ package bomb.modules.s.seashells; import bomb.Widget; -import bomb.annotation.Puzzle; +import bomb.annotation.DisplayComponent; -@Puzzle(resource = "seashells.fxml", buttonLinkerName = "Seashells") +@DisplayComponent(resource = "seashells.fxml", buttonLinkerName = "Seashells") public final class Seashells extends Widget { } diff --git a/src/main/java/bomb/modules/s/semaphore/Semaphore.java b/src/main/java/bomb/modules/s/semaphore/Semaphore.java index 36878cb5..b0071c55 100644 --- a/src/main/java/bomb/modules/s/semaphore/Semaphore.java +++ b/src/main/java/bomb/modules/s/semaphore/Semaphore.java @@ -1,8 +1,8 @@ package bomb.modules.s.semaphore; import bomb.Widget; -import bomb.annotation.Puzzle; +import bomb.annotation.DisplayComponent; -@Puzzle(resource = "semaphore.fxml", buttonLinkerName = "Semaphore") +@DisplayComponent(resource = "semaphore.fxml", buttonLinkerName = "Semaphore") public final class Semaphore extends Widget { } diff --git a/src/main/java/bomb/modules/s/shape_shift/ShapeShift.java b/src/main/java/bomb/modules/s/shape_shift/ShapeShift.java index ab34d64b..6888ac41 100644 --- a/src/main/java/bomb/modules/s/shape_shift/ShapeShift.java +++ b/src/main/java/bomb/modules/s/shape_shift/ShapeShift.java @@ -1,7 +1,7 @@ package bomb.modules.s.shape_shift; import bomb.Widget; -import bomb.annotation.Puzzle; +import bomb.annotation.DisplayComponent; import bomb.tools.data.structures.graph.list.ListGraph; import org.javatuples.Pair; import org.jetbrains.annotations.NotNull; @@ -24,7 +24,7 @@ import static bomb.modules.s.shape_shift.ShapeEnd.SHAPE_END_ARRAY; import static bomb.tools.logic.BitConverter.TO_INT; -@Puzzle(resource = "shape_shift.fxml", buttonLinkerName = "Shape Shift") +@DisplayComponent(resource = "shape_shift.fxml", buttonLinkerName = "Shape Shift") public final class ShapeShift extends Widget { private static final int[][] COUNT_TRACKER; diff --git a/src/main/java/bomb/modules/s/simon/screams/SimonScreams.java b/src/main/java/bomb/modules/s/simon/screams/SimonScreams.java index 51119ab5..32c187d5 100644 --- a/src/main/java/bomb/modules/s/simon/screams/SimonScreams.java +++ b/src/main/java/bomb/modules/s/simon/screams/SimonScreams.java @@ -1,7 +1,7 @@ package bomb.modules.s.simon.screams; import bomb.Widget; -import bomb.annotation.Puzzle; +import bomb.annotation.DisplayComponent; import bomb.modules.s.simon.SimonColors.ScreamColor; import org.jetbrains.annotations.NotNull; @@ -10,7 +10,7 @@ import static java.util.stream.Collectors.joining; -@Puzzle(resource = "simon_screams.fxml", buttonLinkerName = "Simon Screams") +@DisplayComponent(resource = "simon_screams.fxml", buttonLinkerName = "Simon Screams") public final class SimonScreams extends Widget { private static final int MAX_OUTPUT_RULES; private static final List CURRENT_OUTPUT_NUMBERS; diff --git a/src/main/java/bomb/modules/s/simon/states/SimonStates.java b/src/main/java/bomb/modules/s/simon/states/SimonStates.java index 7773b649..ad3bff67 100644 --- a/src/main/java/bomb/modules/s/simon/states/SimonStates.java +++ b/src/main/java/bomb/modules/s/simon/states/SimonStates.java @@ -1,7 +1,7 @@ package bomb.modules.s.simon.states; import bomb.Widget; -import bomb.annotation.Puzzle; +import bomb.annotation.DisplayComponent; import bomb.modules.s.simon.SimonColors.StateColor; import bomb.modules.s.souvenir.Souvenir; import org.jetbrains.annotations.NotNull; @@ -23,7 +23,7 @@ import static java.util.Collections.reverse; import static java.util.stream.Collectors.joining; -@Puzzle(resource = "simon_states.fxml", buttonLinkerName = "Simon States") +@DisplayComponent(resource = "simon_states.fxml", buttonLinkerName = "Simon States") public final class SimonStates extends Widget { private static final int HIGH = 1, LOW = 2, LOWEST = 3; private static final List PRESSED_COLOR_HISTORY; diff --git a/src/main/java/bomb/modules/s/souvenir/Souvenir.java b/src/main/java/bomb/modules/s/souvenir/Souvenir.java index 709bf139..67d1af2a 100644 --- a/src/main/java/bomb/modules/s/souvenir/Souvenir.java +++ b/src/main/java/bomb/modules/s/souvenir/Souvenir.java @@ -1,7 +1,7 @@ package bomb.modules.s.souvenir; import bomb.Widget; -import bomb.annotation.Puzzle; +import bomb.annotation.DisplayComponent; import org.javatuples.Pair; import org.jetbrains.annotations.NotNull; @@ -9,7 +9,7 @@ import java.util.List; import java.util.Map; -@Puzzle(resource = "souvenir.fxml", buttonLinkerName = "Souvenir") +@DisplayComponent(resource = "souvenir.fxml", buttonLinkerName = "Souvenir") public final class Souvenir extends Widget { private static final Map MODULE_ARTIFACTS; diff --git a/src/main/java/bomb/modules/s/square/SquareButton.java b/src/main/java/bomb/modules/s/square/SquareButton.java index fb6638cc..9c4da954 100644 --- a/src/main/java/bomb/modules/s/square/SquareButton.java +++ b/src/main/java/bomb/modules/s/square/SquareButton.java @@ -1,7 +1,7 @@ package bomb.modules.s.square; import bomb.Widget; -import bomb.annotation.Puzzle; +import bomb.annotation.DisplayComponent; import bomb.tools.number.MathUtils; import org.jetbrains.annotations.NotNull; @@ -23,7 +23,7 @@ import static java.util.Arrays.asList; import static java.util.stream.Collectors.joining; -@Puzzle(resource = "square_button.fxml", buttonLinkerName = "Square Button") +@DisplayComponent(resource = "square_button.fxml", buttonLinkerName = "Square Button") public final class SquareButton extends Widget { //Button colors public static final int BLUE, YELLOW, DARK_GRAY, WHITE; diff --git a/src/main/java/bomb/modules/s/switches/Switches.java b/src/main/java/bomb/modules/s/switches/Switches.java index a8842557..ed566d95 100644 --- a/src/main/java/bomb/modules/s/switches/Switches.java +++ b/src/main/java/bomb/modules/s/switches/Switches.java @@ -1,7 +1,7 @@ package bomb.modules.s.switches; import bomb.Widget; -import bomb.annotation.Puzzle; +import bomb.annotation.DisplayComponent; import bomb.modules.c.colored_switches.ColoredSwitches; import org.jetbrains.annotations.NotNull; @@ -15,7 +15,7 @@ import static java.util.Arrays.asList; -@Puzzle(resource = "switches.fxml", buttonLinkerName = "Switches") +@DisplayComponent(resource = "switches.fxml", buttonLinkerName = "Switches") public sealed class Switches extends Widget permits ColoredSwitches { protected static final byte BIT_LENGTH = 5; private static final Set FORBIDDEN_MOVES; diff --git a/src/main/java/bomb/modules/t/bulb/TheBulb.java b/src/main/java/bomb/modules/t/bulb/TheBulb.java index e9b51e69..929e75ed 100644 --- a/src/main/java/bomb/modules/t/bulb/TheBulb.java +++ b/src/main/java/bomb/modules/t/bulb/TheBulb.java @@ -1,7 +1,7 @@ package bomb.modules.t.bulb; import bomb.Widget; -import bomb.annotation.Puzzle; +import bomb.annotation.DisplayComponent; import bomb.enumerations.Indicator; import bomb.modules.s.souvenir.Souvenir; import bomb.tools.filter.Regex; @@ -34,7 +34,7 @@ import static bomb.modules.t.bulb.Bulb.Position.SCREWED; import static bomb.modules.t.bulb.Bulb.Position.UNSCREWED; -@Puzzle(resource = "the_bulb.fxml", buttonLinkerName = "The Bulb") +@DisplayComponent(resource = "the_bulb.fxml", buttonLinkerName = "The Bulb") public final class TheBulb extends Widget { public static final String PRESS_I, PRESS_O, SCREW, UNSCREW; diff --git a/src/main/java/bomb/modules/t/three_d_maze/ThreeDMaze.java b/src/main/java/bomb/modules/t/three_d_maze/ThreeDMaze.java index 3a47c793..9432fdff 100644 --- a/src/main/java/bomb/modules/t/three_d_maze/ThreeDMaze.java +++ b/src/main/java/bomb/modules/t/three_d_maze/ThreeDMaze.java @@ -1,7 +1,7 @@ package bomb.modules.t.three_d_maze; -import bomb.annotation.Puzzle; +import bomb.annotation.DisplayComponent; -@Puzzle(resource = "3d_maze.fxml", buttonLinkerName = "3D Maze") +@DisplayComponent(resource = "3d_maze.fxml", buttonLinkerName = "3D Maze") public class ThreeDMaze { } diff --git a/src/main/java/bomb/modules/t/two_bit/TwoBit.java b/src/main/java/bomb/modules/t/two_bit/TwoBit.java index 3cb997df..529047f7 100644 --- a/src/main/java/bomb/modules/t/two_bit/TwoBit.java +++ b/src/main/java/bomb/modules/t/two_bit/TwoBit.java @@ -1,7 +1,7 @@ package bomb.modules.t.two_bit; import bomb.Widget; -import bomb.annotation.Puzzle; +import bomb.annotation.DisplayComponent; import bomb.modules.s.souvenir.Souvenir; import org.jetbrains.annotations.NotNull; @@ -18,7 +18,7 @@ /** * */ -@Puzzle(resource = "two_bit.fxml", buttonLinkerName = "Two Bit") +@DisplayComponent(resource = "two_bit.fxml", buttonLinkerName = "Two Bit") public final class TwoBit extends Widget { public static final String QUERY_TEXT, SUBMIT_TEXT; diff --git a/src/main/java/bomb/modules/wz/word_search/WordSearch.java b/src/main/java/bomb/modules/wz/word_search/WordSearch.java index 53152aff..fd95859e 100644 --- a/src/main/java/bomb/modules/wz/word_search/WordSearch.java +++ b/src/main/java/bomb/modules/wz/word_search/WordSearch.java @@ -1,7 +1,7 @@ package bomb.modules.wz.word_search; import bomb.Widget; -import bomb.annotation.Puzzle; +import bomb.annotation.DisplayComponent; import org.jetbrains.annotations.NotNull; import java.io.BufferedReader; @@ -15,7 +15,7 @@ import static java.util.stream.Collectors.toUnmodifiableMap; @SuppressWarnings("ConstantConditions") -@Puzzle(resource = "word_search.fxml", buttonLinkerName = "Word Search") +@DisplayComponent(resource = "word_search.fxml", buttonLinkerName = "Word Search") public final class WordSearch extends Widget { private static final int ARRAY_SIZE; private static final String FILENAME; diff --git a/src/main/java/bomb/modules/wz/zoo/Zoo.java b/src/main/java/bomb/modules/wz/zoo/Zoo.java index 44e6d70d..e6cf1972 100644 --- a/src/main/java/bomb/modules/wz/zoo/Zoo.java +++ b/src/main/java/bomb/modules/wz/zoo/Zoo.java @@ -1,8 +1,8 @@ package bomb.modules.wz.zoo; import bomb.Widget; -import bomb.annotation.Puzzle; +import bomb.annotation.DisplayComponent; -@Puzzle(resource = "zoo.fxml", buttonLinkerName = "Zoo") +@DisplayComponent(resource = "zoo.fxml", buttonLinkerName = "Zoo") public final class Zoo extends Widget { } diff --git a/src/main/java/bomb/tools/note/NoteController.java b/src/main/java/bomb/tools/note/NoteController.java index bf6787e4..920a81b6 100644 --- a/src/main/java/bomb/tools/note/NoteController.java +++ b/src/main/java/bomb/tools/note/NoteController.java @@ -1,6 +1,7 @@ package bomb.tools.note; import bomb.abstractions.Resettable; +import bomb.annotation.DisplayComponent; import bomb.tools.pattern.facade.FacadeFX; import com.jfoenix.controls.JFXTextArea; import javafx.fxml.FXML; @@ -9,6 +10,7 @@ import java.util.ArrayList; import java.util.List; +@DisplayComponent(resource = "extra_notes.fxml", buttonLinkerName = "Extra Notes") public class NoteController implements Resettable { @FXML private JFXTextArea firstNote, secondNote, thirdNote, fourthNote, fifthNote; diff --git a/src/main/resources/bomb/empty_view.fxml b/src/main/resources/bomb/empty_view.fxml new file mode 100644 index 00000000..26b60c58 --- /dev/null +++ b/src/main/resources/bomb/empty_view.fxml @@ -0,0 +1,13 @@ + + + + + + + + + + + diff --git a/src/main/resources/bomb/modules/ab/adjacent/adjacent_letters.fxml b/src/main/resources/bomb/modules/ab/adjacent/adjacent_letters.fxml new file mode 100644 index 00000000..26b60c58 --- /dev/null +++ b/src/main/resources/bomb/modules/ab/adjacent/adjacent_letters.fxml @@ -0,0 +1,13 @@ + + + + + + + + + + + diff --git a/src/main/resources/bomb/modules/ab/alphabet/alphabet.fxml b/src/main/resources/bomb/modules/ab/alphabet/alphabet.fxml new file mode 100644 index 00000000..16572816 --- /dev/null +++ b/src/main/resources/bomb/modules/ab/alphabet/alphabet.fxml @@ -0,0 +1,77 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/main/resources/bomb/modules/ab/astrology/astrology.fxml b/src/main/resources/bomb/modules/ab/astrology/astrology.fxml new file mode 100644 index 00000000..a5a9fcd7 --- /dev/null +++ b/src/main/resources/bomb/modules/ab/astrology/astrology.fxml @@ -0,0 +1,289 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/main/resources/bomb/modules/ab/battleship/battleship.fxml b/src/main/resources/bomb/modules/ab/battleship/battleship.fxml new file mode 100644 index 00000000..26b60c58 --- /dev/null +++ b/src/main/resources/bomb/modules/ab/battleship/battleship.fxml @@ -0,0 +1,13 @@ + + + + + + + + + + + diff --git a/src/main/resources/bomb/modules/ab/bitwise/bitwise_ops.fxml b/src/main/resources/bomb/modules/ab/bitwise/bitwise_ops.fxml new file mode 100644 index 00000000..2d0706e3 --- /dev/null +++ b/src/main/resources/bomb/modules/ab/bitwise/bitwise_ops.fxml @@ -0,0 +1,43 @@ + + + + + + + + + +

+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + diff --git a/src/main/resources/bomb/modules/ab/blind_alley/blind_alley.fxml b/src/main/resources/bomb/modules/ab/blind_alley/blind_alley.fxml new file mode 100644 index 00000000..4da5c87f --- /dev/null +++ b/src/main/resources/bomb/modules/ab/blind_alley/blind_alley.fxml @@ -0,0 +1,86 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/main/resources/bomb/modules/ab/boolean_venn/boolean_venn_diagram.fxml b/src/main/resources/bomb/modules/ab/boolean_venn/boolean_venn_diagram.fxml new file mode 100644 index 00000000..6b89b2ee --- /dev/null +++ b/src/main/resources/bomb/modules/ab/boolean_venn/boolean_venn_diagram.fxml @@ -0,0 +1,125 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/main/resources/bomb/tools/note/extra_notes.fxml b/src/main/resources/bomb/tools/note/extra_notes.fxml new file mode 100644 index 00000000..cadd716e --- /dev/null +++ b/src/main/resources/bomb/tools/note/extra_notes.fxml @@ -0,0 +1,31 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + From ca2e9ece9facaa24747b1a013c5834975001fd62 Mon Sep 17 00:00:00 2001 From: "Mr. J" <45538844+Ultraviolet-Ninja@users.noreply.github.com> Date: Sun, 18 Dec 2022 19:40:18 -0600 Subject: [PATCH 66/86] Restructured the project packages to exclude as many underscores as possible --- .../junit-tests/OldShapeShiftTest.java | 10 +- .../old_code/junit-tests/OldTwoBitTest.java | 6 +- src/main/java/bomb/ManualController.java | 10 +- src/main/java/bomb/TestingArea.java | 12 --- src/main/java/bomb/Widget.java | 30 +++--- .../alley}/BlindAlley.java | 2 +- .../alley}/BlindAlleyController.java | 2 +- .../venn/diagram}/BooleanController.java | 2 +- .../venn/diagram}/BooleanVenn.java | 2 +- .../checkout}/CheapCheckout.java | 6 +- .../checkout}/CheapController.java | 2 +- .../checkout}/CheckoutItem.java | 22 ++--- .../flash}/ColorFlash.java | 10 +- .../flash}/ColorFlashColor.java | 2 +- .../flash}/ColorFlashController.java | 2 +- .../switches}/ColoredSwitchController.java | 16 ++-- .../switches}/ColoredSwitchGraphFactory.java | 2 +- .../switches}/ColoredSwitchNode.java | 2 +- .../switches}/ColoredSwitches.java | 4 +- .../switches}/SwitchColor.java | 2 +- .../math}/FastController.java | 2 +- .../dh/{fast_math => fast/math}/FastMath.java | 2 +- .../me/not}/ForgetMeNot.java | 2 +- .../me/not}/ForgetMeNotController.java | 2 +- .../il/{ice_cream => ice/cream}/Allergen.java | 2 +- .../il/{ice_cream => ice/cream}/Flavor.java | 20 ++-- .../il/{ice_cream => ice/cream}/IceCream.java | 22 ++--- .../cream}/IceCreamController.java | 2 +- .../il/{ice_cream => ice/cream}/Person.java | 2 +- .../encryption}/LEDEncryptController.java | 2 +- .../encryption}/LEDEncryption.java | 2 +- .../{number_pad => number/pad}/NumberPad.java | 2 +- .../pad}/NumberPadController.java | 2 +- .../keypads}/Keypad.java | 2 +- .../keypads}/RoundKeypads.java | 4 +- .../keypads}/RoundKeypadsController.java | 88 +++++++++--------- .../shift}/ShapeEnd.java | 2 +- .../shift}/ShapeShift.java | 4 +- .../shift}/ShapeShiftController.java | 4 +- .../s/square/{ => button}/SquareButton.java | 2 +- .../{ => button}/SquareButtonController.java | 2 +- .../bomb/modules/s/switches/Switches.java | 2 +- .../bomb/modules/t/{ => the}/bulb/Bulb.java | 2 +- .../modules/t/{ => the}/bulb/TheBulb.java | 74 ++++++--------- .../t/{ => the}/bulb/TheBulbController.java | 24 ++--- .../d/maze}/ThreeDMaze.java | 2 +- .../d/maze}/ThreeDMazeController.java | 2 +- .../t/{two_bit => two/bit}/TwoBit.java | 6 +- .../bit}/TwoBitController.java | 2 +- .../t/{two_bit => two/bit}/TwoBitState.java | 2 +- .../search}/WordFinder.java | 2 +- .../search}/WordSearch.java | 2 +- .../observer/BlindAlleyPaneObserver.java | 2 +- .../observer/SouvenirToggleObserver.java | 1 - src/main/java/module-info.java | 35 ++++--- .../resources/bomb/fxml/ab/blind_alley.fxml | 2 +- .../bomb/fxml/ab/boolean_venn_diagram.fxml | 2 +- .../bomb/fxml/c/colored_switches.fxml | 2 +- .../resources/bomb/fxml/dh/fast_math.fxml | 2 +- .../resources/bomb/fxml/forget_me_not.fxml | 2 +- .../resources/bomb/fxml/r/round_keypads.fxml | 86 ++++++++--------- .../resources/bomb/fxml/s/shape_shift.fxml | 2 +- src/main/resources/bomb/fxml/t/3d_maze.fxml | 2 +- src/main/resources/bomb/fxml/t/the_bulb.fxml | 2 +- src/main/resources/bomb/fxml/t/two_bit.fxml | 2 +- .../{ => letters}/adjacent_letters.fxml | 0 .../bomb/modules/ab/bitwise/bitwise_ops.fxml | 1 + .../alley}/blind_alley.fxml | 4 +- .../venn/diagram}/boolean_venn_diagram.fxml | 4 +- .../switches}/graph.csv | 0 .../{ice_cream => ice/cream}/allergyTable.csv | 0 .../{round_keypads => round/keypads}/A_T.PNG | Bin .../keypads}/Alien 3.PNG | Bin .../keypads}/BackwardsC.PNG | Bin .../r/{round_keypads => round/keypads}/C.PNG | Bin .../keypads}/Copyright.PNG | Bin .../keypads}/Curvy H.PNG | Bin .../keypads}/Disney Q.PNG | Bin .../keypads}/Empty Racket.PNG | Bin .../keypads}/Harry Potter.PNG | Bin .../keypads}/Hollow Star.PNG | Bin .../keypads}/Lambda.PNG | Bin .../{round_keypads => round/keypads}/Not3.PNG | Bin .../keypads}/Omega.PNG | Bin .../keypads}/Paragraph.PNG | Bin .../{round_keypads => round/keypads}/Psi.PNG | Bin .../keypads}/Puzzle.PNG | Bin .../keypads}/Reverse Euro.PNG | Bin .../keypads}/Russian 6.PNG | Bin .../keypads}/Russian Cat.PNG | Bin .../keypads}/Russian NH.PNG | Bin .../keypads}/Russian X.PNG | Bin .../{round_keypads => round/keypads}/Sac.PNG | Bin .../keypads}/Smily.PNG | Bin .../keypads}/Spanish Question.PNG | Bin .../{round_keypads => round/keypads}/Star.PNG | Bin .../r/{round_keypads => round/keypads}/Tb.PNG | Bin .../r/{round_keypads => round/keypads}/ae.PNG | Bin .../wz/{word_search => word/search}/words.txt | 0 .../alley}/BlindAlleyTest.java | 2 +- .../venn/diagram}/BooleanVennTest.java | 2 +- .../checkout}/CheapCheckoutTest.java | 26 +++--- .../checkout}/CheckoutItemTest.java | 30 +++--- .../switches}/ColoredSwitchNodeEqTest.java | 2 +- .../switches}/ColoredSwitchesTest.java | 12 +-- .../math}/FastMathTest.java | 2 +- .../me/not}/ForgetMeNotTest.java | 2 +- .../cream}/IceCreamTest.java | 38 ++++---- .../keypads}/RoundKeypadTest.java | 14 +-- .../shift}/ShapeShiftTest.java | 10 +- .../square/{ => button}/SquareButtonTest.java | 16 ++-- .../modules/t/{ => the}/bulb/TheBulbTest.java | 32 +++---- .../t/{two_bit => two/bit}/TwoBitTest.java | 6 +- .../search}/WordFinderTest.java | 2 +- .../search}/WordSearchTest.java | 2 +- src/test/resources/suites/suiteFive.xml | 4 +- src/test/resources/suites/suiteFour.xml | 8 +- src/test/resources/suites/suiteOne.xml | 12 +-- src/test/resources/suites/suiteThree.xml | 2 +- src/test/resources/suites/suiteTwo.xml | 6 +- 120 files changed, 401 insertions(+), 418 deletions(-) rename src/main/java/bomb/modules/ab/{blind_alley => blind/alley}/BlindAlley.java (99%) rename src/main/java/bomb/modules/ab/{blind_alley => blind/alley}/BlindAlleyController.java (98%) rename src/main/java/bomb/modules/ab/{boolean_venn => bool/venn/diagram}/BooleanController.java (99%) rename src/main/java/bomb/modules/ab/{boolean_venn => bool/venn/diagram}/BooleanVenn.java (99%) rename src/main/java/bomb/modules/c/{cheap_checkout => cheap/checkout}/CheapCheckout.java (97%) rename src/main/java/bomb/modules/c/{cheap_checkout => cheap/checkout}/CheapController.java (78%) rename src/main/java/bomb/modules/c/{cheap_checkout => cheap/checkout}/CheckoutItem.java (80%) rename src/main/java/bomb/modules/c/{color_flash => color/flash}/ColorFlash.java (94%) rename src/main/java/bomb/modules/c/{color_flash => color/flash}/ColorFlashColor.java (68%) rename src/main/java/bomb/modules/c/{color_flash => color/flash}/ColorFlashController.java (80%) rename src/main/java/bomb/modules/c/{colored_switches => colored/switches}/ColoredSwitchController.java (94%) rename src/main/java/bomb/modules/c/{colored_switches => colored/switches}/ColoredSwitchGraphFactory.java (98%) rename src/main/java/bomb/modules/c/{colored_switches => colored/switches}/ColoredSwitchNode.java (96%) rename src/main/java/bomb/modules/c/{colored_switches => colored/switches}/ColoredSwitches.java (98%) rename src/main/java/bomb/modules/c/{colored_switches => colored/switches}/SwitchColor.java (92%) rename src/main/java/bomb/modules/dh/{fast_math => fast/math}/FastController.java (98%) rename src/main/java/bomb/modules/dh/{fast_math => fast/math}/FastMath.java (99%) rename src/main/java/bomb/modules/dh/{forget_me => forget/me/not}/ForgetMeNot.java (99%) rename src/main/java/bomb/modules/dh/{forget_me => forget/me/not}/ForgetMeNotController.java (98%) rename src/main/java/bomb/modules/il/{ice_cream => ice/cream}/Allergen.java (96%) rename src/main/java/bomb/modules/il/{ice_cream => ice/cream}/Flavor.java (59%) rename src/main/java/bomb/modules/il/{ice_cream => ice/cream}/IceCream.java (84%) rename src/main/java/bomb/modules/il/{ice_cream => ice/cream}/IceCreamController.java (80%) rename src/main/java/bomb/modules/il/{ice_cream => ice/cream}/Person.java (97%) rename src/main/java/bomb/modules/il/{led_encryption => led/encryption}/LEDEncryptController.java (78%) rename src/main/java/bomb/modules/il/{led_encryption => led/encryption}/LEDEncryption.java (83%) rename src/main/java/bomb/modules/np/{number_pad => number/pad}/NumberPad.java (84%) rename src/main/java/bomb/modules/np/{number_pad => number/pad}/NumberPadController.java (80%) rename src/main/java/bomb/modules/r/{round_keypads => round/keypads}/Keypad.java (96%) rename src/main/java/bomb/modules/r/{round_keypads => round/keypads}/RoundKeypads.java (96%) rename src/main/java/bomb/modules/r/{round_keypads => round/keypads}/RoundKeypadsController.java (69%) rename src/main/java/bomb/modules/s/{shape_shift => shape/shift}/ShapeEnd.java (81%) rename src/main/java/bomb/modules/s/{shape_shift => shape/shift}/ShapeShift.java (98%) rename src/main/java/bomb/modules/s/{shape_shift => shape/shift}/ShapeShiftController.java (87%) rename src/main/java/bomb/modules/s/square/{ => button}/SquareButton.java (99%) rename src/main/java/bomb/modules/s/square/{ => button}/SquareButtonController.java (79%) rename src/main/java/bomb/modules/t/{ => the}/bulb/Bulb.java (96%) rename src/main/java/bomb/modules/t/{ => the}/bulb/TheBulb.java (84%) rename src/main/java/bomb/modules/t/{ => the}/bulb/TheBulbController.java (78%) rename src/main/java/bomb/modules/t/{three_d_maze => three/d/maze}/ThreeDMaze.java (79%) rename src/main/java/bomb/modules/t/{three_d_maze => three/d/maze}/ThreeDMazeController.java (79%) rename src/main/java/bomb/modules/t/{two_bit => two/bit}/TwoBit.java (96%) rename src/main/java/bomb/modules/t/{two_bit => two/bit}/TwoBitController.java (98%) rename src/main/java/bomb/modules/t/{two_bit => two/bit}/TwoBitState.java (93%) rename src/main/java/bomb/modules/wz/{word_search => word/search}/WordFinder.java (98%) rename src/main/java/bomb/modules/wz/{word_search => word/search}/WordSearch.java (98%) rename src/main/resources/bomb/modules/ab/adjacent/{ => letters}/adjacent_letters.fxml (100%) rename src/main/resources/bomb/modules/ab/{blind_alley => blind/alley}/blind_alley.fxml (96%) rename src/main/resources/bomb/modules/ab/{boolean_venn => bool/venn/diagram}/boolean_venn_diagram.fxml (97%) rename src/main/resources/bomb/modules/c/{colored_switches => colored/switches}/graph.csv (100%) rename src/main/resources/bomb/modules/il/{ice_cream => ice/cream}/allergyTable.csv (100%) rename src/main/resources/bomb/modules/r/{round_keypads => round/keypads}/A_T.PNG (100%) rename src/main/resources/bomb/modules/r/{round_keypads => round/keypads}/Alien 3.PNG (100%) rename src/main/resources/bomb/modules/r/{round_keypads => round/keypads}/BackwardsC.PNG (100%) rename src/main/resources/bomb/modules/r/{round_keypads => round/keypads}/C.PNG (100%) rename src/main/resources/bomb/modules/r/{round_keypads => round/keypads}/Copyright.PNG (100%) rename src/main/resources/bomb/modules/r/{round_keypads => round/keypads}/Curvy H.PNG (100%) rename src/main/resources/bomb/modules/r/{round_keypads => round/keypads}/Disney Q.PNG (100%) rename src/main/resources/bomb/modules/r/{round_keypads => round/keypads}/Empty Racket.PNG (100%) rename src/main/resources/bomb/modules/r/{round_keypads => round/keypads}/Harry Potter.PNG (100%) rename src/main/resources/bomb/modules/r/{round_keypads => round/keypads}/Hollow Star.PNG (100%) rename src/main/resources/bomb/modules/r/{round_keypads => round/keypads}/Lambda.PNG (100%) rename src/main/resources/bomb/modules/r/{round_keypads => round/keypads}/Not3.PNG (100%) rename src/main/resources/bomb/modules/r/{round_keypads => round/keypads}/Omega.PNG (100%) rename src/main/resources/bomb/modules/r/{round_keypads => round/keypads}/Paragraph.PNG (100%) rename src/main/resources/bomb/modules/r/{round_keypads => round/keypads}/Psi.PNG (100%) rename src/main/resources/bomb/modules/r/{round_keypads => round/keypads}/Puzzle.PNG (100%) rename src/main/resources/bomb/modules/r/{round_keypads => round/keypads}/Reverse Euro.PNG (100%) rename src/main/resources/bomb/modules/r/{round_keypads => round/keypads}/Russian 6.PNG (100%) rename src/main/resources/bomb/modules/r/{round_keypads => round/keypads}/Russian Cat.PNG (100%) rename src/main/resources/bomb/modules/r/{round_keypads => round/keypads}/Russian NH.PNG (100%) rename src/main/resources/bomb/modules/r/{round_keypads => round/keypads}/Russian X.PNG (100%) rename src/main/resources/bomb/modules/r/{round_keypads => round/keypads}/Sac.PNG (100%) rename src/main/resources/bomb/modules/r/{round_keypads => round/keypads}/Smily.PNG (100%) rename src/main/resources/bomb/modules/r/{round_keypads => round/keypads}/Spanish Question.PNG (100%) rename src/main/resources/bomb/modules/r/{round_keypads => round/keypads}/Star.PNG (100%) rename src/main/resources/bomb/modules/r/{round_keypads => round/keypads}/Tb.PNG (100%) rename src/main/resources/bomb/modules/r/{round_keypads => round/keypads}/ae.PNG (100%) rename src/main/resources/bomb/modules/wz/{word_search => word/search}/words.txt (100%) rename src/test/java/bomb/modules/ab/{blind_alley => blind/alley}/BlindAlleyTest.java (98%) rename src/test/java/bomb/modules/ab/{boolean_venn => bool/venn/diagram}/BooleanVennTest.java (97%) rename src/test/java/bomb/modules/c/{cheap_checkout => cheap/checkout}/CheapCheckoutTest.java (81%) rename src/test/java/bomb/modules/c/{cheap_checkout => cheap/checkout}/CheckoutItemTest.java (54%) rename src/test/java/bomb/modules/c/{colored_switches => colored/switches}/ColoredSwitchNodeEqTest.java (91%) rename src/test/java/bomb/modules/c/{colored_switches => colored/switches}/ColoredSwitchesTest.java (84%) rename src/test/java/bomb/modules/dh/{fast_math => fast/math}/FastMathTest.java (98%) rename src/test/java/bomb/modules/dh/{forget_me => forget/me/not}/ForgetMeNotTest.java (99%) rename src/test/java/bomb/modules/il/{ice_cream => ice/cream}/IceCreamTest.java (83%) rename src/test/java/bomb/modules/r/{round_keypads => round/keypads}/RoundKeypadTest.java (75%) rename src/test/java/bomb/modules/s/{shape_shift => shape/shift}/ShapeShiftTest.java (91%) rename src/test/java/bomb/modules/s/square/{ => button}/SquareButtonTest.java (91%) rename src/test/java/bomb/modules/t/{ => the}/bulb/TheBulbTest.java (85%) rename src/test/java/bomb/modules/t/{two_bit => two/bit}/TwoBitTest.java (93%) rename src/test/java/bomb/modules/wz/{word_search => word/search}/WordFinderTest.java (98%) rename src/test/java/bomb/modules/wz/{word_search => word/search}/WordSearchTest.java (98%) diff --git a/documentation/journals/old_code/junit-tests/OldShapeShiftTest.java b/documentation/journals/old_code/junit-tests/OldShapeShiftTest.java index 05da739b..c675ea74 100644 --- a/documentation/journals/old_code/junit-tests/OldShapeShiftTest.java +++ b/documentation/journals/old_code/junit-tests/OldShapeShiftTest.java @@ -1,4 +1,4 @@ -package bomb.modules.s.shape_shift; +package bomb.modules.s.shape; import bomb.Widget; import bomb.WidgetSimulations; @@ -8,10 +8,10 @@ import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static bomb.modules.s.shape_shift.ShapeEnd.FLAT; -import static bomb.modules.s.shape_shift.ShapeEnd.POINT; -import static bomb.modules.s.shape_shift.ShapeEnd.ROUND; -import static bomb.modules.s.shape_shift.ShapeEnd.TICKET; +import static bomb.modules.s.shape.ShapeEnd.FLAT; +import static bomb.modules.s.shape.ShapeEnd.POINT; +import static bomb.modules.s.shape.ShapeEnd.ROUND; +import static bomb.modules.s.shape.ShapeEnd.TICKET; import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertFalse; diff --git a/documentation/journals/old_code/junit-tests/OldTwoBitTest.java b/documentation/journals/old_code/junit-tests/OldTwoBitTest.java index 8ef8e0af..c4382752 100644 --- a/documentation/journals/old_code/junit-tests/OldTwoBitTest.java +++ b/documentation/journals/old_code/junit-tests/OldTwoBitTest.java @@ -1,4 +1,4 @@ -package bomb.modules.t.two_bit; +package bomb.modules.t.two; import bomb.Widget; import bomb.WidgetSimulations; @@ -6,8 +6,8 @@ import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static bomb.modules.t.two_bit.TwoBit.QUERY; -import static bomb.modules.t.two_bit.TwoBit.SUBMIT; +import static bomb.modules.t.two.TwoBit.QUERY; +import static bomb.modules.t.two.TwoBit.SUBMIT; import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertThrows; diff --git a/src/main/java/bomb/ManualController.java b/src/main/java/bomb/ManualController.java index 67703604..67a8a24c 100644 --- a/src/main/java/bomb/ManualController.java +++ b/src/main/java/bomb/ManualController.java @@ -1,7 +1,7 @@ package bomb; import bomb.annotation.DisplayComponent; -import bomb.modules.ab.blind_alley.BlindAlleyController; +import bomb.modules.ab.blind.alley.BlindAlleyController; import bomb.modules.s.souvenir.SouvenirController; import bomb.tools.filter.Regex; import bomb.tools.note.NoteController; @@ -92,6 +92,7 @@ public void initialize() throws ExecutionException, InterruptedException { ); ObserverHub.addObserver(FORGET_ME_NOT_TOGGLE, new ForgetMeNotToggleObserver(forgetMeNot)); ObserverHub.addObserver(SOUVENIR_TOGGLE, new SouvenirToggleObserver(souvenir)); + long start = System.nanoTime(); regionMap = setupRegionMap().get(); long stop = System.nanoTime(); @@ -99,8 +100,7 @@ public void initialize() throws ExecutionException, InterruptedException { } private CompletableFuture> setupRegionMap() throws ExecutionException, InterruptedException { - CompletableFuture> radioButtonNameFuture = - createRadioButtonNameFuture(options.getToggles()); + var radioButtonNameFuture = createRadioButtonNameFuture(options.getToggles()); createFXMLMap(); // var fxmlMapFuture = supplyAsync(ManualController::createFXMLMap); @@ -119,7 +119,9 @@ private static CompletableFuture> createRadioButtonNameFutur .replaceAll("[ -]", "_") .replaceAll("[()']", "") .toLowerCase(), - identity() + identity(), + (x, y) -> y, + LinkedHashMap::new ))); } diff --git a/src/main/java/bomb/TestingArea.java b/src/main/java/bomb/TestingArea.java index c7e88df0..08599a7c 100644 --- a/src/main/java/bomb/TestingArea.java +++ b/src/main/java/bomb/TestingArea.java @@ -7,17 +7,5 @@ public static void main(String[] args) { Regex labelFilter = new Regex("\"([^\"]*)\",?"); Regex frequencyFilter = new Regex("frequencies\\.put\\(\"([^\"]+)\", (\\d\\.\\d{1,3})\\);"); Regex whoMapFilter = new Regex("stepTwoMap\\.put\\(\"([^\"]+)\", \"([^\"]+)\"\\);"); - - method(Widget.class); - } - - public static void method(Class cls) { - System.out.println(cls); - var subClasses = cls.getPermittedSubclasses(); - if (subClasses != null) { - for (Class cl : subClasses) { - method(cl); - } - } } } \ No newline at end of file diff --git a/src/main/java/bomb/Widget.java b/src/main/java/bomb/Widget.java index 349d072c..e25d9de4 100644 --- a/src/main/java/bomb/Widget.java +++ b/src/main/java/bomb/Widget.java @@ -6,44 +6,44 @@ import bomb.modules.ab.alphabet.Alphabet; import bomb.modules.ab.astrology.Astrology; import bomb.modules.ab.battleship.Battleship; -import bomb.modules.ab.blind_alley.BlindAlley; +import bomb.modules.ab.blind.alley.BlindAlley; import bomb.modules.ab.bitwise.Bitwise; -import bomb.modules.ab.boolean_venn.BooleanVenn; +import bomb.modules.ab.bool.venn.diagram.BooleanVenn; import bomb.modules.c.caesar.Caesar; -import bomb.modules.c.cheap_checkout.CheapCheckout; +import bomb.modules.c.cheap.checkout.CheapCheckout; import bomb.modules.c.chess.Chess; import bomb.modules.c.chords.ChordQualities; -import bomb.modules.c.color_flash.ColorFlash; +import bomb.modules.c.color.flash.ColorFlash; import bomb.modules.dh.emoji.EmojiMath; -import bomb.modules.dh.fast_math.FastMath; +import bomb.modules.dh.fast.math.FastMath; import bomb.modules.dh.fizzbuzz.FizzBuzz; -import bomb.modules.dh.forget_me.ForgetMeNot; +import bomb.modules.dh.forget.me.not.ForgetMeNot; import bomb.modules.dh.hexamaze.Hexamaze; -import bomb.modules.il.ice_cream.IceCream; +import bomb.modules.il.ice.cream.IceCream; import bomb.modules.il.laundry.Laundry; -import bomb.modules.il.led_encryption.LEDEncryption; +import bomb.modules.il.led.encryption.LEDEncryption; import bomb.modules.il.logic.Logic; import bomb.modules.m.microcontroller.MicroController; import bomb.modules.m.monsplode.MonslopeFight; import bomb.modules.m.morsematics.Morsematics; import bomb.modules.m.murder.Murder; import bomb.modules.np.neutralization.Neutralization; -import bomb.modules.np.number_pad.NumberPad; -import bomb.modules.r.round_keypads.RoundKeypads; +import bomb.modules.np.number.pad.NumberPad; +import bomb.modules.r.round.keypads.RoundKeypads; import bomb.modules.s.seashells.Seashells; import bomb.modules.s.semaphore.Semaphore; -import bomb.modules.s.shape_shift.ShapeShift; +import bomb.modules.s.shape.shift.ShapeShift; import bomb.modules.s.simon.screams.SimonScreams; import bomb.modules.s.simon.states.SimonStates; import bomb.modules.s.souvenir.Souvenir; -import bomb.modules.s.square.SquareButton; +import bomb.modules.s.square.button.SquareButton; import bomb.modules.s.switches.Switches; -import bomb.modules.t.bulb.TheBulb; +import bomb.modules.t.the.bulb.TheBulb; import bomb.modules.t.translated.TranslationCenter; import bomb.modules.t.translated.solutions.button.Button; -import bomb.modules.t.two_bit.TwoBit; -import bomb.modules.wz.word_search.WordSearch; +import bomb.modules.t.two.bit.TwoBit; +import bomb.modules.wz.word.search.WordSearch; import bomb.modules.wz.zoo.Zoo; import org.jetbrains.annotations.NotNull; diff --git a/src/main/java/bomb/modules/ab/blind_alley/BlindAlley.java b/src/main/java/bomb/modules/ab/blind/alley/BlindAlley.java similarity index 99% rename from src/main/java/bomb/modules/ab/blind_alley/BlindAlley.java rename to src/main/java/bomb/modules/ab/blind/alley/BlindAlley.java index ab5185c9..2a6600b0 100644 --- a/src/main/java/bomb/modules/ab/blind_alley/BlindAlley.java +++ b/src/main/java/bomb/modules/ab/blind/alley/BlindAlley.java @@ -1,4 +1,4 @@ -package bomb.modules.ab.blind_alley; +package bomb.modules.ab.blind.alley; import bomb.Widget; import bomb.annotation.DisplayComponent; diff --git a/src/main/java/bomb/modules/ab/blind_alley/BlindAlleyController.java b/src/main/java/bomb/modules/ab/blind/alley/BlindAlleyController.java similarity index 98% rename from src/main/java/bomb/modules/ab/blind_alley/BlindAlleyController.java rename to src/main/java/bomb/modules/ab/blind/alley/BlindAlleyController.java index 5d0b744c..c6a52b25 100644 --- a/src/main/java/bomb/modules/ab/blind_alley/BlindAlleyController.java +++ b/src/main/java/bomb/modules/ab/blind/alley/BlindAlleyController.java @@ -1,4 +1,4 @@ -package bomb.modules.ab.blind_alley; +package bomb.modules.ab.blind.alley; import bomb.abstractions.Resettable; import bomb.tools.pattern.observer.ObserverHub; diff --git a/src/main/java/bomb/modules/ab/boolean_venn/BooleanController.java b/src/main/java/bomb/modules/ab/bool/venn/diagram/BooleanController.java similarity index 99% rename from src/main/java/bomb/modules/ab/boolean_venn/BooleanController.java rename to src/main/java/bomb/modules/ab/bool/venn/diagram/BooleanController.java index 0fef447e..19480c54 100644 --- a/src/main/java/bomb/modules/ab/boolean_venn/BooleanController.java +++ b/src/main/java/bomb/modules/ab/bool/venn/diagram/BooleanController.java @@ -1,4 +1,4 @@ -package bomb.modules.ab.boolean_venn; +package bomb.modules.ab.bool.venn.diagram; import bomb.abstractions.Resettable; import bomb.tools.filter.Regex; diff --git a/src/main/java/bomb/modules/ab/boolean_venn/BooleanVenn.java b/src/main/java/bomb/modules/ab/bool/venn/diagram/BooleanVenn.java similarity index 99% rename from src/main/java/bomb/modules/ab/boolean_venn/BooleanVenn.java rename to src/main/java/bomb/modules/ab/bool/venn/diagram/BooleanVenn.java index 68360ea9..caa9b874 100644 --- a/src/main/java/bomb/modules/ab/boolean_venn/BooleanVenn.java +++ b/src/main/java/bomb/modules/ab/bool/venn/diagram/BooleanVenn.java @@ -1,4 +1,4 @@ -package bomb.modules.ab.boolean_venn; +package bomb.modules.ab.bool.venn.diagram; import bomb.Widget; import bomb.annotation.DisplayComponent; diff --git a/src/main/java/bomb/modules/c/cheap_checkout/CheapCheckout.java b/src/main/java/bomb/modules/c/cheap/checkout/CheapCheckout.java similarity index 97% rename from src/main/java/bomb/modules/c/cheap_checkout/CheapCheckout.java rename to src/main/java/bomb/modules/c/cheap/checkout/CheapCheckout.java index 2fb655dd..46a9912f 100644 --- a/src/main/java/bomb/modules/c/cheap_checkout/CheapCheckout.java +++ b/src/main/java/bomb/modules/c/cheap/checkout/CheapCheckout.java @@ -1,4 +1,4 @@ -package bomb.modules.c.cheap_checkout; +package bomb.modules.c.cheap.checkout; import bomb.Widget; import bomb.annotation.DisplayComponent; @@ -8,8 +8,8 @@ import java.util.List; import java.util.function.ToDoubleFunction; -import static bomb.modules.c.cheap_checkout.CheckoutItem.Category.FRUIT; -import static bomb.modules.c.cheap_checkout.CheckoutItem.Category.SWEET; +import static bomb.modules.c.cheap.checkout.CheckoutItem.Category.FRUIT; +import static bomb.modules.c.cheap.checkout.CheckoutItem.Category.SWEET; import static bomb.tools.number.MathUtils.digitalRoot; import static bomb.tools.number.MathUtils.roundToNPlaces; diff --git a/src/main/java/bomb/modules/c/cheap_checkout/CheapController.java b/src/main/java/bomb/modules/c/cheap/checkout/CheapController.java similarity index 78% rename from src/main/java/bomb/modules/c/cheap_checkout/CheapController.java rename to src/main/java/bomb/modules/c/cheap/checkout/CheapController.java index 210a6065..e3aa683a 100644 --- a/src/main/java/bomb/modules/c/cheap_checkout/CheapController.java +++ b/src/main/java/bomb/modules/c/cheap/checkout/CheapController.java @@ -1,4 +1,4 @@ -package bomb.modules.c.cheap_checkout; +package bomb.modules.c.cheap.checkout; import bomb.abstractions.Resettable; diff --git a/src/main/java/bomb/modules/c/cheap_checkout/CheckoutItem.java b/src/main/java/bomb/modules/c/cheap/checkout/CheckoutItem.java similarity index 80% rename from src/main/java/bomb/modules/c/cheap_checkout/CheckoutItem.java rename to src/main/java/bomb/modules/c/cheap/checkout/CheckoutItem.java index 302953bb..5f89ac03 100644 --- a/src/main/java/bomb/modules/c/cheap_checkout/CheckoutItem.java +++ b/src/main/java/bomb/modules/c/cheap/checkout/CheckoutItem.java @@ -1,4 +1,4 @@ -package bomb.modules.c.cheap_checkout; +package bomb.modules.c.cheap.checkout; import bomb.abstractions.Resettable; import org.jetbrains.annotations.NotNull; @@ -6,16 +6,16 @@ import java.util.List; -import static bomb.modules.c.cheap_checkout.CheckoutItem.Category.CARE; -import static bomb.modules.c.cheap_checkout.CheckoutItem.Category.DAIRY; -import static bomb.modules.c.cheap_checkout.CheckoutItem.Category.FRUIT; -import static bomb.modules.c.cheap_checkout.CheckoutItem.Category.GRAIN; -import static bomb.modules.c.cheap_checkout.CheckoutItem.Category.OIL; -import static bomb.modules.c.cheap_checkout.CheckoutItem.Category.OTHER; -import static bomb.modules.c.cheap_checkout.CheckoutItem.Category.PROTEIN; -import static bomb.modules.c.cheap_checkout.CheckoutItem.Category.SWEET; -import static bomb.modules.c.cheap_checkout.CheckoutItem.Category.VEGETABLE; -import static bomb.modules.c.cheap_checkout.CheckoutItem.Category.WATER; +import static bomb.modules.c.cheap.checkout.CheckoutItem.Category.CARE; +import static bomb.modules.c.cheap.checkout.CheckoutItem.Category.DAIRY; +import static bomb.modules.c.cheap.checkout.CheckoutItem.Category.FRUIT; +import static bomb.modules.c.cheap.checkout.CheckoutItem.Category.GRAIN; +import static bomb.modules.c.cheap.checkout.CheckoutItem.Category.OIL; +import static bomb.modules.c.cheap.checkout.CheckoutItem.Category.OTHER; +import static bomb.modules.c.cheap.checkout.CheckoutItem.Category.PROTEIN; +import static bomb.modules.c.cheap.checkout.CheckoutItem.Category.SWEET; +import static bomb.modules.c.cheap.checkout.CheckoutItem.Category.VEGETABLE; +import static bomb.modules.c.cheap.checkout.CheckoutItem.Category.WATER; public enum CheckoutItem implements Resettable { BANANAS(FRUIT, 0.87), BROCCOLI(VEGETABLE, 1.39), diff --git a/src/main/java/bomb/modules/c/color_flash/ColorFlash.java b/src/main/java/bomb/modules/c/color/flash/ColorFlash.java similarity index 94% rename from src/main/java/bomb/modules/c/color_flash/ColorFlash.java rename to src/main/java/bomb/modules/c/color/flash/ColorFlash.java index 125c7274..3510ac97 100644 --- a/src/main/java/bomb/modules/c/color_flash/ColorFlash.java +++ b/src/main/java/bomb/modules/c/color/flash/ColorFlash.java @@ -1,4 +1,4 @@ -package bomb.modules.c.color_flash; +package bomb.modules.c.color.flash; import bomb.Widget; import bomb.annotation.DisplayComponent; @@ -8,10 +8,10 @@ import java.util.ArrayList; import java.util.List; -import static bomb.modules.c.color_flash.ColorFlashColor.BLUE; -import static bomb.modules.c.color_flash.ColorFlashColor.GREEN; -import static bomb.modules.c.color_flash.ColorFlashColor.RED; -import static bomb.modules.c.color_flash.ColorFlashColor.WHITE; +import static bomb.modules.c.color.flash.ColorFlashColor.BLUE; +import static bomb.modules.c.color.flash.ColorFlashColor.GREEN; +import static bomb.modules.c.color.flash.ColorFlashColor.RED; +import static bomb.modules.c.color.flash.ColorFlashColor.WHITE; import static bomb.tools.string.StringFormat.NO; import static bomb.tools.string.StringFormat.YES; diff --git a/src/main/java/bomb/modules/c/color_flash/ColorFlashColor.java b/src/main/java/bomb/modules/c/color/flash/ColorFlashColor.java similarity index 68% rename from src/main/java/bomb/modules/c/color_flash/ColorFlashColor.java rename to src/main/java/bomb/modules/c/color/flash/ColorFlashColor.java index 687d308c..5d7d2453 100644 --- a/src/main/java/bomb/modules/c/color_flash/ColorFlashColor.java +++ b/src/main/java/bomb/modules/c/color/flash/ColorFlashColor.java @@ -1,4 +1,4 @@ -package bomb.modules.c.color_flash; +package bomb.modules.c.color.flash; public enum ColorFlashColor { RED, YELLOW, GREEN, BLUE, MAGENTA, WHITE diff --git a/src/main/java/bomb/modules/c/color_flash/ColorFlashController.java b/src/main/java/bomb/modules/c/color/flash/ColorFlashController.java similarity index 80% rename from src/main/java/bomb/modules/c/color_flash/ColorFlashController.java rename to src/main/java/bomb/modules/c/color/flash/ColorFlashController.java index f033c504..151513c1 100644 --- a/src/main/java/bomb/modules/c/color_flash/ColorFlashController.java +++ b/src/main/java/bomb/modules/c/color/flash/ColorFlashController.java @@ -1,4 +1,4 @@ -package bomb.modules.c.color_flash; +package bomb.modules.c.color.flash; import bomb.abstractions.Resettable; diff --git a/src/main/java/bomb/modules/c/colored_switches/ColoredSwitchController.java b/src/main/java/bomb/modules/c/colored/switches/ColoredSwitchController.java similarity index 94% rename from src/main/java/bomb/modules/c/colored_switches/ColoredSwitchController.java rename to src/main/java/bomb/modules/c/colored/switches/ColoredSwitchController.java index 2ebacb0a..d9a52e11 100644 --- a/src/main/java/bomb/modules/c/colored_switches/ColoredSwitchController.java +++ b/src/main/java/bomb/modules/c/colored/switches/ColoredSwitchController.java @@ -1,4 +1,4 @@ -package bomb.modules.c.colored_switches; +package bomb.modules.c.colored.switches; import bomb.abstractions.Resettable; import bomb.tools.data.structures.ring.ArrayRing; @@ -16,13 +16,13 @@ import java.util.List; -import static bomb.modules.c.colored_switches.SwitchColor.BLUE; -import static bomb.modules.c.colored_switches.SwitchColor.CYAN; -import static bomb.modules.c.colored_switches.SwitchColor.GREEN; -import static bomb.modules.c.colored_switches.SwitchColor.MAGENTA; -import static bomb.modules.c.colored_switches.SwitchColor.NEUTRAL; -import static bomb.modules.c.colored_switches.SwitchColor.ORANGE; -import static bomb.modules.c.colored_switches.SwitchColor.RED; +import static bomb.modules.c.colored.switches.SwitchColor.BLUE; +import static bomb.modules.c.colored.switches.SwitchColor.CYAN; +import static bomb.modules.c.colored.switches.SwitchColor.GREEN; +import static bomb.modules.c.colored.switches.SwitchColor.MAGENTA; +import static bomb.modules.c.colored.switches.SwitchColor.NEUTRAL; +import static bomb.modules.c.colored.switches.SwitchColor.ORANGE; +import static bomb.modules.c.colored.switches.SwitchColor.RED; import static bomb.tools.string.StringFormat.ARROW; public class ColoredSwitchController implements Resettable { diff --git a/src/main/java/bomb/modules/c/colored_switches/ColoredSwitchGraphFactory.java b/src/main/java/bomb/modules/c/colored/switches/ColoredSwitchGraphFactory.java similarity index 98% rename from src/main/java/bomb/modules/c/colored_switches/ColoredSwitchGraphFactory.java rename to src/main/java/bomb/modules/c/colored/switches/ColoredSwitchGraphFactory.java index 65dc901f..6966789d 100644 --- a/src/main/java/bomb/modules/c/colored_switches/ColoredSwitchGraphFactory.java +++ b/src/main/java/bomb/modules/c/colored/switches/ColoredSwitchGraphFactory.java @@ -1,4 +1,4 @@ -package bomb.modules.c.colored_switches; +package bomb.modules.c.colored.switches; import bomb.tools.filter.Regex; import com.opencsv.CSVReader; diff --git a/src/main/java/bomb/modules/c/colored_switches/ColoredSwitchNode.java b/src/main/java/bomb/modules/c/colored/switches/ColoredSwitchNode.java similarity index 96% rename from src/main/java/bomb/modules/c/colored_switches/ColoredSwitchNode.java rename to src/main/java/bomb/modules/c/colored/switches/ColoredSwitchNode.java index b25b1e90..6d13df6f 100644 --- a/src/main/java/bomb/modules/c/colored_switches/ColoredSwitchNode.java +++ b/src/main/java/bomb/modules/c/colored/switches/ColoredSwitchNode.java @@ -1,4 +1,4 @@ -package bomb.modules.c.colored_switches; +package bomb.modules.c.colored.switches; import org.javatuples.Pair; diff --git a/src/main/java/bomb/modules/c/colored_switches/ColoredSwitches.java b/src/main/java/bomb/modules/c/colored/switches/ColoredSwitches.java similarity index 98% rename from src/main/java/bomb/modules/c/colored_switches/ColoredSwitches.java rename to src/main/java/bomb/modules/c/colored/switches/ColoredSwitches.java index 5f89e243..a3d371f2 100644 --- a/src/main/java/bomb/modules/c/colored_switches/ColoredSwitches.java +++ b/src/main/java/bomb/modules/c/colored/switches/ColoredSwitches.java @@ -1,4 +1,4 @@ -package bomb.modules.c.colored_switches; +package bomb.modules.c.colored.switches; import bomb.annotation.DisplayComponent; import bomb.modules.s.switches.Switches; @@ -13,7 +13,7 @@ import java.util.List; import java.util.function.BiFunction; -import static bomb.modules.c.colored_switches.SwitchColor.NEUTRAL; +import static bomb.modules.c.colored.switches.SwitchColor.NEUTRAL; @DisplayComponent(resource = "colored_switches.fxml", buttonLinkerName = "Colored Switches") public final class ColoredSwitches extends Switches { diff --git a/src/main/java/bomb/modules/c/colored_switches/SwitchColor.java b/src/main/java/bomb/modules/c/colored/switches/SwitchColor.java similarity index 92% rename from src/main/java/bomb/modules/c/colored_switches/SwitchColor.java rename to src/main/java/bomb/modules/c/colored/switches/SwitchColor.java index 0b492975..1bd5f16f 100644 --- a/src/main/java/bomb/modules/c/colored_switches/SwitchColor.java +++ b/src/main/java/bomb/modules/c/colored/switches/SwitchColor.java @@ -1,4 +1,4 @@ -package bomb.modules.c.colored_switches; +package bomb.modules.c.colored.switches; public enum SwitchColor { RED("red-switch"), ORANGE("orange-switch"), GREEN("green-switch"), CYAN("cyan-switch"), diff --git a/src/main/java/bomb/modules/dh/fast_math/FastController.java b/src/main/java/bomb/modules/dh/fast/math/FastController.java similarity index 98% rename from src/main/java/bomb/modules/dh/fast_math/FastController.java rename to src/main/java/bomb/modules/dh/fast/math/FastController.java index a20f4e72..4176d6ba 100644 --- a/src/main/java/bomb/modules/dh/fast_math/FastController.java +++ b/src/main/java/bomb/modules/dh/fast/math/FastController.java @@ -1,4 +1,4 @@ -package bomb.modules.dh.fast_math; +package bomb.modules.dh.fast.math; import bomb.abstractions.Resettable; import bomb.tools.event.HoverHandler; diff --git a/src/main/java/bomb/modules/dh/fast_math/FastMath.java b/src/main/java/bomb/modules/dh/fast/math/FastMath.java similarity index 99% rename from src/main/java/bomb/modules/dh/fast_math/FastMath.java rename to src/main/java/bomb/modules/dh/fast/math/FastMath.java index 04659058..2140c517 100644 --- a/src/main/java/bomb/modules/dh/fast_math/FastMath.java +++ b/src/main/java/bomb/modules/dh/fast/math/FastMath.java @@ -1,4 +1,4 @@ -package bomb.modules.dh.fast_math; +package bomb.modules.dh.fast.math; import bomb.Widget; import bomb.annotation.DisplayComponent; diff --git a/src/main/java/bomb/modules/dh/forget_me/ForgetMeNot.java b/src/main/java/bomb/modules/dh/forget/me/not/ForgetMeNot.java similarity index 99% rename from src/main/java/bomb/modules/dh/forget_me/ForgetMeNot.java rename to src/main/java/bomb/modules/dh/forget/me/not/ForgetMeNot.java index f872d473..fca7a028 100644 --- a/src/main/java/bomb/modules/dh/forget_me/ForgetMeNot.java +++ b/src/main/java/bomb/modules/dh/forget/me/not/ForgetMeNot.java @@ -1,4 +1,4 @@ -package bomb.modules.dh.forget_me; +package bomb.modules.dh.forget.me.not; import bomb.Widget; import bomb.annotation.DisplayComponent; diff --git a/src/main/java/bomb/modules/dh/forget_me/ForgetMeNotController.java b/src/main/java/bomb/modules/dh/forget/me/not/ForgetMeNotController.java similarity index 98% rename from src/main/java/bomb/modules/dh/forget_me/ForgetMeNotController.java rename to src/main/java/bomb/modules/dh/forget/me/not/ForgetMeNotController.java index 70aee980..b06cb7ca 100644 --- a/src/main/java/bomb/modules/dh/forget_me/ForgetMeNotController.java +++ b/src/main/java/bomb/modules/dh/forget/me/not/ForgetMeNotController.java @@ -1,4 +1,4 @@ -package bomb.modules.dh.forget_me; +package bomb.modules.dh.forget.me.not; import bomb.Widget; import bomb.abstractions.Resettable; diff --git a/src/main/java/bomb/modules/il/ice_cream/Allergen.java b/src/main/java/bomb/modules/il/ice/cream/Allergen.java similarity index 96% rename from src/main/java/bomb/modules/il/ice_cream/Allergen.java rename to src/main/java/bomb/modules/il/ice/cream/Allergen.java index 149fb8cd..cff33379 100644 --- a/src/main/java/bomb/modules/il/ice_cream/Allergen.java +++ b/src/main/java/bomb/modules/il/ice/cream/Allergen.java @@ -1,4 +1,4 @@ -package bomb.modules.il.ice_cream; +package bomb.modules.il.ice.cream; import org.jetbrains.annotations.Contract; import org.jetbrains.annotations.NotNull; diff --git a/src/main/java/bomb/modules/il/ice_cream/Flavor.java b/src/main/java/bomb/modules/il/ice/cream/Flavor.java similarity index 59% rename from src/main/java/bomb/modules/il/ice_cream/Flavor.java rename to src/main/java/bomb/modules/il/ice/cream/Flavor.java index 430b826f..ff405bfe 100644 --- a/src/main/java/bomb/modules/il/ice_cream/Flavor.java +++ b/src/main/java/bomb/modules/il/ice/cream/Flavor.java @@ -1,16 +1,16 @@ -package bomb.modules.il.ice_cream; +package bomb.modules.il.ice.cream; import java.util.EnumSet; -import static bomb.modules.il.ice_cream.Allergen.CHERRY; -import static bomb.modules.il.ice_cream.Allergen.CHOCOLATE; -import static bomb.modules.il.ice_cream.Allergen.COOKIES; -import static bomb.modules.il.ice_cream.Allergen.FRUIT; -import static bomb.modules.il.ice_cream.Allergen.MARSHMALLOW; -import static bomb.modules.il.ice_cream.Allergen.MINT; -import static bomb.modules.il.ice_cream.Allergen.NUTS; -import static bomb.modules.il.ice_cream.Allergen.RASPBERRY; -import static bomb.modules.il.ice_cream.Allergen.STRAWBERRY; +import static bomb.modules.il.ice.cream.Allergen.CHERRY; +import static bomb.modules.il.ice.cream.Allergen.CHOCOLATE; +import static bomb.modules.il.ice.cream.Allergen.COOKIES; +import static bomb.modules.il.ice.cream.Allergen.FRUIT; +import static bomb.modules.il.ice.cream.Allergen.MARSHMALLOW; +import static bomb.modules.il.ice.cream.Allergen.MINT; +import static bomb.modules.il.ice.cream.Allergen.NUTS; +import static bomb.modules.il.ice.cream.Allergen.RASPBERRY; +import static bomb.modules.il.ice.cream.Allergen.STRAWBERRY; public enum Flavor { TUTTI_FRUTTI(FRUIT), diff --git a/src/main/java/bomb/modules/il/ice_cream/IceCream.java b/src/main/java/bomb/modules/il/ice/cream/IceCream.java similarity index 84% rename from src/main/java/bomb/modules/il/ice_cream/IceCream.java rename to src/main/java/bomb/modules/il/ice/cream/IceCream.java index 0a9264df..2a227cf7 100644 --- a/src/main/java/bomb/modules/il/ice_cream/IceCream.java +++ b/src/main/java/bomb/modules/il/ice/cream/IceCream.java @@ -1,4 +1,4 @@ -package bomb.modules.il.ice_cream; +package bomb.modules.il.ice.cream; import bomb.Widget; import bomb.annotation.DisplayComponent; @@ -10,16 +10,16 @@ import static bomb.Widget.IndicatorFilter.LIT; import static bomb.Widget.IndicatorFilter.UNLIT; -import static bomb.modules.il.ice_cream.Flavor.COOKIES_N_CREAM; -import static bomb.modules.il.ice_cream.Flavor.DOUBLE_CHOCOLATE; -import static bomb.modules.il.ice_cream.Flavor.DOUBLE_STRAWBERRY; -import static bomb.modules.il.ice_cream.Flavor.MINT_CHIP; -import static bomb.modules.il.ice_cream.Flavor.NEAPOLITAN; -import static bomb.modules.il.ice_cream.Flavor.RASPBERRY_RIPPLE; -import static bomb.modules.il.ice_cream.Flavor.ROCKY_ROAD; -import static bomb.modules.il.ice_cream.Flavor.THE_CLASSIC; -import static bomb.modules.il.ice_cream.Flavor.TUTTI_FRUTTI; -import static bomb.modules.il.ice_cream.Flavor.VANILLA; +import static bomb.modules.il.ice.cream.Flavor.COOKIES_N_CREAM; +import static bomb.modules.il.ice.cream.Flavor.DOUBLE_CHOCOLATE; +import static bomb.modules.il.ice.cream.Flavor.DOUBLE_STRAWBERRY; +import static bomb.modules.il.ice.cream.Flavor.MINT_CHIP; +import static bomb.modules.il.ice.cream.Flavor.NEAPOLITAN; +import static bomb.modules.il.ice.cream.Flavor.RASPBERRY_RIPPLE; +import static bomb.modules.il.ice.cream.Flavor.ROCKY_ROAD; +import static bomb.modules.il.ice.cream.Flavor.THE_CLASSIC; +import static bomb.modules.il.ice.cream.Flavor.TUTTI_FRUTTI; +import static bomb.modules.il.ice.cream.Flavor.VANILLA; @DisplayComponent(resource = "ice_cream.fxml", buttonLinkerName = "Ice Cream") public final class IceCream extends Widget { diff --git a/src/main/java/bomb/modules/il/ice_cream/IceCreamController.java b/src/main/java/bomb/modules/il/ice/cream/IceCreamController.java similarity index 80% rename from src/main/java/bomb/modules/il/ice_cream/IceCreamController.java rename to src/main/java/bomb/modules/il/ice/cream/IceCreamController.java index e17ef585..02129387 100644 --- a/src/main/java/bomb/modules/il/ice_cream/IceCreamController.java +++ b/src/main/java/bomb/modules/il/ice/cream/IceCreamController.java @@ -1,4 +1,4 @@ -package bomb.modules.il.ice_cream; +package bomb.modules.il.ice.cream; import bomb.abstractions.Resettable; diff --git a/src/main/java/bomb/modules/il/ice_cream/Person.java b/src/main/java/bomb/modules/il/ice/cream/Person.java similarity index 97% rename from src/main/java/bomb/modules/il/ice_cream/Person.java rename to src/main/java/bomb/modules/il/ice/cream/Person.java index dd0dd08b..19193f5c 100644 --- a/src/main/java/bomb/modules/il/ice_cream/Person.java +++ b/src/main/java/bomb/modules/il/ice/cream/Person.java @@ -1,4 +1,4 @@ -package bomb.modules.il.ice_cream; +package bomb.modules.il.ice.cream; import com.opencsv.CSVReader; diff --git a/src/main/java/bomb/modules/il/led_encryption/LEDEncryptController.java b/src/main/java/bomb/modules/il/led/encryption/LEDEncryptController.java similarity index 78% rename from src/main/java/bomb/modules/il/led_encryption/LEDEncryptController.java rename to src/main/java/bomb/modules/il/led/encryption/LEDEncryptController.java index 9dcc84ff..1c892dc3 100644 --- a/src/main/java/bomb/modules/il/led_encryption/LEDEncryptController.java +++ b/src/main/java/bomb/modules/il/led/encryption/LEDEncryptController.java @@ -1,4 +1,4 @@ -package bomb.modules.il.led_encryption; +package bomb.modules.il.led.encryption; import bomb.abstractions.Resettable; diff --git a/src/main/java/bomb/modules/il/led_encryption/LEDEncryption.java b/src/main/java/bomb/modules/il/led/encryption/LEDEncryption.java similarity index 83% rename from src/main/java/bomb/modules/il/led_encryption/LEDEncryption.java rename to src/main/java/bomb/modules/il/led/encryption/LEDEncryption.java index 42dd15d5..9a1ec3b4 100644 --- a/src/main/java/bomb/modules/il/led_encryption/LEDEncryption.java +++ b/src/main/java/bomb/modules/il/led/encryption/LEDEncryption.java @@ -1,4 +1,4 @@ -package bomb.modules.il.led_encryption; +package bomb.modules.il.led.encryption; import bomb.Widget; import bomb.annotation.DisplayComponent; diff --git a/src/main/java/bomb/modules/np/number_pad/NumberPad.java b/src/main/java/bomb/modules/np/number/pad/NumberPad.java similarity index 84% rename from src/main/java/bomb/modules/np/number_pad/NumberPad.java rename to src/main/java/bomb/modules/np/number/pad/NumberPad.java index f32f1599..4c4d9abe 100644 --- a/src/main/java/bomb/modules/np/number_pad/NumberPad.java +++ b/src/main/java/bomb/modules/np/number/pad/NumberPad.java @@ -1,4 +1,4 @@ -package bomb.modules.np.number_pad; +package bomb.modules.np.number.pad; import bomb.Widget; import bomb.annotation.DisplayComponent; diff --git a/src/main/java/bomb/modules/np/number_pad/NumberPadController.java b/src/main/java/bomb/modules/np/number/pad/NumberPadController.java similarity index 80% rename from src/main/java/bomb/modules/np/number_pad/NumberPadController.java rename to src/main/java/bomb/modules/np/number/pad/NumberPadController.java index 9d6c9aa3..9e5495b7 100644 --- a/src/main/java/bomb/modules/np/number_pad/NumberPadController.java +++ b/src/main/java/bomb/modules/np/number/pad/NumberPadController.java @@ -1,4 +1,4 @@ -package bomb.modules.np.number_pad; +package bomb.modules.np.number.pad; import bomb.abstractions.Resettable; diff --git a/src/main/java/bomb/modules/r/round_keypads/Keypad.java b/src/main/java/bomb/modules/r/round/keypads/Keypad.java similarity index 96% rename from src/main/java/bomb/modules/r/round_keypads/Keypad.java rename to src/main/java/bomb/modules/r/round/keypads/Keypad.java index 480a2bf2..01e2153b 100644 --- a/src/main/java/bomb/modules/r/round_keypads/Keypad.java +++ b/src/main/java/bomb/modules/r/round/keypads/Keypad.java @@ -1,4 +1,4 @@ -package bomb.modules.r.round_keypads; +package bomb.modules.r.round.keypads; import bomb.abstractions.Flaggable; import javafx.scene.image.Image; diff --git a/src/main/java/bomb/modules/r/round_keypads/RoundKeypads.java b/src/main/java/bomb/modules/r/round/keypads/RoundKeypads.java similarity index 96% rename from src/main/java/bomb/modules/r/round_keypads/RoundKeypads.java rename to src/main/java/bomb/modules/r/round/keypads/RoundKeypads.java index ba9be1e1..13b0f6bf 100644 --- a/src/main/java/bomb/modules/r/round_keypads/RoundKeypads.java +++ b/src/main/java/bomb/modules/r/round/keypads/RoundKeypads.java @@ -1,4 +1,4 @@ -package bomb.modules.r.round_keypads; +package bomb.modules.r.round.keypads; import bomb.Widget; import bomb.abstractions.Flaggable; @@ -11,7 +11,7 @@ import java.util.Map; import java.util.function.UnaryOperator; -import static bomb.modules.r.round_keypads.Keypad.KEYPAD_ARRAY; +import static bomb.modules.r.round.keypads.Keypad.KEYPAD_ARRAY; import static java.util.Arrays.stream; import static java.util.function.UnaryOperator.identity; import static java.util.stream.Collectors.counting; diff --git a/src/main/java/bomb/modules/r/round_keypads/RoundKeypadsController.java b/src/main/java/bomb/modules/r/round/keypads/RoundKeypadsController.java similarity index 69% rename from src/main/java/bomb/modules/r/round_keypads/RoundKeypadsController.java rename to src/main/java/bomb/modules/r/round/keypads/RoundKeypadsController.java index b99b30a5..fde3d19f 100644 --- a/src/main/java/bomb/modules/r/round_keypads/RoundKeypadsController.java +++ b/src/main/java/bomb/modules/r/round/keypads/RoundKeypadsController.java @@ -1,4 +1,4 @@ -package bomb.modules.r.round_keypads; +package bomb.modules.r.round.keypads; import bomb.abstractions.Resettable; import javafx.fxml.FXML; @@ -7,49 +7,49 @@ import java.util.List; -import static bomb.modules.r.round_keypads.Keypad.AE; -import static bomb.modules.r.round_keypads.Keypad.ALIEN_THREE; -import static bomb.modules.r.round_keypads.Keypad.A_T; -import static bomb.modules.r.round_keypads.Keypad.BACK_C1; -import static bomb.modules.r.round_keypads.Keypad.BACK_C2; -import static bomb.modules.r.round_keypads.Keypad.COPYRIGHT; -import static bomb.modules.r.round_keypads.Keypad.CURVY_H1; -import static bomb.modules.r.round_keypads.Keypad.CURVY_H2; -import static bomb.modules.r.round_keypads.Keypad.C_DOT; -import static bomb.modules.r.round_keypads.Keypad.DISNEY_Q1; -import static bomb.modules.r.round_keypads.Keypad.DISNEY_Q2; -import static bomb.modules.r.round_keypads.Keypad.HARRY_POTTER; -import static bomb.modules.r.round_keypads.Keypad.HOLLOW_STAR1; -import static bomb.modules.r.round_keypads.Keypad.HOLLOW_STAR2; -import static bomb.modules.r.round_keypads.Keypad.KEYPAD_ARRAY; -import static bomb.modules.r.round_keypads.Keypad.NOT_THREE; -import static bomb.modules.r.round_keypads.Keypad.OMEGA; -import static bomb.modules.r.round_keypads.Keypad.PARAGRAPH1; -import static bomb.modules.r.round_keypads.Keypad.PARAGRAPH2; -import static bomb.modules.r.round_keypads.Keypad.PSI1; -import static bomb.modules.r.round_keypads.Keypad.PSI2; -import static bomb.modules.r.round_keypads.Keypad.PUZZLE; -import static bomb.modules.r.round_keypads.Keypad.RACKET1; -import static bomb.modules.r.round_keypads.Keypad.RACKET2; -import static bomb.modules.r.round_keypads.Keypad.REVERSE_EURO1; -import static bomb.modules.r.round_keypads.Keypad.REVERSE_EURO2; -import static bomb.modules.r.round_keypads.Keypad.RUSSIAN_CAT1; -import static bomb.modules.r.round_keypads.Keypad.RUSSIAN_CAT2; -import static bomb.modules.r.round_keypads.Keypad.RUSSIAN_NH; -import static bomb.modules.r.round_keypads.Keypad.RUSSIAN_SIX1; -import static bomb.modules.r.round_keypads.Keypad.RUSSIAN_SIX2; -import static bomb.modules.r.round_keypads.Keypad.RUSSIAN_X1; -import static bomb.modules.r.round_keypads.Keypad.RUSSIAN_X2; -import static bomb.modules.r.round_keypads.Keypad.SMILEY1; -import static bomb.modules.r.round_keypads.Keypad.SMILEY2; -import static bomb.modules.r.round_keypads.Keypad.SPANISH_QUESTION1; -import static bomb.modules.r.round_keypads.Keypad.SPANISH_QUESTION2; -import static bomb.modules.r.round_keypads.Keypad.STAR; -import static bomb.modules.r.round_keypads.Keypad.STROKED_LAMBDA1; -import static bomb.modules.r.round_keypads.Keypad.STROKED_LAMBDA2; -import static bomb.modules.r.round_keypads.Keypad.TB_1; -import static bomb.modules.r.round_keypads.Keypad.TB_2; -import static bomb.modules.r.round_keypads.Keypad.THE_SAC; +import static bomb.modules.r.round.keypads.Keypad.AE; +import static bomb.modules.r.round.keypads.Keypad.ALIEN_THREE; +import static bomb.modules.r.round.keypads.Keypad.A_T; +import static bomb.modules.r.round.keypads.Keypad.BACK_C1; +import static bomb.modules.r.round.keypads.Keypad.BACK_C2; +import static bomb.modules.r.round.keypads.Keypad.COPYRIGHT; +import static bomb.modules.r.round.keypads.Keypad.CURVY_H1; +import static bomb.modules.r.round.keypads.Keypad.CURVY_H2; +import static bomb.modules.r.round.keypads.Keypad.C_DOT; +import static bomb.modules.r.round.keypads.Keypad.DISNEY_Q1; +import static bomb.modules.r.round.keypads.Keypad.DISNEY_Q2; +import static bomb.modules.r.round.keypads.Keypad.HARRY_POTTER; +import static bomb.modules.r.round.keypads.Keypad.HOLLOW_STAR1; +import static bomb.modules.r.round.keypads.Keypad.HOLLOW_STAR2; +import static bomb.modules.r.round.keypads.Keypad.KEYPAD_ARRAY; +import static bomb.modules.r.round.keypads.Keypad.NOT_THREE; +import static bomb.modules.r.round.keypads.Keypad.OMEGA; +import static bomb.modules.r.round.keypads.Keypad.PARAGRAPH1; +import static bomb.modules.r.round.keypads.Keypad.PARAGRAPH2; +import static bomb.modules.r.round.keypads.Keypad.PSI1; +import static bomb.modules.r.round.keypads.Keypad.PSI2; +import static bomb.modules.r.round.keypads.Keypad.PUZZLE; +import static bomb.modules.r.round.keypads.Keypad.RACKET1; +import static bomb.modules.r.round.keypads.Keypad.RACKET2; +import static bomb.modules.r.round.keypads.Keypad.REVERSE_EURO1; +import static bomb.modules.r.round.keypads.Keypad.REVERSE_EURO2; +import static bomb.modules.r.round.keypads.Keypad.RUSSIAN_CAT1; +import static bomb.modules.r.round.keypads.Keypad.RUSSIAN_CAT2; +import static bomb.modules.r.round.keypads.Keypad.RUSSIAN_NH; +import static bomb.modules.r.round.keypads.Keypad.RUSSIAN_SIX1; +import static bomb.modules.r.round.keypads.Keypad.RUSSIAN_SIX2; +import static bomb.modules.r.round.keypads.Keypad.RUSSIAN_X1; +import static bomb.modules.r.round.keypads.Keypad.RUSSIAN_X2; +import static bomb.modules.r.round.keypads.Keypad.SMILEY1; +import static bomb.modules.r.round.keypads.Keypad.SMILEY2; +import static bomb.modules.r.round.keypads.Keypad.SPANISH_QUESTION1; +import static bomb.modules.r.round.keypads.Keypad.SPANISH_QUESTION2; +import static bomb.modules.r.round.keypads.Keypad.STAR; +import static bomb.modules.r.round.keypads.Keypad.STROKED_LAMBDA1; +import static bomb.modules.r.round.keypads.Keypad.STROKED_LAMBDA2; +import static bomb.modules.r.round.keypads.Keypad.TB_1; +import static bomb.modules.r.round.keypads.Keypad.TB_2; +import static bomb.modules.r.round.keypads.Keypad.THE_SAC; import static java.util.Arrays.asList; public class RoundKeypadsController implements Resettable { diff --git a/src/main/java/bomb/modules/s/shape_shift/ShapeEnd.java b/src/main/java/bomb/modules/s/shape/shift/ShapeEnd.java similarity index 81% rename from src/main/java/bomb/modules/s/shape_shift/ShapeEnd.java rename to src/main/java/bomb/modules/s/shape/shift/ShapeEnd.java index d794df5f..7dbe23a8 100644 --- a/src/main/java/bomb/modules/s/shape_shift/ShapeEnd.java +++ b/src/main/java/bomb/modules/s/shape/shift/ShapeEnd.java @@ -1,4 +1,4 @@ -package bomb.modules.s.shape_shift; +package bomb.modules.s.shape.shift; public enum ShapeEnd { ROUND, POINT, FLAT, TICKET; diff --git a/src/main/java/bomb/modules/s/shape_shift/ShapeShift.java b/src/main/java/bomb/modules/s/shape/shift/ShapeShift.java similarity index 98% rename from src/main/java/bomb/modules/s/shape_shift/ShapeShift.java rename to src/main/java/bomb/modules/s/shape/shift/ShapeShift.java index 6888ac41..8c860967 100644 --- a/src/main/java/bomb/modules/s/shape_shift/ShapeShift.java +++ b/src/main/java/bomb/modules/s/shape/shift/ShapeShift.java @@ -1,4 +1,4 @@ -package bomb.modules.s.shape_shift; +package bomb.modules.s.shape.shift; import bomb.Widget; import bomb.annotation.DisplayComponent; @@ -21,7 +21,7 @@ import static bomb.enumerations.Port.PS2; import static bomb.enumerations.Port.RCA; import static bomb.enumerations.Port.RJ45; -import static bomb.modules.s.shape_shift.ShapeEnd.SHAPE_END_ARRAY; +import static bomb.modules.s.shape.shift.ShapeEnd.SHAPE_END_ARRAY; import static bomb.tools.logic.BitConverter.TO_INT; @DisplayComponent(resource = "shape_shift.fxml", buttonLinkerName = "Shape Shift") diff --git a/src/main/java/bomb/modules/s/shape_shift/ShapeShiftController.java b/src/main/java/bomb/modules/s/shape/shift/ShapeShiftController.java similarity index 87% rename from src/main/java/bomb/modules/s/shape_shift/ShapeShiftController.java rename to src/main/java/bomb/modules/s/shape/shift/ShapeShiftController.java index d372538d..a8dd4a3a 100644 --- a/src/main/java/bomb/modules/s/shape_shift/ShapeShiftController.java +++ b/src/main/java/bomb/modules/s/shape/shift/ShapeShiftController.java @@ -1,10 +1,10 @@ -package bomb.modules.s.shape_shift; +package bomb.modules.s.shape.shift; import bomb.abstractions.Resettable; import bomb.tools.data.structures.ring.ArrayRing; import javafx.fxml.FXML; -import static bomb.modules.s.shape_shift.ShapeEnd.SHAPE_END_ARRAY; +import static bomb.modules.s.shape.shift.ShapeEnd.SHAPE_END_ARRAY; public class ShapeShiftController implements Resettable { private final ArrayRing leftSide, rightSide; diff --git a/src/main/java/bomb/modules/s/square/SquareButton.java b/src/main/java/bomb/modules/s/square/button/SquareButton.java similarity index 99% rename from src/main/java/bomb/modules/s/square/SquareButton.java rename to src/main/java/bomb/modules/s/square/button/SquareButton.java index 9c4da954..d2872c02 100644 --- a/src/main/java/bomb/modules/s/square/SquareButton.java +++ b/src/main/java/bomb/modules/s/square/button/SquareButton.java @@ -1,4 +1,4 @@ -package bomb.modules.s.square; +package bomb.modules.s.square.button; import bomb.Widget; import bomb.annotation.DisplayComponent; diff --git a/src/main/java/bomb/modules/s/square/SquareButtonController.java b/src/main/java/bomb/modules/s/square/button/SquareButtonController.java similarity index 79% rename from src/main/java/bomb/modules/s/square/SquareButtonController.java rename to src/main/java/bomb/modules/s/square/button/SquareButtonController.java index 06f169c0..b10a7a1b 100644 --- a/src/main/java/bomb/modules/s/square/SquareButtonController.java +++ b/src/main/java/bomb/modules/s/square/button/SquareButtonController.java @@ -1,4 +1,4 @@ -package bomb.modules.s.square; +package bomb.modules.s.square.button; import bomb.abstractions.Resettable; diff --git a/src/main/java/bomb/modules/s/switches/Switches.java b/src/main/java/bomb/modules/s/switches/Switches.java index ed566d95..bed5da0c 100644 --- a/src/main/java/bomb/modules/s/switches/Switches.java +++ b/src/main/java/bomb/modules/s/switches/Switches.java @@ -2,7 +2,7 @@ import bomb.Widget; import bomb.annotation.DisplayComponent; -import bomb.modules.c.colored_switches.ColoredSwitches; +import bomb.modules.c.colored.switches.ColoredSwitches; import org.jetbrains.annotations.NotNull; import java.util.ArrayList; diff --git a/src/main/java/bomb/modules/t/bulb/Bulb.java b/src/main/java/bomb/modules/t/the/bulb/Bulb.java similarity index 96% rename from src/main/java/bomb/modules/t/bulb/Bulb.java rename to src/main/java/bomb/modules/t/the/bulb/Bulb.java index 521bcade..11c4f861 100644 --- a/src/main/java/bomb/modules/t/bulb/Bulb.java +++ b/src/main/java/bomb/modules/t/the/bulb/Bulb.java @@ -1,4 +1,4 @@ -package bomb.modules.t.bulb; +package bomb.modules.t.the.bulb; public class Bulb { private Color color; diff --git a/src/main/java/bomb/modules/t/bulb/TheBulb.java b/src/main/java/bomb/modules/t/the/bulb/TheBulb.java similarity index 84% rename from src/main/java/bomb/modules/t/bulb/TheBulb.java rename to src/main/java/bomb/modules/t/the/bulb/TheBulb.java index 929e75ed..84c7c011 100644 --- a/src/main/java/bomb/modules/t/bulb/TheBulb.java +++ b/src/main/java/bomb/modules/t/the/bulb/TheBulb.java @@ -1,4 +1,4 @@ -package bomb.modules.t.bulb; +package bomb.modules.t.the.bulb; import bomb.Widget; import bomb.annotation.DisplayComponent; @@ -21,18 +21,6 @@ import static bomb.enumerations.Indicator.MSA; import static bomb.enumerations.Indicator.SIG; import static bomb.enumerations.Indicator.SND; -import static bomb.modules.t.bulb.Bulb.Color.BLUE; -import static bomb.modules.t.bulb.Bulb.Color.GREEN; -import static bomb.modules.t.bulb.Bulb.Color.PURPLE; -import static bomb.modules.t.bulb.Bulb.Color.RED; -import static bomb.modules.t.bulb.Bulb.Color.WHITE; -import static bomb.modules.t.bulb.Bulb.Color.YELLOW; -import static bomb.modules.t.bulb.Bulb.Light.OFF; -import static bomb.modules.t.bulb.Bulb.Light.ON; -import static bomb.modules.t.bulb.Bulb.Opacity.OPAQUE; -import static bomb.modules.t.bulb.Bulb.Opacity.TRANSLUCENT; -import static bomb.modules.t.bulb.Bulb.Position.SCREWED; -import static bomb.modules.t.bulb.Bulb.Position.UNSCREWED; @DisplayComponent(resource = "the_bulb.fxml", buttonLinkerName = "The Bulb") public final class TheBulb extends Widget { @@ -61,16 +49,16 @@ public final class TheBulb extends Widget { } private static void stepOne(Bulb bulb, List outputList) { - if (bulb.getLight() == OFF) { + if (bulb.getLight() == Bulb.Light.OFF) { unscrewBulb(bulb, outputList); stepFour(bulb, outputList); return; } - if (bulb.getOpacity() == TRANSLUCENT) { + if (bulb.getOpacity() == Bulb.Opacity.TRANSLUCENT) { outputList.add(PRESS_I); - if (bulb.getColor() == WHITE) + if (bulb.getColor() == Bulb.Color.WHITE) checkIfLightTurnsOff(bulb, outputList); stepTwo(bulb, outputList); @@ -82,7 +70,7 @@ private static void stepOne(Bulb bulb, List outputList) { } private static void stepTwo(Bulb bulb, List outputList) { - if (bulb.getColor() == RED) { + if (bulb.getColor() == Bulb.Color.RED) { checkIfLightTurnsOff(bulb, outputList); outputList.add(PRESS_I); unscrewBulb(bulb, outputList); @@ -90,7 +78,7 @@ private static void stepTwo(Bulb bulb, List outputList) { return; } - if (bulb.getColor() == WHITE) { + if (bulb.getColor() == Bulb.Color.WHITE) { outputList.add(PRESS_O); unscrewBulb(bulb, outputList); stepSix(bulb, outputList); @@ -102,7 +90,7 @@ private static void stepTwo(Bulb bulb, List outputList) { } private static void stepThree(Bulb bulb, List outputList) { - if (bulb.getColor() == GREEN) { + if (bulb.getColor() == Bulb.Color.GREEN) { outputList.add(PRESS_I); checkIfLightTurnsOff(bulb, outputList); unscrewBulb(bulb, outputList); @@ -110,7 +98,7 @@ private static void stepThree(Bulb bulb, List outputList) { return; } - if (bulb.getColor() == PURPLE) { + if (bulb.getColor() == Bulb.Color.PURPLE) { checkIfLightTurnsOff(bulb, outputList); outputList.add(PRESS_O); unscrewBulb(bulb, outputList); @@ -155,21 +143,21 @@ private static void stepSix(Bulb bulb, List outputList) { } private static void stepSeven(Bulb bulb, List outputList) { - if (bulb.getColor() == GREEN) { + if (bulb.getColor() == Bulb.Color.GREEN) { rememberedIndicator = SIG; outputList.add(PRESS_I); stepEleven(bulb, outputList); return; } - if (bulb.getColor() == PURPLE) { + if (bulb.getColor() == Bulb.Color.PURPLE) { outputList.add(PRESS_I); screwBulb(bulb, outputList); stepTwelve(bulb, outputList); return; } - if (bulb.getColor() == BLUE) { + if (bulb.getColor() == Bulb.Color.BLUE) { rememberedIndicator = CLR; outputList.add(PRESS_O); stepEleven(bulb, outputList); @@ -182,21 +170,21 @@ private static void stepSeven(Bulb bulb, List outputList) { } private static void stepEight(Bulb bulb, List outputList) { - if (bulb.getColor() == WHITE) { + if (bulb.getColor() == Bulb.Color.WHITE) { rememberedIndicator = FRQ; outputList.add(PRESS_I); stepEleven(bulb, outputList); return; } - if (bulb.getColor() == RED) { + if (bulb.getColor() == Bulb.Color.RED) { outputList.add(PRESS_I); screwBulb(bulb, outputList); stepThirteen(bulb, outputList); return; } - if (bulb.getColor() == YELLOW) { + if (bulb.getColor() == Bulb.Color.YELLOW) { rememberedIndicator = FRK; outputList.add(PRESS_O); stepEleven(bulb, outputList); @@ -209,33 +197,33 @@ private static void stepEight(Bulb bulb, List outputList) { } private static void stepNine(Bulb bulb, List outputList) { - if (bulb.getColor() == BLUE) { + if (bulb.getColor() == Bulb.Color.BLUE) { outputList.add(PRESS_I); stepFourteen(bulb, outputList); return; } - if (bulb.getColor() == GREEN) { + if (bulb.getColor() == Bulb.Color.GREEN) { outputList.add(PRESS_I); screwBulb(bulb, outputList); stepTwelve(bulb, outputList); return; } - if (bulb.getColor() == YELLOW) { + if (bulb.getColor() == Bulb.Color.YELLOW) { outputList.add(PRESS_O); stepFifteen(bulb, outputList); return; } - if (bulb.getColor() == WHITE) { + if (bulb.getColor() == Bulb.Color.WHITE) { outputList.add(PRESS_O); screwBulb(bulb, outputList); stepThirteen(bulb, outputList); return; } - if (bulb.getColor() == PURPLE) { + if (bulb.getColor() == Bulb.Color.PURPLE) { screwBulb(bulb, outputList); outputList.add(PRESS_I); stepTwelve(bulb, outputList); @@ -248,33 +236,33 @@ private static void stepNine(Bulb bulb, List outputList) { } private static void stepTen(Bulb bulb, List outputList) { - if (bulb.getColor() == PURPLE) { + if (bulb.getColor() == Bulb.Color.PURPLE) { outputList.add(PRESS_I); stepFourteen(bulb, outputList); return; } - if (bulb.getColor() == RED) { + if (bulb.getColor() == Bulb.Color.RED) { outputList.add(PRESS_I); screwBulb(bulb, outputList); stepThirteen(bulb, outputList); return; } - if (bulb.getColor() == BLUE) { + if (bulb.getColor() == Bulb.Color.BLUE) { outputList.add(PRESS_O); stepFifteen(bulb, outputList); return; } - if (bulb.getColor() == YELLOW) { + if (bulb.getColor() == Bulb.Color.YELLOW) { outputList.add(PRESS_O); screwBulb(bulb, outputList); stepTwelve(bulb, outputList); return; } - if (bulb.getColor() == GREEN) { + if (bulb.getColor() == Bulb.Color.GREEN) { screwBulb(bulb, outputList); outputList.add(PRESS_I); stepThirteen(bulb, outputList); @@ -303,12 +291,12 @@ private static void stepThirteen(Bulb bulb, List outputList) { } private static void stepFourteen(Bulb bulb, List outputList) { - outputList.add(bulb.getOpacity() == OPAQUE ? PRESS_I : PRESS_O); + outputList.add(bulb.getOpacity() == Bulb.Opacity.OPAQUE ? PRESS_I : PRESS_O); screwBulb(bulb, outputList); } private static void stepFifteen(Bulb bulb, List outputList) { - outputList.add(bulb.getOpacity() == TRANSLUCENT ? PRESS_I : PRESS_O); + outputList.add(bulb.getOpacity() == Bulb.Opacity.TRANSLUCENT ? PRESS_I : PRESS_O); screwBulb(bulb, outputList); } @@ -337,7 +325,7 @@ private static void checkIfLightTurnsOff(Bulb bulb, List outputList) { options.ifPresent(buttonType -> isLightOffAtStepOne = buttonType == yes); - bulb.setLight(isLightOffAtStepOne ? OFF : ON); + bulb.setLight(isLightOffAtStepOne ? Bulb.Light.OFF : Bulb.Light.ON); } private static boolean confirmLightIsOn(Bulb bulb, List outputList) throws IllegalStateException { @@ -360,22 +348,22 @@ private static boolean confirmLightIsOn(Bulb bulb, List outputList) thro throw new IllegalStateException("Unexpected state"); boolean isLightOn = options.get() == on; - bulb.setLight(isLightOn ? ON : OFF); + bulb.setLight(isLightOn ? Bulb.Light.ON : Bulb.Light.OFF); return isLightOn; } private static void unscrewBulb(Bulb theBulb, List list) throws IllegalStateException { - theBulb.setPosition(UNSCREWED); + theBulb.setPosition(Bulb.Position.UNSCREWED); list.add(UNSCREW); } private static void screwBulb(Bulb theBulb, List list) throws IllegalStateException { - theBulb.setPosition(SCREWED); + theBulb.setPosition(Bulb.Position.SCREWED); list.add(SCREW); } private static void validateBulb(Bulb bulb) throws IllegalArgumentException { - if (bulb.getPosition() != SCREWED) + if (bulb.getPosition() != Bulb.Position.SCREWED) throw new IllegalArgumentException("Bulb must be screwed in at the start"); if (bulb.getLight() == null) throw new IllegalArgumentException("Bulb must be lit or unlit"); diff --git a/src/main/java/bomb/modules/t/bulb/TheBulbController.java b/src/main/java/bomb/modules/t/the/bulb/TheBulbController.java similarity index 78% rename from src/main/java/bomb/modules/t/bulb/TheBulbController.java rename to src/main/java/bomb/modules/t/the/bulb/TheBulbController.java index 92fa77c5..643bdd74 100644 --- a/src/main/java/bomb/modules/t/bulb/TheBulbController.java +++ b/src/main/java/bomb/modules/t/the/bulb/TheBulbController.java @@ -1,4 +1,4 @@ -package bomb.modules.t.bulb; +package bomb.modules.t.the.bulb; import bomb.abstractions.Resettable; import bomb.tools.pattern.facade.FacadeFX; @@ -9,17 +9,17 @@ import java.util.List; -import static bomb.modules.t.bulb.Bulb.Color.BLUE; -import static bomb.modules.t.bulb.Bulb.Color.GREEN; -import static bomb.modules.t.bulb.Bulb.Color.PURPLE; -import static bomb.modules.t.bulb.Bulb.Color.RED; -import static bomb.modules.t.bulb.Bulb.Color.WHITE; -import static bomb.modules.t.bulb.Bulb.Color.YELLOW; -import static bomb.modules.t.bulb.Bulb.Light.OFF; -import static bomb.modules.t.bulb.Bulb.Light.ON; -import static bomb.modules.t.bulb.Bulb.Opacity.OPAQUE; -import static bomb.modules.t.bulb.Bulb.Opacity.TRANSLUCENT; -import static bomb.modules.t.bulb.Bulb.Position.SCREWED; +import static bomb.modules.t.the.bulb.Bulb.Color.BLUE; +import static bomb.modules.t.the.bulb.Bulb.Color.GREEN; +import static bomb.modules.t.the.bulb.Bulb.Color.PURPLE; +import static bomb.modules.t.the.bulb.Bulb.Color.RED; +import static bomb.modules.t.the.bulb.Bulb.Color.WHITE; +import static bomb.modules.t.the.bulb.Bulb.Color.YELLOW; +import static bomb.modules.t.the.bulb.Bulb.Light.OFF; +import static bomb.modules.t.the.bulb.Bulb.Light.ON; +import static bomb.modules.t.the.bulb.Bulb.Opacity.OPAQUE; +import static bomb.modules.t.the.bulb.Bulb.Opacity.TRANSLUCENT; +import static bomb.modules.t.the.bulb.Bulb.Position.SCREWED; public class TheBulbController implements Resettable { @FXML diff --git a/src/main/java/bomb/modules/t/three_d_maze/ThreeDMaze.java b/src/main/java/bomb/modules/t/three/d/maze/ThreeDMaze.java similarity index 79% rename from src/main/java/bomb/modules/t/three_d_maze/ThreeDMaze.java rename to src/main/java/bomb/modules/t/three/d/maze/ThreeDMaze.java index 9432fdff..eff077b8 100644 --- a/src/main/java/bomb/modules/t/three_d_maze/ThreeDMaze.java +++ b/src/main/java/bomb/modules/t/three/d/maze/ThreeDMaze.java @@ -1,4 +1,4 @@ -package bomb.modules.t.three_d_maze; +package bomb.modules.t.three.d.maze; import bomb.annotation.DisplayComponent; diff --git a/src/main/java/bomb/modules/t/three_d_maze/ThreeDMazeController.java b/src/main/java/bomb/modules/t/three/d/maze/ThreeDMazeController.java similarity index 79% rename from src/main/java/bomb/modules/t/three_d_maze/ThreeDMazeController.java rename to src/main/java/bomb/modules/t/three/d/maze/ThreeDMazeController.java index a6f3af25..e008bf88 100644 --- a/src/main/java/bomb/modules/t/three_d_maze/ThreeDMazeController.java +++ b/src/main/java/bomb/modules/t/three/d/maze/ThreeDMazeController.java @@ -1,4 +1,4 @@ -package bomb.modules.t.three_d_maze; +package bomb.modules.t.three.d.maze; import bomb.abstractions.Resettable; diff --git a/src/main/java/bomb/modules/t/two_bit/TwoBit.java b/src/main/java/bomb/modules/t/two/bit/TwoBit.java similarity index 96% rename from src/main/java/bomb/modules/t/two_bit/TwoBit.java rename to src/main/java/bomb/modules/t/two/bit/TwoBit.java index 529047f7..aa992f77 100644 --- a/src/main/java/bomb/modules/t/two_bit/TwoBit.java +++ b/src/main/java/bomb/modules/t/two/bit/TwoBit.java @@ -1,4 +1,4 @@ -package bomb.modules.t.two_bit; +package bomb.modules.t.two.bit; import bomb.Widget; import bomb.annotation.DisplayComponent; @@ -7,8 +7,8 @@ import static bomb.enumerations.Port.RCA; import static bomb.enumerations.Port.RJ45; -import static bomb.modules.t.two_bit.TwoBitState.SECOND_QUERY; -import static bomb.modules.t.two_bit.TwoBitState.SUBMIT; +import static bomb.modules.t.two.bit.TwoBitState.SECOND_QUERY; +import static bomb.modules.t.two.bit.TwoBitState.SUBMIT; import static bomb.tools.filter.RegexFilter.CHAR_FILTER; import static bomb.tools.filter.RegexFilter.NUMBER_PATTERN; import static bomb.tools.filter.RegexFilter.filter; diff --git a/src/main/java/bomb/modules/t/two_bit/TwoBitController.java b/src/main/java/bomb/modules/t/two/bit/TwoBitController.java similarity index 98% rename from src/main/java/bomb/modules/t/two_bit/TwoBitController.java rename to src/main/java/bomb/modules/t/two/bit/TwoBitController.java index 714e9ee8..9652a6d1 100644 --- a/src/main/java/bomb/modules/t/two_bit/TwoBitController.java +++ b/src/main/java/bomb/modules/t/two/bit/TwoBitController.java @@ -1,4 +1,4 @@ -package bomb.modules.t.two_bit; +package bomb.modules.t.two.bit; import bomb.abstractions.Resettable; import bomb.tools.pattern.facade.FacadeFX; diff --git a/src/main/java/bomb/modules/t/two_bit/TwoBitState.java b/src/main/java/bomb/modules/t/two/bit/TwoBitState.java similarity index 93% rename from src/main/java/bomb/modules/t/two_bit/TwoBitState.java rename to src/main/java/bomb/modules/t/two/bit/TwoBitState.java index 96f0a2b2..2d95a0c9 100644 --- a/src/main/java/bomb/modules/t/two_bit/TwoBitState.java +++ b/src/main/java/bomb/modules/t/two/bit/TwoBitState.java @@ -1,4 +1,4 @@ -package bomb.modules.t.two_bit; +package bomb.modules.t.two.bit; import bomb.abstractions.State; diff --git a/src/main/java/bomb/modules/wz/word_search/WordFinder.java b/src/main/java/bomb/modules/wz/word/search/WordFinder.java similarity index 98% rename from src/main/java/bomb/modules/wz/word_search/WordFinder.java rename to src/main/java/bomb/modules/wz/word/search/WordFinder.java index 66f1172d..50d88f1d 100644 --- a/src/main/java/bomb/modules/wz/word_search/WordFinder.java +++ b/src/main/java/bomb/modules/wz/word/search/WordFinder.java @@ -1,4 +1,4 @@ -package bomb.modules.wz.word_search; +package bomb.modules.wz.word.search; import bomb.tools.Coordinates; import bomb.tools.data.structures.trie.Trie; diff --git a/src/main/java/bomb/modules/wz/word_search/WordSearch.java b/src/main/java/bomb/modules/wz/word/search/WordSearch.java similarity index 98% rename from src/main/java/bomb/modules/wz/word_search/WordSearch.java rename to src/main/java/bomb/modules/wz/word/search/WordSearch.java index fd95859e..b226a825 100644 --- a/src/main/java/bomb/modules/wz/word_search/WordSearch.java +++ b/src/main/java/bomb/modules/wz/word/search/WordSearch.java @@ -1,4 +1,4 @@ -package bomb.modules.wz.word_search; +package bomb.modules.wz.word.search; import bomb.Widget; import bomb.annotation.DisplayComponent; diff --git a/src/main/java/bomb/tools/pattern/observer/BlindAlleyPaneObserver.java b/src/main/java/bomb/tools/pattern/observer/BlindAlleyPaneObserver.java index c7cd959f..4d294219 100644 --- a/src/main/java/bomb/tools/pattern/observer/BlindAlleyPaneObserver.java +++ b/src/main/java/bomb/tools/pattern/observer/BlindAlleyPaneObserver.java @@ -1,6 +1,6 @@ package bomb.tools.pattern.observer; -import bomb.modules.ab.blind_alley.BlindAlleyController; +import bomb.modules.ab.blind.alley.BlindAlleyController; public class BlindAlleyPaneObserver implements Observer { private final BlindAlleyController controller; diff --git a/src/main/java/bomb/tools/pattern/observer/SouvenirToggleObserver.java b/src/main/java/bomb/tools/pattern/observer/SouvenirToggleObserver.java index bcc149f0..eb446605 100644 --- a/src/main/java/bomb/tools/pattern/observer/SouvenirToggleObserver.java +++ b/src/main/java/bomb/tools/pattern/observer/SouvenirToggleObserver.java @@ -3,7 +3,6 @@ import bomb.Widget; import javafx.scene.control.RadioButton; -@SuppressWarnings("ClassCanBeRecord") public class SouvenirToggleObserver implements Observer { private final RadioButton souvenir; diff --git a/src/main/java/module-info.java b/src/main/java/module-info.java index 82cee910..b3f4cbbe 100644 --- a/src/main/java/module-info.java +++ b/src/main/java/module-info.java @@ -10,47 +10,50 @@ requires org.jetbrains.annotations; exports bomb to javafx.fxml; + exports bomb.components.chord to javafx.fxml; exports bomb.components.hex to javafx.fxml; exports bomb.components.microcontroller to javafx.fxml; exports bomb.components.simon.screams to javafx.fxml; exports bomb.components.simon.states to javafx.fxml; + exports bomb.enumerations to javafx.fxml; + exports bomb.modules.ab.alphabet to javafx.fxml; exports bomb.modules.ab.astrology to javafx.fxml; exports bomb.modules.ab.bitwise to javafx.fxml; - exports bomb.modules.ab.blind_alley to javafx.fxml; - exports bomb.modules.ab.boolean_venn to javafx.fxml; + exports bomb.modules.ab.blind.alley to javafx.fxml; + exports bomb.modules.ab.bool.venn.diagram to javafx.fxml; exports bomb.modules.c.caesar to javafx.fxml; - exports bomb.modules.c.cheap_checkout to javafx.fxml; + exports bomb.modules.c.cheap.checkout to javafx.fxml; exports bomb.modules.c.chess to javafx.fxml; exports bomb.modules.c.chords to javafx.fxml; - exports bomb.modules.c.color_flash to javafx.fxml; - exports bomb.modules.c.colored_switches to javafx.fxml; + exports bomb.modules.c.color.flash to javafx.fxml; + exports bomb.modules.c.colored.switches to javafx.fxml; exports bomb.modules.dh.emoji to javafx.fxml; - exports bomb.modules.dh.fast_math to javafx.fxml; - exports bomb.modules.dh.forget_me to javafx.fxml; + exports bomb.modules.dh.fast.math to javafx.fxml; + exports bomb.modules.dh.forget.me.not to javafx.fxml; exports bomb.modules.dh.hexamaze to javafx.fxml; exports bomb.modules.dh.hexamaze.hexalgorithm.storage to javafx.fxml; - exports bomb.modules.il.ice_cream to javafx.fxml; + exports bomb.modules.il.ice.cream to javafx.fxml; exports bomb.modules.il.laundry to javafx.fxml; - exports bomb.modules.il.led_encryption to javafx.fxml; + exports bomb.modules.il.led.encryption to javafx.fxml; exports bomb.modules.m.microcontroller to javafx.fxml; exports bomb.modules.m.microcontroller.chip to javafx.fxml; exports bomb.modules.m.monsplode to javafx.fxml; exports bomb.modules.np.neutralization to javafx.fxml; - exports bomb.modules.np.number_pad to javafx.fxml; - exports bomb.modules.r.round_keypads to javafx.fxml; + exports bomb.modules.np.number.pad to javafx.fxml; + exports bomb.modules.r.round.keypads to javafx.fxml; exports bomb.modules.s.seashells to javafx.fxml; exports bomb.modules.s.semaphore to javafx.fxml; - exports bomb.modules.s.shape_shift to javafx.fxml; + exports bomb.modules.s.shape.shift to javafx.fxml; exports bomb.modules.s.simon to javafx.fxml; exports bomb.modules.s.simon.screams to javafx.fxml; exports bomb.modules.s.simon.states to javafx.fxml; exports bomb.modules.s.souvenir to javafx.fxml; exports bomb.modules.s.switches to javafx.fxml; - exports bomb.modules.t.bulb to javafx.fxml; - exports bomb.modules.t.three_d_maze to javafx.fxml; + exports bomb.modules.t.the.bulb to javafx.fxml; + exports bomb.modules.t.three.d.maze to javafx.fxml; exports bomb.modules.t.translated to javafx.fxml; exports bomb.modules.t.translated.solutions to javafx.fxml; exports bomb.modules.t.translated.solutions.button to javafx.fxml; @@ -58,8 +61,10 @@ exports bomb.modules.t.translated.solutions.morse to javafx.fxml; exports bomb.modules.t.translated.solutions.password to javafx.fxml; exports bomb.modules.t.translated.solutions.wof to javafx.fxml; - exports bomb.modules.t.two_bit to javafx.fxml; + exports bomb.modules.t.two.bit to javafx.fxml; + exports bomb.modules.wz.word.search to javafx.fxml; exports bomb.modules.wz.zoo to javafx.fxml; + exports bomb.tools to javafx.fxml; exports bomb.tools.data.structures.queue to javafx.fxml; exports bomb.tools.data.structures.ring to javafx.fxml; diff --git a/src/main/resources/bomb/fxml/ab/blind_alley.fxml b/src/main/resources/bomb/fxml/ab/blind_alley.fxml index 3cc72b25..1de80cac 100644 --- a/src/main/resources/bomb/fxml/ab/blind_alley.fxml +++ b/src/main/resources/bomb/fxml/ab/blind_alley.fxml @@ -11,7 +11,7 @@ + fx:controller="bomb.modules.ab.blind.alley.BlindAlleyController"> diff --git a/src/main/resources/bomb/fxml/ab/boolean_venn_diagram.fxml b/src/main/resources/bomb/fxml/ab/boolean_venn_diagram.fxml index facef247..f9a80ada 100644 --- a/src/main/resources/bomb/fxml/ab/boolean_venn_diagram.fxml +++ b/src/main/resources/bomb/fxml/ab/boolean_venn_diagram.fxml @@ -15,7 +15,7 @@ + xmlns:fx="http://javafx.com/fxml/1" fx:controller="bomb.modules.ab.bool.venn.diagram.BooleanController"> diff --git a/src/main/resources/bomb/fxml/c/colored_switches.fxml b/src/main/resources/bomb/fxml/c/colored_switches.fxml index 8c267b91..7fb858ce 100644 --- a/src/main/resources/bomb/fxml/c/colored_switches.fxml +++ b/src/main/resources/bomb/fxml/c/colored_switches.fxml @@ -16,7 +16,7 @@ + fx:controller="bomb.modules.c.colored.switches.ColoredSwitchController"> diff --git a/src/main/resources/bomb/fxml/dh/fast_math.fxml b/src/main/resources/bomb/fxml/dh/fast_math.fxml index 47e52d1e..cdff1e38 100644 --- a/src/main/resources/bomb/fxml/dh/fast_math.fxml +++ b/src/main/resources/bomb/fxml/dh/fast_math.fxml @@ -13,7 +13,7 @@ + fx:controller="bomb.modules.dh.fast.math.FastController"> diff --git a/src/main/resources/bomb/fxml/forget_me_not.fxml b/src/main/resources/bomb/fxml/forget_me_not.fxml index e052b3a8..7ca097c9 100644 --- a/src/main/resources/bomb/fxml/forget_me_not.fxml +++ b/src/main/resources/bomb/fxml/forget_me_not.fxml @@ -13,7 +13,7 @@ + fx:controller="bomb.modules.dh.forget.me.not.ForgetMeNotController"> diff --git a/src/main/resources/bomb/fxml/r/round_keypads.fxml b/src/main/resources/bomb/fxml/r/round_keypads.fxml index 87b54883..0445c1cd 100644 --- a/src/main/resources/bomb/fxml/r/round_keypads.fxml +++ b/src/main/resources/bomb/fxml/r/round_keypads.fxml @@ -10,7 +10,7 @@ + fx:controller="bomb.modules.r.round.keypads.RoundKeypadsController"> @@ -26,292 +26,292 @@ - + - + - + - + - + - + - +
- + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + diff --git a/src/main/resources/bomb/fxml/s/shape_shift.fxml b/src/main/resources/bomb/fxml/s/shape_shift.fxml index 3c01a0f9..de6aeab5 100644 --- a/src/main/resources/bomb/fxml/s/shape_shift.fxml +++ b/src/main/resources/bomb/fxml/s/shape_shift.fxml @@ -4,7 +4,7 @@ + fx:controller="bomb.modules.s.shape.shift.ShapeShiftController"> diff --git a/src/main/resources/bomb/fxml/t/3d_maze.fxml b/src/main/resources/bomb/fxml/t/3d_maze.fxml index d41f8cbb..d5dccebc 100644 --- a/src/main/resources/bomb/fxml/t/3d_maze.fxml +++ b/src/main/resources/bomb/fxml/t/3d_maze.fxml @@ -6,7 +6,7 @@ + fx:controller="bomb.modules.t.three.d.maze.ThreeDMazeController"> diff --git a/src/main/resources/bomb/fxml/t/the_bulb.fxml b/src/main/resources/bomb/fxml/t/the_bulb.fxml index 1327f335..ede03d4f 100644 --- a/src/main/resources/bomb/fxml/t/the_bulb.fxml +++ b/src/main/resources/bomb/fxml/t/the_bulb.fxml @@ -13,7 +13,7 @@ + fx:controller="bomb.modules.t.the.bulb.TheBulbController"> diff --git a/src/main/resources/bomb/fxml/t/two_bit.fxml b/src/main/resources/bomb/fxml/t/two_bit.fxml index 6ba19668..6e535e8b 100644 --- a/src/main/resources/bomb/fxml/t/two_bit.fxml +++ b/src/main/resources/bomb/fxml/t/two_bit.fxml @@ -11,7 +11,7 @@ + fx:controller="bomb.modules.t.two.bit.TwoBitController"> diff --git a/src/main/resources/bomb/modules/ab/adjacent/adjacent_letters.fxml b/src/main/resources/bomb/modules/ab/adjacent/letters/adjacent_letters.fxml similarity index 100% rename from src/main/resources/bomb/modules/ab/adjacent/adjacent_letters.fxml rename to src/main/resources/bomb/modules/ab/adjacent/letters/adjacent_letters.fxml diff --git a/src/main/resources/bomb/modules/ab/bitwise/bitwise_ops.fxml b/src/main/resources/bomb/modules/ab/bitwise/bitwise_ops.fxml index 2d0706e3..02593916 100644 --- a/src/main/resources/bomb/modules/ab/bitwise/bitwise_ops.fxml +++ b/src/main/resources/bomb/modules/ab/bitwise/bitwise_ops.fxml @@ -6,6 +6,7 @@ + + fx:controller="bomb.modules.ab.blind.alley.BlindAlleyController"> diff --git a/src/main/resources/bomb/modules/ab/boolean_venn/boolean_venn_diagram.fxml b/src/main/resources/bomb/modules/ab/bool/venn/diagram/boolean_venn_diagram.fxml similarity index 97% rename from src/main/resources/bomb/modules/ab/boolean_venn/boolean_venn_diagram.fxml rename to src/main/resources/bomb/modules/ab/bool/venn/diagram/boolean_venn_diagram.fxml index 6b89b2ee..56d41728 100644 --- a/src/main/resources/bomb/modules/ab/boolean_venn/boolean_venn_diagram.fxml +++ b/src/main/resources/bomb/modules/ab/bool/venn/diagram/boolean_venn_diagram.fxml @@ -14,8 +14,8 @@ + stylesheets="@../../../../../css/ab/boolean_venn_diagram.css" xmlns="http://javafx.com/javafx/15.0.1" + xmlns:fx="http://javafx.com/fxml/1" fx:controller="bomb.modules.ab.bool.venn.diagram.BooleanController"> diff --git a/src/main/resources/bomb/modules/c/colored_switches/graph.csv b/src/main/resources/bomb/modules/c/colored/switches/graph.csv similarity index 100% rename from src/main/resources/bomb/modules/c/colored_switches/graph.csv rename to src/main/resources/bomb/modules/c/colored/switches/graph.csv diff --git a/src/main/resources/bomb/modules/il/ice_cream/allergyTable.csv b/src/main/resources/bomb/modules/il/ice/cream/allergyTable.csv similarity index 100% rename from src/main/resources/bomb/modules/il/ice_cream/allergyTable.csv rename to src/main/resources/bomb/modules/il/ice/cream/allergyTable.csv diff --git a/src/main/resources/bomb/modules/r/round_keypads/A_T.PNG b/src/main/resources/bomb/modules/r/round/keypads/A_T.PNG similarity index 100% rename from src/main/resources/bomb/modules/r/round_keypads/A_T.PNG rename to src/main/resources/bomb/modules/r/round/keypads/A_T.PNG diff --git a/src/main/resources/bomb/modules/r/round_keypads/Alien 3.PNG b/src/main/resources/bomb/modules/r/round/keypads/Alien 3.PNG similarity index 100% rename from src/main/resources/bomb/modules/r/round_keypads/Alien 3.PNG rename to src/main/resources/bomb/modules/r/round/keypads/Alien 3.PNG diff --git a/src/main/resources/bomb/modules/r/round_keypads/BackwardsC.PNG b/src/main/resources/bomb/modules/r/round/keypads/BackwardsC.PNG similarity index 100% rename from src/main/resources/bomb/modules/r/round_keypads/BackwardsC.PNG rename to src/main/resources/bomb/modules/r/round/keypads/BackwardsC.PNG diff --git a/src/main/resources/bomb/modules/r/round_keypads/C.PNG b/src/main/resources/bomb/modules/r/round/keypads/C.PNG similarity index 100% rename from src/main/resources/bomb/modules/r/round_keypads/C.PNG rename to src/main/resources/bomb/modules/r/round/keypads/C.PNG diff --git a/src/main/resources/bomb/modules/r/round_keypads/Copyright.PNG b/src/main/resources/bomb/modules/r/round/keypads/Copyright.PNG similarity index 100% rename from src/main/resources/bomb/modules/r/round_keypads/Copyright.PNG rename to src/main/resources/bomb/modules/r/round/keypads/Copyright.PNG diff --git a/src/main/resources/bomb/modules/r/round_keypads/Curvy H.PNG b/src/main/resources/bomb/modules/r/round/keypads/Curvy H.PNG similarity index 100% rename from src/main/resources/bomb/modules/r/round_keypads/Curvy H.PNG rename to src/main/resources/bomb/modules/r/round/keypads/Curvy H.PNG diff --git a/src/main/resources/bomb/modules/r/round_keypads/Disney Q.PNG b/src/main/resources/bomb/modules/r/round/keypads/Disney Q.PNG similarity index 100% rename from src/main/resources/bomb/modules/r/round_keypads/Disney Q.PNG rename to src/main/resources/bomb/modules/r/round/keypads/Disney Q.PNG diff --git a/src/main/resources/bomb/modules/r/round_keypads/Empty Racket.PNG b/src/main/resources/bomb/modules/r/round/keypads/Empty Racket.PNG similarity index 100% rename from src/main/resources/bomb/modules/r/round_keypads/Empty Racket.PNG rename to src/main/resources/bomb/modules/r/round/keypads/Empty Racket.PNG diff --git a/src/main/resources/bomb/modules/r/round_keypads/Harry Potter.PNG b/src/main/resources/bomb/modules/r/round/keypads/Harry Potter.PNG similarity index 100% rename from src/main/resources/bomb/modules/r/round_keypads/Harry Potter.PNG rename to src/main/resources/bomb/modules/r/round/keypads/Harry Potter.PNG diff --git a/src/main/resources/bomb/modules/r/round_keypads/Hollow Star.PNG b/src/main/resources/bomb/modules/r/round/keypads/Hollow Star.PNG similarity index 100% rename from src/main/resources/bomb/modules/r/round_keypads/Hollow Star.PNG rename to src/main/resources/bomb/modules/r/round/keypads/Hollow Star.PNG diff --git a/src/main/resources/bomb/modules/r/round_keypads/Lambda.PNG b/src/main/resources/bomb/modules/r/round/keypads/Lambda.PNG similarity index 100% rename from src/main/resources/bomb/modules/r/round_keypads/Lambda.PNG rename to src/main/resources/bomb/modules/r/round/keypads/Lambda.PNG diff --git a/src/main/resources/bomb/modules/r/round_keypads/Not3.PNG b/src/main/resources/bomb/modules/r/round/keypads/Not3.PNG similarity index 100% rename from src/main/resources/bomb/modules/r/round_keypads/Not3.PNG rename to src/main/resources/bomb/modules/r/round/keypads/Not3.PNG diff --git a/src/main/resources/bomb/modules/r/round_keypads/Omega.PNG b/src/main/resources/bomb/modules/r/round/keypads/Omega.PNG similarity index 100% rename from src/main/resources/bomb/modules/r/round_keypads/Omega.PNG rename to src/main/resources/bomb/modules/r/round/keypads/Omega.PNG diff --git a/src/main/resources/bomb/modules/r/round_keypads/Paragraph.PNG b/src/main/resources/bomb/modules/r/round/keypads/Paragraph.PNG similarity index 100% rename from src/main/resources/bomb/modules/r/round_keypads/Paragraph.PNG rename to src/main/resources/bomb/modules/r/round/keypads/Paragraph.PNG diff --git a/src/main/resources/bomb/modules/r/round_keypads/Psi.PNG b/src/main/resources/bomb/modules/r/round/keypads/Psi.PNG similarity index 100% rename from src/main/resources/bomb/modules/r/round_keypads/Psi.PNG rename to src/main/resources/bomb/modules/r/round/keypads/Psi.PNG diff --git a/src/main/resources/bomb/modules/r/round_keypads/Puzzle.PNG b/src/main/resources/bomb/modules/r/round/keypads/Puzzle.PNG similarity index 100% rename from src/main/resources/bomb/modules/r/round_keypads/Puzzle.PNG rename to src/main/resources/bomb/modules/r/round/keypads/Puzzle.PNG diff --git a/src/main/resources/bomb/modules/r/round_keypads/Reverse Euro.PNG b/src/main/resources/bomb/modules/r/round/keypads/Reverse Euro.PNG similarity index 100% rename from src/main/resources/bomb/modules/r/round_keypads/Reverse Euro.PNG rename to src/main/resources/bomb/modules/r/round/keypads/Reverse Euro.PNG diff --git a/src/main/resources/bomb/modules/r/round_keypads/Russian 6.PNG b/src/main/resources/bomb/modules/r/round/keypads/Russian 6.PNG similarity index 100% rename from src/main/resources/bomb/modules/r/round_keypads/Russian 6.PNG rename to src/main/resources/bomb/modules/r/round/keypads/Russian 6.PNG diff --git a/src/main/resources/bomb/modules/r/round_keypads/Russian Cat.PNG b/src/main/resources/bomb/modules/r/round/keypads/Russian Cat.PNG similarity index 100% rename from src/main/resources/bomb/modules/r/round_keypads/Russian Cat.PNG rename to src/main/resources/bomb/modules/r/round/keypads/Russian Cat.PNG diff --git a/src/main/resources/bomb/modules/r/round_keypads/Russian NH.PNG b/src/main/resources/bomb/modules/r/round/keypads/Russian NH.PNG similarity index 100% rename from src/main/resources/bomb/modules/r/round_keypads/Russian NH.PNG rename to src/main/resources/bomb/modules/r/round/keypads/Russian NH.PNG diff --git a/src/main/resources/bomb/modules/r/round_keypads/Russian X.PNG b/src/main/resources/bomb/modules/r/round/keypads/Russian X.PNG similarity index 100% rename from src/main/resources/bomb/modules/r/round_keypads/Russian X.PNG rename to src/main/resources/bomb/modules/r/round/keypads/Russian X.PNG diff --git a/src/main/resources/bomb/modules/r/round_keypads/Sac.PNG b/src/main/resources/bomb/modules/r/round/keypads/Sac.PNG similarity index 100% rename from src/main/resources/bomb/modules/r/round_keypads/Sac.PNG rename to src/main/resources/bomb/modules/r/round/keypads/Sac.PNG diff --git a/src/main/resources/bomb/modules/r/round_keypads/Smily.PNG b/src/main/resources/bomb/modules/r/round/keypads/Smily.PNG similarity index 100% rename from src/main/resources/bomb/modules/r/round_keypads/Smily.PNG rename to src/main/resources/bomb/modules/r/round/keypads/Smily.PNG diff --git a/src/main/resources/bomb/modules/r/round_keypads/Spanish Question.PNG b/src/main/resources/bomb/modules/r/round/keypads/Spanish Question.PNG similarity index 100% rename from src/main/resources/bomb/modules/r/round_keypads/Spanish Question.PNG rename to src/main/resources/bomb/modules/r/round/keypads/Spanish Question.PNG diff --git a/src/main/resources/bomb/modules/r/round_keypads/Star.PNG b/src/main/resources/bomb/modules/r/round/keypads/Star.PNG similarity index 100% rename from src/main/resources/bomb/modules/r/round_keypads/Star.PNG rename to src/main/resources/bomb/modules/r/round/keypads/Star.PNG diff --git a/src/main/resources/bomb/modules/r/round_keypads/Tb.PNG b/src/main/resources/bomb/modules/r/round/keypads/Tb.PNG similarity index 100% rename from src/main/resources/bomb/modules/r/round_keypads/Tb.PNG rename to src/main/resources/bomb/modules/r/round/keypads/Tb.PNG diff --git a/src/main/resources/bomb/modules/r/round_keypads/ae.PNG b/src/main/resources/bomb/modules/r/round/keypads/ae.PNG similarity index 100% rename from src/main/resources/bomb/modules/r/round_keypads/ae.PNG rename to src/main/resources/bomb/modules/r/round/keypads/ae.PNG diff --git a/src/main/resources/bomb/modules/wz/word_search/words.txt b/src/main/resources/bomb/modules/wz/word/search/words.txt similarity index 100% rename from src/main/resources/bomb/modules/wz/word_search/words.txt rename to src/main/resources/bomb/modules/wz/word/search/words.txt diff --git a/src/test/java/bomb/modules/ab/blind_alley/BlindAlleyTest.java b/src/test/java/bomb/modules/ab/blind/alley/BlindAlleyTest.java similarity index 98% rename from src/test/java/bomb/modules/ab/blind_alley/BlindAlleyTest.java rename to src/test/java/bomb/modules/ab/blind/alley/BlindAlleyTest.java index 3e6ddab8..c6e129e5 100644 --- a/src/test/java/bomb/modules/ab/blind_alley/BlindAlleyTest.java +++ b/src/test/java/bomb/modules/ab/blind/alley/BlindAlleyTest.java @@ -1,4 +1,4 @@ -package bomb.modules.ab.blind_alley; +package bomb.modules.ab.blind.alley; import bomb.BombSimulations; import bomb.ConditionSetter; diff --git a/src/test/java/bomb/modules/ab/boolean_venn/BooleanVennTest.java b/src/test/java/bomb/modules/ab/bool/venn/diagram/BooleanVennTest.java similarity index 97% rename from src/test/java/bomb/modules/ab/boolean_venn/BooleanVennTest.java rename to src/test/java/bomb/modules/ab/bool/venn/diagram/BooleanVennTest.java index ed32fec2..6436be88 100644 --- a/src/test/java/bomb/modules/ab/boolean_venn/BooleanVennTest.java +++ b/src/test/java/bomb/modules/ab/bool/venn/diagram/BooleanVennTest.java @@ -1,4 +1,4 @@ -package bomb.modules.ab.boolean_venn; +package bomb.modules.ab.bool.venn.diagram; import org.testng.annotations.DataProvider; import org.testng.annotations.Test; diff --git a/src/test/java/bomb/modules/c/cheap_checkout/CheapCheckoutTest.java b/src/test/java/bomb/modules/c/cheap/checkout/CheapCheckoutTest.java similarity index 81% rename from src/test/java/bomb/modules/c/cheap_checkout/CheapCheckoutTest.java rename to src/test/java/bomb/modules/c/cheap/checkout/CheapCheckoutTest.java index 175dc833..ac8eff82 100644 --- a/src/test/java/bomb/modules/c/cheap_checkout/CheapCheckoutTest.java +++ b/src/test/java/bomb/modules/c/cheap/checkout/CheapCheckoutTest.java @@ -1,4 +1,4 @@ -package bomb.modules.c.cheap_checkout; +package bomb.modules.c.cheap.checkout; import org.testng.annotations.AfterTest; import org.testng.annotations.DataProvider; @@ -8,18 +8,18 @@ import java.util.EnumSet; import java.util.List; -import static bomb.modules.c.cheap_checkout.CheckoutItem.BANANAS; -import static bomb.modules.c.cheap_checkout.CheckoutItem.CHEESE; -import static bomb.modules.c.cheap_checkout.CheckoutItem.CHOCOLATE_BAR; -import static bomb.modules.c.cheap_checkout.CheckoutItem.CHOCOLATE_MILK; -import static bomb.modules.c.cheap_checkout.CheckoutItem.COFFEE_BEANS; -import static bomb.modules.c.cheap_checkout.CheckoutItem.COOKIES; -import static bomb.modules.c.cheap_checkout.CheckoutItem.DEODORANT; -import static bomb.modules.c.cheap_checkout.CheckoutItem.GUM; -import static bomb.modules.c.cheap_checkout.CheckoutItem.HONEY; -import static bomb.modules.c.cheap_checkout.CheckoutItem.ORANGES; -import static bomb.modules.c.cheap_checkout.CheckoutItem.STEAK; -import static bomb.modules.c.cheap_checkout.CheckoutItem.TEA; +import static bomb.modules.c.cheap.checkout.CheckoutItem.BANANAS; +import static bomb.modules.c.cheap.checkout.CheckoutItem.CHEESE; +import static bomb.modules.c.cheap.checkout.CheckoutItem.CHOCOLATE_BAR; +import static bomb.modules.c.cheap.checkout.CheckoutItem.CHOCOLATE_MILK; +import static bomb.modules.c.cheap.checkout.CheckoutItem.COFFEE_BEANS; +import static bomb.modules.c.cheap.checkout.CheckoutItem.COOKIES; +import static bomb.modules.c.cheap.checkout.CheckoutItem.DEODORANT; +import static bomb.modules.c.cheap.checkout.CheckoutItem.GUM; +import static bomb.modules.c.cheap.checkout.CheckoutItem.HONEY; +import static bomb.modules.c.cheap.checkout.CheckoutItem.ORANGES; +import static bomb.modules.c.cheap.checkout.CheckoutItem.STEAK; +import static bomb.modules.c.cheap.checkout.CheckoutItem.TEA; import static java.time.DayOfWeek.FRIDAY; import static java.time.DayOfWeek.MONDAY; import static java.time.DayOfWeek.SATURDAY; diff --git a/src/test/java/bomb/modules/c/cheap_checkout/CheckoutItemTest.java b/src/test/java/bomb/modules/c/cheap/checkout/CheckoutItemTest.java similarity index 54% rename from src/test/java/bomb/modules/c/cheap_checkout/CheckoutItemTest.java rename to src/test/java/bomb/modules/c/cheap/checkout/CheckoutItemTest.java index 2bc2f96c..9b5bc646 100644 --- a/src/test/java/bomb/modules/c/cheap_checkout/CheckoutItemTest.java +++ b/src/test/java/bomb/modules/c/cheap/checkout/CheckoutItemTest.java @@ -1,23 +1,23 @@ -package bomb.modules.c.cheap_checkout; +package bomb.modules.c.cheap.checkout; import org.testng.annotations.Test; import java.util.EnumSet; -import static bomb.modules.c.cheap_checkout.CheckoutItem.BANANAS; -import static bomb.modules.c.cheap_checkout.CheckoutItem.BROCCOLI; -import static bomb.modules.c.cheap_checkout.CheckoutItem.CHICKEN; -import static bomb.modules.c.cheap_checkout.CheckoutItem.GRAPEFRUIT; -import static bomb.modules.c.cheap_checkout.CheckoutItem.LEMONS; -import static bomb.modules.c.cheap_checkout.CheckoutItem.LETTUCE; -import static bomb.modules.c.cheap_checkout.CheckoutItem.ORANGES; -import static bomb.modules.c.cheap_checkout.CheckoutItem.PASTA_SAUCE; -import static bomb.modules.c.cheap_checkout.CheckoutItem.PEANUT_BUTTER; -import static bomb.modules.c.cheap_checkout.CheckoutItem.PORK; -import static bomb.modules.c.cheap_checkout.CheckoutItem.POTATOES; -import static bomb.modules.c.cheap_checkout.CheckoutItem.STEAK; -import static bomb.modules.c.cheap_checkout.CheckoutItem.TOMATOES; -import static bomb.modules.c.cheap_checkout.CheckoutItem.TURKEY; +import static bomb.modules.c.cheap.checkout.CheckoutItem.BANANAS; +import static bomb.modules.c.cheap.checkout.CheckoutItem.BROCCOLI; +import static bomb.modules.c.cheap.checkout.CheckoutItem.CHICKEN; +import static bomb.modules.c.cheap.checkout.CheckoutItem.GRAPEFRUIT; +import static bomb.modules.c.cheap.checkout.CheckoutItem.LEMONS; +import static bomb.modules.c.cheap.checkout.CheckoutItem.LETTUCE; +import static bomb.modules.c.cheap.checkout.CheckoutItem.ORANGES; +import static bomb.modules.c.cheap.checkout.CheckoutItem.PASTA_SAUCE; +import static bomb.modules.c.cheap.checkout.CheckoutItem.PEANUT_BUTTER; +import static bomb.modules.c.cheap.checkout.CheckoutItem.PORK; +import static bomb.modules.c.cheap.checkout.CheckoutItem.POTATOES; +import static bomb.modules.c.cheap.checkout.CheckoutItem.STEAK; +import static bomb.modules.c.cheap.checkout.CheckoutItem.TOMATOES; +import static bomb.modules.c.cheap.checkout.CheckoutItem.TURKEY; import static org.testng.Assert.assertFalse; import static org.testng.Assert.assertTrue; diff --git a/src/test/java/bomb/modules/c/colored_switches/ColoredSwitchNodeEqTest.java b/src/test/java/bomb/modules/c/colored/switches/ColoredSwitchNodeEqTest.java similarity index 91% rename from src/test/java/bomb/modules/c/colored_switches/ColoredSwitchNodeEqTest.java rename to src/test/java/bomb/modules/c/colored/switches/ColoredSwitchNodeEqTest.java index 6eb28fde..2b624cdf 100644 --- a/src/test/java/bomb/modules/c/colored_switches/ColoredSwitchNodeEqTest.java +++ b/src/test/java/bomb/modules/c/colored/switches/ColoredSwitchNodeEqTest.java @@ -1,4 +1,4 @@ -package bomb.modules.c.colored_switches; +package bomb.modules.c.colored.switches; import nl.jqno.equalsverifier.EqualsVerifier; import org.testng.annotations.Test; diff --git a/src/test/java/bomb/modules/c/colored_switches/ColoredSwitchesTest.java b/src/test/java/bomb/modules/c/colored/switches/ColoredSwitchesTest.java similarity index 84% rename from src/test/java/bomb/modules/c/colored_switches/ColoredSwitchesTest.java rename to src/test/java/bomb/modules/c/colored/switches/ColoredSwitchesTest.java index 73c946cf..cb87a521 100644 --- a/src/test/java/bomb/modules/c/colored_switches/ColoredSwitchesTest.java +++ b/src/test/java/bomb/modules/c/colored/switches/ColoredSwitchesTest.java @@ -1,4 +1,4 @@ -package bomb.modules.c.colored_switches; +package bomb.modules.c.colored.switches; import org.testng.annotations.BeforeMethod; import org.testng.annotations.DataProvider; @@ -7,11 +7,11 @@ import java.util.Arrays; import java.util.List; -import static bomb.modules.c.colored_switches.SwitchColor.BLUE; -import static bomb.modules.c.colored_switches.SwitchColor.CYAN; -import static bomb.modules.c.colored_switches.SwitchColor.GREEN; -import static bomb.modules.c.colored_switches.SwitchColor.NEUTRAL; -import static bomb.modules.c.colored_switches.SwitchColor.RED; +import static bomb.modules.c.colored.switches.SwitchColor.BLUE; +import static bomb.modules.c.colored.switches.SwitchColor.CYAN; +import static bomb.modules.c.colored.switches.SwitchColor.GREEN; +import static bomb.modules.c.colored.switches.SwitchColor.NEUTRAL; +import static bomb.modules.c.colored.switches.SwitchColor.RED; import static org.testng.Assert.assertEquals; public class ColoredSwitchesTest { diff --git a/src/test/java/bomb/modules/dh/fast_math/FastMathTest.java b/src/test/java/bomb/modules/dh/fast/math/FastMathTest.java similarity index 98% rename from src/test/java/bomb/modules/dh/fast_math/FastMathTest.java rename to src/test/java/bomb/modules/dh/fast/math/FastMathTest.java index 0fc724ef..2f0e1023 100644 --- a/src/test/java/bomb/modules/dh/fast_math/FastMathTest.java +++ b/src/test/java/bomb/modules/dh/fast/math/FastMathTest.java @@ -1,4 +1,4 @@ -package bomb.modules.dh.fast_math; +package bomb.modules.dh.fast.math; import bomb.ConditionSetter; import bomb.Widget; diff --git a/src/test/java/bomb/modules/dh/forget_me/ForgetMeNotTest.java b/src/test/java/bomb/modules/dh/forget/me/not/ForgetMeNotTest.java similarity index 99% rename from src/test/java/bomb/modules/dh/forget_me/ForgetMeNotTest.java rename to src/test/java/bomb/modules/dh/forget/me/not/ForgetMeNotTest.java index b43e840b..e76d7a3c 100644 --- a/src/test/java/bomb/modules/dh/forget_me/ForgetMeNotTest.java +++ b/src/test/java/bomb/modules/dh/forget/me/not/ForgetMeNotTest.java @@ -1,4 +1,4 @@ -package bomb.modules.dh.forget_me; +package bomb.modules.dh.forget.me.not; import bomb.ConditionSetter; import bomb.Widget; diff --git a/src/test/java/bomb/modules/il/ice_cream/IceCreamTest.java b/src/test/java/bomb/modules/il/ice/cream/IceCreamTest.java similarity index 83% rename from src/test/java/bomb/modules/il/ice_cream/IceCreamTest.java rename to src/test/java/bomb/modules/il/ice/cream/IceCreamTest.java index 310d9f49..5349c10d 100644 --- a/src/test/java/bomb/modules/il/ice_cream/IceCreamTest.java +++ b/src/test/java/bomb/modules/il/ice/cream/IceCreamTest.java @@ -1,4 +1,4 @@ -package bomb.modules.il.ice_cream; +package bomb.modules.il.ice.cream; import bomb.ConditionSetter; import bomb.Widget; @@ -19,24 +19,24 @@ import static bomb.enumerations.Indicator.SIG; import static bomb.enumerations.TrinarySwitch.OFF; import static bomb.enumerations.TrinarySwitch.ON; -import static bomb.modules.il.ice_cream.Flavor.COOKIES_N_CREAM; -import static bomb.modules.il.ice_cream.Flavor.DOUBLE_CHOCOLATE; -import static bomb.modules.il.ice_cream.Flavor.DOUBLE_STRAWBERRY; -import static bomb.modules.il.ice_cream.Flavor.MINT_CHIP; -import static bomb.modules.il.ice_cream.Flavor.NEAPOLITAN; -import static bomb.modules.il.ice_cream.Flavor.RASPBERRY_RIPPLE; -import static bomb.modules.il.ice_cream.Flavor.ROCKY_ROAD; -import static bomb.modules.il.ice_cream.Flavor.THE_CLASSIC; -import static bomb.modules.il.ice_cream.Flavor.VANILLA; -import static bomb.modules.il.ice_cream.Person.ASHLEY; -import static bomb.modules.il.ice_cream.Person.CHERYL; -import static bomb.modules.il.ice_cream.Person.DAVE; -import static bomb.modules.il.ice_cream.Person.JESSICA; -import static bomb.modules.il.ice_cream.Person.PAT; -import static bomb.modules.il.ice_cream.Person.SAM; -import static bomb.modules.il.ice_cream.Person.SIMON; -import static bomb.modules.il.ice_cream.Person.TIM; -import static bomb.modules.il.ice_cream.Person.TOM; +import static bomb.modules.il.ice.cream.Flavor.COOKIES_N_CREAM; +import static bomb.modules.il.ice.cream.Flavor.DOUBLE_CHOCOLATE; +import static bomb.modules.il.ice.cream.Flavor.DOUBLE_STRAWBERRY; +import static bomb.modules.il.ice.cream.Flavor.MINT_CHIP; +import static bomb.modules.il.ice.cream.Flavor.NEAPOLITAN; +import static bomb.modules.il.ice.cream.Flavor.RASPBERRY_RIPPLE; +import static bomb.modules.il.ice.cream.Flavor.ROCKY_ROAD; +import static bomb.modules.il.ice.cream.Flavor.THE_CLASSIC; +import static bomb.modules.il.ice.cream.Flavor.VANILLA; +import static bomb.modules.il.ice.cream.Person.ASHLEY; +import static bomb.modules.il.ice.cream.Person.CHERYL; +import static bomb.modules.il.ice.cream.Person.DAVE; +import static bomb.modules.il.ice.cream.Person.JESSICA; +import static bomb.modules.il.ice.cream.Person.PAT; +import static bomb.modules.il.ice.cream.Person.SAM; +import static bomb.modules.il.ice.cream.Person.SIMON; +import static bomb.modules.il.ice.cream.Person.TIM; +import static bomb.modules.il.ice.cream.Person.TOM; import static org.testng.Assert.assertEquals; public class IceCreamTest { diff --git a/src/test/java/bomb/modules/r/round_keypads/RoundKeypadTest.java b/src/test/java/bomb/modules/r/round/keypads/RoundKeypadTest.java similarity index 75% rename from src/test/java/bomb/modules/r/round_keypads/RoundKeypadTest.java rename to src/test/java/bomb/modules/r/round/keypads/RoundKeypadTest.java index ab1f7433..48f0bc29 100644 --- a/src/test/java/bomb/modules/r/round_keypads/RoundKeypadTest.java +++ b/src/test/java/bomb/modules/r/round/keypads/RoundKeypadTest.java @@ -1,4 +1,4 @@ -package bomb.modules.r.round_keypads; +package bomb.modules.r.round.keypads; import org.testng.Assert; import org.testng.annotations.AfterClass; @@ -6,12 +6,12 @@ import org.testng.annotations.DataProvider; import org.testng.annotations.Test; -import static bomb.modules.r.round_keypads.Keypad.A_T; -import static bomb.modules.r.round_keypads.Keypad.COPYRIGHT; -import static bomb.modules.r.round_keypads.Keypad.PSI1; -import static bomb.modules.r.round_keypads.Keypad.PUZZLE; -import static bomb.modules.r.round_keypads.Keypad.SPANISH_QUESTION1; -import static bomb.modules.r.round_keypads.Keypad.SPANISH_QUESTION2; +import static bomb.modules.r.round.keypads.Keypad.A_T; +import static bomb.modules.r.round.keypads.Keypad.COPYRIGHT; +import static bomb.modules.r.round.keypads.Keypad.PSI1; +import static bomb.modules.r.round.keypads.Keypad.PUZZLE; +import static bomb.modules.r.round.keypads.Keypad.SPANISH_QUESTION1; +import static bomb.modules.r.round.keypads.Keypad.SPANISH_QUESTION2; public class RoundKeypadTest { @BeforeMethod diff --git a/src/test/java/bomb/modules/s/shape_shift/ShapeShiftTest.java b/src/test/java/bomb/modules/s/shape/shift/ShapeShiftTest.java similarity index 91% rename from src/test/java/bomb/modules/s/shape_shift/ShapeShiftTest.java rename to src/test/java/bomb/modules/s/shape/shift/ShapeShiftTest.java index a1e804a0..faa38865 100644 --- a/src/test/java/bomb/modules/s/shape_shift/ShapeShiftTest.java +++ b/src/test/java/bomb/modules/s/shape/shift/ShapeShiftTest.java @@ -1,4 +1,4 @@ -package bomb.modules.s.shape_shift; +package bomb.modules.s.shape.shift; import bomb.ConditionSetter; import bomb.Widget; @@ -11,10 +11,10 @@ import org.testng.annotations.DataProvider; import org.testng.annotations.Test; -import static bomb.modules.s.shape_shift.ShapeEnd.FLAT; -import static bomb.modules.s.shape_shift.ShapeEnd.POINT; -import static bomb.modules.s.shape_shift.ShapeEnd.ROUND; -import static bomb.modules.s.shape_shift.ShapeEnd.TICKET; +import static bomb.modules.s.shape.shift.ShapeEnd.FLAT; +import static bomb.modules.s.shape.shift.ShapeEnd.POINT; +import static bomb.modules.s.shape.shift.ShapeEnd.ROUND; +import static bomb.modules.s.shape.shift.ShapeEnd.TICKET; import static org.testng.Assert.assertEquals; public class ShapeShiftTest { diff --git a/src/test/java/bomb/modules/s/square/SquareButtonTest.java b/src/test/java/bomb/modules/s/square/button/SquareButtonTest.java similarity index 91% rename from src/test/java/bomb/modules/s/square/SquareButtonTest.java rename to src/test/java/bomb/modules/s/square/button/SquareButtonTest.java index 3fef5ed5..1d6f70af 100644 --- a/src/test/java/bomb/modules/s/square/SquareButtonTest.java +++ b/src/test/java/bomb/modules/s/square/button/SquareButtonTest.java @@ -1,4 +1,4 @@ -package bomb.modules.s.square; +package bomb.modules.s.square.button; import bomb.BombSimulations; import bomb.ConditionSetter; @@ -14,13 +14,13 @@ import static bomb.enumerations.Indicator.MSA; import static bomb.enumerations.Indicator.NSA; import static bomb.enumerations.TrinarySwitch.OFF; -import static bomb.modules.s.square.SquareButton.BLUE; -import static bomb.modules.s.square.SquareButton.CYAN; -import static bomb.modules.s.square.SquareButton.DARK_GRAY; -import static bomb.modules.s.square.SquareButton.GREEN; -import static bomb.modules.s.square.SquareButton.ORANGE; -import static bomb.modules.s.square.SquareButton.WHITE; -import static bomb.modules.s.square.SquareButton.YELLOW; +import static bomb.modules.s.square.button.SquareButton.BLUE; +import static bomb.modules.s.square.button.SquareButton.CYAN; +import static bomb.modules.s.square.button.SquareButton.DARK_GRAY; +import static bomb.modules.s.square.button.SquareButton.GREEN; +import static bomb.modules.s.square.button.SquareButton.ORANGE; +import static bomb.modules.s.square.button.SquareButton.WHITE; +import static bomb.modules.s.square.button.SquareButton.YELLOW; import static org.testng.Assert.assertEquals; import static org.testng.Assert.assertTrue; diff --git a/src/test/java/bomb/modules/t/bulb/TheBulbTest.java b/src/test/java/bomb/modules/t/the/bulb/TheBulbTest.java similarity index 85% rename from src/test/java/bomb/modules/t/bulb/TheBulbTest.java rename to src/test/java/bomb/modules/t/the/bulb/TheBulbTest.java index 8b87e815..f3edf8c8 100644 --- a/src/test/java/bomb/modules/t/bulb/TheBulbTest.java +++ b/src/test/java/bomb/modules/t/the/bulb/TheBulbTest.java @@ -1,4 +1,4 @@ -package bomb.modules.t.bulb; +package bomb.modules.t.the.bulb; import bomb.ConditionSetter; import bomb.Widget; @@ -19,21 +19,21 @@ import static bomb.enumerations.Indicator.IND; import static bomb.enumerations.Indicator.NSA; import static bomb.enumerations.Indicator.SIG; -import static bomb.modules.t.bulb.Bulb.Color.BLUE; -import static bomb.modules.t.bulb.Bulb.Color.GREEN; -import static bomb.modules.t.bulb.Bulb.Color.PURPLE; -import static bomb.modules.t.bulb.Bulb.Color.WHITE; -import static bomb.modules.t.bulb.Bulb.Color.YELLOW; -import static bomb.modules.t.bulb.Bulb.Light.OFF; -import static bomb.modules.t.bulb.Bulb.Light.ON; -import static bomb.modules.t.bulb.Bulb.Opacity.OPAQUE; -import static bomb.modules.t.bulb.Bulb.Opacity.TRANSLUCENT; -import static bomb.modules.t.bulb.Bulb.Position.SCREWED; -import static bomb.modules.t.bulb.Bulb.Position.UNSCREWED; -import static bomb.modules.t.bulb.TheBulb.PRESS_I; -import static bomb.modules.t.bulb.TheBulb.PRESS_O; -import static bomb.modules.t.bulb.TheBulb.SCREW; -import static bomb.modules.t.bulb.TheBulb.UNSCREW; +import static bomb.modules.t.the.bulb.Bulb.Color.BLUE; +import static bomb.modules.t.the.bulb.Bulb.Color.GREEN; +import static bomb.modules.t.the.bulb.Bulb.Color.PURPLE; +import static bomb.modules.t.the.bulb.Bulb.Color.WHITE; +import static bomb.modules.t.the.bulb.Bulb.Color.YELLOW; +import static bomb.modules.t.the.bulb.Bulb.Light.OFF; +import static bomb.modules.t.the.bulb.Bulb.Light.ON; +import static bomb.modules.t.the.bulb.Bulb.Opacity.OPAQUE; +import static bomb.modules.t.the.bulb.Bulb.Opacity.TRANSLUCENT; +import static bomb.modules.t.the.bulb.Bulb.Position.SCREWED; +import static bomb.modules.t.the.bulb.Bulb.Position.UNSCREWED; +import static bomb.modules.t.the.bulb.TheBulb.PRESS_I; +import static bomb.modules.t.the.bulb.TheBulb.PRESS_O; +import static bomb.modules.t.the.bulb.TheBulb.SCREW; +import static bomb.modules.t.the.bulb.TheBulb.UNSCREW; import static org.testng.Assert.assertEquals; public class TheBulbTest { diff --git a/src/test/java/bomb/modules/t/two_bit/TwoBitTest.java b/src/test/java/bomb/modules/t/two/bit/TwoBitTest.java similarity index 93% rename from src/test/java/bomb/modules/t/two_bit/TwoBitTest.java rename to src/test/java/bomb/modules/t/two/bit/TwoBitTest.java index 34a3c764..94b228e6 100644 --- a/src/test/java/bomb/modules/t/two_bit/TwoBitTest.java +++ b/src/test/java/bomb/modules/t/two/bit/TwoBitTest.java @@ -1,4 +1,4 @@ -package bomb.modules.t.two_bit; +package bomb.modules.t.two.bit; import bomb.Widget; import org.testng.annotations.AfterClass; @@ -9,8 +9,8 @@ import static bomb.enumerations.Port.PS2; import static bomb.enumerations.Port.RCA; import static bomb.enumerations.Port.RJ45; -import static bomb.modules.t.two_bit.TwoBit.QUERY_TEXT; -import static bomb.modules.t.two_bit.TwoBit.SUBMIT_TEXT; +import static bomb.modules.t.two.bit.TwoBit.QUERY_TEXT; +import static bomb.modules.t.two.bit.TwoBit.SUBMIT_TEXT; import static org.testng.Assert.assertEquals; public class TwoBitTest { diff --git a/src/test/java/bomb/modules/wz/word_search/WordFinderTest.java b/src/test/java/bomb/modules/wz/word/search/WordFinderTest.java similarity index 98% rename from src/test/java/bomb/modules/wz/word_search/WordFinderTest.java rename to src/test/java/bomb/modules/wz/word/search/WordFinderTest.java index bab7cc34..b671819f 100644 --- a/src/test/java/bomb/modules/wz/word_search/WordFinderTest.java +++ b/src/test/java/bomb/modules/wz/word/search/WordFinderTest.java @@ -1,4 +1,4 @@ -package bomb.modules.wz.word_search; +package bomb.modules.wz.word.search; import bomb.tools.Coordinates; import org.javatuples.Pair; diff --git a/src/test/java/bomb/modules/wz/word_search/WordSearchTest.java b/src/test/java/bomb/modules/wz/word/search/WordSearchTest.java similarity index 98% rename from src/test/java/bomb/modules/wz/word_search/WordSearchTest.java rename to src/test/java/bomb/modules/wz/word/search/WordSearchTest.java index b3c00204..e570b3da 100644 --- a/src/test/java/bomb/modules/wz/word_search/WordSearchTest.java +++ b/src/test/java/bomb/modules/wz/word/search/WordSearchTest.java @@ -1,4 +1,4 @@ -package bomb.modules.wz.word_search; +package bomb.modules.wz.word.search; import bomb.Widget; import org.testng.annotations.AfterClass; diff --git a/src/test/resources/suites/suiteFive.xml b/src/test/resources/suites/suiteFive.xml index 0336c57f..32b21b56 100644 --- a/src/test/resources/suites/suiteFive.xml +++ b/src/test/resources/suites/suiteFive.xml @@ -4,8 +4,8 @@ - - + + diff --git a/src/test/resources/suites/suiteFour.xml b/src/test/resources/suites/suiteFour.xml index e1107f09..eaa433d9 100644 --- a/src/test/resources/suites/suiteFour.xml +++ b/src/test/resources/suites/suiteFour.xml @@ -4,20 +4,20 @@ - + - + - + - + \ No newline at end of file diff --git a/src/test/resources/suites/suiteOne.xml b/src/test/resources/suites/suiteOne.xml index 0e65f22c..14a6df79 100644 --- a/src/test/resources/suites/suiteOne.xml +++ b/src/test/resources/suites/suiteOne.xml @@ -9,20 +9,20 @@ - - + + - - + + - - + + \ No newline at end of file diff --git a/src/test/resources/suites/suiteThree.xml b/src/test/resources/suites/suiteThree.xml index a8b28809..21de7089 100644 --- a/src/test/resources/suites/suiteThree.xml +++ b/src/test/resources/suites/suiteThree.xml @@ -10,7 +10,7 @@ - + \ No newline at end of file diff --git a/src/test/resources/suites/suiteTwo.xml b/src/test/resources/suites/suiteTwo.xml index 55845514..0ba61a02 100644 --- a/src/test/resources/suites/suiteTwo.xml +++ b/src/test/resources/suites/suiteTwo.xml @@ -5,9 +5,9 @@ - + - + @@ -17,7 +17,7 @@ - + From 01d7c4088a78685a827b84100816d88e20e3872d Mon Sep 17 00:00:00 2001 From: "Mr. J" <45538844+Ultraviolet-Ninja@users.noreply.github.com> Date: Sun, 18 Dec 2022 19:51:06 -0600 Subject: [PATCH 67/86] Fixed a couple warnings build.gradle file got a few changes that I can only test when deploying the project --- build.gradle | 4 +- src/main/java/bomb/ManualControllerTwo.java | 87 ------------------- .../observer/SouvenirPaneObserver.java | 1 - 3 files changed, 2 insertions(+), 90 deletions(-) delete mode 100644 src/main/java/bomb/ManualControllerTwo.java diff --git a/build.gradle b/build.gradle index 7e456075..ba905594 100644 --- a/build.gradle +++ b/build.gradle @@ -206,9 +206,9 @@ githubRelease { overwrite = true } -task releaseToGitHub() { +tasks.register('releaseToGitHub') { doFirst { githubRelease.token = "${authToken}" } - finalizedBy(tasks.getByName('githubRelease')) + finalizedBy(tasks.named('githubRelease')) } diff --git a/src/main/java/bomb/ManualControllerTwo.java b/src/main/java/bomb/ManualControllerTwo.java deleted file mode 100644 index 5a98f118..00000000 --- a/src/main/java/bomb/ManualControllerTwo.java +++ /dev/null @@ -1,87 +0,0 @@ -package bomb; - -import bomb.tools.pattern.observer.ForgetMeNotToggleObserver; -import bomb.tools.pattern.observer.ObserverHub; -import bomb.tools.pattern.observer.SouvenirToggleObserver; -import com.jfoenix.controls.JFXRadioButton; -import javafx.fxml.FXML; -import javafx.scene.Node; -import javafx.scene.control.RadioButton; -import javafx.scene.control.TextField; -import javafx.scene.control.Toggle; -import javafx.scene.control.ToggleGroup; -import javafx.scene.layout.GridPane; -import javafx.scene.layout.Region; -import javafx.scene.layout.VBox; - -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.concurrent.CompletableFuture; -import java.util.concurrent.ExecutionException; - -import static bomb.tools.pattern.facade.FacadeFX.GET_TOGGLE_NAME; -import static bomb.tools.pattern.factory.TextFormatterFactory.createSearchBarFormatter; -import static bomb.tools.pattern.observer.ObserverHub.ObserverIndex.FORGET_ME_NOT_TOGGLE; -import static bomb.tools.pattern.observer.ObserverHub.ObserverIndex.SOUVENIR_TOGGLE; -import static java.util.concurrent.CompletableFuture.supplyAsync; -import static java.util.function.UnaryOperator.identity; -import static java.util.stream.Collectors.toMap; - -public class ManualControllerTwo { - private Map regionMap; - private List observableRadioList; - private final List allRadioButtons; - - @FXML - private GridPane base; - - @FXML - private JFXRadioButton forgetMeNot, souvenir; - - @FXML - private TextField searchBar; - - @FXML - private ToggleGroup options; - - @FXML - private VBox menuVBox, radioButtonHouse; - - public ManualControllerTwo() { - allRadioButtons = new ArrayList<>(); - } - - public void initialize() throws ExecutionException, InterruptedException { - searchBar.setTextFormatter(createSearchBarFormatter()); - observableRadioList = radioButtonHouse.getChildren(); - allRadioButtons.addAll( - observableRadioList.stream() - .map(node -> (RadioButton) node) - .toList() - ); - ObserverHub.addObserver(FORGET_ME_NOT_TOGGLE, new ForgetMeNotToggleObserver(forgetMeNot)); - ObserverHub.addObserver(SOUVENIR_TOGGLE, new SouvenirToggleObserver(souvenir)); - -// regionMap = setupRegionMap().get(); - - } - - private CompletableFuture> setupRegionMap() throws ExecutionException, InterruptedException { - return null; - } - - private static CompletableFuture> createRadioButtonNameFuture(List radioButtonList) { - return supplyAsync(radioButtonList::stream) - .thenApply(stream -> stream.collect(toMap( - toggle -> GET_TOGGLE_NAME.apply(toggle) - .replaceAll("[ -]", "_") - .replaceAll("[()']", "") - .toLowerCase(), - identity() - ))); - } - - private void createResourceFuture() { - } -} diff --git a/src/main/java/bomb/tools/pattern/observer/SouvenirPaneObserver.java b/src/main/java/bomb/tools/pattern/observer/SouvenirPaneObserver.java index e4b72441..e4e99ffd 100644 --- a/src/main/java/bomb/tools/pattern/observer/SouvenirPaneObserver.java +++ b/src/main/java/bomb/tools/pattern/observer/SouvenirPaneObserver.java @@ -2,7 +2,6 @@ import bomb.modules.s.souvenir.SouvenirController; -@SuppressWarnings("ClassCanBeRecord") public class SouvenirPaneObserver implements Observer { private final SouvenirController controller; From 4390b07f60ec7806c3345f9a37d583b3573f7c03 Mon Sep 17 00:00:00 2001 From: "Mr. J" <45538844+Ultraviolet-Ninja@users.noreply.github.com> Date: Sun, 18 Dec 2022 20:52:53 -0600 Subject: [PATCH 68/86] More directory changes --- src/main/java/bomb/Widget.java | 4 ++-- .../bomb/modules/c/caesar/{ => cipher}/Caesar.java | 4 ++-- .../c/caesar/{ => cipher}/CaesarController.java | 2 +- .../bomb/modules/dh/emoji/{ => math}/Emoji.java | 2 +- .../dh/emoji/{ => math}/EmojiController.java | 12 ++++++------ .../dh/emoji/{ => math}/EmojiControllerState.java | 2 +- .../bomb/modules/dh/emoji/{ => math}/EmojiMath.java | 4 ++-- src/main/java/module-info.java | 4 ++-- src/main/resources/bomb/fxml/dh/emoji_math.fxml | 2 +- .../bomb/modules/c/caesar/cipher/caesar_cipher.fxml | 13 +++++++++++++ .../modules/c/caesar/{ => cipher}/CaesarTest.java | 2 +- .../modules/dh/emoji/{ => math}/EmojiMathTest.java | 2 +- src/test/resources/suites/suiteOne.xml | 2 +- src/test/resources/suites/suiteTwo.xml | 2 +- 14 files changed, 35 insertions(+), 22 deletions(-) rename src/main/java/bomb/modules/c/caesar/{ => cipher}/Caesar.java (93%) rename src/main/java/bomb/modules/c/caesar/{ => cipher}/CaesarController.java (78%) rename src/main/java/bomb/modules/dh/emoji/{ => math}/Emoji.java (96%) rename src/main/java/bomb/modules/dh/emoji/{ => math}/EmojiController.java (90%) rename src/main/java/bomb/modules/dh/emoji/{ => math}/EmojiControllerState.java (96%) rename src/main/java/bomb/modules/dh/emoji/{ => math}/EmojiMath.java (95%) create mode 100644 src/main/resources/bomb/modules/c/caesar/cipher/caesar_cipher.fxml rename src/test/java/bomb/modules/c/caesar/{ => cipher}/CaesarTest.java (98%) rename src/test/java/bomb/modules/dh/emoji/{ => math}/EmojiMathTest.java (96%) diff --git a/src/main/java/bomb/Widget.java b/src/main/java/bomb/Widget.java index e25d9de4..3a1a0827 100644 --- a/src/main/java/bomb/Widget.java +++ b/src/main/java/bomb/Widget.java @@ -9,12 +9,12 @@ import bomb.modules.ab.blind.alley.BlindAlley; import bomb.modules.ab.bitwise.Bitwise; import bomb.modules.ab.bool.venn.diagram.BooleanVenn; -import bomb.modules.c.caesar.Caesar; +import bomb.modules.c.caesar.cipher.Caesar; import bomb.modules.c.cheap.checkout.CheapCheckout; import bomb.modules.c.chess.Chess; import bomb.modules.c.chords.ChordQualities; import bomb.modules.c.color.flash.ColorFlash; -import bomb.modules.dh.emoji.EmojiMath; +import bomb.modules.dh.emoji.math.EmojiMath; import bomb.modules.dh.fast.math.FastMath; import bomb.modules.dh.fizzbuzz.FizzBuzz; import bomb.modules.dh.forget.me.not.ForgetMeNot; diff --git a/src/main/java/bomb/modules/c/caesar/Caesar.java b/src/main/java/bomb/modules/c/caesar/cipher/Caesar.java similarity index 93% rename from src/main/java/bomb/modules/c/caesar/Caesar.java rename to src/main/java/bomb/modules/c/caesar/cipher/Caesar.java index 65b32703..599d93a1 100644 --- a/src/main/java/bomb/modules/c/caesar/Caesar.java +++ b/src/main/java/bomb/modules/c/caesar/cipher/Caesar.java @@ -1,4 +1,4 @@ -package bomb.modules.c.caesar; +package bomb.modules.c.caesar.cipher; import bomb.Widget; import bomb.annotation.DisplayComponent; @@ -10,7 +10,7 @@ import static bomb.enumerations.Indicator.NSA; import static bomb.enumerations.Port.PARALLEL; -@DisplayComponent(resource = "caesar.fxml", buttonLinkerName = "Caesar Cipher") +@DisplayComponent(resource = "caesar_cipher.fxml", buttonLinkerName = "Caesar Cipher") public final class Caesar extends Widget { private static final int MAX_LETTER_COUNT = 26; diff --git a/src/main/java/bomb/modules/c/caesar/CaesarController.java b/src/main/java/bomb/modules/c/caesar/cipher/CaesarController.java similarity index 78% rename from src/main/java/bomb/modules/c/caesar/CaesarController.java rename to src/main/java/bomb/modules/c/caesar/cipher/CaesarController.java index 5994fa59..6e515307 100644 --- a/src/main/java/bomb/modules/c/caesar/CaesarController.java +++ b/src/main/java/bomb/modules/c/caesar/cipher/CaesarController.java @@ -1,4 +1,4 @@ -package bomb.modules.c.caesar; +package bomb.modules.c.caesar.cipher; import bomb.abstractions.Resettable; diff --git a/src/main/java/bomb/modules/dh/emoji/Emoji.java b/src/main/java/bomb/modules/dh/emoji/math/Emoji.java similarity index 96% rename from src/main/java/bomb/modules/dh/emoji/Emoji.java rename to src/main/java/bomb/modules/dh/emoji/math/Emoji.java index b328b6cb..9a5b5b2c 100644 --- a/src/main/java/bomb/modules/dh/emoji/Emoji.java +++ b/src/main/java/bomb/modules/dh/emoji/math/Emoji.java @@ -1,4 +1,4 @@ -package bomb.modules.dh.emoji; +package bomb.modules.dh.emoji.math; import bomb.abstractions.Labeled; diff --git a/src/main/java/bomb/modules/dh/emoji/EmojiController.java b/src/main/java/bomb/modules/dh/emoji/math/EmojiController.java similarity index 90% rename from src/main/java/bomb/modules/dh/emoji/EmojiController.java rename to src/main/java/bomb/modules/dh/emoji/math/EmojiController.java index f1c39a1c..c16fe10f 100644 --- a/src/main/java/bomb/modules/dh/emoji/EmojiController.java +++ b/src/main/java/bomb/modules/dh/emoji/math/EmojiController.java @@ -1,4 +1,4 @@ -package bomb.modules.dh.emoji; +package bomb.modules.dh.emoji.math; import bomb.abstractions.Resettable; import bomb.tools.event.HoverHandler; @@ -11,11 +11,11 @@ import java.util.Objects; import java.util.function.Consumer; -import static bomb.modules.dh.emoji.Emoji.EMOJI_MAP; -import static bomb.modules.dh.emoji.EmojiControllerState.END; -import static bomb.modules.dh.emoji.EmojiControllerState.FIRST_EMOJI_PRESS; -import static bomb.modules.dh.emoji.EmojiControllerState.MATH_SYMBOL_PRESS; -import static bomb.modules.dh.emoji.EmojiControllerState.RESET; +import static bomb.modules.dh.emoji.math.Emoji.EMOJI_MAP; +import static bomb.modules.dh.emoji.math.EmojiControllerState.END; +import static bomb.modules.dh.emoji.math.EmojiControllerState.FIRST_EMOJI_PRESS; +import static bomb.modules.dh.emoji.math.EmojiControllerState.MATH_SYMBOL_PRESS; +import static bomb.modules.dh.emoji.math.EmojiControllerState.RESET; import static bomb.tools.pattern.facade.FacadeFX.BUTTON_NAME_FROM_EVENT; public class EmojiController implements Resettable { diff --git a/src/main/java/bomb/modules/dh/emoji/EmojiControllerState.java b/src/main/java/bomb/modules/dh/emoji/math/EmojiControllerState.java similarity index 96% rename from src/main/java/bomb/modules/dh/emoji/EmojiControllerState.java rename to src/main/java/bomb/modules/dh/emoji/math/EmojiControllerState.java index dcaf51b4..7f55d0e6 100644 --- a/src/main/java/bomb/modules/dh/emoji/EmojiControllerState.java +++ b/src/main/java/bomb/modules/dh/emoji/math/EmojiControllerState.java @@ -1,4 +1,4 @@ -package bomb.modules.dh.emoji; +package bomb.modules.dh.emoji.math; import bomb.abstractions.State; diff --git a/src/main/java/bomb/modules/dh/emoji/EmojiMath.java b/src/main/java/bomb/modules/dh/emoji/math/EmojiMath.java similarity index 95% rename from src/main/java/bomb/modules/dh/emoji/EmojiMath.java rename to src/main/java/bomb/modules/dh/emoji/math/EmojiMath.java index b1dae289..60747b47 100644 --- a/src/main/java/bomb/modules/dh/emoji/EmojiMath.java +++ b/src/main/java/bomb/modules/dh/emoji/math/EmojiMath.java @@ -1,4 +1,4 @@ -package bomb.modules.dh.emoji; +package bomb.modules.dh.emoji.math; import bomb.Widget; import bomb.annotation.DisplayComponent; @@ -6,7 +6,7 @@ import org.intellij.lang.annotations.Language; import org.jetbrains.annotations.NotNull; -import static bomb.modules.dh.emoji.Emoji.EMOJI_MAP; +import static bomb.modules.dh.emoji.math.Emoji.EMOJI_MAP; /** * This class deals with the Emoji Math module. diff --git a/src/main/java/module-info.java b/src/main/java/module-info.java index b3f4cbbe..9a4e3da3 100644 --- a/src/main/java/module-info.java +++ b/src/main/java/module-info.java @@ -24,13 +24,13 @@ exports bomb.modules.ab.bitwise to javafx.fxml; exports bomb.modules.ab.blind.alley to javafx.fxml; exports bomb.modules.ab.bool.venn.diagram to javafx.fxml; - exports bomb.modules.c.caesar to javafx.fxml; + exports bomb.modules.c.caesar.cipher to javafx.fxml; exports bomb.modules.c.cheap.checkout to javafx.fxml; exports bomb.modules.c.chess to javafx.fxml; exports bomb.modules.c.chords to javafx.fxml; exports bomb.modules.c.color.flash to javafx.fxml; exports bomb.modules.c.colored.switches to javafx.fxml; - exports bomb.modules.dh.emoji to javafx.fxml; + exports bomb.modules.dh.emoji.math to javafx.fxml; exports bomb.modules.dh.fast.math to javafx.fxml; exports bomb.modules.dh.forget.me.not to javafx.fxml; exports bomb.modules.dh.hexamaze to javafx.fxml; diff --git a/src/main/resources/bomb/fxml/dh/emoji_math.fxml b/src/main/resources/bomb/fxml/dh/emoji_math.fxml index 508171bf..e644e681 100644 --- a/src/main/resources/bomb/fxml/dh/emoji_math.fxml +++ b/src/main/resources/bomb/fxml/dh/emoji_math.fxml @@ -12,7 +12,7 @@ + fx:controller="bomb.modules.dh.emoji.math.EmojiController"> diff --git a/src/main/resources/bomb/modules/c/caesar/cipher/caesar_cipher.fxml b/src/main/resources/bomb/modules/c/caesar/cipher/caesar_cipher.fxml new file mode 100644 index 00000000..26b60c58 --- /dev/null +++ b/src/main/resources/bomb/modules/c/caesar/cipher/caesar_cipher.fxml @@ -0,0 +1,13 @@ + + + + + + + + + + + diff --git a/src/test/java/bomb/modules/c/caesar/CaesarTest.java b/src/test/java/bomb/modules/c/caesar/cipher/CaesarTest.java similarity index 98% rename from src/test/java/bomb/modules/c/caesar/CaesarTest.java rename to src/test/java/bomb/modules/c/caesar/cipher/CaesarTest.java index 5de526c9..8a12ed50 100644 --- a/src/test/java/bomb/modules/c/caesar/CaesarTest.java +++ b/src/test/java/bomb/modules/c/caesar/cipher/CaesarTest.java @@ -1,4 +1,4 @@ -package bomb.modules.c.caesar; +package bomb.modules.c.caesar.cipher; import bomb.ConditionSetter; import bomb.Widget; diff --git a/src/test/java/bomb/modules/dh/emoji/EmojiMathTest.java b/src/test/java/bomb/modules/dh/emoji/math/EmojiMathTest.java similarity index 96% rename from src/test/java/bomb/modules/dh/emoji/EmojiMathTest.java rename to src/test/java/bomb/modules/dh/emoji/math/EmojiMathTest.java index b07ad2c9..e8c9b952 100644 --- a/src/test/java/bomb/modules/dh/emoji/EmojiMathTest.java +++ b/src/test/java/bomb/modules/dh/emoji/math/EmojiMathTest.java @@ -1,4 +1,4 @@ -package bomb.modules.dh.emoji; +package bomb.modules.dh.emoji.math; import org.testng.annotations.DataProvider; import org.testng.annotations.Test; diff --git a/src/test/resources/suites/suiteOne.xml b/src/test/resources/suites/suiteOne.xml index 14a6df79..a2c14e0b 100644 --- a/src/test/resources/suites/suiteOne.xml +++ b/src/test/resources/suites/suiteOne.xml @@ -16,7 +16,7 @@ - + diff --git a/src/test/resources/suites/suiteTwo.xml b/src/test/resources/suites/suiteTwo.xml index 0ba61a02..00d6d69c 100644 --- a/src/test/resources/suites/suiteTwo.xml +++ b/src/test/resources/suites/suiteTwo.xml @@ -4,7 +4,7 @@ - + From 5e5cf3291ce022fefbbe66b00b4679146e3cf230 Mon Sep 17 00:00:00 2001 From: "Mr. J" <45538844+Ultraviolet-Ninja@users.noreply.github.com> Date: Sun, 18 Dec 2022 20:55:24 -0600 Subject: [PATCH 69/86] Added most fxml files to their respective places in the modules folder --- .../bomb/modules/ab/astrology/Astrology.java | 2 +- .../java/bomb/modules/ab/bitwise/Bitwise.java | 2 +- .../ab/adventure/game/adventure_game.fxml | 13 + .../bomb/modules/ab/anagrams/anagrams.fxml | 13 + .../modules/ab/binary/leds/binary_leds.fxml | 13 + .../bomb/modules/ab/bitmaps/bitmaps.fxml | 13 + .../ab/broken/button/broken_button.fxml | 13 + .../c/cheap/checkout/cheap_checkout.fxml | 22 + .../resources/bomb/modules/c/chess/chess.fxml | 68 ++ .../modules/c/chords/chord_qualities.fxml | 23 + .../modules/c/color/flash/color_flash.fxml | 13 + .../bomb/modules/c/color/math/color_math.fxml | 13 + .../c/colored/squares/colored_squares.fxml | 13 + .../c/colored/switches/colored_switches.fxml | 178 ++++++ .../c/combination/lock/combination_lock.fxml | 13 + .../buttons/complicated_buttons.fxml | 7 + .../c/connection/check/connection_check.fxml | 13 + .../modules/c/coordinates/coordinates.fxml | 13 + .../bomb/modules/c/crazy/talk/crazy_talk.fxml | 13 + .../bomb/modules/c/creation/creation.fxml | 13 + .../bomb/modules/c/crossover/crossover.fxml | 13 + .../bomb/modules/c/crypto/crypto.fxml | 13 + .../bomb/modules/dh/double_oh/double_oh.fxml | 13 + .../modules/dh/emoji/math/emoji_math.fxml | 100 +++ .../modules/dh/english/test/english_test.fxml | 13 + .../bomb/modules/dh/fast/math/fast_math.fxml | 110 ++++ .../modules/dh/filibuster/filibuster.fxml | 13 + .../bomb/modules/dh/fizzbuzz/fizzbuzz.fxml | 13 + .../bomb/modules/dh/flags/flags.fxml | 13 + .../follow/the/leader/follow_the_leader.fxml | 13 + .../rates/foreign_exchange_rates.fxml | 13 + .../modules/dh/friendship/friendship.fxml | 13 + .../bomb/modules/dh/hexamaze/hexamaze.fxml | 87 +++ .../bomb/modules/il/ice/cream/ice_cream.fxml | 13 + .../bomb/modules/il/laundry/laundry.fxml | 117 ++++ .../il/led/encryption/led_encryption.fxml | 13 + .../modules/il/letter/keys/letter_keys.fxml | 8 + .../modules/il/light/cycle/light_cycle.fxml | 13 + .../bomb/modules/il/listening/listening.fxml | 13 + .../bomb/modules/il/logic/logic.fxml | 163 +++++ .../modules/m/math/is/hard/math_is_hard.fxml | 13 + .../m/microcontroller/microcontroller.fxml | 92 +++ .../modules/m/minesweeper/minesweeper.fxml | 13 + .../humanity/modules_against_humanity.fxml | 13 + .../modules/m/monsplode/monsplode_fight.fxml | 13 + .../modules/m/morsematics/morsematics.fxml | 13 + .../mouse/in/the/maze/mouse_in_the_maze.fxml | 13 + .../bomb/modules/m/murder/murder.fxml | 13 + .../m/mystic/squares/mystic_squares.fxml | 13 + .../np/neutralization/neutralization.fxml | 195 ++++++ .../np/neutralization/new_neutralization.fxml | 108 ++++ .../modules/np/number/pad/number_pad.fxml | 13 + .../modules/np/only/connect/only_connect.fxml | 13 + .../modules/np/orientation/orientation.fxml | 13 + .../np/perspective/pegs/perspective_pegs.fxml | 13 + .../np/piano/keys/cruel/piano_keys_cruel.fxml | 13 + .../modules/np/piano/keys/piano_keys.fxml | 13 + .../bomb/modules/np/plumbing/plumbing.fxml | 13 + .../np/point/of/order/point_of_order.fxml | 13 + .../bomb/modules/np/probing/probing.fxml | 13 + .../bomb/modules/r/resistors/resistors.fxml | 13 + .../bomb/modules/r/rhythms/rhythms.fxml | 13 + .../rock_paper_scissors_lizard_spock.fxml | 13 + .../r/round/keypads/round_keypads.fxml | 317 ++++++++++ .../modules/r/rubiks/cube/rubiks_cube.fxml | 13 + .../modules/s/safety/safe/safety_safe.fxml | 13 + .../bomb/modules/s/seashells/seashells.fxml | 13 + .../bomb/modules/s/semaphore/semaphore.fxml | 13 + .../modules/s/shape/shift/shape_shift.fxml | 10 + .../modules/s/silly/slots/silly_slots.fxml | 13 + .../s/simon/screams/simon_screams.fxml | 49 ++ .../modules/s/simon/states/simon_states.fxml | 13 + .../modules/s/skewed/slots/skewed_slots.fxml | 13 + .../s/square/button/square_button.fxml | 13 + .../bomb/modules/s/switches/switches.fxml | 89 +++ .../symbolic/password/symbolic_password.fxml | 13 + .../bomb/modules/t/text/field/text_field.fxml | 13 + .../bomb/modules/t/the/bulb/the_bulb.fxml | 115 ++++ .../bomb/modules/t/the/clock/the_clock.fxml | 13 + .../modules/t/the/gamepad/the_gamepad.fxml | 13 + .../bomb/modules/t/third/base/third_base.fxml | 13 + .../bomb/modules/t/three/d/maze/3d_maze.fxml | 24 + .../modules/t/tic/tac/toe/tic_tac_toe.fxml | 13 + .../old_translated_vanilla_modules.fxml | 593 ++++++++++++++++++ .../translated_vanilla_modules.fxml | 209 ++++++ .../t/turn/the/keys/turn_the_keys.fxml | 13 + .../bomb/modules/t/two/bit/two_bit.fxml | 44 ++ .../modules/wz/web/design/web_design.fxml | 13 + .../wz/wire/placement/wire_placement.fxml | 13 + .../wz/word/scramble/word_scramble.fxml | 13 + .../modules/wz/word/search/word_search.fxml | 13 + .../bomb/modules/wz/yahtzee/yahtzee.fxml | 13 + .../resources/bomb/modules/wz/zoo/zoo.fxml | 13 + 93 files changed, 3614 insertions(+), 2 deletions(-) create mode 100644 src/main/resources/bomb/modules/ab/adventure/game/adventure_game.fxml create mode 100644 src/main/resources/bomb/modules/ab/anagrams/anagrams.fxml create mode 100644 src/main/resources/bomb/modules/ab/binary/leds/binary_leds.fxml create mode 100644 src/main/resources/bomb/modules/ab/bitmaps/bitmaps.fxml create mode 100644 src/main/resources/bomb/modules/ab/broken/button/broken_button.fxml create mode 100644 src/main/resources/bomb/modules/c/cheap/checkout/cheap_checkout.fxml create mode 100644 src/main/resources/bomb/modules/c/chess/chess.fxml create mode 100644 src/main/resources/bomb/modules/c/chords/chord_qualities.fxml create mode 100644 src/main/resources/bomb/modules/c/color/flash/color_flash.fxml create mode 100644 src/main/resources/bomb/modules/c/color/math/color_math.fxml create mode 100644 src/main/resources/bomb/modules/c/colored/squares/colored_squares.fxml create mode 100644 src/main/resources/bomb/modules/c/colored/switches/colored_switches.fxml create mode 100644 src/main/resources/bomb/modules/c/combination/lock/combination_lock.fxml create mode 100644 src/main/resources/bomb/modules/c/complicated/buttons/complicated_buttons.fxml create mode 100644 src/main/resources/bomb/modules/c/connection/check/connection_check.fxml create mode 100644 src/main/resources/bomb/modules/c/coordinates/coordinates.fxml create mode 100644 src/main/resources/bomb/modules/c/crazy/talk/crazy_talk.fxml create mode 100644 src/main/resources/bomb/modules/c/creation/creation.fxml create mode 100644 src/main/resources/bomb/modules/c/crossover/crossover.fxml create mode 100644 src/main/resources/bomb/modules/c/crypto/crypto.fxml create mode 100644 src/main/resources/bomb/modules/dh/double_oh/double_oh.fxml create mode 100644 src/main/resources/bomb/modules/dh/emoji/math/emoji_math.fxml create mode 100644 src/main/resources/bomb/modules/dh/english/test/english_test.fxml create mode 100644 src/main/resources/bomb/modules/dh/fast/math/fast_math.fxml create mode 100644 src/main/resources/bomb/modules/dh/filibuster/filibuster.fxml create mode 100644 src/main/resources/bomb/modules/dh/fizzbuzz/fizzbuzz.fxml create mode 100644 src/main/resources/bomb/modules/dh/flags/flags.fxml create mode 100644 src/main/resources/bomb/modules/dh/follow/the/leader/follow_the_leader.fxml create mode 100644 src/main/resources/bomb/modules/dh/foreign/exchange/rates/foreign_exchange_rates.fxml create mode 100644 src/main/resources/bomb/modules/dh/friendship/friendship.fxml create mode 100644 src/main/resources/bomb/modules/dh/hexamaze/hexamaze.fxml create mode 100644 src/main/resources/bomb/modules/il/ice/cream/ice_cream.fxml create mode 100644 src/main/resources/bomb/modules/il/laundry/laundry.fxml create mode 100644 src/main/resources/bomb/modules/il/led/encryption/led_encryption.fxml create mode 100644 src/main/resources/bomb/modules/il/letter/keys/letter_keys.fxml create mode 100644 src/main/resources/bomb/modules/il/light/cycle/light_cycle.fxml create mode 100644 src/main/resources/bomb/modules/il/listening/listening.fxml create mode 100644 src/main/resources/bomb/modules/il/logic/logic.fxml create mode 100644 src/main/resources/bomb/modules/m/math/is/hard/math_is_hard.fxml create mode 100644 src/main/resources/bomb/modules/m/microcontroller/microcontroller.fxml create mode 100644 src/main/resources/bomb/modules/m/minesweeper/minesweeper.fxml create mode 100644 src/main/resources/bomb/modules/m/modules/against/humanity/modules_against_humanity.fxml create mode 100644 src/main/resources/bomb/modules/m/monsplode/monsplode_fight.fxml create mode 100644 src/main/resources/bomb/modules/m/morsematics/morsematics.fxml create mode 100644 src/main/resources/bomb/modules/m/mouse/in/the/maze/mouse_in_the_maze.fxml create mode 100644 src/main/resources/bomb/modules/m/murder/murder.fxml create mode 100644 src/main/resources/bomb/modules/m/mystic/squares/mystic_squares.fxml create mode 100644 src/main/resources/bomb/modules/np/neutralization/neutralization.fxml create mode 100644 src/main/resources/bomb/modules/np/neutralization/new_neutralization.fxml create mode 100644 src/main/resources/bomb/modules/np/number/pad/number_pad.fxml create mode 100644 src/main/resources/bomb/modules/np/only/connect/only_connect.fxml create mode 100644 src/main/resources/bomb/modules/np/orientation/orientation.fxml create mode 100644 src/main/resources/bomb/modules/np/perspective/pegs/perspective_pegs.fxml create mode 100644 src/main/resources/bomb/modules/np/piano/keys/cruel/piano_keys_cruel.fxml create mode 100644 src/main/resources/bomb/modules/np/piano/keys/piano_keys.fxml create mode 100644 src/main/resources/bomb/modules/np/plumbing/plumbing.fxml create mode 100644 src/main/resources/bomb/modules/np/point/of/order/point_of_order.fxml create mode 100644 src/main/resources/bomb/modules/np/probing/probing.fxml create mode 100644 src/main/resources/bomb/modules/r/resistors/resistors.fxml create mode 100644 src/main/resources/bomb/modules/r/rhythms/rhythms.fxml create mode 100644 src/main/resources/bomb/modules/r/rock/paper/scissors/rock_paper_scissors_lizard_spock.fxml create mode 100644 src/main/resources/bomb/modules/r/round/keypads/round_keypads.fxml create mode 100644 src/main/resources/bomb/modules/r/rubiks/cube/rubiks_cube.fxml create mode 100644 src/main/resources/bomb/modules/s/safety/safe/safety_safe.fxml create mode 100644 src/main/resources/bomb/modules/s/seashells/seashells.fxml create mode 100644 src/main/resources/bomb/modules/s/semaphore/semaphore.fxml create mode 100644 src/main/resources/bomb/modules/s/shape/shift/shape_shift.fxml create mode 100644 src/main/resources/bomb/modules/s/silly/slots/silly_slots.fxml create mode 100644 src/main/resources/bomb/modules/s/simon/screams/simon_screams.fxml create mode 100644 src/main/resources/bomb/modules/s/simon/states/simon_states.fxml create mode 100644 src/main/resources/bomb/modules/s/skewed/slots/skewed_slots.fxml create mode 100644 src/main/resources/bomb/modules/s/square/button/square_button.fxml create mode 100644 src/main/resources/bomb/modules/s/switches/switches.fxml create mode 100644 src/main/resources/bomb/modules/s/symbolic/password/symbolic_password.fxml create mode 100644 src/main/resources/bomb/modules/t/text/field/text_field.fxml create mode 100644 src/main/resources/bomb/modules/t/the/bulb/the_bulb.fxml create mode 100644 src/main/resources/bomb/modules/t/the/clock/the_clock.fxml create mode 100644 src/main/resources/bomb/modules/t/the/gamepad/the_gamepad.fxml create mode 100644 src/main/resources/bomb/modules/t/third/base/third_base.fxml create mode 100644 src/main/resources/bomb/modules/t/three/d/maze/3d_maze.fxml create mode 100644 src/main/resources/bomb/modules/t/tic/tac/toe/tic_tac_toe.fxml create mode 100644 src/main/resources/bomb/modules/t/translated/old_translated_vanilla_modules.fxml create mode 100644 src/main/resources/bomb/modules/t/translated/translated_vanilla_modules.fxml create mode 100644 src/main/resources/bomb/modules/t/turn/the/keys/turn_the_keys.fxml create mode 100644 src/main/resources/bomb/modules/t/two/bit/two_bit.fxml create mode 100644 src/main/resources/bomb/modules/wz/web/design/web_design.fxml create mode 100644 src/main/resources/bomb/modules/wz/wire/placement/wire_placement.fxml create mode 100644 src/main/resources/bomb/modules/wz/word/scramble/word_scramble.fxml create mode 100644 src/main/resources/bomb/modules/wz/word/search/word_search.fxml create mode 100644 src/main/resources/bomb/modules/wz/yahtzee/yahtzee.fxml create mode 100644 src/main/resources/bomb/modules/wz/zoo/zoo.fxml diff --git a/src/main/java/bomb/modules/ab/astrology/Astrology.java b/src/main/java/bomb/modules/ab/astrology/Astrology.java index 35933fc4..b8c12003 100644 --- a/src/main/java/bomb/modules/ab/astrology/Astrology.java +++ b/src/main/java/bomb/modules/ab/astrology/Astrology.java @@ -24,7 +24,7 @@ * The quantity of the number is used to determine when to press the button. * (i.e. Bad Omen at 5 means that you need to press "Bad Omen" when the bomb timer has a 5 in it) */ -@DisplayComponent(resource = "alphabet.fxml", buttonLinkerName = "Astrology") +@DisplayComponent(resource = "astrology.fxml", buttonLinkerName = "Astrology") public final class Astrology extends Widget { public static final byte ELEMENT_INDEX = 0, CELESTIAL_INDEX = 1, ZODIAC_INDEX = 2, EXPECTED_SIZE = 3; public static final String GOOD_OMEN = "Good Omen at ", POOR_OMEN = "Poor Omen at ", NO_OMEN = "No Omen"; diff --git a/src/main/java/bomb/modules/ab/bitwise/Bitwise.java b/src/main/java/bomb/modules/ab/bitwise/Bitwise.java index 4c014d5d..b73e0160 100644 --- a/src/main/java/bomb/modules/ab/bitwise/Bitwise.java +++ b/src/main/java/bomb/modules/ab/bitwise/Bitwise.java @@ -18,7 +18,7 @@ * number line with a specific boolean operator that the Defuser reads to the expert. The class evaluates * which bits will be 1 or 0 in the byte line. */ -@DisplayComponent(resource = "bitwise.fxml", buttonLinkerName = "Bitwise Ops") +@DisplayComponent(resource = "bitwise_ops.fxml", buttonLinkerName = "Bitwise Ops") public final class Bitwise extends Widget { /** * Turns the edgework conditions into a byte that the Defuser will input into the bomb module diff --git a/src/main/resources/bomb/modules/ab/adventure/game/adventure_game.fxml b/src/main/resources/bomb/modules/ab/adventure/game/adventure_game.fxml new file mode 100644 index 00000000..409108d7 --- /dev/null +++ b/src/main/resources/bomb/modules/ab/adventure/game/adventure_game.fxml @@ -0,0 +1,13 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/src/main/resources/bomb/modules/ab/anagrams/anagrams.fxml b/src/main/resources/bomb/modules/ab/anagrams/anagrams.fxml new file mode 100644 index 00000000..26b60c58 --- /dev/null +++ b/src/main/resources/bomb/modules/ab/anagrams/anagrams.fxml @@ -0,0 +1,13 @@ + + + + + + + + + + + diff --git a/src/main/resources/bomb/modules/ab/binary/leds/binary_leds.fxml b/src/main/resources/bomb/modules/ab/binary/leds/binary_leds.fxml new file mode 100644 index 00000000..26b60c58 --- /dev/null +++ b/src/main/resources/bomb/modules/ab/binary/leds/binary_leds.fxml @@ -0,0 +1,13 @@ + + + + + + + + + + + diff --git a/src/main/resources/bomb/modules/ab/bitmaps/bitmaps.fxml b/src/main/resources/bomb/modules/ab/bitmaps/bitmaps.fxml new file mode 100644 index 00000000..26b60c58 --- /dev/null +++ b/src/main/resources/bomb/modules/ab/bitmaps/bitmaps.fxml @@ -0,0 +1,13 @@ + + + + + + + + + + + diff --git a/src/main/resources/bomb/modules/ab/broken/button/broken_button.fxml b/src/main/resources/bomb/modules/ab/broken/button/broken_button.fxml new file mode 100644 index 00000000..26b60c58 --- /dev/null +++ b/src/main/resources/bomb/modules/ab/broken/button/broken_button.fxml @@ -0,0 +1,13 @@ + + + + + + + + + + + diff --git a/src/main/resources/bomb/modules/c/cheap/checkout/cheap_checkout.fxml b/src/main/resources/bomb/modules/c/cheap/checkout/cheap_checkout.fxml new file mode 100644 index 00000000..c15824f8 --- /dev/null +++ b/src/main/resources/bomb/modules/c/cheap/checkout/cheap_checkout.fxml @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/main/resources/bomb/modules/c/chess/chess.fxml b/src/main/resources/bomb/modules/c/chess/chess.fxml new file mode 100644 index 00000000..5361c342 --- /dev/null +++ b/src/main/resources/bomb/modules/c/chess/chess.fxml @@ -0,0 +1,68 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/main/resources/bomb/modules/c/chords/chord_qualities.fxml b/src/main/resources/bomb/modules/c/chords/chord_qualities.fxml new file mode 100644 index 00000000..a619d041 --- /dev/null +++ b/src/main/resources/bomb/modules/c/chords/chord_qualities.fxml @@ -0,0 +1,23 @@ + + + + + + + + + +
+ + + +
+ + + + + +
diff --git a/src/main/resources/bomb/modules/c/color/flash/color_flash.fxml b/src/main/resources/bomb/modules/c/color/flash/color_flash.fxml new file mode 100644 index 00000000..26b60c58 --- /dev/null +++ b/src/main/resources/bomb/modules/c/color/flash/color_flash.fxml @@ -0,0 +1,13 @@ + + + + + + + + + + + diff --git a/src/main/resources/bomb/modules/c/color/math/color_math.fxml b/src/main/resources/bomb/modules/c/color/math/color_math.fxml new file mode 100644 index 00000000..26b60c58 --- /dev/null +++ b/src/main/resources/bomb/modules/c/color/math/color_math.fxml @@ -0,0 +1,13 @@ + + + + + + + + + + + diff --git a/src/main/resources/bomb/modules/c/colored/squares/colored_squares.fxml b/src/main/resources/bomb/modules/c/colored/squares/colored_squares.fxml new file mode 100644 index 00000000..26b60c58 --- /dev/null +++ b/src/main/resources/bomb/modules/c/colored/squares/colored_squares.fxml @@ -0,0 +1,13 @@ + + + + + + + + + + + diff --git a/src/main/resources/bomb/modules/c/colored/switches/colored_switches.fxml b/src/main/resources/bomb/modules/c/colored/switches/colored_switches.fxml new file mode 100644 index 00000000..42bbe402 --- /dev/null +++ b/src/main/resources/bomb/modules/c/colored/switches/colored_switches.fxml @@ -0,0 +1,178 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/main/resources/bomb/modules/c/combination/lock/combination_lock.fxml b/src/main/resources/bomb/modules/c/combination/lock/combination_lock.fxml new file mode 100644 index 00000000..26b60c58 --- /dev/null +++ b/src/main/resources/bomb/modules/c/combination/lock/combination_lock.fxml @@ -0,0 +1,13 @@ + + + + + + + + + + + diff --git a/src/main/resources/bomb/modules/c/complicated/buttons/complicated_buttons.fxml b/src/main/resources/bomb/modules/c/complicated/buttons/complicated_buttons.fxml new file mode 100644 index 00000000..d3639e30 --- /dev/null +++ b/src/main/resources/bomb/modules/c/complicated/buttons/complicated_buttons.fxml @@ -0,0 +1,7 @@ + + + + + + diff --git a/src/main/resources/bomb/modules/c/connection/check/connection_check.fxml b/src/main/resources/bomb/modules/c/connection/check/connection_check.fxml new file mode 100644 index 00000000..26b60c58 --- /dev/null +++ b/src/main/resources/bomb/modules/c/connection/check/connection_check.fxml @@ -0,0 +1,13 @@ + + + + + + + + + + + diff --git a/src/main/resources/bomb/modules/c/coordinates/coordinates.fxml b/src/main/resources/bomb/modules/c/coordinates/coordinates.fxml new file mode 100644 index 00000000..26b60c58 --- /dev/null +++ b/src/main/resources/bomb/modules/c/coordinates/coordinates.fxml @@ -0,0 +1,13 @@ + + + + + + + + + + + diff --git a/src/main/resources/bomb/modules/c/crazy/talk/crazy_talk.fxml b/src/main/resources/bomb/modules/c/crazy/talk/crazy_talk.fxml new file mode 100644 index 00000000..26b60c58 --- /dev/null +++ b/src/main/resources/bomb/modules/c/crazy/talk/crazy_talk.fxml @@ -0,0 +1,13 @@ + + + + + + + + + + + diff --git a/src/main/resources/bomb/modules/c/creation/creation.fxml b/src/main/resources/bomb/modules/c/creation/creation.fxml new file mode 100644 index 00000000..26b60c58 --- /dev/null +++ b/src/main/resources/bomb/modules/c/creation/creation.fxml @@ -0,0 +1,13 @@ + + + + + + + + + + + diff --git a/src/main/resources/bomb/modules/c/crossover/crossover.fxml b/src/main/resources/bomb/modules/c/crossover/crossover.fxml new file mode 100644 index 00000000..26b60c58 --- /dev/null +++ b/src/main/resources/bomb/modules/c/crossover/crossover.fxml @@ -0,0 +1,13 @@ + + + + + + + + + + + diff --git a/src/main/resources/bomb/modules/c/crypto/crypto.fxml b/src/main/resources/bomb/modules/c/crypto/crypto.fxml new file mode 100644 index 00000000..26b60c58 --- /dev/null +++ b/src/main/resources/bomb/modules/c/crypto/crypto.fxml @@ -0,0 +1,13 @@ + + + + + + + + + + + diff --git a/src/main/resources/bomb/modules/dh/double_oh/double_oh.fxml b/src/main/resources/bomb/modules/dh/double_oh/double_oh.fxml new file mode 100644 index 00000000..26b60c58 --- /dev/null +++ b/src/main/resources/bomb/modules/dh/double_oh/double_oh.fxml @@ -0,0 +1,13 @@ + + + + + + + + + + + diff --git a/src/main/resources/bomb/modules/dh/emoji/math/emoji_math.fxml b/src/main/resources/bomb/modules/dh/emoji/math/emoji_math.fxml new file mode 100644 index 00000000..5ca843f9 --- /dev/null +++ b/src/main/resources/bomb/modules/dh/emoji/math/emoji_math.fxml @@ -0,0 +1,100 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/main/resources/bomb/modules/dh/english/test/english_test.fxml b/src/main/resources/bomb/modules/dh/english/test/english_test.fxml new file mode 100644 index 00000000..26b60c58 --- /dev/null +++ b/src/main/resources/bomb/modules/dh/english/test/english_test.fxml @@ -0,0 +1,13 @@ + + + + + + + + + + + diff --git a/src/main/resources/bomb/modules/dh/fast/math/fast_math.fxml b/src/main/resources/bomb/modules/dh/fast/math/fast_math.fxml new file mode 100644 index 00000000..a0837230 --- /dev/null +++ b/src/main/resources/bomb/modules/dh/fast/math/fast_math.fxml @@ -0,0 +1,110 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + +
+
diff --git a/src/main/resources/bomb/modules/dh/filibuster/filibuster.fxml b/src/main/resources/bomb/modules/dh/filibuster/filibuster.fxml new file mode 100644 index 00000000..26b60c58 --- /dev/null +++ b/src/main/resources/bomb/modules/dh/filibuster/filibuster.fxml @@ -0,0 +1,13 @@ + + + + + + + + + + + diff --git a/src/main/resources/bomb/modules/dh/fizzbuzz/fizzbuzz.fxml b/src/main/resources/bomb/modules/dh/fizzbuzz/fizzbuzz.fxml new file mode 100644 index 00000000..26b60c58 --- /dev/null +++ b/src/main/resources/bomb/modules/dh/fizzbuzz/fizzbuzz.fxml @@ -0,0 +1,13 @@ + + + + + + + + + + + diff --git a/src/main/resources/bomb/modules/dh/flags/flags.fxml b/src/main/resources/bomb/modules/dh/flags/flags.fxml new file mode 100644 index 00000000..26b60c58 --- /dev/null +++ b/src/main/resources/bomb/modules/dh/flags/flags.fxml @@ -0,0 +1,13 @@ + + + + + + + + + + + diff --git a/src/main/resources/bomb/modules/dh/follow/the/leader/follow_the_leader.fxml b/src/main/resources/bomb/modules/dh/follow/the/leader/follow_the_leader.fxml new file mode 100644 index 00000000..26b60c58 --- /dev/null +++ b/src/main/resources/bomb/modules/dh/follow/the/leader/follow_the_leader.fxml @@ -0,0 +1,13 @@ + + + + + + + + + + + diff --git a/src/main/resources/bomb/modules/dh/foreign/exchange/rates/foreign_exchange_rates.fxml b/src/main/resources/bomb/modules/dh/foreign/exchange/rates/foreign_exchange_rates.fxml new file mode 100644 index 00000000..26b60c58 --- /dev/null +++ b/src/main/resources/bomb/modules/dh/foreign/exchange/rates/foreign_exchange_rates.fxml @@ -0,0 +1,13 @@ + + + + + + + + + + + diff --git a/src/main/resources/bomb/modules/dh/friendship/friendship.fxml b/src/main/resources/bomb/modules/dh/friendship/friendship.fxml new file mode 100644 index 00000000..26b60c58 --- /dev/null +++ b/src/main/resources/bomb/modules/dh/friendship/friendship.fxml @@ -0,0 +1,13 @@ + + + + + + + + + + + diff --git a/src/main/resources/bomb/modules/dh/hexamaze/hexamaze.fxml b/src/main/resources/bomb/modules/dh/hexamaze/hexamaze.fxml new file mode 100644 index 00000000..c63e1891 --- /dev/null +++ b/src/main/resources/bomb/modules/dh/hexamaze/hexamaze.fxml @@ -0,0 +1,87 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/main/resources/bomb/modules/il/ice/cream/ice_cream.fxml b/src/main/resources/bomb/modules/il/ice/cream/ice_cream.fxml new file mode 100644 index 00000000..26b60c58 --- /dev/null +++ b/src/main/resources/bomb/modules/il/ice/cream/ice_cream.fxml @@ -0,0 +1,13 @@ + + + + + + + + + + + diff --git a/src/main/resources/bomb/modules/il/laundry/laundry.fxml b/src/main/resources/bomb/modules/il/laundry/laundry.fxml new file mode 100644 index 00000000..b45a213d --- /dev/null +++ b/src/main/resources/bomb/modules/il/laundry/laundry.fxml @@ -0,0 +1,117 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/main/resources/bomb/modules/il/led/encryption/led_encryption.fxml b/src/main/resources/bomb/modules/il/led/encryption/led_encryption.fxml new file mode 100644 index 00000000..26b60c58 --- /dev/null +++ b/src/main/resources/bomb/modules/il/led/encryption/led_encryption.fxml @@ -0,0 +1,13 @@ + + + + + + + + + + + diff --git a/src/main/resources/bomb/modules/il/letter/keys/letter_keys.fxml b/src/main/resources/bomb/modules/il/letter/keys/letter_keys.fxml new file mode 100644 index 00000000..aab2fe9e --- /dev/null +++ b/src/main/resources/bomb/modules/il/letter/keys/letter_keys.fxml @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/src/main/resources/bomb/modules/il/light/cycle/light_cycle.fxml b/src/main/resources/bomb/modules/il/light/cycle/light_cycle.fxml new file mode 100644 index 00000000..26b60c58 --- /dev/null +++ b/src/main/resources/bomb/modules/il/light/cycle/light_cycle.fxml @@ -0,0 +1,13 @@ + + + + + + + + + + + diff --git a/src/main/resources/bomb/modules/il/listening/listening.fxml b/src/main/resources/bomb/modules/il/listening/listening.fxml new file mode 100644 index 00000000..26b60c58 --- /dev/null +++ b/src/main/resources/bomb/modules/il/listening/listening.fxml @@ -0,0 +1,13 @@ + + + + + + + + + + + diff --git a/src/main/resources/bomb/modules/il/logic/logic.fxml b/src/main/resources/bomb/modules/il/logic/logic.fxml new file mode 100644 index 00000000..53119963 --- /dev/null +++ b/src/main/resources/bomb/modules/il/logic/logic.fxml @@ -0,0 +1,163 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/main/resources/bomb/modules/m/math/is/hard/math_is_hard.fxml b/src/main/resources/bomb/modules/m/math/is/hard/math_is_hard.fxml new file mode 100644 index 00000000..26b60c58 --- /dev/null +++ b/src/main/resources/bomb/modules/m/math/is/hard/math_is_hard.fxml @@ -0,0 +1,13 @@ + + + + + + + + + + + diff --git a/src/main/resources/bomb/modules/m/microcontroller/microcontroller.fxml b/src/main/resources/bomb/modules/m/microcontroller/microcontroller.fxml new file mode 100644 index 00000000..c88fd669 --- /dev/null +++ b/src/main/resources/bomb/modules/m/microcontroller/microcontroller.fxml @@ -0,0 +1,92 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/main/resources/bomb/modules/m/minesweeper/minesweeper.fxml b/src/main/resources/bomb/modules/m/minesweeper/minesweeper.fxml new file mode 100644 index 00000000..26b60c58 --- /dev/null +++ b/src/main/resources/bomb/modules/m/minesweeper/minesweeper.fxml @@ -0,0 +1,13 @@ + + + + + + + + + + + diff --git a/src/main/resources/bomb/modules/m/modules/against/humanity/modules_against_humanity.fxml b/src/main/resources/bomb/modules/m/modules/against/humanity/modules_against_humanity.fxml new file mode 100644 index 00000000..26b60c58 --- /dev/null +++ b/src/main/resources/bomb/modules/m/modules/against/humanity/modules_against_humanity.fxml @@ -0,0 +1,13 @@ + + + + + + + + + + + diff --git a/src/main/resources/bomb/modules/m/monsplode/monsplode_fight.fxml b/src/main/resources/bomb/modules/m/monsplode/monsplode_fight.fxml new file mode 100644 index 00000000..26b60c58 --- /dev/null +++ b/src/main/resources/bomb/modules/m/monsplode/monsplode_fight.fxml @@ -0,0 +1,13 @@ + + + + + + + + + + + diff --git a/src/main/resources/bomb/modules/m/morsematics/morsematics.fxml b/src/main/resources/bomb/modules/m/morsematics/morsematics.fxml new file mode 100644 index 00000000..26b60c58 --- /dev/null +++ b/src/main/resources/bomb/modules/m/morsematics/morsematics.fxml @@ -0,0 +1,13 @@ + + + + + + + + + + + diff --git a/src/main/resources/bomb/modules/m/mouse/in/the/maze/mouse_in_the_maze.fxml b/src/main/resources/bomb/modules/m/mouse/in/the/maze/mouse_in_the_maze.fxml new file mode 100644 index 00000000..26b60c58 --- /dev/null +++ b/src/main/resources/bomb/modules/m/mouse/in/the/maze/mouse_in_the_maze.fxml @@ -0,0 +1,13 @@ + + + + + + + + + + + diff --git a/src/main/resources/bomb/modules/m/murder/murder.fxml b/src/main/resources/bomb/modules/m/murder/murder.fxml new file mode 100644 index 00000000..26b60c58 --- /dev/null +++ b/src/main/resources/bomb/modules/m/murder/murder.fxml @@ -0,0 +1,13 @@ + + + + + + + + + + + diff --git a/src/main/resources/bomb/modules/m/mystic/squares/mystic_squares.fxml b/src/main/resources/bomb/modules/m/mystic/squares/mystic_squares.fxml new file mode 100644 index 00000000..26b60c58 --- /dev/null +++ b/src/main/resources/bomb/modules/m/mystic/squares/mystic_squares.fxml @@ -0,0 +1,13 @@ + + + + + + + + + + + diff --git a/src/main/resources/bomb/modules/np/neutralization/neutralization.fxml b/src/main/resources/bomb/modules/np/neutralization/neutralization.fxml new file mode 100644 index 00000000..a1bc48d3 --- /dev/null +++ b/src/main/resources/bomb/modules/np/neutralization/neutralization.fxml @@ -0,0 +1,195 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/main/resources/bomb/modules/np/neutralization/new_neutralization.fxml b/src/main/resources/bomb/modules/np/neutralization/new_neutralization.fxml new file mode 100644 index 00000000..f4a10f59 --- /dev/null +++ b/src/main/resources/bomb/modules/np/neutralization/new_neutralization.fxml @@ -0,0 +1,108 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/main/resources/bomb/modules/np/number/pad/number_pad.fxml b/src/main/resources/bomb/modules/np/number/pad/number_pad.fxml new file mode 100644 index 00000000..26b60c58 --- /dev/null +++ b/src/main/resources/bomb/modules/np/number/pad/number_pad.fxml @@ -0,0 +1,13 @@ + + + + + + + + + + + diff --git a/src/main/resources/bomb/modules/np/only/connect/only_connect.fxml b/src/main/resources/bomb/modules/np/only/connect/only_connect.fxml new file mode 100644 index 00000000..26b60c58 --- /dev/null +++ b/src/main/resources/bomb/modules/np/only/connect/only_connect.fxml @@ -0,0 +1,13 @@ + + + + + + + + + + + diff --git a/src/main/resources/bomb/modules/np/orientation/orientation.fxml b/src/main/resources/bomb/modules/np/orientation/orientation.fxml new file mode 100644 index 00000000..26b60c58 --- /dev/null +++ b/src/main/resources/bomb/modules/np/orientation/orientation.fxml @@ -0,0 +1,13 @@ + + + + + + + + + + + diff --git a/src/main/resources/bomb/modules/np/perspective/pegs/perspective_pegs.fxml b/src/main/resources/bomb/modules/np/perspective/pegs/perspective_pegs.fxml new file mode 100644 index 00000000..26b60c58 --- /dev/null +++ b/src/main/resources/bomb/modules/np/perspective/pegs/perspective_pegs.fxml @@ -0,0 +1,13 @@ + + + + + + + + + + + diff --git a/src/main/resources/bomb/modules/np/piano/keys/cruel/piano_keys_cruel.fxml b/src/main/resources/bomb/modules/np/piano/keys/cruel/piano_keys_cruel.fxml new file mode 100644 index 00000000..26b60c58 --- /dev/null +++ b/src/main/resources/bomb/modules/np/piano/keys/cruel/piano_keys_cruel.fxml @@ -0,0 +1,13 @@ + + + + + + + + + + + diff --git a/src/main/resources/bomb/modules/np/piano/keys/piano_keys.fxml b/src/main/resources/bomb/modules/np/piano/keys/piano_keys.fxml new file mode 100644 index 00000000..26b60c58 --- /dev/null +++ b/src/main/resources/bomb/modules/np/piano/keys/piano_keys.fxml @@ -0,0 +1,13 @@ + + + + + + + + + + + diff --git a/src/main/resources/bomb/modules/np/plumbing/plumbing.fxml b/src/main/resources/bomb/modules/np/plumbing/plumbing.fxml new file mode 100644 index 00000000..26b60c58 --- /dev/null +++ b/src/main/resources/bomb/modules/np/plumbing/plumbing.fxml @@ -0,0 +1,13 @@ + + + + + + + + + + + diff --git a/src/main/resources/bomb/modules/np/point/of/order/point_of_order.fxml b/src/main/resources/bomb/modules/np/point/of/order/point_of_order.fxml new file mode 100644 index 00000000..26b60c58 --- /dev/null +++ b/src/main/resources/bomb/modules/np/point/of/order/point_of_order.fxml @@ -0,0 +1,13 @@ + + + + + + + + + + + diff --git a/src/main/resources/bomb/modules/np/probing/probing.fxml b/src/main/resources/bomb/modules/np/probing/probing.fxml new file mode 100644 index 00000000..26b60c58 --- /dev/null +++ b/src/main/resources/bomb/modules/np/probing/probing.fxml @@ -0,0 +1,13 @@ + + + + + + + + + + + diff --git a/src/main/resources/bomb/modules/r/resistors/resistors.fxml b/src/main/resources/bomb/modules/r/resistors/resistors.fxml new file mode 100644 index 00000000..26b60c58 --- /dev/null +++ b/src/main/resources/bomb/modules/r/resistors/resistors.fxml @@ -0,0 +1,13 @@ + + + + + + + + + + + diff --git a/src/main/resources/bomb/modules/r/rhythms/rhythms.fxml b/src/main/resources/bomb/modules/r/rhythms/rhythms.fxml new file mode 100644 index 00000000..26b60c58 --- /dev/null +++ b/src/main/resources/bomb/modules/r/rhythms/rhythms.fxml @@ -0,0 +1,13 @@ + + + + + + + + + + + diff --git a/src/main/resources/bomb/modules/r/rock/paper/scissors/rock_paper_scissors_lizard_spock.fxml b/src/main/resources/bomb/modules/r/rock/paper/scissors/rock_paper_scissors_lizard_spock.fxml new file mode 100644 index 00000000..26b60c58 --- /dev/null +++ b/src/main/resources/bomb/modules/r/rock/paper/scissors/rock_paper_scissors_lizard_spock.fxml @@ -0,0 +1,13 @@ + + + + + + + + + + + diff --git a/src/main/resources/bomb/modules/r/round/keypads/round_keypads.fxml b/src/main/resources/bomb/modules/r/round/keypads/round_keypads.fxml new file mode 100644 index 00000000..ce39bc54 --- /dev/null +++ b/src/main/resources/bomb/modules/r/round/keypads/round_keypads.fxml @@ -0,0 +1,317 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/main/resources/bomb/modules/r/rubiks/cube/rubiks_cube.fxml b/src/main/resources/bomb/modules/r/rubiks/cube/rubiks_cube.fxml new file mode 100644 index 00000000..26b60c58 --- /dev/null +++ b/src/main/resources/bomb/modules/r/rubiks/cube/rubiks_cube.fxml @@ -0,0 +1,13 @@ + + + + + + + + + + + diff --git a/src/main/resources/bomb/modules/s/safety/safe/safety_safe.fxml b/src/main/resources/bomb/modules/s/safety/safe/safety_safe.fxml new file mode 100644 index 00000000..26b60c58 --- /dev/null +++ b/src/main/resources/bomb/modules/s/safety/safe/safety_safe.fxml @@ -0,0 +1,13 @@ + + + + + + + + + + + diff --git a/src/main/resources/bomb/modules/s/seashells/seashells.fxml b/src/main/resources/bomb/modules/s/seashells/seashells.fxml new file mode 100644 index 00000000..26b60c58 --- /dev/null +++ b/src/main/resources/bomb/modules/s/seashells/seashells.fxml @@ -0,0 +1,13 @@ + + + + + + + + + + + diff --git a/src/main/resources/bomb/modules/s/semaphore/semaphore.fxml b/src/main/resources/bomb/modules/s/semaphore/semaphore.fxml new file mode 100644 index 00000000..26b60c58 --- /dev/null +++ b/src/main/resources/bomb/modules/s/semaphore/semaphore.fxml @@ -0,0 +1,13 @@ + + + + + + + + + + + diff --git a/src/main/resources/bomb/modules/s/shape/shift/shape_shift.fxml b/src/main/resources/bomb/modules/s/shape/shift/shape_shift.fxml new file mode 100644 index 00000000..de6aeab5 --- /dev/null +++ b/src/main/resources/bomb/modules/s/shape/shift/shape_shift.fxml @@ -0,0 +1,10 @@ + + + + + + + + diff --git a/src/main/resources/bomb/modules/s/silly/slots/silly_slots.fxml b/src/main/resources/bomb/modules/s/silly/slots/silly_slots.fxml new file mode 100644 index 00000000..26b60c58 --- /dev/null +++ b/src/main/resources/bomb/modules/s/silly/slots/silly_slots.fxml @@ -0,0 +1,13 @@ + + + + + + + + + + + diff --git a/src/main/resources/bomb/modules/s/simon/screams/simon_screams.fxml b/src/main/resources/bomb/modules/s/simon/screams/simon_screams.fxml new file mode 100644 index 00000000..141554b2 --- /dev/null +++ b/src/main/resources/bomb/modules/s/simon/screams/simon_screams.fxml @@ -0,0 +1,49 @@ + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/main/resources/bomb/modules/s/simon/states/simon_states.fxml b/src/main/resources/bomb/modules/s/simon/states/simon_states.fxml new file mode 100644 index 00000000..26b60c58 --- /dev/null +++ b/src/main/resources/bomb/modules/s/simon/states/simon_states.fxml @@ -0,0 +1,13 @@ + + + + + + + + + + + diff --git a/src/main/resources/bomb/modules/s/skewed/slots/skewed_slots.fxml b/src/main/resources/bomb/modules/s/skewed/slots/skewed_slots.fxml new file mode 100644 index 00000000..26b60c58 --- /dev/null +++ b/src/main/resources/bomb/modules/s/skewed/slots/skewed_slots.fxml @@ -0,0 +1,13 @@ + + + + + + + + + + + diff --git a/src/main/resources/bomb/modules/s/square/button/square_button.fxml b/src/main/resources/bomb/modules/s/square/button/square_button.fxml new file mode 100644 index 00000000..26b60c58 --- /dev/null +++ b/src/main/resources/bomb/modules/s/square/button/square_button.fxml @@ -0,0 +1,13 @@ + + + + + + + + + + + diff --git a/src/main/resources/bomb/modules/s/switches/switches.fxml b/src/main/resources/bomb/modules/s/switches/switches.fxml new file mode 100644 index 00000000..ef85533f --- /dev/null +++ b/src/main/resources/bomb/modules/s/switches/switches.fxml @@ -0,0 +1,89 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/main/resources/bomb/modules/s/symbolic/password/symbolic_password.fxml b/src/main/resources/bomb/modules/s/symbolic/password/symbolic_password.fxml new file mode 100644 index 00000000..26b60c58 --- /dev/null +++ b/src/main/resources/bomb/modules/s/symbolic/password/symbolic_password.fxml @@ -0,0 +1,13 @@ + + + + + + + + + + + diff --git a/src/main/resources/bomb/modules/t/text/field/text_field.fxml b/src/main/resources/bomb/modules/t/text/field/text_field.fxml new file mode 100644 index 00000000..26b60c58 --- /dev/null +++ b/src/main/resources/bomb/modules/t/text/field/text_field.fxml @@ -0,0 +1,13 @@ + + + + + + + + + + + diff --git a/src/main/resources/bomb/modules/t/the/bulb/the_bulb.fxml b/src/main/resources/bomb/modules/t/the/bulb/the_bulb.fxml new file mode 100644 index 00000000..6653c5c7 --- /dev/null +++ b/src/main/resources/bomb/modules/t/the/bulb/the_bulb.fxml @@ -0,0 +1,115 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/main/resources/bomb/modules/t/the/clock/the_clock.fxml b/src/main/resources/bomb/modules/t/the/clock/the_clock.fxml new file mode 100644 index 00000000..26b60c58 --- /dev/null +++ b/src/main/resources/bomb/modules/t/the/clock/the_clock.fxml @@ -0,0 +1,13 @@ + + + + + + + + + + + diff --git a/src/main/resources/bomb/modules/t/the/gamepad/the_gamepad.fxml b/src/main/resources/bomb/modules/t/the/gamepad/the_gamepad.fxml new file mode 100644 index 00000000..26b60c58 --- /dev/null +++ b/src/main/resources/bomb/modules/t/the/gamepad/the_gamepad.fxml @@ -0,0 +1,13 @@ + + + + + + + + + + + diff --git a/src/main/resources/bomb/modules/t/third/base/third_base.fxml b/src/main/resources/bomb/modules/t/third/base/third_base.fxml new file mode 100644 index 00000000..26b60c58 --- /dev/null +++ b/src/main/resources/bomb/modules/t/third/base/third_base.fxml @@ -0,0 +1,13 @@ + + + + + + + + + + + diff --git a/src/main/resources/bomb/modules/t/three/d/maze/3d_maze.fxml b/src/main/resources/bomb/modules/t/three/d/maze/3d_maze.fxml new file mode 100644 index 00000000..d5dccebc --- /dev/null +++ b/src/main/resources/bomb/modules/t/three/d/maze/3d_maze.fxml @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/main/resources/bomb/modules/t/tic/tac/toe/tic_tac_toe.fxml b/src/main/resources/bomb/modules/t/tic/tac/toe/tic_tac_toe.fxml new file mode 100644 index 00000000..26b60c58 --- /dev/null +++ b/src/main/resources/bomb/modules/t/tic/tac/toe/tic_tac_toe.fxml @@ -0,0 +1,13 @@ + + + + + + + + + + + diff --git a/src/main/resources/bomb/modules/t/translated/old_translated_vanilla_modules.fxml b/src/main/resources/bomb/modules/t/translated/old_translated_vanilla_modules.fxml new file mode 100644 index 00000000..6b50244f --- /dev/null +++ b/src/main/resources/bomb/modules/t/translated/old_translated_vanilla_modules.fxml @@ -0,0 +1,593 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +
+ + + +
+ +
+ + + +
+ + + +
+ +
+ + + +
+ + + +
+ +
+ + + +
+ + + +
+ +
+ + + +
+ + + +
+ +
+ + + +
+ + + +
+ +
+ + + +
+ + + +
+ +
+ + + +
+ + + +
+ +
+ + + +
+ + + +
+ +
+ + + +
+ + + +
+ +
+ + + +
+ + + +
+ +
+ + + +
+ + + +
+ +
+ + + +
+ + + +
+ +
+ + + +
+ + + +
+ +
+ + + +
+ + + +
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
diff --git a/src/main/resources/bomb/modules/t/translated/translated_vanilla_modules.fxml b/src/main/resources/bomb/modules/t/translated/translated_vanilla_modules.fxml new file mode 100644 index 00000000..9dcbc289 --- /dev/null +++ b/src/main/resources/bomb/modules/t/translated/translated_vanilla_modules.fxml @@ -0,0 +1,209 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/main/resources/bomb/modules/t/turn/the/keys/turn_the_keys.fxml b/src/main/resources/bomb/modules/t/turn/the/keys/turn_the_keys.fxml new file mode 100644 index 00000000..fd33361b --- /dev/null +++ b/src/main/resources/bomb/modules/t/turn/the/keys/turn_the_keys.fxml @@ -0,0 +1,13 @@ + + + + + + + + + + + diff --git a/src/main/resources/bomb/modules/t/two/bit/two_bit.fxml b/src/main/resources/bomb/modules/t/two/bit/two_bit.fxml new file mode 100644 index 00000000..8653418d --- /dev/null +++ b/src/main/resources/bomb/modules/t/two/bit/two_bit.fxml @@ -0,0 +1,44 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/main/resources/bomb/modules/wz/web/design/web_design.fxml b/src/main/resources/bomb/modules/wz/web/design/web_design.fxml new file mode 100644 index 00000000..26b60c58 --- /dev/null +++ b/src/main/resources/bomb/modules/wz/web/design/web_design.fxml @@ -0,0 +1,13 @@ + + + + + + + + + + + diff --git a/src/main/resources/bomb/modules/wz/wire/placement/wire_placement.fxml b/src/main/resources/bomb/modules/wz/wire/placement/wire_placement.fxml new file mode 100644 index 00000000..26b60c58 --- /dev/null +++ b/src/main/resources/bomb/modules/wz/wire/placement/wire_placement.fxml @@ -0,0 +1,13 @@ + + + + + + + + + + + diff --git a/src/main/resources/bomb/modules/wz/word/scramble/word_scramble.fxml b/src/main/resources/bomb/modules/wz/word/scramble/word_scramble.fxml new file mode 100644 index 00000000..409108d7 --- /dev/null +++ b/src/main/resources/bomb/modules/wz/word/scramble/word_scramble.fxml @@ -0,0 +1,13 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/src/main/resources/bomb/modules/wz/word/search/word_search.fxml b/src/main/resources/bomb/modules/wz/word/search/word_search.fxml new file mode 100644 index 00000000..26b60c58 --- /dev/null +++ b/src/main/resources/bomb/modules/wz/word/search/word_search.fxml @@ -0,0 +1,13 @@ + + + + + + + + + + + diff --git a/src/main/resources/bomb/modules/wz/yahtzee/yahtzee.fxml b/src/main/resources/bomb/modules/wz/yahtzee/yahtzee.fxml new file mode 100644 index 00000000..26b60c58 --- /dev/null +++ b/src/main/resources/bomb/modules/wz/yahtzee/yahtzee.fxml @@ -0,0 +1,13 @@ + + + + + + + + + + + diff --git a/src/main/resources/bomb/modules/wz/zoo/zoo.fxml b/src/main/resources/bomb/modules/wz/zoo/zoo.fxml new file mode 100644 index 00000000..26b60c58 --- /dev/null +++ b/src/main/resources/bomb/modules/wz/zoo/zoo.fxml @@ -0,0 +1,13 @@ + + + + + + + + + + + From df8f51a9e9f4874b0c94727c61436d676e9cd689 Mon Sep 17 00:00:00 2001 From: "Mr. J" <45538844+Ultraviolet-Ninja@users.noreply.github.com> Date: Sun, 18 Dec 2022 21:14:03 -0600 Subject: [PATCH 70/86] Added the last needed fxml files --- .../dh/forget/me/not/forget_me_not.fxml | 112 +++++ .../bomb/modules/s/souvenir/souvenir.fxml | 44 ++ src/main/resources/bomb/widget.fxml | 472 ++++++++++++++++++ 3 files changed, 628 insertions(+) create mode 100644 src/main/resources/bomb/modules/dh/forget/me/not/forget_me_not.fxml create mode 100644 src/main/resources/bomb/modules/s/souvenir/souvenir.fxml create mode 100644 src/main/resources/bomb/widget.fxml diff --git a/src/main/resources/bomb/modules/dh/forget/me/not/forget_me_not.fxml b/src/main/resources/bomb/modules/dh/forget/me/not/forget_me_not.fxml new file mode 100644 index 00000000..31042066 --- /dev/null +++ b/src/main/resources/bomb/modules/dh/forget/me/not/forget_me_not.fxml @@ -0,0 +1,112 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/main/resources/bomb/modules/s/souvenir/souvenir.fxml b/src/main/resources/bomb/modules/s/souvenir/souvenir.fxml new file mode 100644 index 00000000..5b32f755 --- /dev/null +++ b/src/main/resources/bomb/modules/s/souvenir/souvenir.fxml @@ -0,0 +1,44 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/main/resources/bomb/widget.fxml b/src/main/resources/bomb/widget.fxml new file mode 100644 index 00000000..7bf06834 --- /dev/null +++ b/src/main/resources/bomb/widget.fxml @@ -0,0 +1,472 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + From 72dbcbb9cf4f72d0954d22683779d6ea5f7c4361 Mon Sep 17 00:00:00 2001 From: "Mr. J" <45538844+Ultraviolet-Ninja@users.noreply.github.com> Date: Sun, 18 Dec 2022 21:14:55 -0600 Subject: [PATCH 71/86] Annotated Widget --- src/main/java/bomb/Widget.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/main/java/bomb/Widget.java b/src/main/java/bomb/Widget.java index 3a1a0827..01ab7c44 100644 --- a/src/main/java/bomb/Widget.java +++ b/src/main/java/bomb/Widget.java @@ -1,5 +1,6 @@ package bomb; +import bomb.annotation.DisplayComponent; import bomb.enumerations.Indicator; import bomb.enumerations.Port; import bomb.enumerations.TrinarySwitch; @@ -67,6 +68,7 @@ * This class is extended by the Module classes, and all bomb widgets are accessible by those classes, * as well as the MainController to add/subtract to the widgets. */ +@DisplayComponent(resource = "widget.fxml", buttonLinkerName = "Widget") public sealed class Widget permits Alphabet, Astrology, Battleship, Bitwise, BlindAlley, BooleanVenn, Caesar, CheapCheckout, Chess, ChordQualities, ColorFlash, EmojiMath, FastMath, FizzBuzz, ForgetMeNot, Hexamaze, IceCream, Laundry, LEDEncryption, Logic, MicroController, MonslopeFight, Morsematics, Murder, From 02a781387ea3c447e789782ac8d0241e022b0ded Mon Sep 17 00:00:00 2001 From: "Mr. J" <45538844+Ultraviolet-Ninja@users.noreply.github.com> Date: Sun, 18 Dec 2022 21:54:14 -0600 Subject: [PATCH 72/86] Integration complete and confirmed to work --- src/main/java/bomb/ManualController.java | 141 ++++++----------------- 1 file changed, 37 insertions(+), 104 deletions(-) diff --git a/src/main/java/bomb/ManualController.java b/src/main/java/bomb/ManualController.java index 67a8a24c..18665d4a 100644 --- a/src/main/java/bomb/ManualController.java +++ b/src/main/java/bomb/ManualController.java @@ -3,7 +3,6 @@ import bomb.annotation.DisplayComponent; import bomb.modules.ab.blind.alley.BlindAlleyController; import bomb.modules.s.souvenir.SouvenirController; -import bomb.tools.filter.Regex; import bomb.tools.note.NoteController; import bomb.tools.pattern.facade.FacadeFX; import bomb.tools.pattern.observer.BlindAlleyPaneObserver; @@ -26,13 +25,7 @@ import javafx.scene.layout.VBox; import org.javatuples.Pair; -import java.io.File; -import java.net.MalformedURLException; -import java.net.URI; -import java.net.URISyntaxException; -import java.net.URL; -import java.nio.file.Path; -import java.nio.file.Paths; +import java.io.IOException; import java.util.ArrayDeque; import java.util.ArrayList; import java.util.LinkedHashMap; @@ -40,7 +33,6 @@ import java.util.Map; import java.util.concurrent.CompletableFuture; import java.util.concurrent.ExecutionException; -import java.util.stream.IntStream; import static bomb.tools.number.MathUtils.negativeSafeModulo; import static bomb.tools.pattern.facade.FacadeFX.GET_TOGGLE_NAME; @@ -57,7 +49,7 @@ @SuppressWarnings("ConstantConditions") public class ManualController { - private static final String FXML_DIRECTORY = "fxml"; + private static final Region EMPTY_VIEW; private Map regionMap; private List observableRadioList; @@ -78,6 +70,15 @@ public class ManualController { @FXML private VBox menuVBox, radioButtonHouse; + static { + var emptyViewLocation = ManualController.class.getResource("empty_view.fxml"); + try { + EMPTY_VIEW = FXMLLoader.load(emptyViewLocation); + } catch (IOException e) { + throw new RuntimeException(e); + } + } + public ManualController() { allRadioButtons = new ArrayList<>(); } @@ -99,84 +100,25 @@ public void initialize() throws ExecutionException, InterruptedException { System.out.printf("Timer: %,d%n", stop - start); } - private CompletableFuture> setupRegionMap() throws ExecutionException, InterruptedException { + private CompletableFuture> setupRegionMap() { + ResetObserver resetObserver = new ResetObserver(); + ObserverHub.addObserver(RESET, resetObserver); + var fxmlMapFuture = supplyAsync(() -> createFXMLMap(resetObserver)); var radioButtonNameFuture = createRadioButtonNameFuture(options.getToggles()); - createFXMLMap(); -// var fxmlMapFuture = supplyAsync(ManualController::createFXMLMap); - - //TODO - This is what we're looking to replace - return createFilePathFuture().thenApply(filePathFuture -> - filePathFuture.thenCombine(radioButtonNameFuture, (filePathMap, radioButtonMap) -> - createRegionMap(radioButtonMap, filePathMap))) - .get(); + return radioButtonNameFuture.thenCombine(fxmlMapFuture, ManualController::createRegionMap); } private static CompletableFuture> createRadioButtonNameFuture(List radioButtonList) { return supplyAsync(radioButtonList::stream) .thenApply(stream -> stream.collect(toMap( - toggle -> GET_TOGGLE_NAME.apply(toggle) - .replaceAll("[ -]", "_") - .replaceAll("[()']", "") - .toLowerCase(), + GET_TOGGLE_NAME, identity(), (x, y) -> y, LinkedHashMap::new ))); } - //TODO - Method to replace - private static CompletableFuture>> createFilePathFuture() { - URI uri = toURI(ManualController.class.getResource(FXML_DIRECTORY)); - - return supplyAsync(() -> getFilesFromDirectory(new File(uri))) - .thenApply(ManualController::convertFilesToRegions); - } - - //TODO - Method to replace - private static CompletableFuture> convertFilesToRegions(List fileList) { - ResetObserver resetObserver = new ResetObserver(); - Regex filenamePattern = new Regex("\\w+(?=\\.fxml)"); - fileList.removeIf(location -> location.contains("old") || location.contains("new")); - - CompletableFuture> regionListFuture = supplyAsync(fileList::parallelStream) - .thenApply(stream -> stream.map(Paths::get) - .map(Path::toUri) - .map(uri -> createSingleRegion(uri, resetObserver)) - .toList() - ); - - CompletableFuture> fileToRegionMapFuture = - supplyAsync(() -> filenamePattern.filterCollection(fileList)) - .thenCombine(regionListFuture, - (fileNameList, regionList) -> IntStream.range(0, fileNameList.size()) - .boxed() - .collect(toMap(fileNameList::get, regionList::get)) - ); - - ObserverHub.addObserver(RESET, resetObserver); - return fileToRegionMapFuture; - } - - //TODO - Method to replace - private static Region createSingleRegion(URI uri, ResetObserver resetObserver) - throws IllegalArgumentException { - FXMLLoader loader; - try { - loader = new FXMLLoader(uri.toURL()); - } catch (MalformedURLException e) { - throw new IllegalArgumentException(e); - } - Region output = FacadeFX.load(loader); - String location = loader.getLocation().toString(); - - if (!location.contains("widget")) resetObserver.addController(loader); - - if (location.contains("souvenir")) loadSouvenirController(loader.getController()); - else if (location.contains("blind_alley")) loadBlindAlleyController(loader.getController()); - return output; - } - private static void loadBlindAlleyController(BlindAlleyController controller) { ObserverHub.addObserver(BLIND_ALLEY_PANE, new BlindAlleyPaneObserver(controller)); } @@ -185,57 +127,36 @@ private static void loadSouvenirController(SouvenirController controller) { ObserverHub.addObserver(SOUVENIR_PANE, new SouvenirPaneObserver(controller)); } - //TODO - Method to replace - private static List getFilesFromDirectory(final File topLevelDirectory) { - List list = new ArrayList<>(); - ArrayDeque files = new ArrayDeque<>(asList(topLevelDirectory.listFiles())); - File temp; - - while ((temp = files.poll()) != null) { - if (!temp.isDirectory()) - list.add(temp.getPath()); - else - files.addAll(asList(temp.listFiles())); - } - return list; - } - private static Map createRegionMap(Map radioButtonMap, Map filePathMap) { Map regionMap = new LinkedHashMap<>(); for (Map.Entry entry : radioButtonMap.entrySet()) regionMap.put( entry.getValue(), - filePathMap.get(entry.getKey()) + filePathMap.getOrDefault(entry.getKey(), EMPTY_VIEW) ); return regionMap; } - private static URI toURI(URL url) throws IllegalArgumentException { - try { - return url.toURI(); - } catch (URISyntaxException e) { - throw new IllegalArgumentException(e); - } - } - - private static LinkedHashMap createFXMLMap() { - return getWidgetSubClasses() + private static Map createFXMLMap(ResetObserver resetObserver) { + return getDisplayedClasses() .stream() .map(cls -> new Pair<>(cls.getAnnotation(DisplayComponent.class), cls)) .map(pair -> pair.setAt1(pair.getValue1().getResource(pair.getValue0().resource()))) .map(pair -> pair.setAt0(pair.getValue0().buttonLinkerName())) + .map(pair -> pair.setAt1(new FXMLLoader(pair.getValue1()))) + .map(pair -> pair.setAt1(createSingleRegion2(pair.getValue1(), resetObserver))) .sorted() .collect(toMap( Pair::getValue0, - pair -> new FXMLLoader(pair.getValue1()), + Pair::getValue1, (x, y) -> y, LinkedHashMap::new )); } - private static List> getWidgetSubClasses() { - List> list = new ArrayList<>(List.of(NoteController.class)); + private static List> getDisplayedClasses() { + List> list = new ArrayList<>(List.of(Widget.class, NoteController.class)); ArrayDeque> files = new ArrayDeque<>(asList(Widget.class.getPermittedSubclasses())); Class temp; @@ -252,6 +173,18 @@ private static List> getWidgetSubClasses() { return list; } + private static Region createSingleRegion2(FXMLLoader loader, ResetObserver resetObserver) + throws IllegalArgumentException { + Region output = FacadeFX.load(loader); + String location = loader.getLocation().toString(); + + if (!location.contains("widget")) resetObserver.addController(loader); + + if (location.contains("souvenir")) loadSouvenirController(loader.getController()); + else if (location.contains("blind_alley")) loadBlindAlleyController(loader.getController()); + return output; + } + @FXML public void switchPaneByButtonPress() { Toggle selected = options.getSelectedToggle(); From dcaea4c56156b08a5f303e3cb2dc37f34ef46f9d Mon Sep 17 00:00:00 2001 From: "Mr. J" <45538844+Ultraviolet-Ninja@users.noreply.github.com> Date: Sun, 18 Dec 2022 22:32:49 -0600 Subject: [PATCH 73/86] Unnecessary imports --- .../bomb/modules/t/translated/TranslatedModuleController.java | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/main/java/bomb/modules/t/translated/TranslatedModuleController.java b/src/main/java/bomb/modules/t/translated/TranslatedModuleController.java index 4edd3909..e006ec8e 100644 --- a/src/main/java/bomb/modules/t/translated/TranslatedModuleController.java +++ b/src/main/java/bomb/modules/t/translated/TranslatedModuleController.java @@ -8,7 +8,6 @@ import bomb.modules.t.translated.solutions.password.PasswordComponent; import bomb.modules.t.translated.solutions.wof.WOFComponent; import bomb.tools.pattern.facade.FacadeFX; -import com.opencsv.exceptions.CsvException; import javafx.event.ActionEvent; import javafx.event.EventHandler; import javafx.fxml.FXML; @@ -18,7 +17,6 @@ import javafx.scene.control.Toggle; import javafx.scene.control.ToggleGroup; -import java.io.IOException; import java.util.List; public class TranslatedModuleController implements Resettable { From a0a025ca07d20280eddf20820749c88ea90a8c29 Mon Sep 17 00:00:00 2001 From: "Mr. J" <45538844+Ultraviolet-Ninja@users.noreply.github.com> Date: Sun, 18 Dec 2022 22:36:02 -0600 Subject: [PATCH 74/86] Parallelized the boot up process All appears fine when running it in the IDE Also, no race conditions seem to occur with the ResetObserver because of this parallel stream --- src/main/java/bomb/ManualController.java | 53 ++++++++++--------- .../tools/pattern/observer/ResetObserver.java | 4 +- 2 files changed, 31 insertions(+), 26 deletions(-) diff --git a/src/main/java/bomb/ManualController.java b/src/main/java/bomb/ManualController.java index 18665d4a..3f0b0fc5 100644 --- a/src/main/java/bomb/ManualController.java +++ b/src/main/java/bomb/ManualController.java @@ -26,6 +26,7 @@ import org.javatuples.Pair; import java.io.IOException; +import java.net.URL; import java.util.ArrayDeque; import java.util.ArrayList; import java.util.LinkedHashMap; @@ -119,14 +120,6 @@ private static CompletableFuture> createRadioButtonNameFutur ))); } - private static void loadBlindAlleyController(BlindAlleyController controller) { - ObserverHub.addObserver(BLIND_ALLEY_PANE, new BlindAlleyPaneObserver(controller)); - } - - private static void loadSouvenirController(SouvenirController controller) { - ObserverHub.addObserver(SOUVENIR_PANE, new SouvenirPaneObserver(controller)); - } - private static Map createRegionMap(Map radioButtonMap, Map filePathMap) { Map regionMap = new LinkedHashMap<>(); @@ -140,19 +133,10 @@ private static Map createRegionMap(Map radioButt private static Map createFXMLMap(ResetObserver resetObserver) { return getDisplayedClasses() - .stream() - .map(cls -> new Pair<>(cls.getAnnotation(DisplayComponent.class), cls)) - .map(pair -> pair.setAt1(pair.getValue1().getResource(pair.getValue0().resource()))) - .map(pair -> pair.setAt0(pair.getValue0().buttonLinkerName())) - .map(pair -> pair.setAt1(new FXMLLoader(pair.getValue1()))) - .map(pair -> pair.setAt1(createSingleRegion2(pair.getValue1(), resetObserver))) - .sorted() - .collect(toMap( - Pair::getValue0, - Pair::getValue1, - (x, y) -> y, - LinkedHashMap::new - )); +// .stream() + .parallelStream() + .map(cls -> mapClassToRegion(cls, resetObserver)) + .collect(toMap(Pair::getValue0, Pair::getValue1)); } private static List> getDisplayedClasses() { @@ -173,18 +157,37 @@ private static List> getDisplayedClasses() { return list; } - private static Region createSingleRegion2(FXMLLoader loader, ResetObserver resetObserver) + private static Pair mapClassToRegion(Class clazz, ResetObserver resetObserver) { + DisplayComponent annotation = clazz.getAnnotation(DisplayComponent.class); + URL resource = clazz.getResource(annotation.resource()); + String buttonLinkerName = annotation.buttonLinkerName(); + + return new Pair<>( + buttonLinkerName, + createSingleRegion(new FXMLLoader(resource), resetObserver) + ); + } + + private static Region createSingleRegion(FXMLLoader loader, ResetObserver resetObserver) throws IllegalArgumentException { Region output = FacadeFX.load(loader); String location = loader.getLocation().toString(); - if (!location.contains("widget")) resetObserver.addController(loader); + if (!location.endsWith("widget.fxml")) resetObserver.addController(loader); - if (location.contains("souvenir")) loadSouvenirController(loader.getController()); - else if (location.contains("blind_alley")) loadBlindAlleyController(loader.getController()); + if (location.endsWith("souvenir.fxml")) loadSouvenirController(loader.getController()); + else if (location.endsWith("blind_alley.fxml")) loadBlindAlleyController(loader.getController()); return output; } + private static void loadBlindAlleyController(BlindAlleyController controller) { + ObserverHub.addObserver(BLIND_ALLEY_PANE, new BlindAlleyPaneObserver(controller)); + } + + private static void loadSouvenirController(SouvenirController controller) { + ObserverHub.addObserver(SOUVENIR_PANE, new SouvenirPaneObserver(controller)); + } + @FXML public void switchPaneByButtonPress() { Toggle selected = options.getSelectedToggle(); diff --git a/src/main/java/bomb/tools/pattern/observer/ResetObserver.java b/src/main/java/bomb/tools/pattern/observer/ResetObserver.java index 5b3d3e8b..637f52ea 100644 --- a/src/main/java/bomb/tools/pattern/observer/ResetObserver.java +++ b/src/main/java/bomb/tools/pattern/observer/ResetObserver.java @@ -2,6 +2,7 @@ import bomb.abstractions.Resettable; import javafx.fxml.FXMLLoader; +import org.jetbrains.annotations.NotNull; import java.util.ArrayList; import java.util.List; @@ -13,7 +14,8 @@ public ResetObserver() { controllerList = new ArrayList<>(); } - public void addController(FXMLLoader loader) { + //Be on the lookout if the parallel stream in ManualController causes any overwriting to occur in the ArrayList + public void addController(@NotNull FXMLLoader loader) { Object controller = loader.getController(); if (controller == null) return; controllerList.add((Resettable) controller); From 11f3d5fa19875681c83c968827d9ab5e406c918d Mon Sep 17 00:00:00 2001 From: "Mr. J" <45538844+Ultraviolet-Ninja@users.noreply.github.com> Date: Sun, 18 Dec 2022 22:49:12 -0600 Subject: [PATCH 75/86] Upgrades version in config.yml Added a TODO for the end of the project --- .circleci/config.yml | 2 +- src/main/java/bomb/ManualController.java | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index c42601a6..22263b46 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -37,7 +37,7 @@ jobs: path: ./build/reports pitest: docker: - - image: cimg/openjdk:17.0.1 + - image: cimg/openjdk:17.0.2 parallelism: 6 resource_class: large diff --git a/src/main/java/bomb/ManualController.java b/src/main/java/bomb/ManualController.java index 3f0b0fc5..163708e5 100644 --- a/src/main/java/bomb/ManualController.java +++ b/src/main/java/bomb/ManualController.java @@ -50,6 +50,7 @@ @SuppressWarnings("ConstantConditions") public class ManualController { + //TODO - Remove when every FXML file is being used private static final Region EMPTY_VIEW; private Map regionMap; From 027cd2069d68bd1455bdb957b9c9be2016772011 Mon Sep 17 00:00:00 2001 From: "Mr. J" <45538844+Ultraviolet-Ninja@users.noreply.github.com> Date: Sun, 18 Dec 2022 23:01:49 -0600 Subject: [PATCH 76/86] Removed remnant of merge conflicts --- src/main/java/bomb/Main.java | 1 - 1 file changed, 1 deletion(-) diff --git a/src/main/java/bomb/Main.java b/src/main/java/bomb/Main.java index 08051bb1..eb4bc4a7 100644 --- a/src/main/java/bomb/Main.java +++ b/src/main/java/bomb/Main.java @@ -29,7 +29,6 @@ public class Main extends Application { @Override public void start(Stage primaryStage) throws Exception { - Widget.class.getPermittedSubclasses(); FXMLLoader loader = new FXMLLoader(Main.class.getResource("manual.fxml")); Parent root = loader.load(); Scene scene = new Scene(root); From af23adc2d1a9d53e0a31ce6b183d0f35caacd9a1 Mon Sep 17 00:00:00 2001 From: "Mr. J" <45538844+Ultraviolet-Ninja@users.noreply.github.com> Date: Tue, 20 Dec 2022 11:43:36 -0600 Subject: [PATCH 77/86] JLink Experimentation (#47) * Simple JLink test using just Ubuntu * Adding windows and Mac as well * Current build won't run * Take 3 with Mac * Another test * Restored the way to run all 3 OS * Restored the way to run all 3 OS * Running with stacktrace * Separating the gradle download * Negated extra dependencies * Idea to remove duplicate modules on the module path * Testing JUST windows on the build and updated build.gradle * Experimenting with MacOS * Yml file experimentation * Removal of wrong yml syntax * Testing the release feature * Deleted the Docker plugin Created Gradle tasks to create zip and tar files of the final packaged image * Deleted the previous fxml directory Removed the current branch from yml file Added one line to the build.gradle file to permit uploads if a Release already exist for the Linux and Mac builds... if I ever figure those out --- .github/workflows/build_publish.yml | 51 -- .github/workflows/publish_executables.yml | 112 ++++ Dockerfile | 57 +- build.gradle | 162 +++-- src/main/resources/bomb/KTANE logo.ico | Bin 0 -> 4286 bytes .../bomb/fxml/ab/adjacent_letters.fxml | 13 - .../bomb/fxml/ab/adventure_game.fxml | 13 - src/main/resources/bomb/fxml/ab/alphabet.fxml | 77 --- src/main/resources/bomb/fxml/ab/anagrams.fxml | 13 - .../resources/bomb/fxml/ab/astrology.fxml | 289 --------- .../resources/bomb/fxml/ab/battleship.fxml | 13 - .../resources/bomb/fxml/ab/binary_leds.fxml | 13 - src/main/resources/bomb/fxml/ab/bitmaps.fxml | 13 - .../resources/bomb/fxml/ab/bitwise_ops.fxml | 43 -- .../resources/bomb/fxml/ab/blind_alley.fxml | 86 --- .../bomb/fxml/ab/boolean_venn_diagram.fxml | 125 ---- .../resources/bomb/fxml/ab/broken_button.fxml | 13 - .../resources/bomb/fxml/c/caesar_cipher.fxml | 13 - .../resources/bomb/fxml/c/cheap_checkout.fxml | 22 - src/main/resources/bomb/fxml/c/chess.fxml | 68 -- .../bomb/fxml/c/chord_qualities.fxml | 23 - .../resources/bomb/fxml/c/color_flash.fxml | 13 - .../resources/bomb/fxml/c/color_math.fxml | 13 - .../bomb/fxml/c/colored_squares.fxml | 13 - .../bomb/fxml/c/colored_switches.fxml | 178 ------ .../bomb/fxml/c/combination_lock.fxml | 13 - .../bomb/fxml/c/complicated_buttons.fxml | 7 - .../bomb/fxml/c/connection_check.fxml | 13 - .../resources/bomb/fxml/c/coordinates.fxml | 13 - .../resources/bomb/fxml/c/crazy_talk.fxml | 13 - src/main/resources/bomb/fxml/c/creation.fxml | 13 - src/main/resources/bomb/fxml/c/crossover.fxml | 13 - src/main/resources/bomb/fxml/c/crypto.fxml | 13 - .../resources/bomb/fxml/dh/double_oh.fxml | 13 - .../resources/bomb/fxml/dh/emoji_math.fxml | 100 --- .../resources/bomb/fxml/dh/english_test.fxml | 13 - .../resources/bomb/fxml/dh/fast_math.fxml | 110 ---- .../resources/bomb/fxml/dh/filibuster.fxml | 13 - src/main/resources/bomb/fxml/dh/fizzbuzz.fxml | 13 - src/main/resources/bomb/fxml/dh/flags.fxml | 13 - .../bomb/fxml/dh/follow_the_leader.fxml | 13 - .../bomb/fxml/dh/foreign_exchange_rates.fxml | 13 - .../resources/bomb/fxml/dh/friendship.fxml | 13 - src/main/resources/bomb/fxml/dh/hexamaze.fxml | 87 --- .../resources/bomb/fxml/forget_me_not.fxml | 111 ---- .../resources/bomb/fxml/il/ice_cream.fxml | 13 - src/main/resources/bomb/fxml/il/laundry.fxml | 117 ---- .../bomb/fxml/il/led_encryption.fxml | 13 - .../resources/bomb/fxml/il/letter_keys.fxml | 8 - .../resources/bomb/fxml/il/light_cycle.fxml | 13 - .../resources/bomb/fxml/il/listening.fxml | 13 - src/main/resources/bomb/fxml/il/logic.fxml | 163 ----- .../resources/bomb/fxml/m/math_is_hard.fxml | 13 - .../bomb/fxml/m/microcontroller.fxml | 91 --- .../resources/bomb/fxml/m/minesweeper.fxml | 13 - .../bomb/fxml/m/modules_against_humanity.fxml | 13 - .../bomb/fxml/m/monsplode_fight.fxml | 13 - .../resources/bomb/fxml/m/morsematics.fxml | 13 - .../bomb/fxml/m/mouse_in_the_maze.fxml | 13 - src/main/resources/bomb/fxml/m/murder.fxml | 13 - .../resources/bomb/fxml/m/mystic_squares.fxml | 13 - .../bomb/fxml/notes/extra_notes.fxml | 31 - .../bomb/fxml/np/neutralization.fxml | 195 ------ .../bomb/fxml/np/new_neutralization.fxml | 106 ---- .../resources/bomb/fxml/np/number_pad.fxml | 13 - .../resources/bomb/fxml/np/only_connect.fxml | 13 - .../resources/bomb/fxml/np/orientation.fxml | 13 - .../bomb/fxml/np/perspective_pegs.fxml | 13 - .../resources/bomb/fxml/np/piano_keys.fxml | 13 - .../bomb/fxml/np/piano_keys_cruel.fxml | 13 - src/main/resources/bomb/fxml/np/plumbing.fxml | 13 - .../bomb/fxml/np/point_of_order.fxml | 13 - src/main/resources/bomb/fxml/np/probing.fxml | 13 - src/main/resources/bomb/fxml/r/resistors.fxml | 13 - src/main/resources/bomb/fxml/r/rhythms.fxml | 13 - .../r/rock_paper_scissors_lizard_spock.fxml | 13 - .../resources/bomb/fxml/r/round_keypads.fxml | 317 ---------- .../resources/bomb/fxml/r/rubiks_cube.fxml | 13 - .../resources/bomb/fxml/s/safety_safe.fxml | 13 - src/main/resources/bomb/fxml/s/seashells.fxml | 13 - src/main/resources/bomb/fxml/s/semaphore.fxml | 13 - .../resources/bomb/fxml/s/shape_shift.fxml | 10 - .../resources/bomb/fxml/s/silly_slots.fxml | 13 - .../resources/bomb/fxml/s/simon_screams.fxml | 49 -- .../resources/bomb/fxml/s/simon_states.fxml | 13 - .../resources/bomb/fxml/s/skewed_slots.fxml | 13 - .../resources/bomb/fxml/s/square_button.fxml | 13 - src/main/resources/bomb/fxml/s/switches.fxml | 89 --- .../bomb/fxml/s/symbolic_password.fxml | 13 - src/main/resources/bomb/fxml/souvenir.fxml | 43 -- src/main/resources/bomb/fxml/t/3d_maze.fxml | 24 - .../resources/bomb/fxml/t/text_field.fxml | 13 - src/main/resources/bomb/fxml/t/the_bulb.fxml | 115 ---- src/main/resources/bomb/fxml/t/the_clock.fxml | 13 - .../resources/bomb/fxml/t/the_gamepad.fxml | 13 - src/main/resources/bomb/fxml/t/the_screw.fxml | 13 - .../resources/bomb/fxml/t/third_base.fxml | 13 - .../resources/bomb/fxml/t/tic_tac_toe.fxml | 13 - .../old_translated_vanilla_modules.fxml | 593 ------------------ .../translated_vanilla_modules.fxml | 209 ------ .../resources/bomb/fxml/t/turn_the_keys.fxml | 13 - src/main/resources/bomb/fxml/t/two_bit.fxml | 44 -- src/main/resources/bomb/fxml/widget.fxml | 472 -------------- .../resources/bomb/fxml/wz/web_design.fxml | 13 - .../bomb/fxml/wz/wire_placement.fxml | 13 - .../resources/bomb/fxml/wz/word_scramble.fxml | 13 - .../resources/bomb/fxml/wz/word_search.fxml | 13 - src/main/resources/bomb/fxml/wz/yahtzee.fxml | 13 - src/main/resources/bomb/fxml/wz/zoo.fxml | 13 - 109 files changed, 251 insertions(+), 5069 deletions(-) delete mode 100644 .github/workflows/build_publish.yml create mode 100644 .github/workflows/publish_executables.yml create mode 100644 src/main/resources/bomb/KTANE logo.ico delete mode 100644 src/main/resources/bomb/fxml/ab/adjacent_letters.fxml delete mode 100644 src/main/resources/bomb/fxml/ab/adventure_game.fxml delete mode 100644 src/main/resources/bomb/fxml/ab/alphabet.fxml delete mode 100644 src/main/resources/bomb/fxml/ab/anagrams.fxml delete mode 100644 src/main/resources/bomb/fxml/ab/astrology.fxml delete mode 100644 src/main/resources/bomb/fxml/ab/battleship.fxml delete mode 100644 src/main/resources/bomb/fxml/ab/binary_leds.fxml delete mode 100644 src/main/resources/bomb/fxml/ab/bitmaps.fxml delete mode 100644 src/main/resources/bomb/fxml/ab/bitwise_ops.fxml delete mode 100644 src/main/resources/bomb/fxml/ab/blind_alley.fxml delete mode 100644 src/main/resources/bomb/fxml/ab/boolean_venn_diagram.fxml delete mode 100644 src/main/resources/bomb/fxml/ab/broken_button.fxml delete mode 100644 src/main/resources/bomb/fxml/c/caesar_cipher.fxml delete mode 100644 src/main/resources/bomb/fxml/c/cheap_checkout.fxml delete mode 100644 src/main/resources/bomb/fxml/c/chess.fxml delete mode 100644 src/main/resources/bomb/fxml/c/chord_qualities.fxml delete mode 100644 src/main/resources/bomb/fxml/c/color_flash.fxml delete mode 100644 src/main/resources/bomb/fxml/c/color_math.fxml delete mode 100644 src/main/resources/bomb/fxml/c/colored_squares.fxml delete mode 100644 src/main/resources/bomb/fxml/c/colored_switches.fxml delete mode 100644 src/main/resources/bomb/fxml/c/combination_lock.fxml delete mode 100644 src/main/resources/bomb/fxml/c/complicated_buttons.fxml delete mode 100644 src/main/resources/bomb/fxml/c/connection_check.fxml delete mode 100644 src/main/resources/bomb/fxml/c/coordinates.fxml delete mode 100644 src/main/resources/bomb/fxml/c/crazy_talk.fxml delete mode 100644 src/main/resources/bomb/fxml/c/creation.fxml delete mode 100644 src/main/resources/bomb/fxml/c/crossover.fxml delete mode 100644 src/main/resources/bomb/fxml/c/crypto.fxml delete mode 100644 src/main/resources/bomb/fxml/dh/double_oh.fxml delete mode 100644 src/main/resources/bomb/fxml/dh/emoji_math.fxml delete mode 100644 src/main/resources/bomb/fxml/dh/english_test.fxml delete mode 100644 src/main/resources/bomb/fxml/dh/fast_math.fxml delete mode 100644 src/main/resources/bomb/fxml/dh/filibuster.fxml delete mode 100644 src/main/resources/bomb/fxml/dh/fizzbuzz.fxml delete mode 100644 src/main/resources/bomb/fxml/dh/flags.fxml delete mode 100644 src/main/resources/bomb/fxml/dh/follow_the_leader.fxml delete mode 100644 src/main/resources/bomb/fxml/dh/foreign_exchange_rates.fxml delete mode 100644 src/main/resources/bomb/fxml/dh/friendship.fxml delete mode 100644 src/main/resources/bomb/fxml/dh/hexamaze.fxml delete mode 100644 src/main/resources/bomb/fxml/forget_me_not.fxml delete mode 100644 src/main/resources/bomb/fxml/il/ice_cream.fxml delete mode 100644 src/main/resources/bomb/fxml/il/laundry.fxml delete mode 100644 src/main/resources/bomb/fxml/il/led_encryption.fxml delete mode 100644 src/main/resources/bomb/fxml/il/letter_keys.fxml delete mode 100644 src/main/resources/bomb/fxml/il/light_cycle.fxml delete mode 100644 src/main/resources/bomb/fxml/il/listening.fxml delete mode 100644 src/main/resources/bomb/fxml/il/logic.fxml delete mode 100644 src/main/resources/bomb/fxml/m/math_is_hard.fxml delete mode 100644 src/main/resources/bomb/fxml/m/microcontroller.fxml delete mode 100644 src/main/resources/bomb/fxml/m/minesweeper.fxml delete mode 100644 src/main/resources/bomb/fxml/m/modules_against_humanity.fxml delete mode 100644 src/main/resources/bomb/fxml/m/monsplode_fight.fxml delete mode 100644 src/main/resources/bomb/fxml/m/morsematics.fxml delete mode 100644 src/main/resources/bomb/fxml/m/mouse_in_the_maze.fxml delete mode 100644 src/main/resources/bomb/fxml/m/murder.fxml delete mode 100644 src/main/resources/bomb/fxml/m/mystic_squares.fxml delete mode 100644 src/main/resources/bomb/fxml/notes/extra_notes.fxml delete mode 100644 src/main/resources/bomb/fxml/np/neutralization.fxml delete mode 100644 src/main/resources/bomb/fxml/np/new_neutralization.fxml delete mode 100644 src/main/resources/bomb/fxml/np/number_pad.fxml delete mode 100644 src/main/resources/bomb/fxml/np/only_connect.fxml delete mode 100644 src/main/resources/bomb/fxml/np/orientation.fxml delete mode 100644 src/main/resources/bomb/fxml/np/perspective_pegs.fxml delete mode 100644 src/main/resources/bomb/fxml/np/piano_keys.fxml delete mode 100644 src/main/resources/bomb/fxml/np/piano_keys_cruel.fxml delete mode 100644 src/main/resources/bomb/fxml/np/plumbing.fxml delete mode 100644 src/main/resources/bomb/fxml/np/point_of_order.fxml delete mode 100644 src/main/resources/bomb/fxml/np/probing.fxml delete mode 100644 src/main/resources/bomb/fxml/r/resistors.fxml delete mode 100644 src/main/resources/bomb/fxml/r/rhythms.fxml delete mode 100644 src/main/resources/bomb/fxml/r/rock_paper_scissors_lizard_spock.fxml delete mode 100644 src/main/resources/bomb/fxml/r/round_keypads.fxml delete mode 100644 src/main/resources/bomb/fxml/r/rubiks_cube.fxml delete mode 100644 src/main/resources/bomb/fxml/s/safety_safe.fxml delete mode 100644 src/main/resources/bomb/fxml/s/seashells.fxml delete mode 100644 src/main/resources/bomb/fxml/s/semaphore.fxml delete mode 100644 src/main/resources/bomb/fxml/s/shape_shift.fxml delete mode 100644 src/main/resources/bomb/fxml/s/silly_slots.fxml delete mode 100644 src/main/resources/bomb/fxml/s/simon_screams.fxml delete mode 100644 src/main/resources/bomb/fxml/s/simon_states.fxml delete mode 100644 src/main/resources/bomb/fxml/s/skewed_slots.fxml delete mode 100644 src/main/resources/bomb/fxml/s/square_button.fxml delete mode 100644 src/main/resources/bomb/fxml/s/switches.fxml delete mode 100644 src/main/resources/bomb/fxml/s/symbolic_password.fxml delete mode 100644 src/main/resources/bomb/fxml/souvenir.fxml delete mode 100644 src/main/resources/bomb/fxml/t/3d_maze.fxml delete mode 100644 src/main/resources/bomb/fxml/t/text_field.fxml delete mode 100644 src/main/resources/bomb/fxml/t/the_bulb.fxml delete mode 100644 src/main/resources/bomb/fxml/t/the_clock.fxml delete mode 100644 src/main/resources/bomb/fxml/t/the_gamepad.fxml delete mode 100644 src/main/resources/bomb/fxml/t/the_screw.fxml delete mode 100644 src/main/resources/bomb/fxml/t/third_base.fxml delete mode 100644 src/main/resources/bomb/fxml/t/tic_tac_toe.fxml delete mode 100644 src/main/resources/bomb/fxml/t/translated/old_translated_vanilla_modules.fxml delete mode 100644 src/main/resources/bomb/fxml/t/translated/translated_vanilla_modules.fxml delete mode 100644 src/main/resources/bomb/fxml/t/turn_the_keys.fxml delete mode 100644 src/main/resources/bomb/fxml/t/two_bit.fxml delete mode 100644 src/main/resources/bomb/fxml/widget.fxml delete mode 100644 src/main/resources/bomb/fxml/wz/web_design.fxml delete mode 100644 src/main/resources/bomb/fxml/wz/wire_placement.fxml delete mode 100644 src/main/resources/bomb/fxml/wz/word_scramble.fxml delete mode 100644 src/main/resources/bomb/fxml/wz/word_search.fxml delete mode 100644 src/main/resources/bomb/fxml/wz/yahtzee.fxml delete mode 100644 src/main/resources/bomb/fxml/wz/zoo.fxml diff --git a/.github/workflows/build_publish.yml b/.github/workflows/build_publish.yml deleted file mode 100644 index 38afc604..00000000 --- a/.github/workflows/build_publish.yml +++ /dev/null @@ -1,51 +0,0 @@ -# This workflow will build a Java project with Gradle -# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-gradle - -name: Java CI with Gradle - -on: - push: - branches: [ main ] - -jobs: - build: - - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v2 - - - name: Set up JDK 17 - uses: actions/setup-java@v2 - with: - java-version: 17 - distribution: 'adopt' - check-latest: true - - - name: Grant execute permission for gradlew - run: chmod +x gradlew - - - name: Build with Gradle - run: ./gradlew build - - - name: Linking Dependencies with Gradle - run: ./gradlew jlink - -# - name: Set up QEMU -# uses: docker/setup-qemu-action@v1 -# -# - name: Set up Docker Buildx -# uses: docker/setup-buildx-action@v1 -# -# - name: Login to DockerHub -# uses: docker/login-action@v1 -# with: -# username: ${{ secrets.DOCKER_USERNAME }} -# password: ${{ secrets.DOCKER_PASSWORD }} -# -# - name: Docker Build and Push -# id: docker_build -# run: ./gradlew dockerPushDockerHub -# -# - name: Auto-Upload Releases -# run: ./gradlew releaseToGitHub -PauthToken=${{ secrets.GITHUB_TOKEN }} \ No newline at end of file diff --git a/.github/workflows/publish_executables.yml b/.github/workflows/publish_executables.yml new file mode 100644 index 00000000..81ebf3b5 --- /dev/null +++ b/.github/workflows/publish_executables.yml @@ -0,0 +1,112 @@ +# This workflow will build a Java project with Gradle +# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-gradle + +name: Publishing Executable files using Gradle + +on: + push: + branches: + - main + +jobs: + windows-pipeline: + + runs-on: windows-latest + + steps: + - uses: actions/checkout@v2 + + - name: Set up JDK 17 + uses: actions/setup-java@v2 + with: + java-version: 17 + distribution: 'adopt' + check-latest: true + + - name: Grant execute permission for gradlew + run: chmod +x gradlew + +# - name: Build with Gradle +# run: ./gradlew build + + - name: Creating the Executable + run: ./gradlew jpackageImage + +# - name: Set up QEMU +# uses: docker/setup-qemu-action@v1 +# +# - name: Set up Docker Buildx +# uses: docker/setup-buildx-action@v1 +# +# - name: Login to DockerHub +# uses: docker/login-action@v1 +# with: +# username: ${{ secrets.DOCKER_USERNAME }} +# password: ${{ secrets.DOCKER_PASSWORD }} +# +# - name: Docker Build and Push +# id: docker_build +# run: ./gradlew dockerPushDockerHub + + - name: Upload Releases + run: ./gradlew releaseToGitHub -PauthToken=${{ secrets.GITHUB_TOKEN }} + + linux-pipeline: + + runs-on: ubuntu-latest + needs: windows-pipeline + + steps: + - uses: actions/checkout@v2 + + - name: Set up JDK 17 + uses: actions/setup-java@v2 + with: + java-version: 17 + distribution: 'adopt' + check-latest: true + + - name: Grant execute permission for gradlew + run: chmod +x gradlew + + - name: Build with Gradle + run: ./gradlew build + +# - name: Linking Dependencies with Gradle +# run: ./gradlew jlink + +# - name: Packaging with Gradle +# run: ./gradlew jpackage + +# - name: Auto-Upload Releases +# run: ./gradlew releaseToGitHub -PauthToken=${{ secrets.GITHUB_TOKEN }} + + mac-pipeline: + + runs-on: macos-latest + needs: linux-pipeline + + steps: + - uses: actions/checkout@v2 + + - name: Set up JDK 17 + uses: actions/setup-java@v2 + with: + java-version: 17 + distribution: 'adopt' + check-latest: true + + - name: Grant execute permission for gradlew + run: chmod +x gradlew + + - name: Build with Gradle + run: ./gradlew build + +# - name: Linking Dependencies with Gradle +# run: ./gradlew jlink + +# - name: Packaging with Gradle +# run: ./gradlew jpackage + +# - name: Auto-Upload Releases +# run: ./gradlew releaseToGitHub -PauthToken=${{ secrets.GITHUB_TOKEN }} \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index 48b67919..deec2bf2 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -#V1 of the Dockerfile +#FIXME - V1 of the Dockerfile #FROM openjdk:16-alpine # #ARG JAR_FILE @@ -6,23 +6,40 @@ # #ENTRYPOINT ["java", "-jar", "app.jar"] -FROM gradle:7.4.0-jdk17-alpine - -ENV APP_HOME=/usr/app/ -WORKDIR $APP_HOME - -COPY necessaryFiles/build.gradle necessaryFiles/settings.gradle $APP_HOME - -COPY necessaryFiles/wrapper ${APP_HOME}gradle/wrapper -COPY --chown=gradle:gradle . /home/gradle/src -USER root -RUN chown -R gradle /home/gradle/src - -#COPY necessaryFiles/java/module-info.java ${APP_HOME}src/main/java - -RUN gradle build -i --stacktrace -COPY necessaryFiles/java ${APP_HOME}src/main/java -COPY necessaryFiles/resources ${APP_HOME}src/main/resources -RUN gradle clean build +#FIXME - Shoving the entire program into a docker container (Not the greatest idea) +#FROM gradle:7.4.0-jdk17-alpine +# +#ENV APP_HOME=/usr/app/ +#WORKDIR $APP_HOME +# +#COPY necessaryFiles/build.gradle necessaryFiles/settings.gradle $APP_HOME +# +#COPY necessaryFiles/wrapper ${APP_HOME}gradle/wrapper +#COPY --chown=gradle:gradle . /home/gradle/src +#USER root +#RUN chown -R gradle /home/gradle/src +# +#RUN gradle build -i --stacktrace +#COPY necessaryFiles/java ${APP_HOME}src/main/java +#COPY necessaryFiles/resources ${APP_HOME}src/main/resources +#RUN gradle clean build +# +#ENTRYPOINT gradle run -ENTRYPOINT gradle run \ No newline at end of file +#FIXME - Failed Linux build (duplicate modules on the modulepath for the JavaFX library) +#FROM gradle:7.4.0-jdk17-alpine +# +#ENV APP_HOME=/usr/app/ +#WORKDIR $APP_HOME +# +#COPY necessaryFiles/build.gradle necessaryFiles/settings.gradle $APP_HOME +# +#COPY necessaryFiles/wrapper ${APP_HOME}gradle/wrapper +#COPY --chown=gradle:gradle . /home/gradle/src +#USER root +#RUN chown -R gradle /home/gradle/src +# +#RUN gradle build +#COPY necessaryFiles/java ${APP_HOME}src/main/java +#COPY necessaryFiles/resources ${APP_HOME}src/main/resources +#RUN gradle jlink \ No newline at end of file diff --git a/build.gradle b/build.gradle index ba905594..d80ad6ec 100644 --- a/build.gradle +++ b/build.gradle @@ -3,7 +3,6 @@ plugins { id 'jacoco' id 'application' id 'org.beryx.jlink' version '2.25.0' - id 'com.palantir.docker' version '0.34.0' id 'info.solidsoft.pitest' version '1.7.4' id 'org.openjfx.javafxplugin' version '0.0.13' id 'org.javamodularity.moduleplugin' version '1.8.12' @@ -51,14 +50,12 @@ dependencies { implementation 'org.jetbrains:annotations:23.1.0' //implementation 'io.github.fvarrui:javpackager:1.5.1' - implementation('com.jfoenix:jfoenix:9.0.4') -// { -// exclude group: "org.javafx" -// } - implementation('io.github.palexdev:materialfx:11.12.0') -// { -// exclude group: "org.javafx" -// } + implementation('com.jfoenix:jfoenix:9.0.4') { + exclude group: "org.javafx" + } + implementation('io.github.palexdev:materialfx:11.12.0') { + exclude group: "org.javafx" + } testImplementation 'org.testng:testng:7.7.0' testImplementation 'org.slf4j:slf4j-api:2.0.5' @@ -79,28 +76,30 @@ def includedTestDirectories = [ test { useTestNG() { + String baseDirectory = 'src/test/resources/suites/suite' + if(firstInstance) { - suites "src/test/resources/suites/suiteOne.xml" + suites "${baseDirectory}One.xml" includedTestDirectories.addAll([ 'bomb/modules/ab/**', 'bomb/modules/c/**' ]) } else if (secondInstance) { - suites "src/test/resources/suites/suiteTwo.xml" + suites "${baseDirectory}Two.xml" includedTestDirectories.addAll([ 'bomb/modules/dh/**', 'bomb/modules/il/**', 'bomb/modules/m/**' ]) } else if (thirdInstance) { - suites "src/test/resources/suites/suiteThree.xml" + suites "${baseDirectory}Three.xml" includedTestDirectories.addAll([ 'bomb/modules/np/**', 'bomb/modules/r/**' ]) } else if (fourthInstance) { - suites "src/test/resources/suites/suiteFour.xml" + suites "${baseDirectory}Four.xml" includedTestDirectories.addAll([ 'bomb/modules/s/**', 'bomb/modules/t/**' ]) } else if (fifthInstance) { - suites "src/test/resources/suites/suiteFive.xml" + suites "${baseDirectory}Five.xml" includedTestDirectories.addAll([ 'bomb', 'bomb/tools/filter/*', 'bomb/modules/wz/**' ]) @@ -124,18 +123,20 @@ jacocoTestReport { static List getTargetClasses(boolean firstInstance, boolean secondInstance, boolean thirdInstance, boolean fourthInstance, boolean fifthInstance, boolean sixthInstance) { + String baseModuleDirectory = 'bomb.modules.' + if (firstInstance) - return ['bomb.modules.ab.**'] + return ["${baseModuleDirectory}ab.**"] else if (secondInstance) - return ['bomb.modules.c.**'] + return ["${baseModuleDirectory}c.**"] else if (thirdInstance) - return ['bomb.modules.dh.**', 'bomb.modules.il.**'] + return ["${baseModuleDirectory}dh.**", "${baseModuleDirectory}il.**"] else if (fourthInstance) - return ['bomb.modules.m.**', 'bomb.modules.np.**'] + return ["${baseModuleDirectory}m.**", "${baseModuleDirectory}np.**"] else if (fifthInstance) - return ['bomb.modules.r.**', 'bomb.modules.s.**'] + return ["${baseModuleDirectory}r.**", "${baseModuleDirectory}s.**"] else if (sixthInstance) - return ['bomb.modules.t.**', 'bomb.modules.wz.**', 'bomb.tools.filter.*'] + return ["${baseModuleDirectory}t.**", "${baseModuleDirectory}wz.**", 'bomb.tools.filter.*'] return ['bomb.*'] } @@ -157,56 +158,97 @@ jlink { imageZip = project.file("${buildDir}/distributions/app-${javafx.platform.classifier}.zip") options = ['--strip-debug', '--compress', '2', '--no-header-files', '--no-man-pages'] addExtraDependencies("javafx") - launcher { - name = "${project.name}" + + def opSys = org.gradle.internal.os.OperatingSystem.current() + String iconBaseFilename = "${buildDir}/resources/main/bomb/KTANE logo" + + if (opSys.windows) { + launcher { + name = 'Gradle Centurion Win' + } + + jpackage { + installerOptions += ['--win-per-user-install', '--win-dir-chooser', '--win-menu'] + imageOptions += ['--icon', "${iconBaseFilename}.ico"] + } + } else if (opSys.linux) { + launcher { + name = 'Gradle Centurion Linux' + } + + jpackage { + imageOptions += ['--icon', "${iconBaseFilename}.png"] + installerOptions += [ + '--linux-menu-group', 'Office', + '--linux-shortcut' + ] + } + } else { + launcher { + name = 'Gradle Centurion Mac' + } + + jpackage { + imageOptions += ['--icon', "${iconBaseFilename}.icns"] + } + } +} + +tasks.register('zipExecutableFiles', Zip) { + dependsOn(jpackageImage) + from buildDir + def opSys = org.gradle.internal.os.OperatingSystem.current() + String baseFilename = "Gradle-Centurion-${project.version}-" + + if (opSys.windows) { + include 'jpackage/Gradle Centurion Win/**' + archiveName "${baseFilename}win.zip" + } else if (opSys.linux) { + include 'jpackage/Gradle Centurion Linux/**' + archiveName "${baseFilename}linux.zip" + } else { + include 'jpackage/Gradle Centurion Mac/**' + archiveName "${baseFilename}mac.zip" } } -//docker { -// dependsOn(jar) -// name "${project.name.toLowerCase()}:${project.version}" -// files "${buildDir}/libs/${project.name}-${project.version}.jar" -// buildArgs([JAR_FILE: "${project.name}-${project.version}.jar"]) -// tag('DockerHub', "jasminejragon/${project.name.replace("C", "-c").toLowerCase()}:${project.version}") -//} - -docker { - dependsOn(jar) - name "${project.name.replace("C", "-c").toLowerCase()}:${project.version}" - copySpec.from("src/main").from("gradle").into("necessaryFiles") - files 'build.gradle', 'settings.gradle' -} - -dockerfileZip { - destinationDirectory = file("${buildDir}/zip/docker") -} - -//distZip { -// from projectDir -// include 'src/main/**/*' -// include 'gradle/wrapper/*' -// include 'markdown/*' -// include 'build.gradle', 'gradlew', 'gradlew.bat', 'README.md', 'Progress.md', 'Learned.md' -//} -// -//distTar { -// from projectDir -// include 'src/main/**/*' -// include 'gradle/wrapper/*' -// include 'markdown/*' -// include 'build.gradle', 'gradlew', 'gradlew.bat', 'README.md', 'Progress.md', 'Learned.md' -//} +tasks.register('tarExecutableFiles', Tar) { + dependsOn(jpackageImage) + from buildDir + def opSys = org.gradle.internal.os.OperatingSystem.current() + String baseFilename = "Gradle-Centurion-${project.version}-" + + if (opSys.windows) { + include 'jpackage/Gradle Centurion Win/**' + archiveName "${baseFilename}win.tar" + } else if (opSys.linux) { + include 'jpackage/Gradle Centurion Linux/**' + archiveName "${baseFilename}linux.tar" + } else { + include 'jpackage/Gradle Centurion Mac/**' + archiveName "${baseFilename}mac.tar" + } +} githubRelease { - String baseFileName = "${buildDir}/distributions/${project.name}-${project.version}" - releaseAssets = files("${baseFileName}.zip", "${baseFileName}.tar") tagName = "${project.version}" - targetCommitish = 'main' owner = 'Ultraviolet-Ninja' - overwrite = true + + def opSys = org.gradle.internal.os.OperatingSystem.current() + String baseFilename = "${buildDir}/distributions/Gradle-Centurion-${project.version}-" + allowUploadToExisting = !opSys.windows + + if (opSys.windows) { + releaseAssets = files("${baseFilename}win.zip", "${baseFilename}win.tar") + } else if (opSys.linux) { + releaseAssets = files("${baseFilename}linux.zip", "${baseFilename}linux.tar") + } else { + releaseAssets = files("${baseFilename}mac.zip", "${baseFilename}mac.tar") + } } tasks.register('releaseToGitHub') { + dependsOn(tasks.named('zipExecutableFiles'), tasks.named('tarExecutableFiles')) doFirst { githubRelease.token = "${authToken}" } diff --git a/src/main/resources/bomb/KTANE logo.ico b/src/main/resources/bomb/KTANE logo.ico new file mode 100644 index 0000000000000000000000000000000000000000..a25a8745b99f2f277fc636efeb30b0f58449c179 GIT binary patch literal 4286 zcmdT|c}&z-5Z?aP7>%vm_kF3^Jc!8_kv9J zlK8W+k)#WD|2Aro{lB*&+&f5akRBGvh2f$zak_k zNaV|SPCgL7%|y)4W}anxciKCUnw*Nx&K`cAn9v5Jrv4FJ0;^!_R|UgW1z6%4kJ76p zEYsWDj}`9ju(P(}oJh?DVH4LV-!vXP_!+4wsd)T&ke`Q#RTvr`V;-p044U4tK za1E+}>Dnq7xyGWdwu)tQva^{xWK$|W<(+t5_Iup3&Ss&b{pF+PFL-Y1Z6tHuKN0@(Uoh2xv0NIBPqqHFiy z8Tu`Pw|>SpZr!Sft(B!D4(jj|;^SHO;x`x3)6@4Ce2w7UgI`AQ#n&CYX7jZr*nPMj zo5Jg0?Og&Z?=pmJKh8E98k)F=%#?fjPWUE<2BN1%ux@ctF`Ap2`ChkvT@Hx*G&GuV z1n;he|GPI(c4GkH2}&$nUVyLhwlC-aP}|7{MQSxEVvwDhZ?cSJsU|WS*&;R#7UTleSy{{B?i>@s1Dj%+gSf} zMh2b?4vBgj$MhIb4L%wiV=hD{HVWPqz+}yJER`QccV{c>e|qc_80sy;5@#n#_*xF= zBkpi4>(>eXD{>WlKPqbA={itz9Z(#?4tx(Q-)a~vPe)2>Cd&_tK1KUR=;qC^GB=Zy z16}WTc5pzWQrpi93kq@RVjkP1AGLad!8275_)cFh(2&aY(--r>~TSn zs_WIv+v$8>UFDNb`B034D zlCsd(eTQWsGJC6uDxX(WDp1h34W$J}4EZ~@B8%CTwVTkw&~5f~7_d;7Dnb>GMb z+Cxo^4B+SEjl?5~D7jJsrN~1|OB<@IYmoM3I<{}!I@M>^2{}4DkS_7aW916e+^A)} z=B6L8H!2El%U)v{;+qcZ@2(_6wkUse<}?@moO~h-;uZC5%9T!^QEIa)idJ21c>8ENTgZ|^|6So;>y3pR#?z;&_9jQrEtn#+~qPiF}mOLIO? zyt88mqWA4X%)x_LFz;o~=UnX0MrVp!!k48k&Tw+DLqvGEq&_$s9I3LD6Y_)hf|+Vx as?FKRQ9KCuMPSdy&le#({r>^~_499_d?|nc literal 0 HcmV?d00001 diff --git a/src/main/resources/bomb/fxml/ab/adjacent_letters.fxml b/src/main/resources/bomb/fxml/ab/adjacent_letters.fxml deleted file mode 100644 index 26b60c58..00000000 --- a/src/main/resources/bomb/fxml/ab/adjacent_letters.fxml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - - diff --git a/src/main/resources/bomb/fxml/ab/adventure_game.fxml b/src/main/resources/bomb/fxml/ab/adventure_game.fxml deleted file mode 100644 index 409108d7..00000000 --- a/src/main/resources/bomb/fxml/ab/adventure_game.fxml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - - \ No newline at end of file diff --git a/src/main/resources/bomb/fxml/ab/alphabet.fxml b/src/main/resources/bomb/fxml/ab/alphabet.fxml deleted file mode 100644 index 8e2d9144..00000000 --- a/src/main/resources/bomb/fxml/ab/alphabet.fxml +++ /dev/null @@ -1,77 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/main/resources/bomb/fxml/ab/anagrams.fxml b/src/main/resources/bomb/fxml/ab/anagrams.fxml deleted file mode 100644 index 26b60c58..00000000 --- a/src/main/resources/bomb/fxml/ab/anagrams.fxml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - - diff --git a/src/main/resources/bomb/fxml/ab/astrology.fxml b/src/main/resources/bomb/fxml/ab/astrology.fxml deleted file mode 100644 index 05e323db..00000000 --- a/src/main/resources/bomb/fxml/ab/astrology.fxml +++ /dev/null @@ -1,289 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/main/resources/bomb/fxml/ab/battleship.fxml b/src/main/resources/bomb/fxml/ab/battleship.fxml deleted file mode 100644 index 26b60c58..00000000 --- a/src/main/resources/bomb/fxml/ab/battleship.fxml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - - diff --git a/src/main/resources/bomb/fxml/ab/binary_leds.fxml b/src/main/resources/bomb/fxml/ab/binary_leds.fxml deleted file mode 100644 index 26b60c58..00000000 --- a/src/main/resources/bomb/fxml/ab/binary_leds.fxml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - - diff --git a/src/main/resources/bomb/fxml/ab/bitmaps.fxml b/src/main/resources/bomb/fxml/ab/bitmaps.fxml deleted file mode 100644 index 26b60c58..00000000 --- a/src/main/resources/bomb/fxml/ab/bitmaps.fxml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - - diff --git a/src/main/resources/bomb/fxml/ab/bitwise_ops.fxml b/src/main/resources/bomb/fxml/ab/bitwise_ops.fxml deleted file mode 100644 index c6206fe4..00000000 --- a/src/main/resources/bomb/fxml/ab/bitwise_ops.fxml +++ /dev/null @@ -1,43 +0,0 @@ - - - - - - - - - -
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - -
diff --git a/src/main/resources/bomb/fxml/ab/blind_alley.fxml b/src/main/resources/bomb/fxml/ab/blind_alley.fxml deleted file mode 100644 index 1de80cac..00000000 --- a/src/main/resources/bomb/fxml/ab/blind_alley.fxml +++ /dev/null @@ -1,86 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/main/resources/bomb/fxml/ab/boolean_venn_diagram.fxml b/src/main/resources/bomb/fxml/ab/boolean_venn_diagram.fxml deleted file mode 100644 index f9a80ada..00000000 --- a/src/main/resources/bomb/fxml/ab/boolean_venn_diagram.fxml +++ /dev/null @@ -1,125 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/main/resources/bomb/fxml/ab/broken_button.fxml b/src/main/resources/bomb/fxml/ab/broken_button.fxml deleted file mode 100644 index 26b60c58..00000000 --- a/src/main/resources/bomb/fxml/ab/broken_button.fxml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - - diff --git a/src/main/resources/bomb/fxml/c/caesar_cipher.fxml b/src/main/resources/bomb/fxml/c/caesar_cipher.fxml deleted file mode 100644 index 26b60c58..00000000 --- a/src/main/resources/bomb/fxml/c/caesar_cipher.fxml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - - diff --git a/src/main/resources/bomb/fxml/c/cheap_checkout.fxml b/src/main/resources/bomb/fxml/c/cheap_checkout.fxml deleted file mode 100644 index c15824f8..00000000 --- a/src/main/resources/bomb/fxml/c/cheap_checkout.fxml +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/main/resources/bomb/fxml/c/chess.fxml b/src/main/resources/bomb/fxml/c/chess.fxml deleted file mode 100644 index e8f21f7d..00000000 --- a/src/main/resources/bomb/fxml/c/chess.fxml +++ /dev/null @@ -1,68 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/main/resources/bomb/fxml/c/chord_qualities.fxml b/src/main/resources/bomb/fxml/c/chord_qualities.fxml deleted file mode 100644 index 9ac36392..00000000 --- a/src/main/resources/bomb/fxml/c/chord_qualities.fxml +++ /dev/null @@ -1,23 +0,0 @@ - - - - - - - - - -
- - - -
- - - - - -
diff --git a/src/main/resources/bomb/fxml/c/color_flash.fxml b/src/main/resources/bomb/fxml/c/color_flash.fxml deleted file mode 100644 index 26b60c58..00000000 --- a/src/main/resources/bomb/fxml/c/color_flash.fxml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - - diff --git a/src/main/resources/bomb/fxml/c/color_math.fxml b/src/main/resources/bomb/fxml/c/color_math.fxml deleted file mode 100644 index 26b60c58..00000000 --- a/src/main/resources/bomb/fxml/c/color_math.fxml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - - diff --git a/src/main/resources/bomb/fxml/c/colored_squares.fxml b/src/main/resources/bomb/fxml/c/colored_squares.fxml deleted file mode 100644 index 26b60c58..00000000 --- a/src/main/resources/bomb/fxml/c/colored_squares.fxml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - - diff --git a/src/main/resources/bomb/fxml/c/colored_switches.fxml b/src/main/resources/bomb/fxml/c/colored_switches.fxml deleted file mode 100644 index 7fb858ce..00000000 --- a/src/main/resources/bomb/fxml/c/colored_switches.fxml +++ /dev/null @@ -1,178 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/main/resources/bomb/fxml/c/combination_lock.fxml b/src/main/resources/bomb/fxml/c/combination_lock.fxml deleted file mode 100644 index 26b60c58..00000000 --- a/src/main/resources/bomb/fxml/c/combination_lock.fxml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - - diff --git a/src/main/resources/bomb/fxml/c/complicated_buttons.fxml b/src/main/resources/bomb/fxml/c/complicated_buttons.fxml deleted file mode 100644 index d3639e30..00000000 --- a/src/main/resources/bomb/fxml/c/complicated_buttons.fxml +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - diff --git a/src/main/resources/bomb/fxml/c/connection_check.fxml b/src/main/resources/bomb/fxml/c/connection_check.fxml deleted file mode 100644 index 26b60c58..00000000 --- a/src/main/resources/bomb/fxml/c/connection_check.fxml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - - diff --git a/src/main/resources/bomb/fxml/c/coordinates.fxml b/src/main/resources/bomb/fxml/c/coordinates.fxml deleted file mode 100644 index 26b60c58..00000000 --- a/src/main/resources/bomb/fxml/c/coordinates.fxml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - - diff --git a/src/main/resources/bomb/fxml/c/crazy_talk.fxml b/src/main/resources/bomb/fxml/c/crazy_talk.fxml deleted file mode 100644 index 26b60c58..00000000 --- a/src/main/resources/bomb/fxml/c/crazy_talk.fxml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - - diff --git a/src/main/resources/bomb/fxml/c/creation.fxml b/src/main/resources/bomb/fxml/c/creation.fxml deleted file mode 100644 index 26b60c58..00000000 --- a/src/main/resources/bomb/fxml/c/creation.fxml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - - diff --git a/src/main/resources/bomb/fxml/c/crossover.fxml b/src/main/resources/bomb/fxml/c/crossover.fxml deleted file mode 100644 index 26b60c58..00000000 --- a/src/main/resources/bomb/fxml/c/crossover.fxml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - - diff --git a/src/main/resources/bomb/fxml/c/crypto.fxml b/src/main/resources/bomb/fxml/c/crypto.fxml deleted file mode 100644 index 26b60c58..00000000 --- a/src/main/resources/bomb/fxml/c/crypto.fxml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - - diff --git a/src/main/resources/bomb/fxml/dh/double_oh.fxml b/src/main/resources/bomb/fxml/dh/double_oh.fxml deleted file mode 100644 index 26b60c58..00000000 --- a/src/main/resources/bomb/fxml/dh/double_oh.fxml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - - diff --git a/src/main/resources/bomb/fxml/dh/emoji_math.fxml b/src/main/resources/bomb/fxml/dh/emoji_math.fxml deleted file mode 100644 index e644e681..00000000 --- a/src/main/resources/bomb/fxml/dh/emoji_math.fxml +++ /dev/null @@ -1,100 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/main/resources/bomb/fxml/dh/english_test.fxml b/src/main/resources/bomb/fxml/dh/english_test.fxml deleted file mode 100644 index 26b60c58..00000000 --- a/src/main/resources/bomb/fxml/dh/english_test.fxml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - - diff --git a/src/main/resources/bomb/fxml/dh/fast_math.fxml b/src/main/resources/bomb/fxml/dh/fast_math.fxml deleted file mode 100644 index cdff1e38..00000000 --- a/src/main/resources/bomb/fxml/dh/fast_math.fxml +++ /dev/null @@ -1,110 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - -
-
diff --git a/src/main/resources/bomb/fxml/dh/filibuster.fxml b/src/main/resources/bomb/fxml/dh/filibuster.fxml deleted file mode 100644 index 26b60c58..00000000 --- a/src/main/resources/bomb/fxml/dh/filibuster.fxml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - - diff --git a/src/main/resources/bomb/fxml/dh/fizzbuzz.fxml b/src/main/resources/bomb/fxml/dh/fizzbuzz.fxml deleted file mode 100644 index 26b60c58..00000000 --- a/src/main/resources/bomb/fxml/dh/fizzbuzz.fxml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - - diff --git a/src/main/resources/bomb/fxml/dh/flags.fxml b/src/main/resources/bomb/fxml/dh/flags.fxml deleted file mode 100644 index 26b60c58..00000000 --- a/src/main/resources/bomb/fxml/dh/flags.fxml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - - diff --git a/src/main/resources/bomb/fxml/dh/follow_the_leader.fxml b/src/main/resources/bomb/fxml/dh/follow_the_leader.fxml deleted file mode 100644 index 26b60c58..00000000 --- a/src/main/resources/bomb/fxml/dh/follow_the_leader.fxml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - - diff --git a/src/main/resources/bomb/fxml/dh/foreign_exchange_rates.fxml b/src/main/resources/bomb/fxml/dh/foreign_exchange_rates.fxml deleted file mode 100644 index 26b60c58..00000000 --- a/src/main/resources/bomb/fxml/dh/foreign_exchange_rates.fxml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - - diff --git a/src/main/resources/bomb/fxml/dh/friendship.fxml b/src/main/resources/bomb/fxml/dh/friendship.fxml deleted file mode 100644 index 26b60c58..00000000 --- a/src/main/resources/bomb/fxml/dh/friendship.fxml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - - diff --git a/src/main/resources/bomb/fxml/dh/hexamaze.fxml b/src/main/resources/bomb/fxml/dh/hexamaze.fxml deleted file mode 100644 index 609997be..00000000 --- a/src/main/resources/bomb/fxml/dh/hexamaze.fxml +++ /dev/null @@ -1,87 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/main/resources/bomb/fxml/forget_me_not.fxml b/src/main/resources/bomb/fxml/forget_me_not.fxml deleted file mode 100644 index 7ca097c9..00000000 --- a/src/main/resources/bomb/fxml/forget_me_not.fxml +++ /dev/null @@ -1,111 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/main/resources/bomb/fxml/il/ice_cream.fxml b/src/main/resources/bomb/fxml/il/ice_cream.fxml deleted file mode 100644 index 26b60c58..00000000 --- a/src/main/resources/bomb/fxml/il/ice_cream.fxml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - - diff --git a/src/main/resources/bomb/fxml/il/laundry.fxml b/src/main/resources/bomb/fxml/il/laundry.fxml deleted file mode 100644 index 4c25dc13..00000000 --- a/src/main/resources/bomb/fxml/il/laundry.fxml +++ /dev/null @@ -1,117 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/main/resources/bomb/fxml/il/led_encryption.fxml b/src/main/resources/bomb/fxml/il/led_encryption.fxml deleted file mode 100644 index 26b60c58..00000000 --- a/src/main/resources/bomb/fxml/il/led_encryption.fxml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - - diff --git a/src/main/resources/bomb/fxml/il/letter_keys.fxml b/src/main/resources/bomb/fxml/il/letter_keys.fxml deleted file mode 100644 index aab2fe9e..00000000 --- a/src/main/resources/bomb/fxml/il/letter_keys.fxml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - diff --git a/src/main/resources/bomb/fxml/il/light_cycle.fxml b/src/main/resources/bomb/fxml/il/light_cycle.fxml deleted file mode 100644 index 26b60c58..00000000 --- a/src/main/resources/bomb/fxml/il/light_cycle.fxml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - - diff --git a/src/main/resources/bomb/fxml/il/listening.fxml b/src/main/resources/bomb/fxml/il/listening.fxml deleted file mode 100644 index 26b60c58..00000000 --- a/src/main/resources/bomb/fxml/il/listening.fxml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - - diff --git a/src/main/resources/bomb/fxml/il/logic.fxml b/src/main/resources/bomb/fxml/il/logic.fxml deleted file mode 100644 index bb93a849..00000000 --- a/src/main/resources/bomb/fxml/il/logic.fxml +++ /dev/null @@ -1,163 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/main/resources/bomb/fxml/m/math_is_hard.fxml b/src/main/resources/bomb/fxml/m/math_is_hard.fxml deleted file mode 100644 index 26b60c58..00000000 --- a/src/main/resources/bomb/fxml/m/math_is_hard.fxml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - - diff --git a/src/main/resources/bomb/fxml/m/microcontroller.fxml b/src/main/resources/bomb/fxml/m/microcontroller.fxml deleted file mode 100644 index 09076f19..00000000 --- a/src/main/resources/bomb/fxml/m/microcontroller.fxml +++ /dev/null @@ -1,91 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/main/resources/bomb/fxml/m/minesweeper.fxml b/src/main/resources/bomb/fxml/m/minesweeper.fxml deleted file mode 100644 index 26b60c58..00000000 --- a/src/main/resources/bomb/fxml/m/minesweeper.fxml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - - diff --git a/src/main/resources/bomb/fxml/m/modules_against_humanity.fxml b/src/main/resources/bomb/fxml/m/modules_against_humanity.fxml deleted file mode 100644 index 26b60c58..00000000 --- a/src/main/resources/bomb/fxml/m/modules_against_humanity.fxml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - - diff --git a/src/main/resources/bomb/fxml/m/monsplode_fight.fxml b/src/main/resources/bomb/fxml/m/monsplode_fight.fxml deleted file mode 100644 index 26b60c58..00000000 --- a/src/main/resources/bomb/fxml/m/monsplode_fight.fxml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - - diff --git a/src/main/resources/bomb/fxml/m/morsematics.fxml b/src/main/resources/bomb/fxml/m/morsematics.fxml deleted file mode 100644 index 26b60c58..00000000 --- a/src/main/resources/bomb/fxml/m/morsematics.fxml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - - diff --git a/src/main/resources/bomb/fxml/m/mouse_in_the_maze.fxml b/src/main/resources/bomb/fxml/m/mouse_in_the_maze.fxml deleted file mode 100644 index 26b60c58..00000000 --- a/src/main/resources/bomb/fxml/m/mouse_in_the_maze.fxml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - - diff --git a/src/main/resources/bomb/fxml/m/murder.fxml b/src/main/resources/bomb/fxml/m/murder.fxml deleted file mode 100644 index 26b60c58..00000000 --- a/src/main/resources/bomb/fxml/m/murder.fxml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - - diff --git a/src/main/resources/bomb/fxml/m/mystic_squares.fxml b/src/main/resources/bomb/fxml/m/mystic_squares.fxml deleted file mode 100644 index 26b60c58..00000000 --- a/src/main/resources/bomb/fxml/m/mystic_squares.fxml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - - diff --git a/src/main/resources/bomb/fxml/notes/extra_notes.fxml b/src/main/resources/bomb/fxml/notes/extra_notes.fxml deleted file mode 100644 index cadd716e..00000000 --- a/src/main/resources/bomb/fxml/notes/extra_notes.fxml +++ /dev/null @@ -1,31 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/main/resources/bomb/fxml/np/neutralization.fxml b/src/main/resources/bomb/fxml/np/neutralization.fxml deleted file mode 100644 index a1bc48d3..00000000 --- a/src/main/resources/bomb/fxml/np/neutralization.fxml +++ /dev/null @@ -1,195 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/main/resources/bomb/fxml/np/new_neutralization.fxml b/src/main/resources/bomb/fxml/np/new_neutralization.fxml deleted file mode 100644 index e132bd89..00000000 --- a/src/main/resources/bomb/fxml/np/new_neutralization.fxml +++ /dev/null @@ -1,106 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/main/resources/bomb/fxml/np/number_pad.fxml b/src/main/resources/bomb/fxml/np/number_pad.fxml deleted file mode 100644 index 26b60c58..00000000 --- a/src/main/resources/bomb/fxml/np/number_pad.fxml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - - diff --git a/src/main/resources/bomb/fxml/np/only_connect.fxml b/src/main/resources/bomb/fxml/np/only_connect.fxml deleted file mode 100644 index 26b60c58..00000000 --- a/src/main/resources/bomb/fxml/np/only_connect.fxml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - - diff --git a/src/main/resources/bomb/fxml/np/orientation.fxml b/src/main/resources/bomb/fxml/np/orientation.fxml deleted file mode 100644 index 26b60c58..00000000 --- a/src/main/resources/bomb/fxml/np/orientation.fxml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - - diff --git a/src/main/resources/bomb/fxml/np/perspective_pegs.fxml b/src/main/resources/bomb/fxml/np/perspective_pegs.fxml deleted file mode 100644 index 26b60c58..00000000 --- a/src/main/resources/bomb/fxml/np/perspective_pegs.fxml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - - diff --git a/src/main/resources/bomb/fxml/np/piano_keys.fxml b/src/main/resources/bomb/fxml/np/piano_keys.fxml deleted file mode 100644 index 26b60c58..00000000 --- a/src/main/resources/bomb/fxml/np/piano_keys.fxml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - - diff --git a/src/main/resources/bomb/fxml/np/piano_keys_cruel.fxml b/src/main/resources/bomb/fxml/np/piano_keys_cruel.fxml deleted file mode 100644 index 26b60c58..00000000 --- a/src/main/resources/bomb/fxml/np/piano_keys_cruel.fxml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - - diff --git a/src/main/resources/bomb/fxml/np/plumbing.fxml b/src/main/resources/bomb/fxml/np/plumbing.fxml deleted file mode 100644 index 26b60c58..00000000 --- a/src/main/resources/bomb/fxml/np/plumbing.fxml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - - diff --git a/src/main/resources/bomb/fxml/np/point_of_order.fxml b/src/main/resources/bomb/fxml/np/point_of_order.fxml deleted file mode 100644 index 26b60c58..00000000 --- a/src/main/resources/bomb/fxml/np/point_of_order.fxml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - - diff --git a/src/main/resources/bomb/fxml/np/probing.fxml b/src/main/resources/bomb/fxml/np/probing.fxml deleted file mode 100644 index 26b60c58..00000000 --- a/src/main/resources/bomb/fxml/np/probing.fxml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - - diff --git a/src/main/resources/bomb/fxml/r/resistors.fxml b/src/main/resources/bomb/fxml/r/resistors.fxml deleted file mode 100644 index 26b60c58..00000000 --- a/src/main/resources/bomb/fxml/r/resistors.fxml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - - diff --git a/src/main/resources/bomb/fxml/r/rhythms.fxml b/src/main/resources/bomb/fxml/r/rhythms.fxml deleted file mode 100644 index 26b60c58..00000000 --- a/src/main/resources/bomb/fxml/r/rhythms.fxml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - - diff --git a/src/main/resources/bomb/fxml/r/rock_paper_scissors_lizard_spock.fxml b/src/main/resources/bomb/fxml/r/rock_paper_scissors_lizard_spock.fxml deleted file mode 100644 index 26b60c58..00000000 --- a/src/main/resources/bomb/fxml/r/rock_paper_scissors_lizard_spock.fxml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - - diff --git a/src/main/resources/bomb/fxml/r/round_keypads.fxml b/src/main/resources/bomb/fxml/r/round_keypads.fxml deleted file mode 100644 index 0445c1cd..00000000 --- a/src/main/resources/bomb/fxml/r/round_keypads.fxml +++ /dev/null @@ -1,317 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/main/resources/bomb/fxml/r/rubiks_cube.fxml b/src/main/resources/bomb/fxml/r/rubiks_cube.fxml deleted file mode 100644 index 26b60c58..00000000 --- a/src/main/resources/bomb/fxml/r/rubiks_cube.fxml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - - diff --git a/src/main/resources/bomb/fxml/s/safety_safe.fxml b/src/main/resources/bomb/fxml/s/safety_safe.fxml deleted file mode 100644 index 26b60c58..00000000 --- a/src/main/resources/bomb/fxml/s/safety_safe.fxml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - - diff --git a/src/main/resources/bomb/fxml/s/seashells.fxml b/src/main/resources/bomb/fxml/s/seashells.fxml deleted file mode 100644 index 26b60c58..00000000 --- a/src/main/resources/bomb/fxml/s/seashells.fxml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - - diff --git a/src/main/resources/bomb/fxml/s/semaphore.fxml b/src/main/resources/bomb/fxml/s/semaphore.fxml deleted file mode 100644 index 26b60c58..00000000 --- a/src/main/resources/bomb/fxml/s/semaphore.fxml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - - diff --git a/src/main/resources/bomb/fxml/s/shape_shift.fxml b/src/main/resources/bomb/fxml/s/shape_shift.fxml deleted file mode 100644 index de6aeab5..00000000 --- a/src/main/resources/bomb/fxml/s/shape_shift.fxml +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - diff --git a/src/main/resources/bomb/fxml/s/silly_slots.fxml b/src/main/resources/bomb/fxml/s/silly_slots.fxml deleted file mode 100644 index 26b60c58..00000000 --- a/src/main/resources/bomb/fxml/s/silly_slots.fxml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - - diff --git a/src/main/resources/bomb/fxml/s/simon_screams.fxml b/src/main/resources/bomb/fxml/s/simon_screams.fxml deleted file mode 100644 index 141554b2..00000000 --- a/src/main/resources/bomb/fxml/s/simon_screams.fxml +++ /dev/null @@ -1,49 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/main/resources/bomb/fxml/s/simon_states.fxml b/src/main/resources/bomb/fxml/s/simon_states.fxml deleted file mode 100644 index 26b60c58..00000000 --- a/src/main/resources/bomb/fxml/s/simon_states.fxml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - - diff --git a/src/main/resources/bomb/fxml/s/skewed_slots.fxml b/src/main/resources/bomb/fxml/s/skewed_slots.fxml deleted file mode 100644 index 26b60c58..00000000 --- a/src/main/resources/bomb/fxml/s/skewed_slots.fxml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - - diff --git a/src/main/resources/bomb/fxml/s/square_button.fxml b/src/main/resources/bomb/fxml/s/square_button.fxml deleted file mode 100644 index 26b60c58..00000000 --- a/src/main/resources/bomb/fxml/s/square_button.fxml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - - diff --git a/src/main/resources/bomb/fxml/s/switches.fxml b/src/main/resources/bomb/fxml/s/switches.fxml deleted file mode 100644 index f4957773..00000000 --- a/src/main/resources/bomb/fxml/s/switches.fxml +++ /dev/null @@ -1,89 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/main/resources/bomb/fxml/s/symbolic_password.fxml b/src/main/resources/bomb/fxml/s/symbolic_password.fxml deleted file mode 100644 index 26b60c58..00000000 --- a/src/main/resources/bomb/fxml/s/symbolic_password.fxml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - - diff --git a/src/main/resources/bomb/fxml/souvenir.fxml b/src/main/resources/bomb/fxml/souvenir.fxml deleted file mode 100644 index 43eebc6f..00000000 --- a/src/main/resources/bomb/fxml/souvenir.fxml +++ /dev/null @@ -1,43 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/main/resources/bomb/fxml/t/3d_maze.fxml b/src/main/resources/bomb/fxml/t/3d_maze.fxml deleted file mode 100644 index d5dccebc..00000000 --- a/src/main/resources/bomb/fxml/t/3d_maze.fxml +++ /dev/null @@ -1,24 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/main/resources/bomb/fxml/t/text_field.fxml b/src/main/resources/bomb/fxml/t/text_field.fxml deleted file mode 100644 index 26b60c58..00000000 --- a/src/main/resources/bomb/fxml/t/text_field.fxml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - - diff --git a/src/main/resources/bomb/fxml/t/the_bulb.fxml b/src/main/resources/bomb/fxml/t/the_bulb.fxml deleted file mode 100644 index ede03d4f..00000000 --- a/src/main/resources/bomb/fxml/t/the_bulb.fxml +++ /dev/null @@ -1,115 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/main/resources/bomb/fxml/t/the_clock.fxml b/src/main/resources/bomb/fxml/t/the_clock.fxml deleted file mode 100644 index 26b60c58..00000000 --- a/src/main/resources/bomb/fxml/t/the_clock.fxml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - - diff --git a/src/main/resources/bomb/fxml/t/the_gamepad.fxml b/src/main/resources/bomb/fxml/t/the_gamepad.fxml deleted file mode 100644 index 26b60c58..00000000 --- a/src/main/resources/bomb/fxml/t/the_gamepad.fxml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - - diff --git a/src/main/resources/bomb/fxml/t/the_screw.fxml b/src/main/resources/bomb/fxml/t/the_screw.fxml deleted file mode 100644 index 26b60c58..00000000 --- a/src/main/resources/bomb/fxml/t/the_screw.fxml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - - diff --git a/src/main/resources/bomb/fxml/t/third_base.fxml b/src/main/resources/bomb/fxml/t/third_base.fxml deleted file mode 100644 index 26b60c58..00000000 --- a/src/main/resources/bomb/fxml/t/third_base.fxml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - - diff --git a/src/main/resources/bomb/fxml/t/tic_tac_toe.fxml b/src/main/resources/bomb/fxml/t/tic_tac_toe.fxml deleted file mode 100644 index 26b60c58..00000000 --- a/src/main/resources/bomb/fxml/t/tic_tac_toe.fxml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - - diff --git a/src/main/resources/bomb/fxml/t/translated/old_translated_vanilla_modules.fxml b/src/main/resources/bomb/fxml/t/translated/old_translated_vanilla_modules.fxml deleted file mode 100644 index 6b50244f..00000000 --- a/src/main/resources/bomb/fxml/t/translated/old_translated_vanilla_modules.fxml +++ /dev/null @@ -1,593 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - -
- - - -
- -
- - - -
- - - -
- -
- - - -
- - - -
- -
- - - -
- - - -
- -
- - - -
- - - -
- -
- - - -
- - - -
- -
- - - -
- - - -
- -
- - - -
- - - -
- -
- - - -
- - - -
- -
- - - -
- - - -
- -
- - - -
- - - -
- -
- - - -
- - - -
- -
- - - -
- - - -
- -
- - - -
- - - -
- -
- - - -
- - - -
-
-
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
diff --git a/src/main/resources/bomb/fxml/t/translated/translated_vanilla_modules.fxml b/src/main/resources/bomb/fxml/t/translated/translated_vanilla_modules.fxml deleted file mode 100644 index 9dcbc289..00000000 --- a/src/main/resources/bomb/fxml/t/translated/translated_vanilla_modules.fxml +++ /dev/null @@ -1,209 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/main/resources/bomb/fxml/t/turn_the_keys.fxml b/src/main/resources/bomb/fxml/t/turn_the_keys.fxml deleted file mode 100644 index fd33361b..00000000 --- a/src/main/resources/bomb/fxml/t/turn_the_keys.fxml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - - diff --git a/src/main/resources/bomb/fxml/t/two_bit.fxml b/src/main/resources/bomb/fxml/t/two_bit.fxml deleted file mode 100644 index 6e535e8b..00000000 --- a/src/main/resources/bomb/fxml/t/two_bit.fxml +++ /dev/null @@ -1,44 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/main/resources/bomb/fxml/widget.fxml b/src/main/resources/bomb/fxml/widget.fxml deleted file mode 100644 index 7e1b3190..00000000 --- a/src/main/resources/bomb/fxml/widget.fxml +++ /dev/null @@ -1,472 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/main/resources/bomb/fxml/wz/web_design.fxml b/src/main/resources/bomb/fxml/wz/web_design.fxml deleted file mode 100644 index 26b60c58..00000000 --- a/src/main/resources/bomb/fxml/wz/web_design.fxml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - - diff --git a/src/main/resources/bomb/fxml/wz/wire_placement.fxml b/src/main/resources/bomb/fxml/wz/wire_placement.fxml deleted file mode 100644 index 26b60c58..00000000 --- a/src/main/resources/bomb/fxml/wz/wire_placement.fxml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - - diff --git a/src/main/resources/bomb/fxml/wz/word_scramble.fxml b/src/main/resources/bomb/fxml/wz/word_scramble.fxml deleted file mode 100644 index 409108d7..00000000 --- a/src/main/resources/bomb/fxml/wz/word_scramble.fxml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - - \ No newline at end of file diff --git a/src/main/resources/bomb/fxml/wz/word_search.fxml b/src/main/resources/bomb/fxml/wz/word_search.fxml deleted file mode 100644 index 26b60c58..00000000 --- a/src/main/resources/bomb/fxml/wz/word_search.fxml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - - diff --git a/src/main/resources/bomb/fxml/wz/yahtzee.fxml b/src/main/resources/bomb/fxml/wz/yahtzee.fxml deleted file mode 100644 index 26b60c58..00000000 --- a/src/main/resources/bomb/fxml/wz/yahtzee.fxml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - - diff --git a/src/main/resources/bomb/fxml/wz/zoo.fxml b/src/main/resources/bomb/fxml/wz/zoo.fxml deleted file mode 100644 index 26b60c58..00000000 --- a/src/main/resources/bomb/fxml/wz/zoo.fxml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - - From caa200845fe804c929c5848c94c2f2b25a284051 Mon Sep 17 00:00:00 2001 From: "Mr. J" <45538844+Ultraviolet-Ninja@users.noreply.github.com> Date: Tue, 20 Dec 2022 11:46:08 -0600 Subject: [PATCH 78/86] Deletion of the Dockerfile --- Dockerfile | 45 --------------------------------------------- 1 file changed, 45 deletions(-) delete mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile deleted file mode 100644 index deec2bf2..00000000 --- a/Dockerfile +++ /dev/null @@ -1,45 +0,0 @@ -#FIXME - V1 of the Dockerfile -#FROM openjdk:16-alpine -# -#ARG JAR_FILE -#COPY $JAR_FILE app.jar -# -#ENTRYPOINT ["java", "-jar", "app.jar"] - -#FIXME - Shoving the entire program into a docker container (Not the greatest idea) -#FROM gradle:7.4.0-jdk17-alpine -# -#ENV APP_HOME=/usr/app/ -#WORKDIR $APP_HOME -# -#COPY necessaryFiles/build.gradle necessaryFiles/settings.gradle $APP_HOME -# -#COPY necessaryFiles/wrapper ${APP_HOME}gradle/wrapper -#COPY --chown=gradle:gradle . /home/gradle/src -#USER root -#RUN chown -R gradle /home/gradle/src -# -#RUN gradle build -i --stacktrace -#COPY necessaryFiles/java ${APP_HOME}src/main/java -#COPY necessaryFiles/resources ${APP_HOME}src/main/resources -#RUN gradle clean build -# -#ENTRYPOINT gradle run - -#FIXME - Failed Linux build (duplicate modules on the modulepath for the JavaFX library) -#FROM gradle:7.4.0-jdk17-alpine -# -#ENV APP_HOME=/usr/app/ -#WORKDIR $APP_HOME -# -#COPY necessaryFiles/build.gradle necessaryFiles/settings.gradle $APP_HOME -# -#COPY necessaryFiles/wrapper ${APP_HOME}gradle/wrapper -#COPY --chown=gradle:gradle . /home/gradle/src -#USER root -#RUN chown -R gradle /home/gradle/src -# -#RUN gradle build -#COPY necessaryFiles/java ${APP_HOME}src/main/java -#COPY necessaryFiles/resources ${APP_HOME}src/main/resources -#RUN gradle jlink \ No newline at end of file From 85bd1652de45b717759891fb6afa8655d0ae5c09 Mon Sep 17 00:00:00 2001 From: "Mr. J" <45538844+Ultraviolet-Ninja@users.noreply.github.com> Date: Tue, 20 Dec 2022 12:01:58 -0600 Subject: [PATCH 79/86] Update to README.md to reflect how releases are now conducted --- README.md | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 265ab83e..740fdb80 100644 --- a/README.md +++ b/README.md @@ -30,13 +30,10 @@ This is a huge project for one man to tackle, but I've [learned a lot](Learned.m See the running list of modules [here](Progress.md) ## How to run the program -*Disclaimer:* Make sure you have Java [17](https://www.oracle.com/java/technologies/javase/jdk17-archive-downloads.html) -and the JAVA_HOME is set. -1. Grab the latest .zip/tar of the GradleCenturion-X.X.X and unzip it -2. Using the command line, navigate to the unzipped directory -3. Run the command - - Windows: `gradlew run` - - Linux: `./gradlew run` +*Disclaimer*: This is referring to program versions `0.22.2` onward +- The `source code` option of the [Release Page](https://github.com/Ultraviolet-Ninja/GradleCenturion/releases) contains an executable, a Windows batch file and all the necessary jar files to run the program +- The `Gradle-Centurion-[VERSION]-[OPERATING SYSTEM]` contains a OS-specific executable file with a runtime environment for the program to run in + - *Only supports Windows currently* ## Inspiration After my first manual turning out to be successful in solving the main-game bombs, I thought "*Why stop there?*". From 1df79c3f2dd2bb2d27b7961bc8910c57ba36dbc6 Mon Sep 17 00:00:00 2001 From: "Mr. J" <45538844+Ultraviolet-Ninja@users.noreply.github.com> Date: Tue, 20 Dec 2022 12:19:15 -0600 Subject: [PATCH 80/86] Added Code Quality Analysis GitHub Action --- .github/workflows/codeql.yml | 68 ++++++++++++++++++++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100644 .github/workflows/codeql.yml diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml new file mode 100644 index 00000000..e54aebd6 --- /dev/null +++ b/.github/workflows/codeql.yml @@ -0,0 +1,68 @@ +# For most projects, this workflow file will not need changing; you simply need +# to commit it to your repository. +# +# You may wish to alter this file to override the set of languages analyzed, +# or to provide custom queries or build logic. +name: "CodeQL" + +on: + push: + branches: [ "main", "dev" ] + pull_request: + # The branches below must be a subset of the branches above + branches: [ "main", "dev" ] + schedule: + - cron: '30 10 * * 1' + +jobs: + analyze: + name: Analyze + runs-on: ubuntu-latest + permissions: + actions: read + contents: read + security-events: write + + strategy: + fail-fast: false + matrix: + language: [ 'java' ] + # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ] + # Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support + + steps: + - name: Checkout repository + uses: actions/checkout@v3 + + # Initializes the CodeQL tools for scanning. + - name: Initialize CodeQL + uses: github/codeql-action/init@v2 + with: + languages: ${{ matrix.language }} + # If you wish to specify custom queries, you can do so here or in a config file. + # By default, queries listed here will override any specified in a config file. + # Prefix the list here with "+" to use these queries and those in the config file. + + # Details on CodeQL's query packs refer to : https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs + # queries: security-extended,security-and-quality + + + # Autobuild attempts to build any compiled languages (C/C++, C#, Go, or Java). + # If this step fails, then you should remove it and run the build manually (see below) + - name: Autobuild + uses: github/codeql-action/autobuild@v2 + + # ℹī¸ Command-line programs to run using the OS shell. + # 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun + + # If the Autobuild fails above, remove it and uncomment the following three lines. + # modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance. + + # - run: | + # echo "Run, Build Application using script" + # ./location_of_script_within_repo/buildscript.sh + + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@v2 + with: + category: "/language:${{matrix.language}}" From 45437e83b6c41ae14ec33b362698ed9b41fa67aa Mon Sep 17 00:00:00 2001 From: "Mr. J" <45538844+Ultraviolet-Ninja@users.noreply.github.com> Date: Tue, 20 Dec 2022 12:29:13 -0600 Subject: [PATCH 81/86] Testing manual building of the project --- .github/workflows/codeql.yml | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index e54aebd6..6f11fcfe 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -7,10 +7,10 @@ name: "CodeQL" on: push: - branches: [ "main", "dev" ] + branches: [ "dev" ] pull_request: # The branches below must be a subset of the branches above - branches: [ "main", "dev" ] + branches: [ "dev" ] schedule: - cron: '30 10 * * 1' @@ -49,8 +49,8 @@ jobs: # Autobuild attempts to build any compiled languages (C/C++, C#, Go, or Java). # If this step fails, then you should remove it and run the build manually (see below) - - name: Autobuild - uses: github/codeql-action/autobuild@v2 +# - name: Autobuild +# uses: github/codeql-action/autobuild@v2 # ℹī¸ Command-line programs to run using the OS shell. # 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun @@ -61,6 +61,11 @@ jobs: # - run: | # echo "Run, Build Application using script" # ./location_of_script_within_repo/buildscript.sh + - name: Grant execute permission for gradlew + run: chmod +x gradlew + + - name: Build with Gradle + run: ./gradlew assemble - name: Perform CodeQL Analysis uses: github/codeql-action/analyze@v2 From b72ad6d1c874797bd69c83224c12a5402d06893a Mon Sep 17 00:00:00 2001 From: "Mr. J" <45538844+Ultraviolet-Ninja@users.noreply.github.com> Date: Tue, 20 Dec 2022 12:32:07 -0600 Subject: [PATCH 82/86] Added a JDK setup step --- .github/workflows/codeql.yml | 7 +++++++ .github/workflows/publish_executables.yml | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index 6f11fcfe..3c556b78 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -61,6 +61,13 @@ jobs: # - run: | # echo "Run, Build Application using script" # ./location_of_script_within_repo/buildscript.sh + - name: Set up JDK 17 + uses: actions/setup-java@v2 + with: + java-version: 17 + distribution: 'adopt' + check-latest: true + - name: Grant execute permission for gradlew run: chmod +x gradlew diff --git a/.github/workflows/publish_executables.yml b/.github/workflows/publish_executables.yml index 81ebf3b5..2d6ce1e0 100644 --- a/.github/workflows/publish_executables.yml +++ b/.github/workflows/publish_executables.yml @@ -14,7 +14,7 @@ jobs: runs-on: windows-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Set up JDK 17 uses: actions/setup-java@v2 From cf3bfd3463fa902719242f4ef9d314ef4f520456 Mon Sep 17 00:00:00 2001 From: "Mr. J" <45538844+Ultraviolet-Ninja@users.noreply.github.com> Date: Tue, 20 Dec 2022 13:20:00 -0600 Subject: [PATCH 83/86] Slight tweaks to files and deletion of unwanted comments --- .github/workflows/codeql.yml | 22 +--------------------- build.gradle | 26 +++++++++++--------------- 2 files changed, 12 insertions(+), 36 deletions(-) diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index 3c556b78..2b6c60f3 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -1,8 +1,3 @@ -# For most projects, this workflow file will not need changing; you simply need -# to commit it to your repository. -# -# You may wish to alter this file to override the set of languages analyzed, -# or to provide custom queries or build logic. name: "CodeQL" on: @@ -46,21 +41,6 @@ jobs: # Details on CodeQL's query packs refer to : https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs # queries: security-extended,security-and-quality - - # Autobuild attempts to build any compiled languages (C/C++, C#, Go, or Java). - # If this step fails, then you should remove it and run the build manually (see below) -# - name: Autobuild -# uses: github/codeql-action/autobuild@v2 - - # ℹī¸ Command-line programs to run using the OS shell. - # 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun - - # If the Autobuild fails above, remove it and uncomment the following three lines. - # modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance. - - # - run: | - # echo "Run, Build Application using script" - # ./location_of_script_within_repo/buildscript.sh - name: Set up JDK 17 uses: actions/setup-java@v2 with: @@ -72,7 +52,7 @@ jobs: run: chmod +x gradlew - name: Build with Gradle - run: ./gradlew assemble + run: ./gradlew build - name: Perform CodeQL Analysis uses: github/codeql-action/analyze@v2 diff --git a/build.gradle b/build.gradle index d80ad6ec..4cb152bc 100644 --- a/build.gradle +++ b/build.gradle @@ -76,30 +76,28 @@ def includedTestDirectories = [ test { useTestNG() { - String baseDirectory = 'src/test/resources/suites/suite' - if(firstInstance) { - suites "${baseDirectory}One.xml" + suites 'src/test/resources/suites/suiteOne.xml' includedTestDirectories.addAll([ 'bomb/modules/ab/**', 'bomb/modules/c/**' ]) } else if (secondInstance) { - suites "${baseDirectory}Two.xml" + suites 'src/test/resources/suites/suiteTwo.xml' includedTestDirectories.addAll([ 'bomb/modules/dh/**', 'bomb/modules/il/**', 'bomb/modules/m/**' ]) } else if (thirdInstance) { - suites "${baseDirectory}Three.xml" + suites 'src/test/resources/suites/suiteThree.xml' includedTestDirectories.addAll([ 'bomb/modules/np/**', 'bomb/modules/r/**' ]) } else if (fourthInstance) { - suites "${baseDirectory}Four.xml" + suites 'src/test/resources/suites/suiteFour.xml' includedTestDirectories.addAll([ 'bomb/modules/s/**', 'bomb/modules/t/**' ]) } else if (fifthInstance) { - suites "${baseDirectory}Five.xml" + suites 'src/test/resources/suites/suiteFive.xml' includedTestDirectories.addAll([ 'bomb', 'bomb/tools/filter/*', 'bomb/modules/wz/**' ]) @@ -123,20 +121,18 @@ jacocoTestReport { static List getTargetClasses(boolean firstInstance, boolean secondInstance, boolean thirdInstance, boolean fourthInstance, boolean fifthInstance, boolean sixthInstance) { - String baseModuleDirectory = 'bomb.modules.' - if (firstInstance) - return ["${baseModuleDirectory}ab.**"] + return ['bomb.modules.ab.**'] else if (secondInstance) - return ["${baseModuleDirectory}c.**"] + return ['bomb.modules.c.**'] else if (thirdInstance) - return ["${baseModuleDirectory}dh.**", "${baseModuleDirectory}il.**"] + return ['bomb.modules.dh.**', 'bomb.modules.il.**'] else if (fourthInstance) - return ["${baseModuleDirectory}m.**", "${baseModuleDirectory}np.**"] + return ['bomb.modules.m.**', 'bomb.modules.np.**'] else if (fifthInstance) - return ["${baseModuleDirectory}r.**", "${baseModuleDirectory}s.**"] + return ['bomb.modules.r.**', 'bomb.modules.s.**'] else if (sixthInstance) - return ["${baseModuleDirectory}t.**", "${baseModuleDirectory}wz.**", 'bomb.tools.filter.*'] + return ['bomb.modules.t.**', 'bomb.modules.wz.**', 'bomb.tools.filter.*'] return ['bomb.*'] } From 6f7d36d87f4d50c1af5d87438f41947962cd7371 Mon Sep 17 00:00:00 2001 From: "Mr. J" <45538844+Ultraviolet-Ninja@users.noreply.github.com> Date: Tue, 20 Dec 2022 14:05:54 -0600 Subject: [PATCH 84/86] Testing dependabot.yml --- .github/dependabot.yml | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 .github/dependabot.yml diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 00000000..05771381 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,30 @@ +# To get started with Dependabot version updates, you'll need to specify which +# package ecosystems to update and where the package manifests are located. +# Please see the documentation for all configuration options: +# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates + +version: 2 +updates: + - package-ecosystem: "gradle" # See documentation for possible values + directory: "/" # Location of package manifests + schedule: + interval: "weekly" + allow: + - dependency-name: "com.opencsv:opencsv" + - dependency-name: "org.javatuples:javatuples" + - dependency-name: "org.jgrapht:jgrapht-ext" + - dependency-name: "org.jetbrains:annotations" + - dependency-name: "org.testng:testng" + - dependency-name: "org.slf4j:slf4j-api" + - dependency-name: "org.slf4j:slf4j-simple" + - dependency-name: "nl.jqno.equalsverifier:equalsverifier" + ignore: + - dependency-name: "com.jfoenix:jfoenix" + - dependency-name: "io.github.palexdev:materialfx" + + - package-ecosystem: "github-actions" + directory: "/" + schedule: + interval: "monthly" + allow: + - dependency-type: "all" \ No newline at end of file From be3ec6576006db39ed3fd3461798cc61c88b35fc Mon Sep 17 00:00:00 2001 From: "Mr. J" <45538844+Ultraviolet-Ninja@users.noreply.github.com> Date: Tue, 20 Dec 2022 14:12:12 -0600 Subject: [PATCH 85/86] Updating the version for release --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index 4cb152bc..7ae10feb 100644 --- a/build.gradle +++ b/build.gradle @@ -12,7 +12,7 @@ plugins { } group 'jasmine.jragon' -version '0.22.2' +version '0.22.3' java { sourceCompatibility(17) From da328afd651cb76a294df1373455d5691ba32498 Mon Sep 17 00:00:00 2001 From: "Mr. J" <45538844+Ultraviolet-Ninja@users.noreply.github.com> Date: Tue, 20 Dec 2022 14:15:53 -0600 Subject: [PATCH 86/86] Updating the version in the README.md because I forgot I need to --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 740fdb80..9d7446bf 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ *101 modules, 100 minutes, exponentially more problems.* [![CircleCI](https://circleci.com/gh/Ultraviolet-Ninja/GradleCenturion/tree/main.svg?style=shield)](https://circleci.com/gh/Ultraviolet-Ninja/GradleCenturion/tree/main) -![Project Version](https://img.shields.io/badge/version-0.22.2-blueviolet) +![Project Version](https://img.shields.io/badge/version-0.22.3-blueviolet) ## Intro This project is designed to solve all puzzles found on the Centurion Bomb from Keep Talking and Nobody Explodes, which is a combination of many community-made puzzles and some from the base game set in different languages.
@@ -21,7 +21,7 @@ This is a huge project for one man to tackle, but I've [learned a lot](Learned.m - JFoenix ver. 9.0.4 - JavaTuple ver. 1.2 - JGraphT ver. 1.5.1 -- OpenCSV ver. 5.5.2 +- OpenCSV ver. 5.7.1 ### Other Technologies - Circle CI - CodeMR Free Trial