From 42d010755e646769cdda0c728778f16da35534b3 Mon Sep 17 00:00:00 2001 From: ThisMatt Date: Fri, 22 Sep 2023 18:26:29 -0400 Subject: [PATCH 1/2] Convert cell.data to an int --- .../puzzle/skyscrapers/SkyscrapersCell.java | 8 +++++--- .../skyscrapers/SkyscrapersCellFactory.java | 2 +- .../skyscrapers/SkyscrapersController.java | 16 ++++++++-------- .../skyscrapers/SkyscrapersElementView.java | 2 +- .../skyscrapers/SkyscrapersExporter.java | 2 +- .../skyscrapers/SkyscrapersImporter.java | 4 ++-- .../puzzle/skyscrapers/SkyscrapersType.java | 12 ++++++------ .../ExceedingVisibilityContradictionRule.java | 18 +++++++++--------- ...nsufficientVisibilityContradictionRule.java | 16 ++++++++-------- .../rules/LastSingularCellDirectRule.java | 8 +++++--- .../rules/LastSingularNumberDirectRule.java | 2 +- .../rules/LastVisibleCellDirectRule.java | 6 +++--- .../rules/LastVisibleNumberDirectRule.java | 2 +- .../skyscrapers/rules/NEdgeDirectRule.java | 14 +++++++------- .../PreemptiveVisibilityContradictionRule.java | 4 ++-- .../UnresolvedNumberContradictionRule.java | 4 ++-- 16 files changed, 62 insertions(+), 58 deletions(-) diff --git a/src/main/java/edu/rpi/legup/puzzle/skyscrapers/SkyscrapersCell.java b/src/main/java/edu/rpi/legup/puzzle/skyscrapers/SkyscrapersCell.java index 1cd0e35f5..f58c277d5 100644 --- a/src/main/java/edu/rpi/legup/puzzle/skyscrapers/SkyscrapersCell.java +++ b/src/main/java/edu/rpi/legup/puzzle/skyscrapers/SkyscrapersCell.java @@ -4,16 +4,18 @@ import java.awt.*; -public class SkyscrapersCell extends GridCell { +import static edu.rpi.legup.puzzle.skyscrapers.SkyscrapersType.convertToSkyType; + +public class SkyscrapersCell extends GridCell { private int max; - public SkyscrapersCell(SkyscrapersType value, Point location, int size) { + public SkyscrapersCell(Integer value, Point location, int size) { super(value, location); this.max = size; } public SkyscrapersType getType() { - switch (data) { + switch (convertToSkyType(data)){ case UNKNOWN: return SkyscrapersType.UNKNOWN; default: diff --git a/src/main/java/edu/rpi/legup/puzzle/skyscrapers/SkyscrapersCellFactory.java b/src/main/java/edu/rpi/legup/puzzle/skyscrapers/SkyscrapersCellFactory.java index bb4b49b6c..d276c8bff 100644 --- a/src/main/java/edu/rpi/legup/puzzle/skyscrapers/SkyscrapersCellFactory.java +++ b/src/main/java/edu/rpi/legup/puzzle/skyscrapers/SkyscrapersCellFactory.java @@ -39,7 +39,7 @@ public PuzzleElement importCell(Node node, Board board) throws InvalidFileFormat throw new InvalidFileFormatException("TreeTent Factory: cell unknown value"); } - SkyscrapersCell cell = new SkyscrapersCell(SkyscrapersType.convertToSkyType(value), new Point(x, y), width); + SkyscrapersCell cell = new SkyscrapersCell(value, new Point(x, y), width); cell.setIndex(y * height + x); return cell; } diff --git a/src/main/java/edu/rpi/legup/puzzle/skyscrapers/SkyscrapersController.java b/src/main/java/edu/rpi/legup/puzzle/skyscrapers/SkyscrapersController.java index c97bf7ba6..58994dfe8 100644 --- a/src/main/java/edu/rpi/legup/puzzle/skyscrapers/SkyscrapersController.java +++ b/src/main/java/edu/rpi/legup/puzzle/skyscrapers/SkyscrapersController.java @@ -97,22 +97,22 @@ public void mouseReleased(MouseEvent e) { public void changeCell(MouseEvent e, PuzzleElement element) { SkyscrapersCell cell = (SkyscrapersCell) element; if (e.getButton() == MouseEvent.BUTTON1) { - if (cell.getData().value < cell.getMax()) { - int num = cell.getData().value + 1; - cell.setData(cell.getData().convertToSkyType(num)); + if (cell.getData() < cell.getMax()) { + int num = cell.getData() + 1; + cell.setData(num); } else { - cell.setData(SkyscrapersType.UNKNOWN); + cell.setData(SkyscrapersType.UNKNOWN.value); } } else { if (e.getButton() == MouseEvent.BUTTON3) { - if (cell.getData().value > 0) { - int num = cell.getData().value - 1; - cell.setData(cell.getData().convertToSkyType(num)); + if (cell.getData() > 0) { + int num = cell.getData() - 1; + cell.setData(num); } else { - cell.setData(cell.getData().convertToSkyType(cell.getMax())); + cell.setData(cell.getMax()); } } } diff --git a/src/main/java/edu/rpi/legup/puzzle/skyscrapers/SkyscrapersElementView.java b/src/main/java/edu/rpi/legup/puzzle/skyscrapers/SkyscrapersElementView.java index 45df478b1..9884b4a3c 100644 --- a/src/main/java/edu/rpi/legup/puzzle/skyscrapers/SkyscrapersElementView.java +++ b/src/main/java/edu/rpi/legup/puzzle/skyscrapers/SkyscrapersElementView.java @@ -23,7 +23,7 @@ public void drawElement(Graphics2D graphics2D) { graphics2D.drawRect(location.x, location.y, size.width, size.height); SkyscrapersCell cell = (SkyscrapersCell) puzzleElement; - int val = cell.getData().value; + int val = cell.getData(); if (val != 0) { graphics2D.setColor(FONT_COLOR); graphics2D.setFont(FONT); diff --git a/src/main/java/edu/rpi/legup/puzzle/skyscrapers/SkyscrapersExporter.java b/src/main/java/edu/rpi/legup/puzzle/skyscrapers/SkyscrapersExporter.java index 60803a635..dac09bd16 100644 --- a/src/main/java/edu/rpi/legup/puzzle/skyscrapers/SkyscrapersExporter.java +++ b/src/main/java/edu/rpi/legup/puzzle/skyscrapers/SkyscrapersExporter.java @@ -21,7 +21,7 @@ protected org.w3c.dom.Element createBoardElement(Document newDocument) { org.w3c.dom.Element cellsElement = newDocument.createElement("cells"); for (PuzzleElement puzzleElement : board.getPuzzleElements()) { SkyscrapersCell cell = (SkyscrapersCell) puzzleElement; - if (cell.getData().value != 0) { + if (cell.getData() != 0) { org.w3c.dom.Element cellElement = puzzle.getFactory().exportCell(newDocument, puzzleElement); cellsElement.appendChild(cellElement); } diff --git a/src/main/java/edu/rpi/legup/puzzle/skyscrapers/SkyscrapersImporter.java b/src/main/java/edu/rpi/legup/puzzle/skyscrapers/SkyscrapersImporter.java index 0b2dcbab4..22af18a4c 100644 --- a/src/main/java/edu/rpi/legup/puzzle/skyscrapers/SkyscrapersImporter.java +++ b/src/main/java/edu/rpi/legup/puzzle/skyscrapers/SkyscrapersImporter.java @@ -62,7 +62,7 @@ public void initializeBoard(Node node) throws InvalidFileFormatException { for (int i = 0; i < elementDataList.getLength(); i++) { SkyscrapersCell cell = (SkyscrapersCell) puzzle.getFactory().importCell(elementDataList.item(i), skyscrapersBoard); Point loc = cell.getLocation(); - if (cell.getData().value != 0) { + if (cell.getData() != 0) { cell.setModifiable(false); cell.setGiven(true); } @@ -72,7 +72,7 @@ public void initializeBoard(Node node) throws InvalidFileFormatException { for (int y = 0; y < size; y++) { for (int x = 0; x < size; x++) { if (skyscrapersBoard.getCell(x, y) == null) { - SkyscrapersCell cell = new SkyscrapersCell(SkyscrapersType.UNKNOWN, new Point(x, y), size); + SkyscrapersCell cell = new SkyscrapersCell(SkyscrapersType.UNKNOWN.value, new Point(x, y), size); cell.setIndex(y * size + x); cell.setModifiable(true); skyscrapersBoard.setCell(x, y, cell); diff --git a/src/main/java/edu/rpi/legup/puzzle/skyscrapers/SkyscrapersType.java b/src/main/java/edu/rpi/legup/puzzle/skyscrapers/SkyscrapersType.java index 7a394e83f..0b53a9472 100644 --- a/src/main/java/edu/rpi/legup/puzzle/skyscrapers/SkyscrapersType.java +++ b/src/main/java/edu/rpi/legup/puzzle/skyscrapers/SkyscrapersType.java @@ -1,7 +1,7 @@ package edu.rpi.legup.puzzle.skyscrapers; public enum SkyscrapersType { - UNKNOWN(0), Number(1), ANY(2), CLUE_NORTH(-1), CLUE_EAST(-2), CLUE_SOUTH(-3), CLUE_WEST(-4); + UNKNOWN(0), Number(1), CLUE_NORTH(-1), CLUE_EAST(-2), CLUE_SOUTH(-3), CLUE_WEST(-4), ANY(-5); public int value; @@ -11,10 +11,8 @@ public enum SkyscrapersType { public static SkyscrapersType convertToSkyType(int num) { switch (num) { - case 1: - return Number; - case 2: - return ANY; + case 0: + return UNKNOWN; case -1: return CLUE_NORTH; case -2: @@ -23,8 +21,10 @@ public static SkyscrapersType convertToSkyType(int num) { return CLUE_SOUTH; case -4: return CLUE_WEST; + case -5: + return ANY; default: - return UNKNOWN; + return Number; } } } \ No newline at end of file diff --git a/src/main/java/edu/rpi/legup/puzzle/skyscrapers/rules/ExceedingVisibilityContradictionRule.java b/src/main/java/edu/rpi/legup/puzzle/skyscrapers/rules/ExceedingVisibilityContradictionRule.java index 0d882c18b..efa905ea2 100644 --- a/src/main/java/edu/rpi/legup/puzzle/skyscrapers/rules/ExceedingVisibilityContradictionRule.java +++ b/src/main/java/edu/rpi/legup/puzzle/skyscrapers/rules/ExceedingVisibilityContradictionRule.java @@ -48,10 +48,10 @@ public String checkContradictionAt(Board board, PuzzleElement puzzleElement) { if (row.size() == skyscrapersboard.getWidth()) { //from west border for (SkyscrapersCell c : row) { - if (c.getData().value > max) { - System.out.print(c.getData()); + if (c.getData() > max) { + //System.out.print(c.getData()); //System.out.println(cell.getData()); - max = c.getData().value; + max = c.getData(); count++; } } @@ -64,10 +64,10 @@ public String checkContradictionAt(Board board, PuzzleElement puzzleElement) { //from east border Collections.reverse(row); for (SkyscrapersCell c : row) { - if (c.getData().value > max) { + if (c.getData() > max) { System.out.print(c.getData()); //System.out.println(cell.getData()); - max = c.getData().value; + max = c.getData(); count++; } } @@ -84,10 +84,10 @@ public String checkContradictionAt(Board board, PuzzleElement puzzleElement) { count = 0; for (SkyscrapersCell c : col) { System.out.println(c.getData()); - if (c.getData().value > max) { + if (c.getData() > max) { //System.out.println(cell.getData()); - max = c.getData().value; + max = c.getData(); count++; } } @@ -101,10 +101,10 @@ public String checkContradictionAt(Board board, PuzzleElement puzzleElement) { Collections.reverse(col); for (SkyscrapersCell c : col) { System.out.println(c.getData()); - if (c.getData().value > max) { + if (c.getData() > max) { //System.out.println(cell.getData()); - max = c.getData().value; + max = c.getData(); count++; } } diff --git a/src/main/java/edu/rpi/legup/puzzle/skyscrapers/rules/InsufficientVisibilityContradictionRule.java b/src/main/java/edu/rpi/legup/puzzle/skyscrapers/rules/InsufficientVisibilityContradictionRule.java index 615b53705..afc1b1341 100644 --- a/src/main/java/edu/rpi/legup/puzzle/skyscrapers/rules/InsufficientVisibilityContradictionRule.java +++ b/src/main/java/edu/rpi/legup/puzzle/skyscrapers/rules/InsufficientVisibilityContradictionRule.java @@ -48,10 +48,10 @@ public String checkContradictionAt(Board board, PuzzleElement puzzleElement) { if (row.size() == skyscrapersboard.getWidth()) { //from west border for (SkyscrapersCell c : row) { - if (c.getData().value > max) { + if (c.getData() > max) { System.out.print(c.getData()); //System.out.println(cell.getData()); - max = c.getData().value; + max = c.getData(); count++; } } @@ -64,10 +64,10 @@ public String checkContradictionAt(Board board, PuzzleElement puzzleElement) { //from east border Collections.reverse(row); for (SkyscrapersCell c : row) { - if (c.getData().value > max) { + if (c.getData() > max) { System.out.print(c.getData()); //System.out.println(cell.getData()); - max = c.getData().value; + max = c.getData(); count++; } } @@ -84,10 +84,10 @@ public String checkContradictionAt(Board board, PuzzleElement puzzleElement) { count = 0; for (SkyscrapersCell c : col) { System.out.println(c.getData()); - if (c.getData().value > max) { + if (c.getData() > max) { //System.out.println(cell.getData()); - max = c.getData().value; + max = c.getData(); count++; } } @@ -101,10 +101,10 @@ public String checkContradictionAt(Board board, PuzzleElement puzzleElement) { Collections.reverse(col); for (SkyscrapersCell c : col) { System.out.println(c.getData()); - if (c.getData().value > max) { + if (c.getData() > max) { //System.out.println(cell.getData()); - max = c.getData().value; + max = c.getData(); count++; } } diff --git a/src/main/java/edu/rpi/legup/puzzle/skyscrapers/rules/LastSingularCellDirectRule.java b/src/main/java/edu/rpi/legup/puzzle/skyscrapers/rules/LastSingularCellDirectRule.java index 02f53fc13..5589b9674 100644 --- a/src/main/java/edu/rpi/legup/puzzle/skyscrapers/rules/LastSingularCellDirectRule.java +++ b/src/main/java/edu/rpi/legup/puzzle/skyscrapers/rules/LastSingularCellDirectRule.java @@ -11,6 +11,8 @@ import java.util.ArrayList; +import static edu.rpi.legup.puzzle.skyscrapers.SkyscrapersType.convertToSkyType; + public class LastSingularCellDirectRule extends DirectRule { public LastSingularCellDirectRule() { @@ -44,8 +46,8 @@ public String checkRuleRawAt(TreeTransition transition, PuzzleElement puzzleElem initialBoard.setDupeFlag(true); initialBoard.setViewFlag(false); CellForNumberCaseRule caseRule = new CellForNumberCaseRule(); - ArrayList XCandidates = caseRule.getCasesFor(initialBoard, initialBoard.getWestClues().get(finalCell.getLocation().y), (Integer) finalCell.getData().value); - ArrayList YCandidates = caseRule.getCasesFor(initialBoard, initialBoard.getNorthClues().get(finalCell.getLocation().x), (Integer) finalCell.getData().value); + ArrayList XCandidates = caseRule.getCasesFor(initialBoard, initialBoard.getWestClues().get(finalCell.getLocation().y), (Integer) finalCell.getData()); + ArrayList YCandidates = caseRule.getCasesFor(initialBoard, initialBoard.getNorthClues().get(finalCell.getLocation().x), (Integer) finalCell.getData()); initialBoard.setDupeFlag(dupeTemp); initialBoard.setViewFlag(viewTemp); @@ -77,7 +79,7 @@ private String candidateCheck(ArrayList candidates, PuzzleElement puzzleE private boolean isForced(SkyscrapersBoard board, SkyscrapersCell cell) { SkyscrapersBoard emptyCase = board.copy(); - emptyCase.getPuzzleElement(cell).setData(0); + emptyCase.getPuzzleElement(cell).setData(SkyscrapersType.UNKNOWN.value); DuplicateNumberContradictionRule duplicate = new DuplicateNumberContradictionRule(); if (duplicate.checkContradictionAt(emptyCase, cell) == null) { System.out.println("no contradiction ln"); diff --git a/src/main/java/edu/rpi/legup/puzzle/skyscrapers/rules/LastSingularNumberDirectRule.java b/src/main/java/edu/rpi/legup/puzzle/skyscrapers/rules/LastSingularNumberDirectRule.java index c3c08e8e6..934496827 100644 --- a/src/main/java/edu/rpi/legup/puzzle/skyscrapers/rules/LastSingularNumberDirectRule.java +++ b/src/main/java/edu/rpi/legup/puzzle/skyscrapers/rules/LastSingularNumberDirectRule.java @@ -60,7 +60,7 @@ public String checkRuleRawAt(TreeTransition transition, PuzzleElement puzzleElem private boolean isForced(SkyscrapersBoard board, SkyscrapersCell cell) { SkyscrapersBoard emptyCase = board.copy(); - emptyCase.getPuzzleElement(cell).setData(0); + emptyCase.getPuzzleElement(cell).setData(SkyscrapersType.UNKNOWN.value); DuplicateNumberContradictionRule duplicate = new DuplicateNumberContradictionRule(); if (duplicate.checkContradictionAt(emptyCase, cell) == null) { System.out.println("no contradiction ln"); diff --git a/src/main/java/edu/rpi/legup/puzzle/skyscrapers/rules/LastVisibleCellDirectRule.java b/src/main/java/edu/rpi/legup/puzzle/skyscrapers/rules/LastVisibleCellDirectRule.java index 87db1dbe9..49dc33677 100644 --- a/src/main/java/edu/rpi/legup/puzzle/skyscrapers/rules/LastVisibleCellDirectRule.java +++ b/src/main/java/edu/rpi/legup/puzzle/skyscrapers/rules/LastVisibleCellDirectRule.java @@ -45,8 +45,8 @@ public String checkRuleRawAt(TreeTransition transition, PuzzleElement puzzleElem initialBoard.setDupeFlag(false); initialBoard.setViewFlag(true); CellForNumberCaseRule caseRule = new CellForNumberCaseRule(); - ArrayList XCandidates = caseRule.getCasesFor(initialBoard, initialBoard.getWestClues().get(finalCell.getLocation().y), (Integer) finalCell.getData().value); - ArrayList YCandidates = caseRule.getCasesFor(initialBoard, initialBoard.getNorthClues().get(finalCell.getLocation().x), (Integer) finalCell.getData().value); + ArrayList XCandidates = caseRule.getCasesFor(initialBoard, initialBoard.getWestClues().get(finalCell.getLocation().y), (Integer) finalCell.getData()); + ArrayList YCandidates = caseRule.getCasesFor(initialBoard, initialBoard.getNorthClues().get(finalCell.getLocation().x), (Integer) finalCell.getData()); initialBoard.setDupeFlag(dupeTemp); initialBoard.setViewFlag(viewTemp); @@ -78,7 +78,7 @@ private String candidateCheck(ArrayList candidates, PuzzleElement puzzleE private boolean isForced(SkyscrapersBoard board, SkyscrapersCell cell) { SkyscrapersBoard emptyCase = board.copy(); - emptyCase.getPuzzleElement(cell).setData(0); + emptyCase.getPuzzleElement(cell).setData(SkyscrapersType.UNKNOWN.value); DuplicateNumberContradictionRule duplicate = new DuplicateNumberContradictionRule(); if (duplicate.checkContradictionAt(emptyCase, cell) == null) { System.out.println("no contradiction ln"); diff --git a/src/main/java/edu/rpi/legup/puzzle/skyscrapers/rules/LastVisibleNumberDirectRule.java b/src/main/java/edu/rpi/legup/puzzle/skyscrapers/rules/LastVisibleNumberDirectRule.java index 53cf5305e..d3d4ff2ab 100644 --- a/src/main/java/edu/rpi/legup/puzzle/skyscrapers/rules/LastVisibleNumberDirectRule.java +++ b/src/main/java/edu/rpi/legup/puzzle/skyscrapers/rules/LastVisibleNumberDirectRule.java @@ -61,7 +61,7 @@ public String checkRuleRawAt(TreeTransition transition, PuzzleElement puzzleElem private boolean isForced(SkyscrapersBoard board, SkyscrapersCell cell) { SkyscrapersBoard emptyCase = board.copy(); - emptyCase.getPuzzleElement(cell).setData(0); + emptyCase.getPuzzleElement(cell).setData(SkyscrapersType.UNKNOWN.value); DuplicateNumberContradictionRule duplicate = new DuplicateNumberContradictionRule(); if (duplicate.checkContradictionAt(emptyCase, cell) == null) { System.out.println("no contradiction ln"); diff --git a/src/main/java/edu/rpi/legup/puzzle/skyscrapers/rules/NEdgeDirectRule.java b/src/main/java/edu/rpi/legup/puzzle/skyscrapers/rules/NEdgeDirectRule.java index 081b0b064..9ba726ae4 100644 --- a/src/main/java/edu/rpi/legup/puzzle/skyscrapers/rules/NEdgeDirectRule.java +++ b/src/main/java/edu/rpi/legup/puzzle/skyscrapers/rules/NEdgeDirectRule.java @@ -15,7 +15,7 @@ public class NEdgeDirectRule extends DirectRule { public NEdgeDirectRule() { super("SKYS-BASC-0004", "N Edge", - "If the maximum number appears on an edge, the row or column��s numbers appear in ascending order, starting at that edge.", + "If the maximum number appears on an edge, the row or column's numbers appear in ascending order, starting at that edge.", "edu/rpi/legup/images/skyscrapers/rules/NEdge.png"); } @@ -39,20 +39,20 @@ public String checkRuleRawAt(TreeTransition transition, PuzzleElement puzzleElem } SkyscrapersBoard emptyCase = initialBoard.copy(); - emptyCase.getPuzzleElement(finalCell).setData(0); + emptyCase.getPuzzleElement(finalCell).setData(SkyscrapersType.UNKNOWN.value); Point loc = finalCell.getLocation(); int max = initialBoard.getHeight(); - if (initialBoard.getWestClues().get(loc.y).getData() == max && finalCell.getData().value == loc.x + 1) { + if (initialBoard.getWestClues().get(loc.y).getData() == max && finalCell.getData() == loc.x + 1) { return null; } - if (initialBoard.getEastClues().get(loc.y).getData() == max && finalCell.getData().value == max - loc.x) { + if (initialBoard.getEastClues().get(loc.y).getData() == max && finalCell.getData() == max - loc.x) { return null; } - if (initialBoard.getNorthClues().get(loc.x).getData() == max && finalCell.getData().value == loc.y + 1) { + if (initialBoard.getNorthClues().get(loc.x).getData() == max && finalCell.getData() == loc.y + 1) { return null; } - if (initialBoard.getSouthClues().get(loc.x).getData() == max && finalCell.getData().value == max - loc.y) { + if (initialBoard.getSouthClues().get(loc.x).getData() == max && finalCell.getData() == max - loc.y) { return null; } @@ -62,7 +62,7 @@ public String checkRuleRawAt(TreeTransition transition, PuzzleElement puzzleElem private boolean isForced(SkyscrapersBoard board, SkyscrapersCell cell) { SkyscrapersBoard emptyCase = board.copy(); - emptyCase.getPuzzleElement(cell).setData(0); + emptyCase.getPuzzleElement(cell).setData(SkyscrapersType.UNKNOWN.value); DuplicateNumberContradictionRule duplicate = new DuplicateNumberContradictionRule(); if (duplicate.checkContradictionAt(emptyCase, cell) == null) { System.out.println("no contradiction ln"); diff --git a/src/main/java/edu/rpi/legup/puzzle/skyscrapers/rules/PreemptiveVisibilityContradictionRule.java b/src/main/java/edu/rpi/legup/puzzle/skyscrapers/rules/PreemptiveVisibilityContradictionRule.java index cf01a9375..1be26f49a 100644 --- a/src/main/java/edu/rpi/legup/puzzle/skyscrapers/rules/PreemptiveVisibilityContradictionRule.java +++ b/src/main/java/edu/rpi/legup/puzzle/skyscrapers/rules/PreemptiveVisibilityContradictionRule.java @@ -62,7 +62,7 @@ public String checkContradictionAt(Board board, PuzzleElement puzzleElement) { //don't do anything if already in row boolean exists = false; for (SkyscrapersCell c : temp.getRowCol(loc.y, SkyscrapersType.Number, true)) { - if (c.getData().value == num) { + if (c.getData() == num) { exists = true; break; } @@ -102,7 +102,7 @@ public String checkContradictionAt(Board board, PuzzleElement puzzleElement) { //don't do anything if already in col boolean exists = false; for (SkyscrapersCell c : temp.getRowCol(loc.x, SkyscrapersType.Number, false)) { - if (c.getData().value == num) { + if (c.getData() == num) { exists = true; break; } diff --git a/src/main/java/edu/rpi/legup/puzzle/skyscrapers/rules/UnresolvedNumberContradictionRule.java b/src/main/java/edu/rpi/legup/puzzle/skyscrapers/rules/UnresolvedNumberContradictionRule.java index a8a323e45..21a48caaf 100644 --- a/src/main/java/edu/rpi/legup/puzzle/skyscrapers/rules/UnresolvedNumberContradictionRule.java +++ b/src/main/java/edu/rpi/legup/puzzle/skyscrapers/rules/UnresolvedNumberContradictionRule.java @@ -43,7 +43,7 @@ public String checkContradictionAt(Board board, PuzzleElement puzzleElement) { //isn't already present boolean exists = false; for (SkyscrapersCell presentCell : skyscrapersBoard.getRowCol(loc.y, SkyscrapersType.Number, true)) { - if (presentCell.getData().value == num) { + if (presentCell.getData() == num) { exists = true; break; } @@ -59,7 +59,7 @@ public String checkContradictionAt(Board board, PuzzleElement puzzleElement) { //same process as for row exists = false; for (SkyscrapersCell presentCell : skyscrapersBoard.getRowCol(loc.x, SkyscrapersType.Number, false)) { - if (presentCell.getData().value == num) { + if (presentCell.getData() == num) { exists = true; break; } From 04fdbd2a3980894f88d74e7f5562bbd3bba0153c Mon Sep 17 00:00:00 2001 From: ThisMatt Date: Fri, 22 Sep 2023 18:36:37 -0400 Subject: [PATCH 2/2] unused import --- .../puzzle/skyscrapers/rules/LastSingularCellDirectRule.java | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/main/java/edu/rpi/legup/puzzle/skyscrapers/rules/LastSingularCellDirectRule.java b/src/main/java/edu/rpi/legup/puzzle/skyscrapers/rules/LastSingularCellDirectRule.java index 5589b9674..541075167 100644 --- a/src/main/java/edu/rpi/legup/puzzle/skyscrapers/rules/LastSingularCellDirectRule.java +++ b/src/main/java/edu/rpi/legup/puzzle/skyscrapers/rules/LastSingularCellDirectRule.java @@ -11,8 +11,6 @@ import java.util.ArrayList; -import static edu.rpi.legup.puzzle.skyscrapers.SkyscrapersType.convertToSkyType; - public class LastSingularCellDirectRule extends DirectRule { public LastSingularCellDirectRule() {