There is only one way to lose if you always swop doors and that is to choose the winning door initially. There's a one in 3 chance of doing that. So the chances of winning if you swop are 2/3. If you wish to simulate the game, you only need to worry about the position of the car. Something like this.
class Program
{
private static readonly Random random = new Random();
static void Main()
{
int totalWins = 0;
int iterations = 20000;
for (int i = 0; i < iterations; i++)
{
totalWins += Play();
}
Console.WriteLine("% wins is {0:0.0%}", (double)totalWins / iterations);
Console.ReadLine();
}
public static int Play()
{
int initialChoice = random.Next(3);
int winningDoor = random.Next(3);
int openedDoor;
do
{
openedDoor = random.Next(3);
}
while (openedDoor == initialChoice || openedDoor == winningDoor);
int finalChoice = 3 - (openedDoor + initialChoice);
return finalChoice == winningDoor ? 1 : 0;
}
}