diff options
author | Jérémy Zurcher <jeremy@asynk.ch> | 2014-10-04 00:53:53 +0200 |
---|---|---|
committer | Jérémy Zurcher <jeremy@asynk.ch> | 2014-10-04 00:53:53 +0200 |
commit | 671789f726229b072b37f417f58b711b3ab2c878 (patch) | |
tree | 45652f8a1da8195dda8b89d8bcf3c32d14479936 /core | |
parent | c66d6f554ba6984679003c33ccfaeb416658a3f0 (diff) | |
download | RustAndDust-671789f726229b072b37f417f58b711b3ab2c878.zip RustAndDust-671789f726229b072b37f417f58b711b3ab2c878.tar.gz |
SearchBoard: if distance between from and to is 1, chose this single move
Diffstat (limited to 'core')
-rw-r--r-- | core/src/ch/asynk/tankontank/engine/SearchBoard.java | 11 |
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; } |