From 259292f8fe5f4fe92eb5607f482da99cacc25c14 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Zurcher?= Date: Sat, 21 Nov 2015 15:42:52 +0100 Subject: PathBuilder: fix fitness computation --- core/src/ch/asynk/rustanddust/engine/PathBuilder.java | 6 +++--- 1 file 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); } } -- cgit v1.1-2-g2b99