summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2014-10-04 00:53:53 +0200
committerJérémy Zurcher <jeremy@asynk.ch>2014-10-04 00:53:53 +0200
commit671789f726229b072b37f417f58b711b3ab2c878 (patch)
tree45652f8a1da8195dda8b89d8bcf3c32d14479936
parentc66d6f554ba6984679003c33ccfaeb416658a3f0 (diff)
downloadRustAndDust-671789f726229b072b37f417f58b711b3ab2c878.zip
RustAndDust-671789f726229b072b37f417f58b711b3ab2c878.tar.gz
SearchBoard: if distance between from and to is 1, chose this single move
-rw-r--r--core/src/ch/asynk/tankontank/engine/SearchBoard.java11
1 files changed, 9 insertions, 2 deletions
diff --git a/core/src/ch/asynk/tankontank/engine/SearchBoard.java b/core/src/ch/asynk/tankontank/engine/SearchBoard.java
index 6be0977..d00d056 100644
--- a/core/src/ch/asynk/tankontank/engine/SearchBoard.java
+++ b/core/src/ch/asynk/tankontank/engine/SearchBoard.java
@@ -536,8 +536,15 @@ public class SearchBoard
Node from = getNode(col0, row0);
Node to = getNode(col1, row1);
- path.add(from);
- findAllPaths(pawn, from, to, pawn.getMovementPoints(), true, pawn.getRoadMarchBonus());
+ if (distance(from, to) == 1) {
+ Vector<Node> temp = new Vector<Node>(2);
+ temp.add(to);
+ temp.add(from);
+ possiblePaths.add(temp);
+ } else {
+ path.add(from);
+ findAllPaths(pawn, from, to, pawn.getMovementPoints(), true, pawn.getRoadMarchBonus());
+ }
return possiblePaths;
}