Quote:
Originally Posted by Damien
Monty Hall Problem:
|
Interesting code: made me think .... always a good thing.
Liked your shortcut for resetting the list.
However, i dont think the code works the way it should for the case when the contestant changes their choice.
Quote:
Originally Posted by Damien
Code:
{
doors.Remove(GOAT);
if (doors[random.Next(2)] == CAR) //Did they get the car
DidChangeSuccessRate++;
doors.Add(GOAT);
}
|
You seem to be removing the first door you come across with a Goat behind it (which may even be the contestant's chosen door) and then choosing at random from the 2 remaining doors, rather than swapping to the unchosen door.
I suspect this will give results of 33% and 50% in your output which is not the correct answer.