summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2014-10-04 00:51:25 +0200
committerJérémy Zurcher <jeremy@asynk.ch>2014-10-04 00:51:25 +0200
commitc66d6f554ba6984679003c33ccfaeb416658a3f0 (patch)
treef686db742f967c6c2a16ff9dec469bb1d77cdf30
parent1662f014d288f66772e303470ee44db23291b9e2 (diff)
downloadRustAndDust-c66d6f554ba6984679003c33ccfaeb416658a3f0.zip
RustAndDust-c66d6f554ba6984679003c33ccfaeb416658a3f0.tar.gz
SearchBoard: fix possibleMoves
- on node update push it onto the stack and add it to the moves if not already in - if not enough moves to reach, set remaing to -1 not MAX_VALUE
-rw-r--r--core/src/ch/asynk/tankontank/engine/SearchBoard.java8
1 files changed, 6 insertions, 2 deletions
diff --git a/core/src/ch/asynk/tankontank/engine/SearchBoard.java b/core/src/ch/asynk/tankontank/engine/SearchBoard.java
index 953459d..6be0977 100644
--- a/core/src/ch/asynk/tankontank/engine/SearchBoard.java
+++ b/core/src/ch/asynk/tankontank/engine/SearchBoard.java
@@ -179,6 +179,8 @@ public class SearchBoard
dst.remaining = r;
dst.parent = src;
dst.roadMarch = roadMarch;
+ stack.push(dst);
+ if (!moves.contains(dst)) moves.add(dst);
}
} else {
dst.search = searchCount;
@@ -190,7 +192,7 @@ public class SearchBoard
moves.add(dst);
} else {
dst.parent = null;
- dst.remaining = Integer.MAX_VALUE;
+ dst.remaining = -1;
}
}
}
@@ -218,6 +220,8 @@ public class SearchBoard
dst.remaining = r;
dst.parent = src;
dst.roadMarch = true;
+ roadMarch.push(dst);
+ if (!moves.contains(dst)) moves.add(dst);
}
} else {
dst.search = searchCount;
@@ -229,7 +233,7 @@ public class SearchBoard
moves.add(dst);
} else {
dst.parent = null;
- dst.remaining = Integer.MAX_VALUE;
+ dst.remaining = -1;
}
}
}