コード例 #1
0
        public void NoPathReturnsNull()
        {
            var map = new MapContext(5, 3);

            map.StartingPoint = new Point(0, 0);
            map.TargetPoint   = new Point(4, 1);
            map.AddObstacle(0, 1);
            map.AddObstacle(1, 0);
            map.AddObstacle(1, 1);

            var subject = new AStarPathFinder();
            var path    = subject.FindPath(map);

            Check.That(path).IsNull();
        }
コード例 #2
0
ファイル: Program.cs プロジェクト: akatakritos/PathfinderDemo
        // ReSharper disable once UnusedMember.Local
        static void SetUpSimpleTest(MapContext map)
        {
            map.StartingPoint = new Point(0, 0);
            map.TargetPoint   = new Point(9, 9);

            map.AddObstacle(0, 3);
            map.AddObstacle(1, 3);
            map.AddObstacle(2, 3);

            map.AddObstacle(4, 3);
            map.AddObstacle(5, 3);
            map.AddObstacle(6, 3);
            map.AddObstacle(7, 3);
            map.AddObstacle(8, 3);
            map.AddObstacle(9, 3);

            map.AddObstacle(3, 1);
        }