marcotuliotm / tele2

Monty Hall problem

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Tele2

Monty Hall problem

The purpose of this test is to see how you design and write your code given a problem. Try to use right level of OOP. The problem is a well-known puzzle that you can read more about at http://en.wikipedia.org/wiki/Monty_Hall_problem . Save reading the link if you do not want to know the answer until you have solved the problem.

Problem description:

Assume that you are attending a TV show where you can win money by picking the right box. The game show host shows you three boxes explaining that the money is in one of the boxes. He asks you to pick one of them without opening it. After you have picked one of the boxes he opens one of the other two boxes which is empty. Now he turns to you and asks, do you want to change your mind, picking the remaining box?

Your task:

Write a readable and maintainable program in Java randomly simulating this event over and over again in the quest of answering following question. Do I stand a better chance to win if I change my mind? Maven should be used. The only assumption allowed is that three boxes exist.

Once your code is done, drop us a mail, so we can let you know how to get it to us (or upload it to github and send us the link).

Conclusion

The application simulates 1000000 matches where the player does not change doors and 1000000 where he changes. As expected, it is best to switch doors about 66.66% of the time.

Running the application

Either run this in maven using ./maven clean compile exec:java or using the run features from your IDE of choice, If you don't want to install anything on your machine you can see the execution here https://repl.it/@Marco_TulioTul2/tele2?v=1

Running the tests

Either run this in maven using ./maven clean test or using the run features from your IDE of choice.

Prerequisites

Java 11 
Maven

About

Monty Hall problem


Languages

Language:Java 100.0%