Exemplo n.º 1
0
        public void NextStep()
        {
            if (LearnRobotRoute.Length <= 1)
            {
                LearnRobotRoute.Reset();
                toTarget = !toTarget;
            }

            Position = LearnRobotRoute.ElementAtOrDefault(1) ?? (toTarget ? GetStart() : Position);
            UpdateLearnLabyrinth(Position);

            SetRoutes();
        }
Exemplo n.º 2
0
        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);
            //}
        }