Advertisement
the_alator

Untitled

Feb 15th, 2017
185
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.22 KB | None | 0 0
  1. public boolean distributeWawes(Iterator<ArrayDeque<YX>> iter){
  2.         if(waves.isEmpty())
  3.             return false;
  4.         while(iter.hasNext()){
  5.             ArrayDeque<YX> arr = iter.next(); //ERROR
  6.             if(arr.getLast().x == Level.player.x && arr.getLast().y == Level.player.y){
  7.                 yx = arr;
  8.                 return true;
  9.             }
  10.            
  11.             if(mapYX[arr.getLast().y-1][arr.getLast().x] == 0){
  12.                 temp = arr;
  13.                 temp.addLast(new YX(arr.getLast().y-1,arr.getLast().x));
  14.                 tempWaves.add(temp);
  15.                 mapYX[arr.getLast().y-1][arr.getLast().x] = 1;
  16.             }
  17.             if(mapYX[arr.getLast().y][arr.getLast().x+1] == 0){
  18.                 temp = arr;
  19.                 temp.addLast(new YX(arr.getLast().y,arr.getLast().x+1));
  20.                 tempWaves.add(temp);
  21.                 mapYX[arr.getLast().y][arr.getLast().x+1] = 1;
  22.             }
  23.             if(mapYX[arr.getLast().y+1][arr.getLast().x] == 0){
  24.                 temp = arr;
  25.                 temp.addLast(new YX(arr.getLast().y+1,arr.getLast().x));
  26.                 tempWaves.add(temp);
  27.                 mapYX[arr.getLast().y+1][arr.getLast().x] = 1;
  28.             }
  29.             if(mapYX[arr.getLast().y][arr.getLast().x-1] == 0){
  30.                 temp = arr;
  31.                 temp.addLast(new YX(arr.getLast().y,arr.getLast().x-1));
  32.                 tempWaves.add(temp);
  33.                 mapYX[arr.getLast().y][arr.getLast().x-1] = 1;
  34.             }
  35.         }
  36.         waves = tempWaves;
  37.         return distributeWawes(waves.iterator());
  38.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement