From 5ffea1aa081cb27b0e37d55a6ffc2278f50b8cb8 Mon Sep 17 00:00:00 2001 From: Harrison Date: Thu, 23 Apr 2020 11:51:54 -0500 Subject: [PATCH] DFS max limit check change. --- .../islandsurvivalcraft/pathfinding/DepthFirstSearch.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/ca/recrown/islandsurvivalcraft/pathfinding/DepthFirstSearch.java b/src/main/java/ca/recrown/islandsurvivalcraft/pathfinding/DepthFirstSearch.java index 0977301..a0d0e01 100644 --- a/src/main/java/ca/recrown/islandsurvivalcraft/pathfinding/DepthFirstSearch.java +++ b/src/main/java/ca/recrown/islandsurvivalcraft/pathfinding/DepthFirstSearch.java @@ -71,7 +71,7 @@ public class DepthFirstSearch { Node begin = startNode; queue.add(begin); while (!queue.isEmpty()) { - if (maxNodesSearched != -1 && checkedNodes.size() >= maxNodesSearched) return false; + if (maxNodesSearched != -1 && checkedNodes.size() > maxNodesSearched) return false; Node n = queue.poll(); if (!n.equals(endNode)) { n.child[0] = new Node(n, n.x + 1, n.y); @@ -113,7 +113,7 @@ public class DepthFirstSearch { queue.add(begin); while (!queue.isEmpty()) { Node n = queue.poll(); - if (maxNodesSearched != -1 && checkedNodes.size() >= maxNodesSearched) return false; + if (maxNodesSearched != -1 && checkedNodes.size() > maxNodesSearched) return false; if (!targetValidator.isCoordinateTarget(n.x, n.y)) { n.child[0] = new Node(n, n.x + 1, n.y); n.child[1] = new Node(n, n.x - 1, n.y);