/// <summary> /// solve the maze and save the printing of the sol /// </summary> /// <param name="type">the type of the solving</param> public void SolveMaze(int type) { if (this.solve != null | this.PrintOfSolution != null) { return; } this.solve = new SolutionMaze(new FactorySolvable().SolveTheMaze(this.theGraph, type)); this.PrintOfSolution = this.PrintSolve(); }
/// <summary> /// for copy maze /// </summary> /// <param name="old">old maze to copy</param> /// <param name="newName">the new name of the maze</param> public Maze(Maze old, string newName) { this.Name = newName; if (old.theGraph != null) { this.theGraph = new Graphs(old.theGraph); } if (old.solve != null) { this.solve = new SolutionMaze(old.solve); } this.start = old.GetStartPlace(); this.end = old.GetEndPlace(); this.PrintOfMaze = old.PrintOfMaze; this.PrintOfSolution = old.PrintOfSolution; }
/// <summary> /// crete the maze /// </summary> /// <param name="name">the naem</param> /// <param name="type">the type of the creating</param> public Maze(string name, int type) { this.solve = null; this.Name = name; int sizeMaze = this.GetSizeMaze(); Tuple <double, double> tSize = new Tuple <double, double>(sizeMaze, sizeMaze); this.theGraph = new Graphs(ref tSize); //apply the maze on the graph new FactoryMazeable().CreateTheMaze(theGraph, type); //save the printing this.PrintOfMaze = this.ToString(); this.PrintOfSolution = null; //get the end and the start of the maze this.start = this.GetPlaceCellInMatrix(this.theGraph.Begin); this.end = this.GetPlaceCellInMatrix(this.theGraph.End); }
/// <summary> /// copy c'tor /// </summary> /// <param name="sol">the other solution</param> public SolutionMaze(SolutionMaze sol) : this(sol.theSoul) { }