Browse Source

Remove duplicate Queue elements

master
Your Average Code 11 months ago
parent
commit
7e5d807862
3 changed files with 0 additions and 15 deletions
  1. 0
    5
      src/EscapeBot.java
  2. 0
    5
      src/RumbleBot.java
  3. 0
    5
      src/SnakeBot.java

+ 0
- 5
src/EscapeBot.java View File

queue.add(new Move(start + directions[i][0], start + directions[i][1], commands[i])); queue.add(new Move(start + directions[i][0], start + directions[i][1], commands[i]));
} }


queue.add(new Move(start, start - 1, '^'));
queue.add(new Move(start, start + 1, '>'));
queue.add(new Move(start + 1, start, '>'));
queue.add(new Move(start - 1, start, '<'));

while (!queue.isEmpty()) { while (!queue.isEmpty()) {
Move move = queue.poll(); Move move = queue.poll();
if (move.x < 0 || move.x >= size || move.y < 0 || move.y >= size || visited[move.x][move.y]) continue; if (move.x < 0 || move.x >= size || move.y < 0 || move.y >= size || visited[move.x][move.y]) continue;

+ 0
- 5
src/RumbleBot.java View File

queue.add(new Move(start + directions[i][0], start + directions[i][1], commands[i])); queue.add(new Move(start + directions[i][0], start + directions[i][1], commands[i]));
} }


queue.add(new Move(start, start - 1, '^'));
queue.add(new Move(start, start + 1, '>'));
queue.add(new Move(start + 1, start, '>'));
queue.add(new Move(start - 1, start, '<'));

while (!queue.isEmpty()) { while (!queue.isEmpty()) {
Move move = queue.poll(); Move move = queue.poll();
if (move.x < 0 || move.x >= size || move.y < 0 || move.y >= size || visited[move.x][move.y]) continue; if (move.x < 0 || move.x >= size || move.y < 0 || move.y >= size || visited[move.x][move.y]) continue;

+ 0
- 5
src/SnakeBot.java View File

queue.add(new Move(start + directions[i][0], start + directions[i][1], commands[i])); queue.add(new Move(start + directions[i][0], start + directions[i][1], commands[i]));
} }


queue.add(new Move(start, start - 1, '^'));
queue.add(new Move(start, start + 1, '>'));
queue.add(new Move(start + 1, start, '>'));
queue.add(new Move(start - 1, start, '<'));

while (!queue.isEmpty()) { while (!queue.isEmpty()) {
Move move = queue.poll(); Move move = queue.poll();
if (move.x < 0 || move.x >= size || move.y < 0 || move.y >= size || visited[move.x][move.y]) continue; if (move.x < 0 || move.x >= size || move.y < 0 || move.y >= size || visited[move.x][move.y]) continue;

Loading…
Cancel
Save