diff options
author | Jérémy Zurcher <jeremy@asynk.ch> | 2014-10-08 00:50:27 +0200 |
---|---|---|
committer | Jérémy Zurcher <jeremy@asynk.ch> | 2014-10-08 08:34:43 +0200 |
commit | 5a55d4e4f66869b02fca79ead61e6e5d2a2915db (patch) | |
tree | 34b3461de08c98247e980f84ac1f11659486bdc2 /core/src | |
parent | e55c335fd396da5b5c3ba46379504ba9fda08c6e (diff) | |
download | RustAndDust-5a55d4e4f66869b02fca79ead61e6e5d2a2915db.zip RustAndDust-5a55d4e4f66869b02fca79ead61e6e5d2a2915db.tar.gz |
SearchBoard: possibleMovesFrom fix road march
- do not update remaing when pushing onto raodMarch stack
- another copy of might still be in the regular stack and then pop
out with a bigger movement than it should
Diffstat (limited to 'core/src')
-rw-r--r-- | core/src/ch/asynk/tankontank/engine/SearchBoard.java | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/core/src/ch/asynk/tankontank/engine/SearchBoard.java b/core/src/ch/asynk/tankontank/engine/SearchBoard.java index 26b05b5..6f22f74 100644 --- a/core/src/ch/asynk/tankontank/engine/SearchBoard.java +++ b/core/src/ch/asynk/tankontank/engine/SearchBoard.java @@ -159,11 +159,11 @@ public class SearchBoard while (stack.size() != 0) { Node src = stack.pop(); - if (src.remaining <= 0) { - if (src.roadMarch) { - src.remaining = roadMarchBonus; + if (src.remaining < 0) + continue; + if (src.remaining == 0) { + if (src.roadMarch) roadMarch.push(src); - } continue; } @@ -206,6 +206,7 @@ public class SearchBoard first = false; } + for (Node n : roadMarch) n.remaining = roadMarchBonus; while(roadMarch.size() != 0) { Node src = roadMarch.pop(); |