Exemplo n.º 1
0
 public void Reset()
 {
     isMaked    = false;
     mazeBlocks = new MazeBlocks(mazeSize);
     StartBlock = mazeBlocks.GetBorder(RandomPick <MyGridPoint> .Pick(new List <MyGridPoint>
     {
         new MyGridPoint(0, (new Random().Next() % (mazeSize.Cols / 2))),
         new MyGridPoint(0, (new Random().Next() % (mazeSize.Rows / 2)))
     }));
     StartBlock.mazeMark = MazeMark.Maze;
     ListFrontier        = new List <MyBorder>();
     ListFrontier.AddRange(mazeBlocks.GetMarkedNeightborPoint(StartBlock.point, MazeMark.Map));
 }
Exemplo n.º 2
0
        public void FindPath()
        {
            if (isMaked)
            {
                var EntryPoint = RandomPick <MyGridPoint> .Pick(new List <MyGridPoint> {
                    new MyGridPoint(random.Next() % (Rows / 2), 0),
                    new MyGridPoint(0, random.Next() % (Cols / 2))
                });

                PathBlock RootBlock = new PathBlock {
                    Data = mazeBlocks.GetBorder(EntryPoint)
                };
            }
        }
Exemplo n.º 3
0
        public void StepProcess()
        {
            if (ListFrontier.Count != 0)
            {
                isMaked = false;
                var picked_Frontier = RandomPick <MyBorder> .Pick(ListFrontier);

                picked_Frontier.mazeMark = MazeMark.Maze;
                var next_Block = RandomPick <MyBorder> .Pick(mazeBlocks.GetMarkedNeightborPoint(picked_Frontier.point, MazeMark.Maze));

                mazeBlocks.SetWallThinkness(picked_Frontier, next_Block);
                ListFrontier.Remove(picked_Frontier);
                ListFrontier.AddRange(mazeBlocks.GetMarkedNeightborPoint(picked_Frontier.point, MazeMark.Map).FindAll(x => !ListFrontier.Contains(x)));
            }
            else
            {
                isMaked = true;
            }
        }