Exemplo n.º 1
0
        public void Setup(LabyrinthControl lc)
        {
            GeneralSetup(lc);

            SubIndex = 0;
            ExecuteAsync(lc);
        }
Exemplo n.º 2
0
        protected void ToBreakpoint(LabyrinthControl lc, int id)
        {
            SearchView search = lc.Searches.First();
            Waiter     waiter = search.BlockAddWaiter;

            ToBreakpoint(search, waiter, id);
        }
Exemplo n.º 3
0
 private void ShowJustVirtual(LabyrinthControl lc)
 {
     lc.IsViewRobot = false;
     lc.Robot.DriveSearch.IsVisible = false;
     lc.Robot.BestSearch.IsVisible  = false;
     lc.Robot.WorstSearch.IsVisible = false;
 }
Exemplo n.º 4
0
        private void ToBreakpoint1(LabyrinthControl lc)
        {
            ToBreakpoint(lc.Robot, lc.Robot.MoveWaiter, 1);

            lc.Robot.BestSearch.IsVisible  = true;
            lc.Robot.WorstSearch.IsVisible = true;
        }
Exemplo n.º 5
0
        protected override void GeneralSetup(LabyrinthControl lc)
        {
            Labyrinth lab = new Labyrinth(size, size, size / 2 - 1, size / 2 - 1, 2);

            SearchView search = new SearchView()
            {
                Labyrinth          = lab,
                Start              = Block.Origin,
                IsLabyrinthTarget  = true,
                IsVisible          = true,
                SearchType         = SearchType.BruteForce,
                IsDistancesVisable = false,
                IsCountsVisable    = false,
                IsLengthVisable    = false,
                InterpreterType    = RelationInterpreterType.Actual
            };

            ClearSearches(lc);
            lc.Robot     = null;
            lc.Labyrinth = lab;
            lc.Searches.Add(search);

            lc.IsViewActual  = true;
            lc.IsViewRobot   = false;
            lc.IsViewVirtual = false;
        }
Exemplo n.º 6
0
        protected void ClearSearches(LabyrinthControl lc)
        {
            foreach (SearchView search in lc.Searches)
            {
                search.CancelSearch();
            }

            lc.Searches.Clear();
        }
Exemplo n.º 7
0
        public void Next(LabyrinthControl lc)
        {
            SubIndex = (SubIndex + 1) % SubSetuper.Length;

            if (HaveSetup(lc))
            {
                GeneralSetup(lc);
            }

            ExecuteAsync(lc);
        }
Exemplo n.º 8
0
        protected override void GeneralSetup(LabyrinthControl lc)
        {
            Labyrinth lab   = GetLabyrinth(Name + extention, 2);
            Robot     robot = new Robot(lab);

            Waiter robotWaiter = new Waiter();

            robotWaiter.Time  = TimeSpan.FromMilliseconds(500);
            robotWaiter.Pause = true;
            robotWaiter.Breakpoints.Add(new UIntText(236));
            robotWaiter.Breakpoints.Add(new UIntText(237));
            robotWaiter.Breakpoints.Add(new UIntText(350));
            robotWaiter.Breakpoints.Add(new UIntText(383));

            robot.WorstSearch.BlockAddWaiter  = new Waiter();
            robot.WorstSearch.TryAddWaiter    = new Waiter();
            robot.WorstSearch.IsVisible       = false;
            robot.WorstSearch.IsLengthVisable = true;

            robot.BestSearch.BlockAddWaiter  = new Waiter();
            robot.BestSearch.TryAddWaiter    = new Waiter();
            robot.BestSearch.IsVisible       = false;
            robot.BestSearch.IsLengthVisable = true;

            robot.DriveSearch.BlockAddWaiter = new Waiter();
            robot.DriveSearch.TryAddWaiter   = new Waiter();
            robot.DriveSearch.IsVisible      = true;

            robot.MoveWaiter        = robotWaiter;
            robot.RobotSearchWaiter = robotWaiter;
            robot.TargetWaiter      = robotWaiter;

            ClearSearches(lc);
            lc.Robot     = robot;
            lc.Labyrinth = lab;
            lc.Searches.Add(robot.WorstSearch);
            lc.Searches.Add(robot.BestSearch);
            lc.Searches.Add(robot.DriveSearch);

            lc.IsViewActual  = false;
            lc.IsViewRobot   = true;
            lc.IsViewVirtual = true;
        }
Exemplo n.º 9
0
        protected override void GeneralSetup(LabyrinthControl lc)
        {
            Labyrinth lab = GetLabyrinth(Name + extention, 2);

            Waiter waiter = new Waiter();

            waiter.Time = TimeSpan.FromMilliseconds(1);
            waiter.Breakpoints.Add(new UIntText(97));
            waiter.Breakpoints.Add(new UIntText(406));
            waiter.Breakpoints.Add(new UIntText(412));
            waiter.Breakpoints.Add(new UIntText(432));
            waiter.Breakpoints.Add(new UIntText(553));
            waiter.Breakpoints.Add(new UIntText(1190));
            waiter.Breakpoints.Add(new UIntText(1521));

            SearchView search = new SearchView()
            {
                Labyrinth              = lab,
                Start                  = Block.Origin,
                IsLabyrinthTarget      = true,
                IsVisible              = true,
                SearchType             = SearchType.Direct,
                IsDistancesVisable     = false,
                IsCountsVisable        = false,
                IsLengthVisable        = false,
                InterpreterType        = RelationInterpreterType.Actual,
                TryAddWaiter           = waiter,
                BlockAddWaiter         = waiter,
                IsVisibilitiesExpanded = true,
                IsBlockAddExpanded     = true
            };

            ClearSearches(lc);
            lc.Robot     = null;
            lc.Labyrinth = lab;
            lc.Searches.Add(search);

            lc.IsViewActual  = true;
            lc.IsViewRobot   = false;
            lc.IsViewVirtual = false;
        }
Exemplo n.º 10
0
 private void ShowJustVirtualSafe(LabyrinthControl lc)
 {
     lc.Dispatcher.BeginInvoke(new Action <LabyrinthControl>(ShowJustVirtual), lc);
 }
Exemplo n.º 11
0
 private void ToBreakpoint5(LabyrinthControl lc)
 {
     ToBreakpoint(lc, 5);
 }
Exemplo n.º 12
0
 protected abstract bool HaveSetup(LabyrinthControl lc);
Exemplo n.º 13
0
 private void ToBreakpoint0(LabyrinthControl lc)
 {
     ToBreakpoint(lc, 0);
 }
Exemplo n.º 14
0
 private void ToBreakpoint3(LabyrinthControl lc)
 {
     ToBreakpoint(lc, 3);
 }
Exemplo n.º 15
0
 protected override bool HaveSetup(LabyrinthControl lc)
 {
     return(false);
 }
Exemplo n.º 16
0
 private void ExecuteAsync(LabyrinthControl lc)
 {
     Task.Factory.StartNew(new Action <object>(Execute), lc);
 }
Exemplo n.º 17
0
 private void Nothing(LabyrinthControl lc)
 {
 }
Exemplo n.º 18
0
 public void Previous(LabyrinthControl lc)
 {
     SubIndex = (SubIndex - 1 + SubSetuper.Length) % SubSetuper.Length;
     ExecuteAsync(lc);
 }
Exemplo n.º 19
0
 private void ToBreakpoint2(LabyrinthControl lc)
 {
     ToBreakpoint(lc, 2);
     lc.Searches[0].IsLengthVisable = true;
 }
Exemplo n.º 20
0
 private void ToBreakpoint2(LabyrinthControl lc)
 {
     ToBreakpoint(lc, 2);
 }
Exemplo n.º 21
0
 protected override bool HaveSetup(LabyrinthControl lc)
 {
     return(lc.Searches.Count != 1);
 }
Exemplo n.º 22
0
 private void Start(LabyrinthControl lc)
 {
     lc.Searches.First().BeginSearch();
 }
Exemplo n.º 23
0
 protected override bool HaveSetup(LabyrinthControl lc)
 {
     return(lc.Robot == null || !lc.Searches.Contains(lc.Robot.DriveSearch) ||
            !lc.Searches.Contains(lc.Robot.BestSearch) || !lc.Searches.Contains(lc.Robot.WorstSearch));
 }
Exemplo n.º 24
0
        private void Execute(object obj)
        {
            LabyrinthControl lc = obj as LabyrinthControl;

            SubSetuper[SubIndex](lc);
        }
Exemplo n.º 25
0
 private void ToBreakpoint4(LabyrinthControl lc)
 {
     lc.Searches[0].IsDistancesVisable = true;
     ToBreakpoint(lc, 4);
 }
Exemplo n.º 26
0
 private void ToBreakpoint1(LabyrinthControl lc)
 {
     ToBreakpoint(lc, 1);
 }
Exemplo n.º 27
0
 private void BeginSearch(LabyrinthControl lc)
 {
     lc.Robot.CancelSearch();
     lc.Robot.BeginSearch();
 }
Exemplo n.º 28
0
 protected abstract void GeneralSetup(LabyrinthControl lc);
Exemplo n.º 29
0
 private void ToBreakpoint2(LabyrinthControl lc)
 {
     ToBreakpoint(lc.Robot, lc.Robot.MoveWaiter, 2);
 }
Exemplo n.º 30
0
        protected override void GeneralSetup(LabyrinthControl lc)
        {
            Labyrinth lab   = GetLabyrinth(Name + extention, 2);
            Robot     robot = new Robot(lab);

            robot.WorstSearch.IsVisible       = true;
            robot.WorstSearch.BlockAddWaiter  = new Waiter();
            robot.WorstSearch.TryAddWaiter    = new Waiter();
            robot.WorstSearch.IsLengthVisable = true;

            robot.BestSearch.IsVisible       = true;
            robot.BestSearch.BlockAddWaiter  = new Waiter();
            robot.BestSearch.TryAddWaiter    = new Waiter();
            robot.BestSearch.IsVisible       = false;
            robot.BestSearch.IsLengthVisable = true;

            robot.DriveSearch.IsVisible      = true;
            robot.DriveSearch.BlockAddWaiter = new Waiter();
            robot.DriveSearch.TryAddWaiter   = new Waiter();

            Waiter moveWaiter = new Waiter();

            moveWaiter.Time = TimeSpan.FromMilliseconds(100);

            Waiter targetWaiter = new Waiter();

            targetWaiter.Pause = true;

            robot.MoveWaiter        = moveWaiter;
            robot.TargetWaiter      = targetWaiter;
            robot.RobotSearchWaiter = new Waiter();

            SearchView directSearch = new SearchView()
            {
                Labyrinth              = lab,
                Start                  = Block.Origin,
                IsLabyrinthTarget      = true,
                IsVisible              = true,
                SearchType             = SearchType.Direct,
                IsDistancesVisable     = false,
                IsCountsVisable        = false,
                IsLengthVisable        = false,
                InterpreterType        = RelationInterpreterType.Actual,
                TryAddWaiter           = new Waiter(),
                BlockAddWaiter         = new Waiter(),
                IsVisibilitiesExpanded = true,
                IsBlockAddExpanded     = true
            };

            SearchView bruteForceSearch = new SearchView()
            {
                Labyrinth              = lab,
                Start                  = Block.Origin,
                IsLabyrinthTarget      = true,
                IsVisible              = true,
                SearchType             = SearchType.BruteForce,
                IsDistancesVisable     = false,
                IsCountsVisable        = false,
                IsLengthVisable        = false,
                InterpreterType        = RelationInterpreterType.Actual,
                TryAddWaiter           = new Waiter(),
                BlockAddWaiter         = new Waiter(),
                IsVisibilitiesExpanded = true,
                IsBlockAddExpanded     = true
            };

            ClearSearches(lc);
            lc.Robot     = robot;
            lc.Labyrinth = lab;
            lc.Searches.Add(robot.WorstSearch);
            lc.Searches.Add(robot.BestSearch);
            lc.Searches.Add(robot.DriveSearch);
            lc.Searches.Add(directSearch);
            lc.Searches.Add(bruteForceSearch);

            lc.IsViewActual  = true;
            lc.IsViewRobot   = true;
            lc.IsViewVirtual = true;
        }