示例#1
0
    // Use this for initialization
    void Start()
    {
        BreadthFirstPath path = BreadthFirstPath.Instance;

        path.updatePaths();
        //Put it at 0.0!
        this.transform.position = new Vector2(Mathf.Floor(Random.Range(0, GameState.MAPWIDTH)), 0);
    }
示例#2
0
    // Use this for initialization
    void Start()
    {
        /*for (int x = 0; x < GameState.MAPWIDTH; x++)
         * {
         *  for (int y = 0; y < GameState.MAPHEIGHT; y++)
         *  {
         *     GameState.setTile
         *  }
         * }*/

        BreadthFirstPath path = BreadthFirstPath.Instance;

        path.updatePaths();
    }
示例#3
0
        void GraphTest()
        {
            var strArr = FileHandler.ReadFileAsStrArr("tinyG.txt");
            var intArr = Array.ConvertAll(strArr, s => int.Parse(s));
            var g      = new Graph(intArr);

            foreach (var item in g.Adj(0))
            {
                Console.WriteLine(item);
            }
            Console.WriteLine();
            var v = g.V;
            //var dfs = new DepthFirstSearch(g, 0);
            //var dfp = new DepthFirstPaths(g, 0);
            var bfp = new BreadthFirstPath(g, 0);

            foreach (var item in bfp.PathTo(5))
            {
                Console.WriteLine(item);
            }
            Console.ReadKey();
        }