diff options
author | Jérémy Zurcher <jeremy@asynk.ch> | 2015-10-29 14:13:55 +0100 |
---|---|---|
committer | Jérémy Zurcher <jeremy@asynk.ch> | 2015-10-29 14:13:55 +0100 |
commit | 7461e96feeac507345ec454fe0b3b097162c6ccb (patch) | |
tree | 34a5792cbf40fb2685cfe1483a182987ae592f15 | |
parent | 7dd29657c3f612af114f65dc1d74988e2153f283 (diff) | |
download | RustAndDust-7461e96feeac507345ec454fe0b3b097162c6ccb.zip RustAndDust-7461e96feeac507345ec454fe0b3b097162c6ccb.tar.gz |
SearchBoard: fix isFlankAttack()
-rw-r--r-- | core/src/ch/asynk/rustanddust/engine/SearchBoard.java | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/core/src/ch/asynk/rustanddust/engine/SearchBoard.java b/core/src/ch/asynk/rustanddust/engine/SearchBoard.java index 923c263..eda9055 100644 --- a/core/src/ch/asynk/rustanddust/engine/SearchBoard.java +++ b/core/src/ch/asynk/rustanddust/engine/SearchBoard.java @@ -355,13 +355,15 @@ public class SearchBoard private boolean isFlankAttack(int angle, List<Node> los) { - Node before = los.get(los.size() - 3); Node from = los.get(los.size() - 2); Node to = los.get(los.size() - 1); - boolean special = (distance(from, to) == distance(before, to)); - Orientation o = Orientation.fromMove(to.col, to.row, from.col, from.row); - if (!special) + + if (los.size() < 3) + return o.isInSides(angle); + + Node before = los.get(los.size() - 3); + if (distance(before, to) > 1) return o.isInSides(angle); Orientation o2 = Orientation.fromMove(to.col, to.row, before.col, before.row); |