Skip to content

Commit

Permalink
Merge pull request #164 from Corppet/dev
Browse files Browse the repository at this point in the history
Removed JetBrains annotations.
  • Loading branch information
cjreed121 authored Jun 24, 2022
2 parents 43974fb + 55f9eb1 commit a112e09
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 24 deletions.
33 changes: 16 additions & 17 deletions src/main/java/edu/rpi/legup/puzzle/battleship/BattleshipBoard.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -89,13 +88,13 @@ public BattleshipBoard copy() {
* @return List of adjacent cells in clockwise order:
* <code>{ up, right, down, left }</code>
*/
public List<BattleShipCell> getAdjacent(@NotNull BattleShipCell cell) {
List<BattleShipCell> adj = new ArrayList<>();
public List<BattleshipCell> getAdjacent(BattleshipCell cell) {
List<BattleshipCell> 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);
Expand All @@ -110,13 +109,13 @@ public List<BattleShipCell> getAdjacent(@NotNull BattleShipCell cell) {
* @return List of diagonally adjacent cells in clockwise order:
* <code>{ upRight, downRight, downLeft, upLeft }</code>
*/
public List<BattleShipCell> getAdjDiagonals(@NotNull BattleShipCell cell) {
List<BattleShipCell> dia = new ArrayList<>();
public List<BattleshipCell> getAdjDiagonals(BattleshipCell cell) {
List<BattleshipCell> 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);
Expand All @@ -130,8 +129,8 @@ public List<BattleShipCell> 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<BattleShipCell> getRow(int y) {
List<BattleShipCell> row = new ArrayList<>();
public List<BattleshipCell> getRow(int y) {
List<BattleshipCell> row = new ArrayList<>();
for (int x = 0; x < dimension.width; x++) {
row.add(getCell(x, y));
}
Expand All @@ -144,8 +143,8 @@ public List<BattleShipCell> 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<BattleShipCell> getColumn(int x) {
List<BattleShipCell> column = new ArrayList<>();
public List<BattleshipCell> getColumn(int x) {
List<BattleshipCell> column = new ArrayList<>();
for (int y = 0; y < dimension.height; y++) {
column.add(getCell(x, y));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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<BattleShipCell> orthoAdjCells
List<BattleshipCell> orthoAdjCells
= bsBoard.getAdjacent(cell);

BattleShipCell up = orthoAdjCells.get(0);
BattleshipCell up = orthoAdjCells.get(0);

return null;
}
Expand Down

0 comments on commit a112e09

Please sign in to comment.