public static IShapeBoardBuilder Create(string name, int size) { RandomzingShapeBuilder builder = new RandomzingShapeBuilder(); builder.SetName(name); Random randomizer = new Random(100); for (int index = 0; index < size; index++) { if (randomizer.Next() % 3 == 0) { builder.AddCircle(new Circle { Name = $"Circle {index}" }); } else if (randomizer.Next() % 3 == 1) { builder.AddSquare(new Square { Name = $"Square {index}" }); } else { builder.AddTriangle(new Triangle { Name = $"Triangle {index}" }); } } return(builder); }
public static void Run() { Console.WriteLine("Create the 'Randomzing Demo Board'..."); //Console.WriteLine("Initializing 'Simple Demo Board' with 50 shapes..."); -- NO LONGER NECESSARY !!! IShapeBoardBuilder builder = RandomzingShapeBuilder.Create("Randomzing Demo Board", 50); ShapeBoard board = builder.GetShapeBoard(); Console.WriteLine($"Viewing shapes of '{board.Name}'..."); foreach (Shape shape in board.Shapes) { Console.WriteLine($"\tViewing shape: {shape.Name}"); } Console.WriteLine("\n\nPress <ENTER> key to continue..."); Console.ReadLine(); }