public static void DoorTest1() { string consoleOutput; DoorOption doorOption = new DoorOption(); DoorTest doorTest = new DoorTest(); do { consoleOutput = doorTest.getRespone(doorOption); // Put the prize in the door Random rnd = new Random(); int month = rnd.Next(1, 3); doorOption.PrizeIn = month; switch (consoleOutput) { case "1": doorTest.callDoor(doorOption, 1); break; case "2": doorTest.callDoor(doorOption, 2); break; } } while (consoleOutput != "Q" && consoleOutput != "q"); }
string getRespone(DoorOption _doorOption) { string myChoice; Console.WriteLine("Please pick a door\n\n"); Console.WriteLine("YOu have Win {0} and Lost {1}", _doorOption.Win, _doorOption.Loss); Console.WriteLine("1) Door A"); Console.WriteLine("2) Door B"); Console.WriteLine(); Console.WriteLine("Q) to quit"); Console.WriteLine(); myChoice = Console.ReadLine(); Console.WriteLine(); return myChoice; }
void callDoor(DoorOption _doorOption, int _doorSelected) { Console.WriteLine("You picked door {0}", _doorSelected); if (_doorSelected == _doorOption.PrizeIn) { Console.WriteLine("You got a prize!"); _doorOption.Win += 1; } else { Console.WriteLine("Sorry try again"); _doorOption.Loss += 1; } Console.WriteLine(); Console.WriteLine(); }