//Reset Hunt and kill algorithm public void ResetHuntAndKill(MazeCell[,] grid, MazeBuilder mazeBuilder, int rows, int columns) { scanComplete = false; currentColumn = 0; currentRow = 0; this.grid = grid; this.mazeBuilder = mazeBuilder; this.rows = rows; this.columns = columns; grid[currentRow, currentColumn].visited = true; utilities = new AlgorithmUtilities(rows, columns, grid); }
// Reset parameters public void ResetRecursiveBacktracking(MazeCell[,] grid, MazeBuilder mazeBuilder, int rows, int columns) { this.rows = rows; this.columns = columns; this.mazeBuilder = mazeBuilder; this.grid = grid; currentColumn = 0; currentRow = 0; cellsStack = new Stack <MazeCell>(); cellsStack.Push(grid[currentRow, currentColumn]); grid[currentRow, currentColumn].visited = true; utilities = new AlgorithmUtilities(rows, columns, grid); }
/// <summary> /// Parses a string to any of the known algorithms. /// </summary> /// <param name="value">String representation of the algorith</param> /// <param name="field">Name of the field</param> /// <returns>The Algorithm parsed from the string</returns> /// <exception cref="CsvFileFormatException">Is thrown if the string does not match any known algorithm</exception> public string ParseAlgorithmToString(string value, string field) { return(!AlgorithmUtilities.TryParseToString(value, out string?algorithm) ? throw new CsvFileFormatException($"The {field} \"{value}\" is not a valid algorithm name.", File, Line) : algorithm !); }