예제 #1
0
 private List<Point> generatePoints(Point point) {
   int x = point.getX();
   int y = point.getY();
   return Arrays.asList(
           new Point(x - 1, y), new Point(x + 1, y), new Point(x, y - 1), new Point(x, y + 1))
       .stream()
       .filter(p -> isInRange(p))
       .collect(Collectors.toCollection(ArrayList::new));
 }
예제 #2
0
 public List<Stone> getStonesByPoint(Point point) {
   List<Point> neighborPoints = generatePoints(point);
   List<Stone> stones = new ArrayList<>();
   int x, y;
   for (Point p : neighborPoints) {
     x = p.getX();
     y = p.getY();
     stones.add(state.getStones()[x][y]);
   }
   //        GameLogger.getInstance().logg("Lista sasiednich kamieni " + stones.toString());
   return stones;
 }
예제 #3
0
 private boolean isInRange(Point p) {
   int x = p.getX();
   int y = p.getY();
   return (x >= 0 && x < 5) && (y >= 0 && y < 5);
 }