public void startProgram() { _2DMaze <int> maze = new _2DMaze <int>(5, 5); GeneralMaze <int> Cm = new GeneralMaze <int>(maze); Cm.Generate("mazushshsh", 1); Cm.Solve(0); maze.Print(); }
public _2DMaze(_2DMaze <T> maze) { this.height = maze.GetHeight(); this.width = maze.GetWidth(); Start = new JPosition(maze.End.Row, maze.End.Col); End = new JPosition(maze.Start.Row, maze.Start.Col); for (int i = 0; i < this.height; i++) { for (int j = 0; j < this.width; j++) { this.grid2D[i, j] = new Node <T>(i, j, maze.GetValue(i, j)); } } }
/// <summary> /// Creates a second maze for the Second player /// that has joined the game </summary> public void CreateSecondMaze() { Node <int>[,] grid = mazePlayer1.GetGrid(); Node <int> start = mazePlayer1.GetStartPoint(); Node <int> end = mazePlayer1.GetEndPoint(); _2DMaze <int> twoDMaze = new _2DMaze <int>(); twoDMaze.height = mazePlayer1.GetHeight(); twoDMaze.width = mazePlayer1.GetWidth(); twoDMaze.CopyGrid(grid); //Switches around the starting and ending cell in the Second Maze twoDMaze.SetStartingCell(end.GetRow(), end.GetCol()); twoDMaze.SetEndingCell(start.GetRow(), start.GetCol()); this.mazePlayer2 = new GeneralMaze <int>(twoDMaze); this.mazePlayer2.MakeMazeString(); this.mazePlayer2.UpdateMembers(); this.mazePlayer2.Name = this.mazePlayer1.Name + "_2"; }
/// <summary> /// This is the constructor Method /// </summary> /// <param name="maze">Gets a new 2D maze</param> public GeneralMaze(_2DMaze <T> maze) { this.maze = maze; }