public void NextStep() { if (LearnRobotRoute.Length <= 1) { LearnRobotRoute.Reset(); toTarget = !toTarget; } Position = LearnRobotRoute.ElementAtOrDefault(1) ?? (toTarget ? GetStart() : Position); UpdateLearnLabyrinth(Position); SetRoutes(); }
private void SetRoutes() { System.Diagnostics.Stopwatch sw = new System.Diagnostics.Stopwatch(); //if (LearnRobotRoute?.GetRelations().All(r => r.Relation != RelationType.Close) ?? true) //{ sw.Start(); ITarget target = toTarget ? (ITarget)LearnLabyrinth.Target : new SingleTarget(GetStart()); Block start = LearnRobotRoute?.ElementAtOrDefault(1) ?? (toTarget ? GetStart() : Position); LearnRobotRoute.SearchMaybe(start, LearnRobotRoute?.FirstOrDefault(), target); System.Diagnostics.Debug.WriteLine("Robot: " + sw.ElapsedMilliseconds); //} //if (LearnPossibleRoute?.GetRelations().Any(r => r.Relation == RelationType.Close) ?? true) //{ sw.Reset(); sw.Start(); LearnPossibleRoute.SearchPossible(GetStart(), null, LearnLabyrinth.Target); System.Diagnostics.Debug.WriteLine("Possible: " + sw.ElapsedMilliseconds); //} //if (LearnMaybeRoute?.GetRelations().Any(r => r.Relation == RelationType.Close) ?? true) //{ sw.Reset(); sw.Start(); LearnMaybeRoute.SearchMaybe(GetStart(), null, LearnLabyrinth.Target); System.Diagnostics.Debug.WriteLine("Maybe: " + sw.ElapsedMilliseconds); //} }