summaryrefslogtreecommitdiffstats
path: root/core/src/ch/asynk/tankontank
diff options
context:
space:
mode:
Diffstat (limited to 'core/src/ch/asynk/tankontank')
-rw-r--r--core/src/ch/asynk/tankontank/engine/SearchBoard.java9
1 files changed, 7 insertions, 2 deletions
diff --git a/core/src/ch/asynk/tankontank/engine/SearchBoard.java b/core/src/ch/asynk/tankontank/engine/SearchBoard.java
index 3fe77a3..8117434 100644
--- a/core/src/ch/asynk/tankontank/engine/SearchBoard.java
+++ b/core/src/ch/asynk/tankontank/engine/SearchBoard.java
@@ -389,12 +389,17 @@ public class SearchBoard
private boolean validatePathAngle(int angle, List<Node> los)
{
+ int forth = 0;
Node prev = null;
for (Node next : los) {
if (prev != null) {
Orientation o = Orientation.fromMove(prev.col, prev.row, next.col, next.row);
- if (!o.isInSides(angle))
- return false;
+ if (!o.isInSides(angle)) {
+ forth -= 1;
+ if (forth < 0)
+ return false;
+ }
+ forth += 1;
}
prev = next;
}