View Single Post
Old 02-28-2007, 10:14 PM   #18 (permalink)
FingersMcSteal
Forum Expert
 
FingersMcSteal's Avatar
 
Join Date: Mar 2006
Location: North East, England, UK
Age: 42
Posts: 1,151
Send a message via ICQ to FingersMcSteal Send a message via MSN to FingersMcSteal
Arrow

Quote:
Originally Posted by kfmafeng View Post
Discover a problem Two

1.Lottery picks 2,3,7,3,5

Your ticket... 1,1,1,1,1

Point out all matching of 5 ticket numbers.

Be able to draw the maximal bonus, Why??

2.How reduce win prize rate and the bonus?


My Server is RunUO2.0 RC1
Not sure i understand the question ?

Point out all matching of 5 ticket numbers. <<< ??? and...

Be able to draw the maximal bonus, Why?? <<< ???

Why what ?, Why you don't get the full 100% of the jackpot ? Thats because the jackpot has to be split up into 5 types on winner, the code for the split is in red and should always add up to 100 (100%) of the jackpot, it's the % of split the winers get, 5 matched gets 50% of the jackpot total, never the full amount.

The calculations had me confused at the start of the design so i'll try to explain what it's doing.

If theres NO tickets that matched say 5 numbers, the calculations are done on the basesplit... it uses 50% of the jackpot for the math.

If there are 'some' 5 number matched tickets, it divide's the 50% by the amount of matching tickets, reducing the % it calculates from in order to place the full 100% of the jackpot amount to the stone depending on how many of that type (5 numbers matched) won. Confused... so am i again

This is the formula for the calculations...

Jackpot = Price Per Ticket X Ticket Sales
1% = Jackpot / 100
5 matched win = 1% X 50% (basesplit) or 1/2 the jackpot
4 matched win = 1% X 20% (basesplit) or 1/5th the jackpot
3 matched win = 1% X 15% (basesplit) or 15% of the jackpot ( 1/6-ish maybe 1/7th-sh... FingersMcSteal math here )
2 matched win = 1% X 10% (basesplit) or 1/10th of jackpot
1 matched win = 1% X 5% (basesplit) or 1/20th of the jackpot

so 100% of the jackpot gets spread over the 5 win types.

At draw time if theres no 5 matched the code does this...
tempwin5 = Jackpot Total - (( 1% X basesplit5 ) X tickets with 5 matched, broken down is like this...

tempwin5 = 1% X 50% X how many tickets that matched = 1/2 jackpot
or...
x = 1 X 50 = 50 X 0 = 0... so x = 0... or no gold give to tempwin5 because no one matched 5 numbers

At draw time if 2 had 5 matched the code does this...
winnersplit5 = 50% divided by the number of 5 matched tickets (2) = 25%
then...

tempwin5 = Jackpot Total - (( 1% X 25% ) X tickets with 5 matced (2) = 50%

x = 1 X 25 = 25 X 2 = 50... so x = 50%... or 50% of the jackpot is the 5 matched numebr win amount, because it divided the 50% split % by the amount of tickets that had a match.

It basically reduces the split % by the amount of matching tickets to ensure it pays out the correct amounts to each win type, or in simple terms... makes sure it doesn't create more money than is taken (like the original version did...lol).

The stone works like a gold sink also, unless theres a match in all types not all of the winnings goes back into circulation because it's got to be split for all the types of win in order to get the right amounts to put to the stone.

Your question 2 would probably involve this code...

Code:
                        // Calculate each tickets win value
                        int basesplit5 = 50;
                        int basesplit4 = 20;
                        int basesplit3 = 15;
                        int basesplit2 = 10;
                        int basesplit1 = 5;
                        int tempwin5 = 0;
                        int tempwin4 = 0;
                        int tempwin3 = 0;
                        int tempwin2 = 0;
                        int tempwin1 = 0;

                        int JackpotTotalGold = thislotteryjackpot + thisrolloveramount;
                        int onepercent = JackpotTotalGold / 100;

                        if (fivenumberwinners > 0)
                        {
                            double winnersplit5 = basesplit5 / (double) fivenumberwinners;
                            tempwin5 = JackpotTotalGold - ((onepercent * ((int)(winnersplit5 * 100 )) ) * fivenumberwinners);
                        }
                        else
                        {
                            tempwin5 = JackpotTotalGold - ((onepercent * basesplit5) * fivenumberwinners);
                        }

                        if (fournumberwinners > 0)
                        {
                            double winnersplit4 = basesplit4 / (double) fournumberwinners;
                            tempwin4 = tempwin5 - ((onepercent * ((int)(winnersplit4 * 100 )) ) * fournumberwinners);
                        }
                        else
                        {
                            tempwin4 = tempwin5 - ((onepercent * basesplit4) * fournumberwinners);
                        }

                        if (threenumberwinners > 0)
                        {
                            double winnersplit3 = basesplit3 / (double) threenumberwinners;
                            tempwin3 = tempwin4 - ((onepercent * ((int)(winnersplit3 * 100 )) ) * threenumberwinners);
                        }
                        else
                        {
                            tempwin3 = tempwin4 - ((onepercent * basesplit3) * threenumberwinners);
                        }

                        if (twonumberwinners > 0)
                        {
                            double winnersplit2 = basesplit2 / (double) twonumberwinners;
                            tempwin2 = tempwin3 - ((onepercent * ((int)(winnersplit2 * 100 )) ) * twonumberwinners);
                        }
                        else
                        {
                            tempwin2 = tempwin3 - ((onepercent * basesplit2) * twonumberwinners);
                        }

                        if (onenumberwinners > 0)
                        {
                            double winnersplit1 = basesplit1 / (double) onenumberwinners;
                            tempwin1 = tempwin2 - ((onepercent * ((int)(winnersplit1 * 100 )) ) * onenumberwinners);
                        }
                        else
                        {
                            tempwin1 = tempwin2 - ((onepercent * basesplit1) * onenumberwinners);
                        }

                        // Amount to give to the winners stored on stone
                        // Needs to have division of 100 later at payout
                        thislotterystone.WinAmount5 = JackpotTotalGold - tempwin5;
                        thislotterystone.WinAmount4 = tempwin5 - tempwin4;
                        thislotterystone.WinAmount3 = tempwin4 - tempwin3;
                        thislotterystone.WinAmount2 = tempwin3 - tempwin2;
                        thislotterystone.WinAmount1 = tempwin2 - tempwin1;
although i'm not sure what you want to do with it ???

The code below that part puts the win amounts onto the tickets so you could make adjustments there i guess depending on what you wanted.

P.S. Ask me some easy stargate questions next time... i hate maths

Last edited by FingersMcSteal; 02-28-2007 at 10:16 PM.
FingersMcSteal is offline   Reply With Quote