use of net.runelite.client.plugins.puzzlesolver.solver.heuristics.ManhattanDistance in project runelite by runelite.
the class PuzzleSolverOverlay method solve.
private void solve(int[] items) {
if (solverFuture != null) {
solverFuture.cancel(true);
}
PuzzleState puzzleState = new PuzzleState(items);
solver = new PuzzleSolver(new IDAStar(new ManhattanDistance()), puzzleState);
solverFuture = executorService.submit(solver);
}
use of net.runelite.client.plugins.puzzlesolver.solver.heuristics.ManhattanDistance 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