private void RandomTraversal(List <Maze.Connection> connections) { while (connections.Count > 0) { Maze.Connection connection = connections.PopRandom(ref random); if (maze.IsUnconnected(connection.b)) { maze.AddConnection(connection); maze.GetPossibleConnections(connection.b, connections); } } }
private void RandomDepthFirstTraversal(List <Maze.Connection> connections) { var possibleConnections = new List <Maze.Connection>(); while (connections.Count > 0) { Maze.Connection connection = connections[connections.Count - 1]; connections.RemoveAt(connections.Count - 1); if (maze.IsUnconnected(connection.b)) { maze.AddConnection(connection); possibleConnections.Clear(); maze.GetPossibleConnections(connection.b, possibleConnections); possibleConnections.Shuffle(ref random); connections.AddRange(possibleConnections); } } }