diff options
author | Jérémy Zurcher <jeremy@asynk.ch> | 2014-09-24 16:08:20 +0200 |
---|---|---|
committer | Jérémy Zurcher <jeremy@asynk.ch> | 2014-09-24 16:08:20 +0200 |
commit | 99c197a15f73c7ab0f4c6c527a3c08265e085ae1 (patch) | |
tree | c061e705a4c1a6bfdd2bb792ee2ab964462a5239 /core/src/ch/asynk/tankontank/engine | |
parent | 45cd3556d32e2ca11010e290486d6204b9149b3e (diff) | |
download | RustAndDust-99c197a15f73c7ab0f4c6c527a3c08265e085ae1.zip RustAndDust-99c197a15f73c7ab0f4c6c527a3c08265e085ae1.tar.gz |
SearchBoard: update if roadMarch and (mvtLeft > bonus) overtake dst.mvtLeft
Diffstat (limited to 'core/src/ch/asynk/tankontank/engine')
-rw-r--r-- | core/src/ch/asynk/tankontank/engine/SearchBoard.java | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/core/src/ch/asynk/tankontank/engine/SearchBoard.java b/core/src/ch/asynk/tankontank/engine/SearchBoard.java index 1c7f67f..b4b0584 100644 --- a/core/src/ch/asynk/tankontank/engine/SearchBoard.java +++ b/core/src/ch/asynk/tankontank/engine/SearchBoard.java @@ -91,6 +91,8 @@ public class SearchBoard start.roadMarch = true; stack.push(start); + int roadMarchBonus = pawn.roadMarch(); + boolean first = true; while (stack.size() != 0) { @@ -98,7 +100,7 @@ public class SearchBoard if (src.mvtLeft <= 0) { if (src.roadMarch) { - src.mvtLeft = board.getTile(src.col, src.row).roadMarchBonus(pawn); + src.mvtLeft = roadMarchBonus; roadMarch.push(src); } continue; @@ -118,7 +120,7 @@ public class SearchBoard boolean roadMarch = road && src.roadMarch; if (dst.search == searchCount) { - if ((r >= 0) && ((r > dst.mvtLeft) || roadMarch)) { + if ((r >= 0) && ((r > dst.mvtLeft) || (roadMarch && ((r + roadMarchBonus) >= dst.mvtLeft)))) { dst.mvtLeft = r; dst.parent = src; dst.roadMarch = roadMarch; |