From a9fd410dde49bf2378da6ad795396e626e2b0099 Mon Sep 17 00:00:00 2001 From: popem Date: Thu, 23 Jun 2022 23:05:43 -0400 Subject: [PATCH] Fixed battleship typos/jetbrains (pulled when broken) --- .../puzzle/battleship/BattleshipBoard.java | 33 +++++++++---------- .../rules/AdjacentShipsContradictionRule.java | 14 ++++---- 2 files changed, 23 insertions(+), 24 deletions(-) diff --git a/src/main/java/edu/rpi/legup/puzzle/battleship/BattleshipBoard.java b/src/main/java/edu/rpi/legup/puzzle/battleship/BattleshipBoard.java index 637cbd926..abe63e22b 100644 --- a/src/main/java/edu/rpi/legup/puzzle/battleship/BattleshipBoard.java +++ b/src/main/java/edu/rpi/legup/puzzle/battleship/BattleshipBoard.java @@ -2,7 +2,6 @@ import edu.rpi.legup.model.gameboard.GridBoard; import edu.rpi.legup.model.gameboard.PuzzleElement; -import org.jetbrains.annotations.NotNull; import java.awt.*; import java.util.ArrayList; @@ -89,13 +88,13 @@ public BattleshipBoard copy() { * @return List of adjacent cells in clockwise order: * { up, right, down, left } */ - public List getAdjacent(@NotNull BattleShipCell cell) { - List adj = new ArrayList<>(); + public List getAdjacent(BattleshipCell cell) { + List adj = new ArrayList<>(); Point loc = cell.getLocation(); - BattleShipCell up = getCell(loc.x, loc.y - 1); - BattleShipCell right = getCell(loc.x + 1, loc.y); - BattleShipCell down = getCell(loc.x, loc.y + 1); - BattleShipCell left = getCell(loc.x - 1, loc.y); + BattleshipCell up = getCell(loc.x, loc.y - 1); + BattleshipCell right = getCell(loc.x + 1, loc.y); + BattleshipCell down = getCell(loc.x, loc.y + 1); + BattleshipCell left = getCell(loc.x - 1, loc.y); adj.add(up); adj.add(right); adj.add(down); @@ -110,13 +109,13 @@ public List getAdjacent(@NotNull BattleShipCell cell) { * @return List of diagonally adjacent cells in clockwise order: * { upRight, downRight, downLeft, upLeft } */ - public List getAdjDiagonals(@NotNull BattleShipCell cell) { - List dia = new ArrayList<>(); + public List getAdjDiagonals(BattleshipCell cell) { + List dia = new ArrayList<>(); Point loc = cell.getLocation(); - BattleShipCell upRight = getCell(loc.x + 1, loc.y - 1); - BattleShipCell downRight = getCell(loc.x + 1, loc.y + 1); - BattleShipCell downLeft = getCell(loc.x - 1, loc.y + 1); - BattleShipCell upLeft = getCell(loc.x - 1, loc.y - 1); + BattleshipCell upRight = getCell(loc.x + 1, loc.y - 1); + BattleshipCell downRight = getCell(loc.x + 1, loc.y + 1); + BattleshipCell downLeft = getCell(loc.x - 1, loc.y + 1); + BattleshipCell upLeft = getCell(loc.x - 1, loc.y - 1); dia.add(upRight); dia.add(downRight); dia.add(downLeft); @@ -130,8 +129,8 @@ public List getAdjDiagonals(@NotNull BattleShipCell cell) { * @param y The y-coordinate of the row. * @return List of cells in the row in increasing x-coordinate order. */ - public List getRow(int y) { - List row = new ArrayList<>(); + public List getRow(int y) { + List row = new ArrayList<>(); for (int x = 0; x < dimension.width; x++) { row.add(getCell(x, y)); } @@ -144,8 +143,8 @@ public List getRow(int y) { * @param x The x-coordinate of the column. * @return List of cells in the column in increasing y-coordinate order. */ - public List getColumn(int x) { - List column = new ArrayList<>(); + public List getColumn(int x) { + List column = new ArrayList<>(); for (int y = 0; y < dimension.height; y++) { column.add(getCell(x, y)); } diff --git a/src/main/java/edu/rpi/legup/puzzle/battleship/rules/AdjacentShipsContradictionRule.java b/src/main/java/edu/rpi/legup/puzzle/battleship/rules/AdjacentShipsContradictionRule.java index 4f3fd700e..92d7df933 100644 --- a/src/main/java/edu/rpi/legup/puzzle/battleship/rules/AdjacentShipsContradictionRule.java +++ b/src/main/java/edu/rpi/legup/puzzle/battleship/rules/AdjacentShipsContradictionRule.java @@ -3,9 +3,9 @@ import edu.rpi.legup.model.gameboard.Board; import edu.rpi.legup.model.gameboard.PuzzleElement; import edu.rpi.legup.model.rules.ContradictionRule; -import edu.rpi.legup.puzzle.battleship.BattleShipBoard; -import edu.rpi.legup.puzzle.battleship.BattleShipCell; -import edu.rpi.legup.puzzle.battleship.BattleShipType; +import edu.rpi.legup.puzzle.battleship.BattleshipBoard; +import edu.rpi.legup.puzzle.battleship.BattleshipCell; +import edu.rpi.legup.puzzle.battleship.BattleshipType; import java.util.List; @@ -34,14 +34,14 @@ public AdjacentShipsContradictionRule() { */ @Override public String checkContradictionAt(Board board, PuzzleElement puzzleElement) { - BattleShipBoard bsBoard = (BattleShipBoard) board; - BattleShipCell cell = (BattleShipCell) bsBoard.getPuzzleElement(puzzleElement); + BattleshipBoard bsBoard = (BattleshipBoard) board; + BattleshipCell cell = (BattleshipCell) bsBoard.getPuzzleElement(puzzleElement); // check orthogonally adjacent cells - List orthoAdjCells + List orthoAdjCells = bsBoard.getAdjacent(cell); - BattleShipCell up = orthoAdjCells.get(0); + BattleshipCell up = orthoAdjCells.get(0); return null; }