public static void Main()
var maxGamesToRun = 10000;
var nonSwitchWinCount = 0;
var randomGenerator = new Random();
while (gameCount < maxGamesToRun)
bool[] doors = {false,false,false};
var carLocation = randomGenerator.Next(0, 3);
doors[carLocation] = true;
var playerChoice = randomGenerator.Next(0, 3);
var hostChoice = GetHostChoice(playerChoice,doors);
var switchPlayerChoice = Switch(playerChoice, hostChoice);
if (doors[switchPlayerChoice]) switchWinCount++;
if (doors[playerChoice]) nonSwitchWinCount++;
Console.WriteLine("Switch Win Average");
Console.WriteLine(switchWinCount/100);
Console.WriteLine("No Switch Win Average");
Console.WriteLine(nonSwitchWinCount/100);
public static int GetHostChoice(int playerChoice, bool[] doors)
var randomGenerator = new Random();
while (hostChoice == playerChoice || doors[hostChoice] == true)
hostChoice = randomGenerator.Next(0, 3);
public static int Switch(int playerChoice, int hostChoice)
if (playerChoice !=0 && hostChoice != 0) return 0;
if (playerChoice !=1 && hostChoice != 1) return 1;