public void VerifyThatCompletionCheckWorks() { var heuristic = new TargetedHeuristic(new Coordinate(1, 0)); Assert.IsFalse(heuristic.Complete(0, 0)); Assert.IsTrue(heuristic.Complete(1, 0)); }
private void SetupWorld(int width, int height) { _world = WorldBuilder.CreateEmptyWorld(width, height); _costCalc = new BooleanMapCostCalculator(_world); _heuristicCalc = new TargetedHeuristic(new Coordinate(0, 0)); _explorer = new PathfinderEngine(_world.Width, _world.Height, _costCalc, _heuristicCalc); }
public void ConfirmScalingIncreasesCost() { var heuristic = new TargetedHeuristic(new Coordinate(5, 5)); heuristic.HeuristicScale = 2; Assert.AreEqual(100, heuristic.Calculate(0, 0)); Assert.AreEqual(4, heuristic.Calculate(4, 4)); }
public void ConfirmMovingCloserReducesCalculationValue() { var heuristic = new TargetedHeuristic(new Coordinate(5, 5)); Assert.AreEqual(50, heuristic.Calculate(0, 0)); Assert.AreEqual(32, heuristic.Calculate(1, 1)); Assert.AreEqual(18, heuristic.Calculate(2, 2)); Assert.AreEqual(8, heuristic.Calculate(3, 3)); Assert.AreEqual(2, heuristic.Calculate(4, 4)); Assert.AreEqual(0, heuristic.Calculate(5, 5)); }
private void ExploreBetween(Coordinate from, Coordinate to) { // Set Pins _mapHost.ShowBluePin(from); _mapHost.ShowGreenPin(to); // Setup var costCalculator = new BooleanMapCostCalculator(_world) { BlockPartialDiagonals = BlockPartialDiagonals, HorizontalAndVerticalMovementCost = EdgeMovementCost, DiagonalMovementCost = DiagonalMovementCost }; var heuristic = new TargetedHeuristic(to); var pathfinder = new PathfinderEngine(_world.Width, _world.Height, costCalculator, heuristic, _movementMode); PerformExplore(pathfinder, from); }
public void Execute(object parameter) { // Set Pins _mapHost.ShowBluePin(_from); _mapHost.ShowGreenPin(_to); // Setup var costCalculator = new BooleanMapCostCalculator(_world) { BlockPartialDiagonals = _blockPartialDiagonals }; var heuristic = new TargetedHeuristic(_to); var pathfinder = new PathfinderEngine(_world.Width, _world.Height, costCalculator, heuristic, _moveMode); _mapHost.ClearMap(); pathfinder.ExploreFrom(_from); // TODO: Load Pathfinder into host // TODO: Reset WorkQueue }