private void GeneratePlayground(ref Playground pPlayground) { pPlayground.ResetPlayground(); var rnd = new Random(); foreach (var cell in pPlayground.PlaygroundCells) { if (rnd.NextDouble() < (float)numeric_probability.Value) { switch (rnd.Next(Enum.GetNames(typeof(Shapes.ShapesType)).Length)) { case (int)Shapes.ShapesType.BEACON: Shapes.SetBeaconTo(cell.PositionX, cell.PositionY, pPlayground); break; case (int)Shapes.ShapesType.BEEHIVE: Shapes.SetBeehiveTo(cell.PositionX, cell.PositionY, pPlayground); break; case (int)Shapes.ShapesType.BLINKER: Shapes.SetBlinkerTo(cell.PositionX, cell.PositionY, pPlayground); break; case (int)Shapes.ShapesType.BLOCK: Shapes.SetBlockTo(cell.PositionX, cell.PositionY, pPlayground); break; case (int)Shapes.ShapesType.BOAT: Shapes.SetBoatTo(cell.PositionX, cell.PositionY, pPlayground); break; case (int)Shapes.ShapesType.GLIDER: Shapes.SetGliderTo(cell.PositionX, cell.PositionY, pPlayground); break; case (int)Shapes.ShapesType.LOAF: Shapes.SetLoafTo(cell.PositionX, cell.PositionY, pPlayground); break; case (int)Shapes.ShapesType.PULSAR: Shapes.SetPulsarTo(cell.PositionX, cell.PositionY, pPlayground); break; } } } }