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 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 Rubik(int [] DATA) { List <int> list = new List <int>(); start = new Cube(DATA, 0, list); }
public string ida() { string result = ""; if (check() == false) { return("This Rubik is InCorrect"); } if (isGoal(start)) { return("this is Goal"); } int limit = 0; List <Cube> fringe = new List <Cube>(); for (int i = 1; i <= 9; i++) { if (start.getNode(i).getF() > limit) { limit = start.getNode(i).getF(); } fringe.Add(start.getNode(i)); } int nextLimit = limit + 999999999; while (true) { fringe = new List <Cube>(); for (int i = 1; i <= 9; i++) { fringe.Add(start.getNode(i)); if (isGoal(start.getNode(i))) { foreach (int m in start.getNode(i).getResult()) { result = " > " + m; } return(result); } } for (int j = 0; j < fringe.Count; j++) { Cube cube = fringe[j]; for (int i = 1; i <= 9; i++) { if (isGoal(cube)) { foreach (int m in cube.getResult()) { result = " > " + m; } return(result); } if (cube.getNode(i).getF() <= limit) { fringe.Add(cube.getNode(i)); if (isGoal(cube.getNode(i))) { foreach (int m in cube.getNode(i).getResult()) { result = " > " + m; } return(result); } } else { if (cube.getNode(i).getF() < nextLimit) { nextLimit = cube.getNode(i).getF(); } } } } limit = nextLimit; nextLimit = nextLimit + 999999999; } return("not Found"); }