public void generatePath(int startX, int startY, int targetX, int targetY) { if ((startX + startY + targetX + targetY) == 0) { pathfinder = new Pathfinder(hazardModel.getModel(), hazardModel.hazardModelImage, 0, 0, r.Next(hazardModel.getModel().GetLength(0)), r.Next(hazardModel.getModel().GetLength(1))); } else { try { pathfinder = new Pathfinder(hazardModel.getModel(), hazardModel.hazardModelImage, startX, startY, targetX, targetY); } catch{ } } }
public void startSimulationKnownMap(int startX, int startY, int endX, int endY) { Pathfinder pathfinder = new Pathfinder(hazardModel.getModel() , hazardModel.hazardModelImage, startX, startY, endX, endY); System.Diagnostics.Stopwatch sw = System.Diagnostics.Stopwatch.StartNew(); pathfinder.findPath(startX, startY, endX, endY); sw.Stop(); pathfinder.generatePathImage(); steps = pathfinder.getPath().Count; imageSource = pathfinder.getPathImage(); timeTaken = sw.Elapsed.TotalSeconds + " Seconds"; stepTraverseStarted = false; }