Some time ago a king needed money. So he gathered his advisors and told them to think of a new task. One of them offered to tax stupidity. The king asked one question – how. The guy came up with a lottery idea 🙂
Is this true – noone knows. Anyhow, if you want to make a calculator of the probabilities of ball games – here is one good – mine 🙂 In the three blue fields you enter how many balls are gonna be selected out of how much and how many positions do you want. As you see, if you play with 28 fully secured balls, the number of combinations is 13.9 millions and the probability to win a 6 is 0.027 (for the football players – 2.7 percent) 🙂
How does it look like with 5 of 35? Like this:
What should we note? Well, do not play these games, until you really feel lucky.
The code is in 3 files, as far as I think it is about time to start separating the code 🙂 and not writing everything in one file. After all, I am writing book reviews and this is really not a best practice 🙂 Something more about the code – never calculate factorial with recursion, especially in a production code, it is really not a good idea. But I did it! 🙂
If you are willing to see the “Tool” working, you may do it here.
As far as the code is in 3 files, I will not paste it, but I will simply provide the code in GitHub. So, here comes the code.
Enjoy it!