static void Main(string[] args) { Menu menu = new Menu("Simulation"); menu.AddChoice("3 Doors", new ThreeDoorsSimulator()); menu.ChoiceMade += (ignored, choice) => { ISimulator simulator = (ISimulator)choice; simulator.SolicitValues(); //todo: improve the weird cross-dependency here simulator.Simulate(); //todo: possibly make simulator not know about console }; menu.Execute(); }
static void Main(string[] args) { Menu mainMenu = new Menu("Test Type"); mainMenu.AddChoice("Multiplication Table", new Configuration(Operation.Multiplication, Constraints.LastDigitCycle, 1, 1, false, 100)); mainMenu.AddChoice("Addition Table", new Configuration(Operation.Addition, Constraints.LastDigitCycle, 1, 1, false, 100)); mainMenu.AddChoice("Subtraction Table", new Configuration(Operation.Subtraction, Constraints.LastDigitCycle, 1, 1, false, 100)); mainMenu.AddChoice("Addition", new Configuration(Operation.Addition)); mainMenu.AddChoice("Subtraction", new Configuration(Operation.Subtraction)); mainMenu.AddChoice("Multiplication", new Configuration(Operation.Multiplication)); mainMenu.AddChoice("Multiplication by 11", new Configuration(Operation.Multiplication, Constraints.SecondNumberIsEleven, null, 2)); mainMenu.AddChoice("Multiplication of same first digit and second adding to 10", new Configuration(Operation.Multiplication, Constraints.LastDigitsAddTo10 | Constraints.FirstDigitIsSame, 2, 2)); mainMenu.AddChoice("Square", new Configuration(Operation.Square, Constraints.None, null, 1, true)); mainMenu.AddChoice("Cube", new Configuration(Operation.Cube, Constraints.None, null, 1, true)); mainMenu.AddChoice("Day of the week on New Year's Day in the 2000s", new Configuration(Operation.DayOfWeek, Constraints.None, 1, 1, true)); mainMenu.ChoiceMade += processChoice; mainMenu.Execute(); }