use of net.runelite.client.plugins.puzzlesolver.solver.PuzzleState in project runelite by runelite.
the class IDAStar method search.
private PuzzleState search(PuzzleState node, int g, int bound) {
int h = node.getHeuristicValue(getHeuristic());
int f = g + h;
if (f > bound) {
return null;
}
if (h == 0) {
return node;
}
for (PuzzleState successor : node.computeMoves()) {
PuzzleState t = search(successor, g + 1, bound);
if (t != null) {
return t;
}
}
return null;
}
use of net.runelite.client.plugins.puzzlesolver.solver.PuzzleState in project runelite by runelite.
the class PuzzleSolverTest method testSolver.
@Test
public void testSolver() {
for (PuzzleState state : START_STATES) {
PuzzleSolver solver = new PuzzleSolver(new IDAStar(new ManhattanDistance()), state);
solver.run();
assertTrue(solver.hasSolution());
assertFalse(solver.hasFailed());
assertTrue(solver.getStep(solver.getStepCount() - 1).hasPieces(FINISHED_STATE));
}
}
Aggregations