Beispiel #1
0
 private List<Point> initializeBoardCells() {
   List<Point> result = new ArrayList<Point>();
   for (int x = 1; x < size.getValue() - 1; x++) {
     for (int y = 1; y < size.getValue() - 1; y++) {
       result.add(new PointImpl(x, y));
     }
   }
   return result;
 }
Beispiel #2
0
 private void removeMine(Point result) {
   removedMines.add(result);
   getMines().remove(result);
   increaseScore();
   recalculateWalkMap();
   fire(MinesweeperEvents.DESTROY_MINE);
   if (getMines().isEmpty()) {
     openAllBoard();
     fire(MinesweeperEvents.WIN);
   }
 }
Beispiel #3
0
 @Override
 public List<Point> getFreeCells() {
   List<Point> result = new LinkedList<Point>();
   for (Point cell : getCells()) {
     boolean isSapper = cell.equals(getSapper());
     boolean isBoard =
         cell.getX() == 0
             || cell.getY() == 0
             || cell.getX() == size.getValue() - 1
             || cell.getY() == size.getValue() - 1; // TODO test me
     boolean isMine = isMine(cell);
     if (!isSapper && !isMine && !isBoard) {
       result.add(cell);
     }
   }
   return result;
 }