diff --git a/src/main/java/cl/cromer/azaraka/Constants.java b/src/main/java/cl/cromer/azaraka/Constants.java index bdeba51..7ad53f6 100644 --- a/src/main/java/cl/cromer/azaraka/Constants.java +++ b/src/main/java/cl/cromer/azaraka/Constants.java @@ -69,7 +69,7 @@ public interface Constants { /** * The amount of chests to draw, if less then 2 the game cannot be won */ - int CHESTS = 2; + int CHESTS = 3; /** * The amount of enemies to draw */ diff --git a/src/main/java/cl/cromer/azaraka/ai/PlayerAI.java b/src/main/java/cl/cromer/azaraka/ai/PlayerAI.java index 397433c..12b2081 100644 --- a/src/main/java/cl/cromer/azaraka/ai/PlayerAI.java +++ b/src/main/java/cl/cromer/azaraka/ai/PlayerAI.java @@ -107,8 +107,11 @@ public interface PlayerAI extends Runnable, Constants { return Double.compare(state1Distance, state2Distance); } else { + // We don't know where the player is, so equal importance return 0; } + + //scene.getCanvas().getEnemies(); } }); return destinations; diff --git a/src/main/java/cl/cromer/azaraka/ai/PlayerAStarAI.java b/src/main/java/cl/cromer/azaraka/ai/PlayerAStarAI.java index caed964..a0b39b3 100644 --- a/src/main/java/cl/cromer/azaraka/ai/PlayerAStarAI.java +++ b/src/main/java/cl/cromer/azaraka/ai/PlayerAStarAI.java @@ -447,6 +447,9 @@ public class PlayerAStarAI extends AI implements PlayerAI, Constants { */ @Override public void sortDestinations() { + if (initial == null) { + initial = new State(player.getCell().getX(), player.getCell().getY(), State.Type.PLAYER, null, 0); + } destinations = sortDestinations(destinations, initial); } diff --git a/src/main/java/cl/cromer/azaraka/ai/PlayerBreadthFirstAI.java b/src/main/java/cl/cromer/azaraka/ai/PlayerBreadthFirstAI.java index 458bb82..0e6f421 100644 --- a/src/main/java/cl/cromer/azaraka/ai/PlayerBreadthFirstAI.java +++ b/src/main/java/cl/cromer/azaraka/ai/PlayerBreadthFirstAI.java @@ -242,6 +242,9 @@ public class PlayerBreadthFirstAI extends AI implements PlayerAI, Constants { * Sort the destinations by importance, if the importance is the same then sort them by distance */ public void sortDestinations() { + if (initial == null) { + initial = new State(player.getCell().getX(), player.getCell().getY(), State.Type.PLAYER, null, 0); + } destinations = sortDestinations(destinations, initial); }