protected boolean isSafeMovement(Mine mine, Cell source, Cell target) { if (source == null || target == null) return false; if (source.getContent().getTrampolineTarget() == target.getContent()) return true; Cell upCell = mine.getCell(target.getCoordinate().up()); if (upCell == null) return true; Cell upUpCell = mine.getCell(target.getCoordinate().up().up()); Cell upUpLeftCell = mine.getCell(target.getCoordinate().up().up().left()); Cell upUpRightCell = mine.getCell(target.getCoordinate().up().up().right()); if (upCell.getContent() == CellContent.Empty && (upUpCell != null && (upUpCell.getContent() == CellContent.Rock || upUpCell.getContent() == CellContent.HighOrderRock) || upUpLeftCell != null && (upUpLeftCell.getContent() == CellContent.Rock || upUpLeftCell.getContent() == CellContent.HighOrderRock) || upUpRightCell != null && (upUpRightCell.getContent() == CellContent.Rock || upUpRightCell.getContent() == CellContent.HighOrderRock))) { return false; } return true; }