Lottery prize distribution

190 Views Asked by At

Assume a lottery game of the following rules:

General conditions

  • Each ticket has 6 numbers each can go from 0 to 15 (16 numbers in total)
  • Prize pool increases every week if jackpot is not hit / prizes don't exhaust the prize pool.
  • Total prizes cannot be more than the prize pool
  • Prizes start for more than 2 hits. 0, 1 hit = 0$, should be lower or higher depending of the other hits.

This is an iteration of this lotto https://docs.glowyield.com/glow-yield/glow-dapps/glow-lotto/prize-details#expected-prize-calculation. But they are assuming the profits of a ticket rather than working with a fixed pool.

Problem

I just can't figure out an algorithm for it. I want to give something to people that hit 2 numbers but I don't want to exhaust the prize pool. Also if someone hits the jackpot it should give the max prize considering all the other winners too.

Examples

Consider the following example, there is a pool of 100\$ prize and there was one ticket with 2 hits so I should be giving to that person something like 1.20\$.

Now on another example. For the same pool there was 4 winning tickets, 3 with 2 hits and 1 jackpot, then it should max out the jackpot but still give people with 2 hits some too, maybe a minimum would be 1\$. So that would take us to 97\$ to the winner and 1\$ for the others.

Obviously this is being very naive, I do like what they did with their example calculating a pow to every consecutive number, but I would like for that to impact the max pool and SHOULD NOT go over it.

[EDIT] Downvotes -- Please, instead of downvoting can you please comment or ask what else you expect from me to further clarify my post? I'm trying my best to explain this case. I've searched on google and here on mathematics but couldn't find anything related to my case. Did find some other topics close to my question but not really the same and was unable to understand/adapt to my case scenario. Thank you!