Solving TV Game Shows with Java
OK so it’s a rather grandiose title, but this site describes one of those brainteasers that is tricky to get your head around logically, but pretty simple empirically.
Here is a ‘quick and dirty’ program I wrote to demonstrate that indeed, your chances are doubled if you change from your first choice!
Output:
Without swapping doors:
After 1000000 runs, the prize was won 333686 times.
With swapping doors:
After 1000000 runs, the prize was won 666606 times.
Here is the code.