Пример #1
0
        static void Main(string[] args)
        {
            var carFactory = new CarFactory(WIDTH, HEIGHT);
            var cars       = carFactory.Create(5);

            var docFactory = new DocFactory(WIDTH, HEIGHT);
            var docs       = docFactory.Create(500);

            var calculator = new Calculator();
            var routes     = calculator.CalcRoutes(docs, cars);

            var array = new int[WIDTH, HEIGHT];

            int index = 1;

            foreach (var route in routes)
            {
                foreach (var doc in route.Docs)
                {
                    array[(int)doc.Lon, (int)doc.Lat] = index;
                }
                index++;
            }

            for (int i = 0; i < WIDTH; i++)
            {
                for (int j = 0; j < HEIGHT; j++)
                {
                    Console.Write($"{array[i,j]} ");
                }

                Console.WriteLine();
            }

            Console.ReadLine();
        }