Fix infinite search in A* Search

Signed-off-by: Chris Cromer <chris@cromer.cl>
This commit is contained in:
Chris Cromer 2019-10-26 13:47:08 -03:00
parent 7744b5ae6d
commit 6183bf84c6

View File

@ -95,7 +95,7 @@ public class PlayerAStarAI extends AI implements PlayerAI, Constants {
cameFrom.put(start, start);
costSoFar.put(start, 0.0);
while (frontier.size() > 0) {
while (frontier.size() > 0 && cameFrom.size() <= (HORIZONTAL_CELLS * VERTICAL_CELLS) * 2) {
State current = frontier.poll();
if (current.equals(goal)) {