Example #1
0
 public MyModel CreateMazeLandscapeCube(int dimension, int seed,float cubeScale,RandomMaze maze)
 {
     Cube cube = new Cube();
     return new MyModel(game,
         cube.GetMazeVertexWithCube(maze.maze,cubeScale),
         "cube",1);
 }
        public void MazeGenerationTest3()
        {
            int dimension = 100;
            int dumbSmart = dimension / 10 * 3;
            int seed = 3122;

            RandomMaze maze = new RandomMaze(dimension, seed, 0.50f);

            Node destPoint1 = maze.generatePossibleDestPoint(maze.edgePoints, maze.startPoint);

            maze.GenerateMazeWithDestBranch(1, 1);
            maze.printMaze();
        }
        public void TestMethod1()
        {
            RandomMaze maze;
            maze = new RandomMaze(15, 9);
            //cube = new Cube();
            maze.GenerateMaze();

            maze.printMaze();

            maze.setStartPointAndDestPoint();

            maze.printMaze();
        }
        public MazeLandscape(LabGame game,int dimension,int seed )
        {
            this.seed = seed;
            this.dimension = dimension;
            this.game = game;
            maze = new RandomMaze(dimension, seed);
            cube = new Cube();
            maze.GenerateMaze();
            maze.setStartPointAndDestPoint();

            while (maze.destPoint == null)
            {
                game.mazeSeed=game.random.Next();
                this.seed = game.mazeSeed;
                maze = new RandomMaze(dimension, this.seed);
                //cube = new Cube();
                maze.GenerateMaze();
                maze.setStartPointAndDestPoint();
            }

            //display path.

            /*
                            List<Node> pathFromSrcToDest = maze.astar.FindPath(maze.astar.Float2DtoInt(maze.maze)
                , RandomMaze.WALL, maze.startPoint.x, maze.startPoint.y, maze.destPoint.x, maze.destPoint.y);
            */
            //maze.updateMazeRoad(pathFromSrcToDest, Project.Cube.goal);

            type = GameObjectType.MazeLandscape;
            //if maze existed before just remove it from model
            game.assets.modelDict.Remove(mazeModelName);
            myModel = game.assets.GetModel(mazeModelName, CreateMazeLandscapeModel);
            //radius = 0.5f;
            //frictionConstant = 0.4f;
            pos = new SharpDX.Vector3(0, 0, 0);
            GetParamsFromModel();
            effect = game.Content.Load<Effect>("Phong");
            Debug.WriteLine("maze created");
            entranceX = maze.startPoint.x * CUBESCALE * 2;
            entranceZ = maze.startPoint.y * CUBESCALE * 2;
            normalMaze = myModel.shapeArray;
        }
        public void MazeGenerationTest2()
        {
            int dimension = 100;
            int dumbSmart = dimension / 10 * 3;
            int seed = 3122;

            RandomMaze maze = new RandomMaze(dimension, seed, 0.50f);

            Node destPoint1 = maze.generatePossibleDestPoint(maze.edgePoints, maze.startPoint);

            Console.Write("destPoint 1 + " + destPoint1);

            //maze.updateMazeRoad(maze.generateDumbPathToDestPoint(0, 0, 1, 1));
            //maze.updateMazeRoad(maze.generateDumbPathToDestPoint(100, 100, 1, 1));
            //maze.updateMazeRoad(maze.generateDumbPathToDestPoint(5, 19, 1, 1));
            //maze.updateMazeRoad(maze.generateDumbPathToDestPoint(10, 19, 1, 1));
            //maze.updateMazeRoad(maze.generateDumbPathToDestPoint(19, 5, 1, 1));
            //maze.updateMazeRoad(maze.generateDumbPathToDestPoint(0,0, dumbSmart, dumbSmart));

            maze.GenerateMazeWithRandomPoint(50, 1, 1);
            maze.printMaze();
        }
 public void MazeTest()
 {
     AstarSearch astar = new AstarSearch();
     int dimension = 20;
     int dumbSmart = dimension / 10 * 2;
     int seed = 34534;
     List<Node> path = null;
     RandomMaze maze = new RandomMaze(dimension,seed,0.85f);
     path = maze.generateDumbPathToDestPoint(maze.destX,maze.destY,dumbSmart, dumbSmart);
     Console.WriteLine(" -- path count " + path.Count);
     maze.astar.printPath(path);
     maze.updateMazeRoad(path);
     maze.printMaze();
     Console.WriteLine("-----------------astar---------------------");
     astar.printPath(astar.FindPath(astar.Float2DtoInt(maze.maze),1,maze.startPoint.x,maze.startPoint.y,maze.destPoint.x,
         maze.destPoint.y));
 }