Skip to content

Commit 525c9b4

Browse files
author
Зелёный Андрей Сергеевич
committed
Program.cs changed
1 parent 79565e8 commit 525c9b4

1 file changed

Lines changed: 11 additions & 3 deletions

File tree

Program.cs

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,24 @@ class Program
88
{
99
static void Main(string[] args)
1010
{
11-
Graph graph = new Graph(1, 1, 2, 3, 20.0);
11+
// Создаем матрицу-препятствий из csv-файла
12+
string docPath = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
13+
int[,] obstacleMatrix = Obstacle.CreateObstacleMatrixFromCSVFile(Path.Combine(docPath, "MazeMini.csv"));
14+
15+
// Инициализируем граф с помощью этой матрицы
16+
Graph graph = new Graph(obstacleMatrix);
1217

1318
// Вычисляем кратчайший путь
1419
double shortestPathLength = 0.0;
1520

16-
Point2D startPoint = new Point2D(0, 0);
17-
Point2D goalPoint = new Point2D(1, 1);
21+
Point2D startPoint = new Point2D(2, 12);
22+
Point2D goalPoint = new Point2D(6, 7);
1823

1924
List<Point2D> shortestPath = graph.FindShortestPathAndLength(startPoint, goalPoint, out shortestPathLength);
2025

26+
// Записываем найденный путь в файл
27+
WriteShortestPathToFile(shortestPath, Path.Combine(docPath, "shortestPath.txt"));
28+
2129
Console.ReadLine();
2230
}
2331

0 commit comments

Comments
 (0)