Monty Hall Simulator

CIS220 Sample code that implements a Monty Hall simulator to demonstrate probability theory and statistical analysis

📅 December 2019💻 Java
JavaGradleStatisticsProbability TheorySimulationNetBeansTestingMathematics
javastatisticsprobabilitysimulationmathematicseducationgradletesting

Sample code written for CIS220, and an old favourite argument: in the Monty Hall problem, does switching doors actually help?

The counterintuitive answer — sticking wins a third of the time, switching wins two-thirds — reliably splits a room. The simulator settles it the way engineers should settle such things: run the game ten thousand times under each strategy and look at the numbers. Watching the switch strategy converge on 66.7% is more persuasive than any amount of probability notation, though the notation is in the README too for the sceptics.

It is a plain Java project built with Gradle, kept deliberately simple because the point is the idea, not the code. The lesson underneath it — when intuition and arithmetic disagree, simulate — is one of the more useful habits a programming student can pick up.