// Violation of SRP? public static Board CreateEmptyBoard(int w, int h) { Board b = new Board(w, h); for (int x = 0; x < b.Size.Width; x++) for (int y = 0; y < b.Size.Height; y++) b._data[x,y]=(Tile)new EmptyTile(); return b; }
// candidate for strategy pattern public void Generate(Board target) { for (int x = 0; x < target.Size.Width; x++) { for (int y = 0; y < target.Size.Height; y++) { Tile z=null; switch ((TileTypes)_random.Next((int)TileTypes.Normal, (int)TileTypes.Special)) { case TileTypes.Normal: z = (Tile)new NormalTile(); break; case TileTypes.Special: z=(Tile)new SpecialTile(); break; } target.SetDataAt(x,y, z); } } }