AStar/Executable/Program.cs

21 lines
674 B
C#
Raw Normal View History

2022-11-01 05:08:52 +01:00
using Graph;
using Logging;
using astar;
Logger logger = new (LogType.CONSOLE, LogLevel.DEBUG);
2022-11-13 14:59:06 +01:00
Graph.Graph graph = OpenStreetMap_Importer.Importer.Import(@"C:\Users\glax\Downloads\oberbayern-latest.osm", true, logger);
2022-11-01 05:08:52 +01:00
logger.level = LogLevel.DEBUG;
Random r = new();
2022-11-03 19:14:14 +01:00
Route _route;
2022-11-01 05:08:52 +01:00
Node n1, n2;
do
{
do
{
2022-11-13 14:59:06 +01:00
n1 = graph.NodeAtIndex(r.Next(0, graph.GetNodeCount() - 1));
n2 = graph.NodeAtIndex(r.Next(0, graph.GetNodeCount() - 1));
2022-11-13 14:02:27 +01:00
_route = new Astar().FindPath(graph, n1, n2, logger);
2022-11-03 19:14:14 +01:00
} while (!_route.routeFound);
2022-11-13 15:03:35 +01:00
logger.Log(LogLevel.INFO, "Press Enter to find new path.");
2022-11-01 05:08:52 +01:00
} while (Console.ReadKey().Key.Equals(ConsoleKey.Enter));