diff options
author | Jérémy Zurcher <jeremy@asynk.ch> | 2015-11-21 15:42:52 +0100 |
---|---|---|
committer | Jérémy Zurcher <jeremy@asynk.ch> | 2015-11-21 15:42:52 +0100 |
commit | 259292f8fe5f4fe92eb5607f482da99cacc25c14 (patch) | |
tree | 12491371275f5c00c06d389427d40a0db1fde7a8 | |
parent | add0f037b8d4213c19028fc0993ef974c016d26d (diff) | |
download | RustAndDust-259292f8fe5f4fe92eb5607f482da99cacc25c14.zip RustAndDust-259292f8fe5f4fe92eb5607f482da99cacc25c14.tar.gz |
PathBuilder: fix fitness computation
-rw-r--r-- | core/src/ch/asynk/rustanddust/engine/PathBuilder.java | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/core/src/ch/asynk/rustanddust/engine/PathBuilder.java b/core/src/ch/asynk/rustanddust/engine/PathBuilder.java index f8df34a..5c69a5b 100644 --- a/core/src/ch/asynk/rustanddust/engine/PathBuilder.java +++ b/core/src/ch/asynk/rustanddust/engine/PathBuilder.java @@ -153,7 +153,7 @@ public class PathBuilder implements Disposable Orientation o = board.getSide(i); int n = next.costFrom(pawn, o); boolean r = next.road(o); - if (!r) fitness += n; + int f = (fitness + 1 + (r ? 0 : 1)); int m = (mvtLeft - n); r &= roadMarch; @@ -168,12 +168,12 @@ public class PathBuilder implements Disposable tiles.add(t); } path.roadMarch = r; - path.fitness = fitness; + path.fitness = f; path.cost = (pawn.getMovementPoints() - m); paths.add(path); } else { stack.add(next); - findAllPaths(next, m, fitness, r); + findAllPaths(next, m, f, r); stack.remove(stack.size() - 1); } } |