Lottery Simulator¶
Lottery is said to be quite popular in Finland, but how worth is it really? With some probability math one can easily point out how unlikely it is to end up net positive in lottery. Probability math is hard though, and humans are really bad at understanding probabilities. So, instead of mathing this out, we can investigate the topic with a simulator. You'll be in charge of making said simulator of course. With your very own simulator you can keep rolling the dice until you hit the jackpot for no cost - except perhaps your sanity.
Program Features¶
The following features are required from the program. Extra features are not required for the project to be accepted, but they will naturally yield bonus points.
- Setting rules of the lottery
- This feature creates the rules of the lottery. The user needs to input the following values:
- Total amount of numbers
- Amount of numbers picked each time
- Price of one lottery ticket
- How many prize tiers exist (e.g. in a lottery with 7 picked numbers and 4 tiers, the smallest prize would be gotten with 4 correct)
- The amount of prize money for each tier
- Buying lottery tickets
- This feature allows the user to buy a number of lottery tickets.
- The user can fill their tickets by themself, or they can ask the program to randomize them. When randomizing, make sure the same set of numbers isn't picked multiple times. For both cases you also need to make sure the same number isn't picked multiple times on a single ticket.
- Running the lottery once
- This feature randomizes the winning numbers, and then goes through the user's tickets, reporting whether they won anything, and how much if they did. It should also print the total amount of money won.
- Extra feature: simulating multiple weeks
- This feature performs the lottery a number of weeks, selected by the user. For each week, new set of winning numbers is randomized, and checked against each of the user's tickets. Then the total earnings and net outcome are reported for each week.
- This feature should only print summary information for each week and the final summary, not results for individual tickets.
Testing the Program¶
This program cannot quite simulate the lottery ran by Finnish Veikkaus because it lacks extra and plus number features. However, you can still get reasonable simulation results with values like:
- Amount of numbers: 40
- Selected numbers: 7
- Prize tiers: 4
- Ticket price: 1
- Prizes:
- 7 right: 1000000
- 6 right: 5000
- 5 right: 100
- 4 right: 10
Since it's rather hard to hit more than 4 right with this setup, you should also test with smaller, player friendlier numbers to make sure your program functions correctly in all situations.