예제 #1
0
    // Use this for initialization
    void Awake()
    {
        prefabs     = GetComponent <Prefabs>();
        charHandler = GetComponent <CharacterHandler>();
        depthFirst  = GetComponent <DepthFirst>();
        charFactory = GetComponent <CharacterFactory>();
        uiHandler   = GetComponent <UIHandler>();
        turnHandler = GetComponent <TurnHandler>();

        MapGenerator mapGen = GetComponent <MapGenerator>();

        mapGen.CreateMap();
        depthFirst.Init();
        charHandler.Init();
        charFactory.Init();
        uiHandler.Init();
        turnHandler.Init();

        GameObject startRoom = GameObject.Find("Room0");
        Vector3    pos       = startRoom.GetComponent <Room>().GetCenter();
        GameObject player    = charFactory.CreateCharacter(prefabs.player, pos.x, pos.z);

        charHandler.SelectUnit(player.GetComponent <Character>());
        Camera.main.transform.position = new Vector3(player.transform.position.x, Camera.main.transform.position.y, player.transform.position.z - 4);

        Vector3    goblinRoom = GameObject.Find("Room1").GetComponent <Room>().GetCenter();
        GameObject goblin     = charFactory.CreateCharacter(prefabs.goblin, goblinRoom.x, goblinRoom.z);

        charHandler.characters.Add(player.GetComponent <Character>());
        charHandler.enemies.Add(goblin.GetComponent <Character>());

        player.AddComponent <MeleeAttack>();
        uiHandler.PopulatePanel(player.GetComponent <Character>());
        turnHandler.FirstTurn();
    }
예제 #2
0
        private bool Solve(string selectedAlgorithm)
        {
            TraversalType TraversalType = null;

            switch (selectedAlgorithm)
            {
            case "BreadthFirst":
                TraversalType = new BreadthFirst(_Map);
                break;

            case "DepthFirst":
                TraversalType = new DepthFirst(_Map);
                break;

            case "DeadEndFill":
                TraversalType = new DeadEndFill(_Map);
                break;

            case "FibonacciHeap":
                break;

            case "LeftTurn":
                break;

            default:
                break;
            }

            return(TraversalType.Solve());
        }
예제 #3
0
        public void DepthFirst_Smoke_Test()
        {
            var graph = new Graph <char>();

            graph.AddVertex('A');
            graph.AddVertex('B');
            graph.AddVertex('C');
            graph.AddVertex('D');
            graph.AddVertex('E');

            graph.AddVertex('F');
            graph.AddVertex('G');
            graph.AddVertex('H');
            graph.AddVertex('I');

            graph.AddEdge('A', 'F');
            graph.AddEdge('B', 'F');
            graph.AddEdge('B', 'G');
            graph.AddEdge('C', 'H');
            graph.AddEdge('C', 'I');
            graph.AddEdge('D', 'G');
            graph.AddEdge('D', 'H');
            graph.AddEdge('E', 'F');
            graph.AddEdge('E', 'I');

            var algo = new DepthFirst <char>();

            Assert.IsTrue(algo.Find(graph, 'D'));

            Assert.IsFalse(algo.Find(graph, 'M'));
        }
예제 #4
0
        public void CanGetSmallestBranch()
        {
            // Arrange
            Tree <int> tree = new Tree <int>();

            Node <int> root = new Node <int>(10);
            Node <int> b    = new Node <int>(15);
            Node <int> c    = new Node <int>(20);
            Node <int> d    = new Node <int>(25);
            Node <int> e    = new Node <int>(30);

            tree.Root = root;

            root.LeftChild  = b;
            root.RightChild = c;

            b.LeftChild  = d;
            b.RightChild = e;

            // Act
            int result = DepthFirst.SmallestBranch(root);

            // Assert
            Assert.Equal(2, result);
        }
예제 #5
0
 public void StartCannotBeNull()
 {
     typeof(DepthFirst).Invoking(_ =>
                                 DepthFirst.VisitAll(CreateSimpleGraph(), null).ToList())
     .Should().Throw <ArgumentNullException>()
     .Which.ParamName.Should().Be("start");
 }
예제 #6
0
 public void GraphCannotBeNull()
 {
     typeof(DepthFirst).Invoking(_ =>
                                 DepthFirst.VisitAll(null, NodeIdentity.Of("A")).ToList())
     .Should().Throw <ArgumentNullException>()
     .Which.ParamName.Should().Be("graph");
 }
예제 #7
0
        public void DepthFirst_AdjacencyMatrixGraph_Smoke_Test()
        {
            var graph = new Advanced.Algorithms.DataStructures.Graph.AdjacencyMatrix.Graph <char>();

            graph.AddVertex('A');
            graph.AddVertex('B');
            graph.AddVertex('C');
            graph.AddVertex('D');
            graph.AddVertex('E');

            graph.AddVertex('F');
            graph.AddVertex('G');
            graph.AddVertex('H');
            graph.AddVertex('I');

            graph.AddEdge('A', 'F');
            graph.AddEdge('B', 'F');
            graph.AddEdge('B', 'G');
            graph.AddEdge('C', 'H');
            graph.AddEdge('C', 'I');
            graph.AddEdge('D', 'G');
            graph.AddEdge('D', 'H');
            graph.AddEdge('E', 'F');
            graph.AddEdge('E', 'I');

            var algorithm = new DepthFirst <char>();

            Assert.IsTrue(algorithm.Find(graph, 'D'));

            Assert.IsFalse(algorithm.Find(graph, 'M'));
        }
예제 #8
0
        public void whenDoDepthFirstSearchInTheGraphShouldEqualToResult()
        {
            var dfs       = new DepthFirst <int>();
            var dfsresult = dfs.search(graph);

            Assert.Equal("0 1 2 4 3 ", dfsresult);
        }
예제 #9
0
        public void CanCountTreeLeavesDepth()
        {
            // Arrange
            Tree <int> tree = new Tree <int>();

            Node <int> root = new Node <int>(10);
            Node <int> b    = new Node <int>(15);
            Node <int> c    = new Node <int>(20);
            Node <int> d    = new Node <int>(25);
            Node <int> e    = new Node <int>(30);
            Node <int> f    = new Node <int>(35);
            Node <int> g    = new Node <int>(40);

            tree.Root = root;

            root.LeftChild  = b;
            root.RightChild = c;

            b.LeftChild  = d;
            b.RightChild = e;

            c.LeftChild  = f;
            c.RightChild = g;

            // Act
            int result = DepthFirst.CountTreeLeavesDepth(root);

            // Assert
            Assert.Equal(4, result);
        }
예제 #10
0
 private void Start()
 {
     grid         = GetComponent <Grid>();
     astar        = new AStar();
     breadthFirst = new BreadthFirst();
     depthFirst   = new DepthFirst();
     dijkstra     = new Dijkstra();
     greedyBfs    = new GreedyBestFirst();
 }
예제 #11
0
 public void DoesNotVisitDisconnectedNodes()
 {
     DepthFirst.VisitAll(
         GraphFactory.BuildGraph("A-B", "C-D"), NodeIdentity.Of("A"))
     .Should()
     .ContainInOrder(
         NodeIdentity.Of("A"),
         NodeIdentity.Of("B")
         ).And.HaveCount(2);
 }
예제 #12
0
 public void VisitsNodesInOrder()
 {
     DepthFirst.VisitAll(CreateSimpleGraph(), NodeIdentity.Of("A"))
     .Should().ContainInOrder(
         NodeIdentity.Of("A"),
         NodeIdentity.Of("B2"),
         NodeIdentity.Of("C2"),
         NodeIdentity.Of("C1"),
         NodeIdentity.Of("B1")
         ).And.HaveCount(5);
 }
예제 #13
0
        //genera el laberinto y encuentra una ruta entre inicio y fin
        private int BuscarNodoFuncional()
        {
            var ProbarLaberinto = new DibujarLaberinto(pbMaze);
            var BuscarCamino    = new DepthFirst(ProbarLaberinto.Cuadrilla);
            var progress        = BuscarCamino.MarcarRuta();

            while (progress.RutaPosible && !progress.RutaEncontrada)
            {
                progress = BuscarCamino.MarcarRuta();
            }
            return(progress.RutaEncontrada ? ProbarLaberinto.Seed : 0);
        }
예제 #14
0
        /// <summary>
        /// Generate mazes until one is found that has a valid path between A and B
        /// </summary>
        /// <returns>The seed of the valid maze</returns>
        private int FindWorkingSeed()
        {
            var testMazeDrawer = new MazeDrawer(pbMaze);
            var testPathFinder = new DepthFirst(testMazeDrawer.Grid);
            var progress       = testPathFinder.GetPathTick();

            while (progress.PathPossible && !progress.PathFound)
            {
                progress = testPathFinder.GetPathTick();
            }

            return(progress.PathFound ? testMazeDrawer.Seed : 0);
        }
예제 #15
0
        public bool IsReachableFrom(TSymValue source, TSymValue target)
        {
            bool reachable = false;

            DepthFirst.Visit(this, source, sv => {
                if (sv.Equals(target))
                {
                    reachable = true;
                }
                return(true);
            }, null);
            return(reachable);
        }
예제 #16
0
        public void SearchedVertexValueIsTheFirstOne()
        {
            // Arrange
            var graph = new Graph <char>();

            graph.AddVertex('A');
            graph.AddVertex('B');

            var depthFirst = new DepthFirst <char>();

            // Act & Assert
            Assert.True(depthFirst.Find(graph.FirstVertexOrNull, 'A'));
        }
예제 #17
0
    static void StartDepthFirst(int initstate)
    {
        try
        {
            DepthFirst o = new DepthFirst(initstate);
            o.Depth = Utils.depthlimit;
            Console.Write("\rDepth First Search starts . . . Please wait");
            o.Solve();
        }

        catch (Exception e)
        {
            HandleException(e);
        }
    }
예제 #18
0
        public void SearchedVertexValueIsNotFound()
        {
            // Arrange
            var graph = new Graph <char>();

            graph.AddVertex('A');
            graph.AddVertex('B');

            graph.AddEdge('A', 'B');

            var depthFirst = new DepthFirst <char>();

            // Act & Assert
            Assert.False(depthFirst.Find(graph.FirstVertexOrNull, 'X'));
        }
예제 #19
0
        public void DepthFirstSearchTest()
        {
            Board board = new Board();

            board.SetSquareValue(1, 6, 2);
            board.SetSquareValue(1, 7, 1);

            board.SetSquareValue(2, 3, 4);
            board.SetSquareValue(2, 6, 8);
            board.SetSquareValue(2, 7, 7);

            board.SetSquareValue(3, 2, 2);
            board.SetSquareValue(3, 4, 3);
            board.SetSquareValue(3, 7, 9);

            board.SetSquareValue(4, 1, 6);
            board.SetSquareValue(4, 3, 2);
            board.SetSquareValue(4, 6, 3);
            board.SetSquareValue(4, 8, 4);

            board.SetSquareValue(6, 2, 5);
            board.SetSquareValue(6, 4, 6);
            board.SetSquareValue(6, 7, 3);
            board.SetSquareValue(6, 9, 1);

            board.SetSquareValue(7, 3, 3);
            board.SetSquareValue(7, 6, 5);
            board.SetSquareValue(7, 8, 8);

            board.SetSquareValue(8, 3, 8);
            board.SetSquareValue(8, 4, 2);
            board.SetSquareValue(8, 7, 5);

            board.SetSquareValue(9, 3, 9);
            board.SetSquareValue(9, 4, 7);
            try
            {
                DepthFirst.DepthFirstSearch(board);
            }
            catch (Exception e)
            {
                if (e != null)
                {
                    Assert.Fail();
                }
            }
        }
예제 #20
0
        public void CanFindIfTreeIsContainedInAnotherTree()
        {
            // Arrange

            Tree <int> tree1 = new Tree <int>();

            Node <int> root1 = new Node <int>(15);
            Node <int> h     = new Node <int>(25);
            Node <int> i     = new Node <int>(30);

            tree1.Root = root1;

            root1.LeftChild  = h;
            root1.RightChild = i;

            Tree <int> tree2 = new Tree <int>();

            Node <int> root2 = new Node <int>(10);
            Node <int> b     = new Node <int>(15);
            Node <int> c     = new Node <int>(20);
            Node <int> d     = new Node <int>(25);
            Node <int> e     = new Node <int>(30);
            Node <int> f     = new Node <int>(35);
            Node <int> g     = new Node <int>(40);

            tree2.Root = root2;

            root2.LeftChild  = b;
            root2.RightChild = c;

            b.LeftChild  = d;
            b.RightChild = e;

            c.LeftChild  = f;
            c.RightChild = g;

            // Act
            bool result = DepthFirst.IsTree1ContainedInTree2(root1, root2);

            // Assert
            Assert.True(result);
        }
예제 #21
0
파일: Program.cs 프로젝트: Ebski/Algorithms
        public static void Main(string[] args)
        {
            GraphBuilder gb = new MyGraphBuilder();

            Node a = gb.createNode("A");
            Node b = gb.createNode("B");
            Node c = gb.createNode("C");
            Node d = gb.createNode("D");
            Node e = gb.createNode("E");

            gb.createEdge(a, b);
            gb.createEdge(b, a);
            gb.createEdge(b, c);
            gb.createEdge(c, d);
            gb.createEdge(a, d);
            gb.createEdge(d, a);
            gb.createEdge(c, e);
            gb.createEdge(e, d);
            gb.createEdge(c, c);

            Graph g = gb.build();
            IEnumerable <Node> resBreathFirst = BreathFirst.runBreathFirst(a);
            IEnumerable <Node> resDepthFirst  = DepthFirst.runDepthFirst(a);

            foreach (Node node in resBreathFirst)
            {
                Console.WriteLine(node.getName());
            }

            Console.WriteLine("\n------------------------------------\n");

            foreach (Node node in resDepthFirst)
            {
                Console.WriteLine(node.getName());
            }

            while (true)
            {
            }
        }
예제 #22
0
        private void RunAlgorithm(string _algoName, Graph _graph)
        {
            // Variables
            DateTime  beginning;
            DateTime  end;
            TimeSpan  duration;
            Algorithm algo = null;

            // Création de l'algorithme
            switch (_algoName)
            {
            case "Depth-First":
                algo = new DepthFirst(_graph, this);                     // Algorithm(Graph _graph, IHM _ihm).
                break;

            case "Breadth-First":
                algo = new BreadthFirst(_graph, this);
                break;

            case "Bellman-Ford":
                algo = new BellmanFord(_graph, this);
                break;

            case "Dijkstra":
                algo = new Dijkstra(_graph, this);
                break;

            case "A*":
                algo = new AStar(_graph, this);
                break;
            }

            // Résolution
            Console.Out.WriteLine("Algorithme : " + _algoName);
            beginning = DateTime.Now;
            algo.Solve();
            end      = DateTime.Now;
            duration = end - beginning;
            Console.Out.WriteLine("Durée (ms) : " + duration.TotalMilliseconds.ToString() + "\n");
        }
예제 #23
0
    public static void Main()
    {
        Tests.TestAll();
        Byte[] raw;
#if DoubleLinked
        int        endPos = -1;
        JsonNode   jsn;
        BrowseNode v1, v2;
        DepthFirst bf1, bf2;
#endif
        Parser  jsonParser = new Parser(true); // FloatAsDecimal
        Printer prn        = new Printer();

#if DoubleLinked
        raw = Encoding.UTF8.GetBytes(Strings.JSONnetPart1);
        jsonParser.Parse(raw, ref endPos, out JsonNode jsn1
#if KEY_SPLIT
                         , new ByteString[] { }, 0, 0, 0
#endif
                         );
        bf1 = new DepthFirst(jsn1, raw);
        v1  = new BrowseNode(ref jsn1, raw);

        raw = Encoding.UTF8.GetBytes(Strings.JSONnetPart2);
        jsonParser.Parse(raw, ref endPos, out JsonNode jsn2
#if KEY_SPLIT
                         , new ByteString[] { }, 0, 0, 0
#endif
                         );
        jsonParser.SortPaths(jsn2, raw, "id");
        v2 = new BrowseNode(ref jsn2, raw);

        bf2 = new DepthFirst(jsn2, raw);
        jsonParser.RemoveTwins(ref bf1, ref bf2);

        Console.WriteLine("RemoveTwins result 1/2:");
        Console.WriteLine(prn.Print(ref v1, 0).ToString());
        Console.WriteLine("RemoveTwins result 2/2:");
        Console.WriteLine(prn.Print(ref v2, 0).ToString());

        raw = Encoding.UTF8.GetBytes(Strings.JSONnetComplete);
        ByteString[] keys = new ByteString[]
        {
            new ByteString("batters"),
            null
        };
        jsonParser.Parse(raw, ref endPos, out jsn
#if KEY_SPLIT
                         , keys, 2, 0, 2
#endif
                         ); // batters / null path, read only 1st 2
#if !KEY_SPLIT
        jsonParser.SortPaths(jsn, raw, null);
        v1 = new BrowseNode(ref jsn, raw);
        String check = prn.Print(ref v1, 0).ToString();
        if (Strings.Sort1 != check)
        {
            Console.WriteLine($"SortPaths 2.1 error:\n{Strings.Sort1}!=\n{check}<-");
        }
        else
        {
            Console.WriteLine("SortPaths 2.1 OK");
        }
        jsonParser.SortPaths(jsn, raw, "id");
        check = prn.Print(ref v1, 0).ToString();
        if (Strings.Sort2 != check)
        {
            Console.WriteLine($"SortPaths 2.2 error:\n{Strings.Sort2}");
        }
        else
        {
            Console.WriteLine("SortPaths 2.2 OK");
        }
        endPos = -1;
#else
        Console.WriteLine("1st 2 rows of batters only:");
        jsonParser.Parse(raw, ref endPos, out jsn
                         , keys, 2, endPos, 2
                         ); // and now following 2
        ValueWriter wr = new ValueWriter();
        using (StreamWriter sw = new StreamWriter(Console.OpenStandardOutput()))
        {
            sw.AutoFlush = true;
            wr.DumpValueIterative(sw, jsn, raw);
        }
#endif

        // Twiter complex json -> TC
        raw = Encoding.UTF8.GetBytes(Tests.ReadFile("pass6.json"));
        jsonParser.Parse(raw, ref endPos, out JsonNode jsn01
#if KEY_SPLIT
                         , new ByteString[] { }, 0, 0, 0
#endif
                         );
        jsonParser.Parse(raw, ref endPos, out JsonNode jsn02
#if KEY_SPLIT
                         , new ByteString[] { }, 0, 0, 0
#endif
                         );
        v1  = new BrowseNode(ref jsn01, raw);
        v2  = new BrowseNode(ref jsn02, raw);
        bf1 = new DepthFirst(jsn01, raw);
        bf2 = new DepthFirst(jsn02, raw);
        Tests.ModifyTwitter(ref bf1, ref bf2, raw);
        jsonParser.RemoveTwins(ref bf1, ref bf2);
        if (v1.NodeRawData == null)
        {
            Console.WriteLine("Bug - 1st modified Twitter JSON empty");
        }
        else if (Strings.Twitter1 == prn.Print(ref v1, 0).ToString())
        {
            Console.WriteLine($"Twitter check 1/2 OK - 1st variant has expected content:");
        }
        else
        {
            Console.WriteLine($"Twiter RemoveTwins result 1/2 differs:\n{prn.Print(ref v1, 0).ToString()}");
        }
        if (v2.NodeRawData == null)
        {
            Console.WriteLine("Bug - 2nd modified Twitter JSON empty");
        }
        else if (Strings.Twitter2 == prn.Print(ref v2, 0).ToString())
        {
            Console.WriteLine($"Twitter check 2/2 OK - 2nd variant has expected content:");
        }
        else
        {
            Console.WriteLine($"Twiter RemoveTwins result 2/2 differs:\n{prn.Print(ref v2, 0).ToString()}");
        }
#endif

        raw = File.ReadAllBytes(@"citylots.json");
        Benchmark b = new Benchmark(raw);
        b.Run(); // < 30s
        return;
    }
예제 #24
0
        private void Run()
        {
            // 1st map
            String mapStr = "..  XX   .\n"
                            + "*.  *X  *.\n"
                            + " .  XX ...\n"
                            + " .* X *.* \n"
                            + " ...=...  \n"
                            + " .* X     \n"
                            + " .  XXX*  \n"
                            + " .  * =   \n"
                            + " .... XX  \n"
                            + "   *.  X* ";
            Map       map  = new Map(mapStr, 0, 0, 9, 9);
            Algorithm algo = new DepthFirst(map, this);

            algo.Solve();
            Console.WriteLine();
            algo = new BreadthFirst(map, this);
            algo.Solve();
            Console.WriteLine();
            algo = new BellmanFord(map, this);
            algo.Solve();
            Console.WriteLine();
            algo = new Dijkstra(map, this);
            algo.Solve();
            Console.WriteLine();
            algo = new AStar(map, this);
            algo.Solve();
            Console.WriteLine();

            // 2nd map
            mapStr = "...*     X .*    *  \n"
                     + " *..*   *X .........\n"
                     + "   .     =   *.*  *.\n"
                     + "  *.   * XXXX .    .\n"
                     + "XXX=XX   X *XX=XXX*.\n"
                     + "  *.*X   =  X*.  X  \n"
                     + "   . X * X  X . *X* \n"
                     + "*  .*XX=XX *X . XXXX\n"
                     + " ....  .... X . X   \n"
                     + " . *....* . X*. = * ";
            map  = new Map(mapStr, 0, 0, 9, 19);
            algo = new DepthFirst(map, this);
            algo.Solve();
            Console.WriteLine();
            algo = new BreadthFirst(map, this);
            algo.Solve();
            Console.WriteLine();
            algo = new BellmanFord(map, this);
            algo.Solve();
            Console.WriteLine();
            algo = new Dijkstra(map, this);
            algo.Solve();
            Console.WriteLine();
            algo = new AStar(map, this);
            algo.Solve();
            Console.WriteLine();

            Console.ReadKey();
        }
예제 #25
0
        private (List <Position>, List <Position>) DFS(Position a, Position b)
        {
            DepthFirst dfsSearch = new DepthFirst();

            return(dfsSearch.Search(a, b, grid));
        }
예제 #26
0
    public static void ModifyTwitter(ref DepthFirst bf1, ref DepthFirst bf2, Byte[] raw)
    {
        JsonNode nNo2 = null, nNo3 = null, nId1 = null, nId2 = null;

        if (bf2.FindNode("created_at")) // Small TC-like demo
        {
            P_ByteLnk  index = bf2.Current.doubleOrString, tmp;
            ByteString chars = bf2.Current.GetFatData(raw);
            tmp        = index;
            tmp.length = 1;
            tmp.pos   += chars.Find('2'); // find "2" for value
            nNo2       = new JsonNode
            {
                Tag            = JsonTag.JSON_STRING,
                doubleOrString = tmp
#if DEBUGGING
                , uniqueNo = 16228
#endif
            };
            tmp.pos = index.pos + chars.Find('3'); // find "3" for value
            nNo3    = new JsonNode
            {
                Tag            = JsonTag.JSON_STRING,
                doubleOrString = tmp
#if DEBUGGING
                , uniqueNo = 16229
#endif
            };
            tmp.pos    = index.pos;
            tmp.length = 3; // Sun
            nId1       = new JsonNode
            {
                Tag            = JsonTag.JSON_STRING,
                doubleOrString = tmp
#if DEBUGGING
                , uniqueNo = 16230
#endif
            };
            tmp.pos += 4; // Aug
            nId2     = new JsonNode
            {
                Tag            = JsonTag.JSON_STRING,
                doubleOrString = tmp
#if DEBUGGING
                , uniqueNo = 16231
#endif
            };
        }
        if (bf1.FindNode("metadata") &&
            bf1.Parent() &&
            bf1.NextNth(99) &&
            bf1.FindNode("user") &&
            bf1.FindNode("hashtags"))
        {
            bf1.Next();
            bf1.PrependChild(nId1); // Invalid in JSON text, but possible in it's object representation
        }
        bf1.Current = bf1.Root;
        if (bf2.FindNode("metadata") &&
            bf2.Parent() &&
            bf2.NextNth(37) &&
            bf2.FindNode("retweet_count") &&
            bf2.FindNode("screen_name") &&
            bf2.FindNode("indices"))
        {
            bf2.PrependChild(nNo3);
            bf2.PrependChild(nNo2);
        }
        if (bf2.FindNode("metadata") &&
            bf2.Parent() &&
            bf2.NextNth(60) &&
            bf2.FindNode("user") &&
            bf2.FindNode("hashtags"))
        {
            bf2.Next();
            bf2.PrependChild(nId2); // Invalid in JSON
        }
    }
예제 #27
0
        private MazeGenerator SetupGenerator(Maze maze)
        {
            // pretty algorithm to generate mazes
            DepthFirst generator = new DepthFirst (maze);

            // dont enter into the 3x3 center
            generator.SetVisited (5, 5, true);
            generator.SetVisited (6, 5, true);
            generator.SetVisited (7, 5, true);
            generator.SetVisited (5, 6, true);
            generator.SetVisited (6, 6, true);
            generator.SetVisited (7, 6, true);
            generator.SetVisited (5, 7, true);
            generator.SetVisited (6, 7, true);
            generator.SetVisited (7, 7, true);

            return generator;
        }
 public void Init()
 {
     depthFirst = GetComponent <DepthFirst>();
     tiles      = GetComponent <MapGenerator>().tiles;
 }