summaryrefslogtreecommitdiffstats
path: root/core/src/ch
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2014-10-13 19:25:39 +0200
committerJérémy Zurcher <jeremy@asynk.ch>2014-10-13 19:25:39 +0200
commitc8367f11b593addb84ed11f49bda3be02a30b7c1 (patch)
treeb2d8c40dd2bb50b6b1e435c3c96935dc68f24fa0 /core/src/ch
parent2f21c7ce9b4cbbcbdf268bd429c0d92f76318311 (diff)
downloadRustAndDust-c8367f11b593addb84ed11f49bda3be02a30b7c1.zip
RustAndDust-c8367f11b593addb84ed11f49bda3be02a30b7c1.tar.gz
SearchBoard: fix validatePathAngle(...) count move forth to allow back one
Diffstat (limited to 'core/src/ch')
-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;
}