示例#1
0
        static void SetUpRandomTest(MapContext map)
        {
            map.StartingPoint = RandomPoint(map);
            do
            {
                map.TargetPoint = RandomPoint(map);
            } while (map.TargetPoint == map.StartingPoint);

            for (int i = 0; i < 50; i++)
            {
                var point = RandomPoint(map);
                while (point == map.StartingPoint || point == map.TargetPoint || map.IsObstacle(point))
                {
                    point = RandomPoint(map);
                }

                map.Obstacles.Add(point);
            }
        }