diff options
author | Jérémy Zurcher <jeremy@asynk.ch> | 2014-10-13 19:25:39 +0200 |
---|---|---|
committer | Jérémy Zurcher <jeremy@asynk.ch> | 2014-10-13 19:25:39 +0200 |
commit | c8367f11b593addb84ed11f49bda3be02a30b7c1 (patch) | |
tree | b2d8c40dd2bb50b6b1e435c3c96935dc68f24fa0 /core/src/ch/asynk/tankontank | |
parent | 2f21c7ce9b4cbbcbdf268bd429c0d92f76318311 (diff) | |
download | RustAndDust-c8367f11b593addb84ed11f49bda3be02a30b7c1.zip RustAndDust-c8367f11b593addb84ed11f49bda3be02a30b7c1.tar.gz |
SearchBoard: fix validatePathAngle(...) count move forth to allow back one
Diffstat (limited to 'core/src/ch/asynk/tankontank')
-rw-r--r-- | core/src/ch/asynk/tankontank/engine/SearchBoard.java | 9 |
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; } |