Example #1
0
        public void ExploreFromOutsideTheUpperBoundsOfYAndGetAnOutOfRangeException()
        {
            var world    = WorldBuilder.CreateStandardEmptyWorld();
            var explorer = new PathfinderEngine(world.Width, world.Height, new BooleanMapCostCalculator(world), new EmptyHeuristicCalculator());

            explorer.ExploreFrom(new Coordinate(0, world.Height));
        }
Example #2
0
        private void PerformExplore(PathfinderEngine pathfinder, Coordinate from)
        {
            _mapHost.ClearMap();

            _pathfinder = pathfinder;
            _pathfinder.ExploreFrom(from);

            RefreshWorkQueue();
        }
        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);
        }
Example #4
0
        private void ExploreFrom(Coordinate from)
        {
            // Set Pins
            _mapHost.ShowBluePin(from);

            // Setup
            var costCalculator = new BooleanMapCostCalculator(_world)
            {
                BlockPartialDiagonals             = BlockPartialDiagonals,
                HorizontalAndVerticalMovementCost = EdgeMovementCost,
                DiagonalMovementCost = DiagonalMovementCost
            };
            var heuristic  = new EmptyHeuristicCalculator();
            var pathfinder = new PathfinderEngine(_world.Width, _world.Height, costCalculator, heuristic, _movementMode);

            PerformExplore(pathfinder, from);
        }
Example #5
0
        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
        }