From 7e5d807862aae097801444a7874b3070877a1198 Mon Sep 17 00:00:00 2001 From: Your Average Code <138674451+UrAvgCode@users.noreply.github.com> Date: Thu, 25 Jan 2024 01:30:27 +0100 Subject: [PATCH] Remove duplicate Queue elements --- src/EscapeBot.java | 5 ----- src/RumbleBot.java | 5 ----- src/SnakeBot.java | 5 ----- 3 files changed, 15 deletions(-) diff --git a/src/EscapeBot.java b/src/EscapeBot.java index ab26d5c..3a80bb3 100644 --- a/src/EscapeBot.java +++ b/src/EscapeBot.java @@ -78,11 +78,6 @@ public class EscapeBot extends Bot { 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()) { Move move = queue.poll(); if (move.x < 0 || move.x >= size || move.y < 0 || move.y >= size || visited[move.x][move.y]) continue; diff --git a/src/RumbleBot.java b/src/RumbleBot.java index 367f7be..f596ef3 100644 --- a/src/RumbleBot.java +++ b/src/RumbleBot.java @@ -96,11 +96,6 @@ public class RumbleBot extends Bot { 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()) { Move move = queue.poll(); if (move.x < 0 || move.x >= size || move.y < 0 || move.y >= size || visited[move.x][move.y]) continue; diff --git a/src/SnakeBot.java b/src/SnakeBot.java index a4a0d8a..6a61eca 100644 --- a/src/SnakeBot.java +++ b/src/SnakeBot.java @@ -99,11 +99,6 @@ public class SnakeBot extends Bot { 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()) { Move move = queue.poll(); if (move.x < 0 || move.x >= size || move.y < 0 || move.y >= size || visited[move.x][move.y]) continue;