/// <summary> /// Create a copy of the tags. /// </summary> public CellTag[] GetTags() { var copy = new CellTag[tags.Length]; for (int i = 0; i < tags.Length; i++) { // Metadata is a mutable class, so if we return tags.ToArray(), // we'll get copies of the celltags, but they'll refer to the same // mutable metadata. copy[i] = tags[i].DeepCopy(); } return(copy); }
public override Maze GetMaze() { Random random = new Random(seed); int[,] weights = BuildRandomWeights(random, gridLength, gridWidth, gridWeights); List <Coord> path = BuildInitialPath(random, weights, cellCount); Coord start = path[0]; Coord end = path[path.Count - 1]; List <MazeLink> links = Enumerable.Range(0, path.Count - 1) .Select(i => new MazeLink(path[i], path[i + 1])) .ToList(); ExpandPath(path, links, random, cellCount, extraLinkProportion); var cellInfo = new CellTag[] { new CellTag(start, new MetaData(entranceCell)), new CellTag(end, new MetaData(exitCell)) }; Maze maze = new Maze(path, links, cellInfo); return(maze); }
CellTag Flip(CellTag tag) { return(new CellTag(Flip(tag.Cell), tag.MetaData)); }
CellTag RotateCW(CellTag tag, int xMax) { return(new CellTag(RotateCW(tag.Cell, xMax), tag.MetaData)); }