Script to divide

Discussion in 'ASP General' started by Jeff, Dec 6, 2005.

  1. Jeff

    Jeff Guest

    Ok gang. Here is what I have. I am using asp with Access DB on a microsoft
    server.

    I don't know if a premade script exists out there, but I couldn't find it.
    I am looking for a script to use for my golf team. We have In-House Tourneys
    that we play, and I want to show earnings won for the tourney, kind of like
    the PGA golf does. What this script would have to do, is see how many
    players finished the tourney, and divide the total (which would be
    $1,000,000 cyberbucks) per event. I would need it to give first the most,
    second less, and so on. But the thing that I am unable to do, is determine
    the breakdown with different amount of finishers.

    If 4 finished all the time, the formula would be easy, but sometimes there
    are as many as 20 that finish.

    Does this make sense? If someone wants to email me about this they can. It
    is kind of hard to describe what I need. --- (take out
    the -- on both ends) is my email.
    Thanks
    Bam
    Jeff, Dec 6, 2005
    #1
    1. Advertising

  2. Jeff

    Larry Bud Guest

    > the PGA golf does. What this script would have to do, is see how many
    > players finished the tourney, and divide the total (which would be
    > $1,000,000 cyberbucks) per event. I would need it to give first the most,
    > second less, and so on. But the thing that I am unable to do, is determine
    > the breakdown with different amount of finishers.
    >
    > If 4 finished all the time, the formula would be easy, but sometimes there
    > are as many as 20 that finish.


    This really isn't an ASP question, but I'll give it a go.

    It really depends on how you want to divide the pot up. Do you want to
    give the winner half the pot, 1/3 of the pot, 1/4 of the pot??

    You would always go in halves, no matter how many people are "in the
    money".

    Winner gets 1/2, 2nd place gets half of what's left (so really, 1/4),
    3rd place gets have of what's left after that, (1/8), etc. The last
    guy gets whatever is remaining.

    If two or more people tie, those places that they finished have the
    money averaged out for those places.
    Larry Bud, Dec 6, 2005
    #2
    1. Advertising

  3. Jeff wrote:
    > Ok gang. Here is what I have. I am using asp with Access DB on a
    > microsoft server.
    >
    > I don't know if a premade script exists out there, but I couldn't
    > find it. I am looking for a script to use for my golf team. We have
    > In-House Tourneys that we play, and I want to show earnings won for
    > the tourney, kind of like the PGA golf does. What this script would
    > have to do, is see how many players finished the tourney, and divide
    > the total (which would be $1,000,000 cyberbucks) per event. I would
    > need it to give first the most, second less, and so on. But the thing
    > that I am unable to do, is determine the breakdown with different
    > amount of finishers.
    >
    > If 4 finished all the time, the formula would be easy, but sometimes
    > there are as many as 20 that finish.
    >
    > Does this make sense? If someone wants to email me about this they
    > can. It is kind of hard to describe what I need.
    > --- (take out the -- on both ends) is my email.
    > Thanks
    > Bam

    We don't do email support. What you need to do is describe the structures of
    the relevant tables (datatypes, fieldnames - only show the relevant fields),
    show us some sample data in tabular format, and show us the results you wish
    to retrieve from that sample data - also in tabular format.

    Bob Barrows
    --
    Microsoft MVP -- ASP/ASP.NET
    Please reply to the newsgroup. The email account listed in my From
    header is my spam trap, so I don't check it very often. You will get a
    quicker response by posting to the newsgroup.
    Bob Barrows [MVP], Dec 6, 2005
    #3
  4. Jeff

    Evertjan. Guest

    Jeff wrote on 06 dec 2005 in microsoft.public.inetserver.asp.general:

    > Ok gang. Here is what I have. I am using asp with Access DB on a
    > microsoft server.
    >
    > I don't know if a premade script exists out there, but I couldn't find
    > it. I am looking for a script to use for my golf team. We have
    > In-House Tourneys that we play, and I want to show earnings won for
    > the tourney, kind of like the PGA golf does. What this script would
    > have to do, is see how many players finished the tourney, and divide
    > the total (which would be $1,000,000 cyberbucks) per event. I would
    > need it to give first the most, second less, and so on. But the thing
    > that I am unable to do, is determine the breakdown with different
    > amount of finishers.
    >
    > If 4 finished all the time, the formula would be easy, but sometimes
    > there are as many as 20 that finish.
    >
    > Does this make sense? If someone wants to email me about this they
    > can. It is kind of hard to describe what I need.
    > --- (take out the -- on both ends) is my email.


    For that amount of money,
    you could easily spend 1% for a professional programmer?

    --
    Evertjan.
    The Netherlands.
    (Replace all crosses with dots in my emailaddress)
    Evertjan., Dec 6, 2005
    #4
  5. Jeff

    Larry Bud Guest

    Evertjan. wrote:
    > Jeff wrote on 06 dec 2005 in microsoft.public.inetserver.asp.general:
    >
    > > Ok gang. Here is what I have. I am using asp with Access DB on a
    > > microsoft server.
    > >
    > > I don't know if a premade script exists out there, but I couldn't find
    > > it. I am looking for a script to use for my golf team. We have
    > > In-House Tourneys that we play, and I want to show earnings won for
    > > the tourney, kind of like the PGA golf does. What this script would
    > > have to do, is see how many players finished the tourney, and divide
    > > the total (which would be $1,000,000 cyberbucks) per event. I would
    > > need it to give first the most, second less, and so on. But the thing
    > > that I am unable to do, is determine the breakdown with different
    > > amount of finishers.
    > >
    > > If 4 finished all the time, the formula would be easy, but sometimes
    > > there are as many as 20 that finish.
    > >
    > > Does this make sense? If someone wants to email me about this they
    > > can. It is kind of hard to describe what I need.
    > > --- (take out the -- on both ends) is my email.

    >
    > For that amount of money,
    > you could easily spend 1% for a professional programmer?


    They're "cyberbucks", not greenbacks!
    Larry Bud, Dec 6, 2005
    #5
  6. Jeff

    Larry Bud Guest

    Jeff wrote:
    > Ok gang. Here is what I have. I am using asp with Access DB on a microsoft
    > server.
    >
    > I don't know if a premade script exists out there, but I couldn't find it.
    > I am looking for a script to use for my golf team. We have In-House Tourneys
    > that we play, and I want to show earnings won for the tourney, kind of like
    > the PGA golf does. What this script would have to do, is see how many
    > players finished the tourney, and divide the total (which would be
    > $1,000,000 cyberbucks) per event.


    Here's some code I whipped up that you can adapt for database use.

    Note the line:
    place_pot=int(ra*2/3)
    You can change the ratio to suit your needs, but 2/3 seems to be pretty
    fair.

    <%
    num_players=request.form("num_players")
    total_pot=request.form("total_pot")
    %> <html>

    <head>
    <meta http-equiv="Content-Language" content="en-us">
    <meta http-equiv="Content-Type" content="text/html;
    charset=windows-1252">
    <title>Purse</title>
    <meta name="Microsoft Theme" content="tacnet-blue 110, default">
    </head>

    <body>

    <%if num_players="" then%>
    <form method="POST" action="--WEBBOT-SELF--" name="theform1">
    <p># of players: <input type="text" name="num_players" size="20"></p>
    <p>Total pot: <input type="text" name="total_pot" size="20">
    <input type="submit" value="Submit" name="B1"></p>
    </form>
    <%else%>
    <table cellspacing="0" cellpadding="3">
    <tr>
    <td><b>Place</b></td>
    <td><b>Player</b></td>
    <td><b>Amount</b></td>
    </tr>
    <%
    ra=total_pot
    for i=1 to num_players-1
    place_pot=int(ra*2/3)
    ra=ra-place_pot
    %>
    <tr>
    <td><%=i%></td>
    <td><%=chr(i+64)%></td>
    <td align="right"><%=place_pot%></td>
    </tr>
    <%next%>
    <tr>
    <td><%=i%></td>
    <td><%=chr(i+64)%></td>
    <td align="right"><%=ra%></td>
    </tr>
    </table>
    <%end if%>

    </body>

    </html>
    Larry Bud, Dec 6, 2005
    #6
  7. Jeff

    Evertjan. Guest

    Larry Bud wrote on 06 dec 2005 in microsoft.public.inetserver.asp.general:

    > They're "cyberbucks", not greenbacks!


    Euros will do. ;-}

    --
    Evertjan.
    The Netherlands.
    (Replace all crosses with dots in my emailaddress)
    Evertjan., Dec 6, 2005
    #7
  8. Jeff

    Jeff Guest

    Sorry Bob, I just didn't want to clutter up things here.


    "Bob Barrows [MVP]" <> wrote in message
    news:eri5fGn%...
    > Jeff wrote:
    >> Ok gang. Here is what I have. I am using asp with Access DB on a
    >> microsoft server.
    >>
    >> I don't know if a premade script exists out there, but I couldn't
    >> find it. I am looking for a script to use for my golf team. We have
    >> In-House Tourneys that we play, and I want to show earnings won for
    >> the tourney, kind of like the PGA golf does. What this script would
    >> have to do, is see how many players finished the tourney, and divide
    >> the total (which would be $1,000,000 cyberbucks) per event. I would
    >> need it to give first the most, second less, and so on. But the thing
    >> that I am unable to do, is determine the breakdown with different
    >> amount of finishers.
    >>
    >> If 4 finished all the time, the formula would be easy, but sometimes
    >> there are as many as 20 that finish.
    >>
    >> Does this make sense? If someone wants to email me about this they
    >> can. It is kind of hard to describe what I need.
    >> --- (take out the -- on both ends) is my email.
    >> Thanks
    >> Bam

    > We don't do email support. What you need to do is describe the structures
    > of
    > the relevant tables (datatypes, fieldnames - only show the relevant
    > fields),
    > show us some sample data in tabular format, and show us the results you
    > wish
    > to retrieve from that sample data - also in tabular format.
    >
    > Bob Barrows
    > --
    > Microsoft MVP -- ASP/ASP.NET
    > Please reply to the newsgroup. The email account listed in my From
    > header is my spam trap, so I don't check it very often. You will get a
    > quicker response by posting to the newsgroup.
    >
    >
    Jeff, Dec 6, 2005
    #8
  9. Jeff

    Jeff Guest

    LOL. Surely I wouldn't actually PAY that amount. And yes, I will stop
    calling you shirley.

    Anyway, thanks Larry, this gives me a great starting point to go by.
    Bam

    "Larry Bud" <> wrote in message
    news:...
    >
    > Jeff wrote:
    >> Ok gang. Here is what I have. I am using asp with Access DB on a
    >> microsoft
    >> server.
    >>
    >> I don't know if a premade script exists out there, but I couldn't find
    >> it.
    >> I am looking for a script to use for my golf team. We have In-House
    >> Tourneys
    >> that we play, and I want to show earnings won for the tourney, kind of
    >> like
    >> the PGA golf does. What this script would have to do, is see how many
    >> players finished the tourney, and divide the total (which would be
    >> $1,000,000 cyberbucks) per event.

    >
    > Here's some code I whipped up that you can adapt for database use.
    >
    > Note the line:
    > place_pot=int(ra*2/3)
    > You can change the ratio to suit your needs, but 2/3 seems to be pretty
    > fair.
    >
    > <%
    > num_players=request.form("num_players")
    > total_pot=request.form("total_pot")
    > %> <html>
    >
    > <head>
    > <meta http-equiv="Content-Language" content="en-us">
    > <meta http-equiv="Content-Type" content="text/html;
    > charset=windows-1252">
    > <title>Purse</title>
    > <meta name="Microsoft Theme" content="tacnet-blue 110, default">
    > </head>
    >
    > <body>
    >
    > <%if num_players="" then%>
    > <form method="POST" action="--WEBBOT-SELF--" name="theform1">
    > <p># of players: <input type="text" name="num_players" size="20"></p>
    > <p>Total pot: <input type="text" name="total_pot" size="20">
    > <input type="submit" value="Submit" name="B1"></p>
    > </form>
    > <%else%>
    > <table cellspacing="0" cellpadding="3">
    > <tr>
    > <td><b>Place</b></td>
    > <td><b>Player</b></td>
    > <td><b>Amount</b></td>
    > </tr>
    > <%
    > ra=total_pot
    > for i=1 to num_players-1
    > place_pot=int(ra*2/3)
    > ra=ra-place_pot
    > %>
    > <tr>
    > <td><%=i%></td>
    > <td><%=chr(i+64)%></td>
    > <td align="right"><%=place_pot%></td>
    > </tr>
    > <%next%>
    > <tr>
    > <td><%=i%></td>
    > <td><%=chr(i+64)%></td>
    > <td align="right"><%=ra%></td>
    > </tr>
    > </table>
    > <%end if%>
    >
    > </body>
    >
    > </html>
    >
    Jeff, Dec 6, 2005
    #9
  10. Jeff

    Jeff Guest

    Ok. I am using 2/5, which is 40%. However, the last place person keeps
    coming up with more than next to last. Test it here:
    http://www.gig-golf.com/purse.asp
    Is weird
    I guess maybe it is giving the remaining amount to the guy in last place?


    "Larry Bud" <> wrote in message
    news:...
    >
    > Jeff wrote:
    >> Ok gang. Here is what I have. I am using asp with Access DB on a
    >> microsoft
    >> server.
    >>
    >> I don't know if a premade script exists out there, but I couldn't find
    >> it.
    >> I am looking for a script to use for my golf team. We have In-House
    >> Tourneys
    >> that we play, and I want to show earnings won for the tourney, kind of
    >> like
    >> the PGA golf does. What this script would have to do, is see how many
    >> players finished the tourney, and divide the total (which would be
    >> $1,000,000 cyberbucks) per event.

    >
    > Here's some code I whipped up that you can adapt for database use.
    >
    > Note the line:
    > place_pot=int(ra*2/3)
    > You can change the ratio to suit your needs, but 2/3 seems to be pretty
    > fair.
    >
    > <%
    > num_players=request.form("num_players")
    > total_pot=request.form("total_pot")
    > %> <html>
    >
    > <head>
    > <meta http-equiv="Content-Language" content="en-us">
    > <meta http-equiv="Content-Type" content="text/html;
    > charset=windows-1252">
    > <title>Purse</title>
    > <meta name="Microsoft Theme" content="tacnet-blue 110, default">
    > </head>
    >
    > <body>
    >
    > <%if num_players="" then%>
    > <form method="POST" action="--WEBBOT-SELF--" name="theform1">
    > <p># of players: <input type="text" name="num_players" size="20"></p>
    > <p>Total pot: <input type="text" name="total_pot" size="20">
    > <input type="submit" value="Submit" name="B1"></p>
    > </form>
    > <%else%>
    > <table cellspacing="0" cellpadding="3">
    > <tr>
    > <td><b>Place</b></td>
    > <td><b>Player</b></td>
    > <td><b>Amount</b></td>
    > </tr>
    > <%
    > ra=total_pot
    > for i=1 to num_players-1
    > place_pot=int(ra*2/3)
    > ra=ra-place_pot
    > %>
    > <tr>
    > <td><%=i%></td>
    > <td><%=chr(i+64)%></td>
    > <td align="right"><%=place_pot%></td>
    > </tr>
    > <%next%>
    > <tr>
    > <td><%=i%></td>
    > <td><%=chr(i+64)%></td>
    > <td align="right"><%=ra%></td>
    > </tr>
    > </table>
    > <%end if%>
    >
    > </body>
    >
    > </html>
    >
    Jeff, Dec 6, 2005
    #10
  11. Jeff

    Larry Bud Guest

    Jeff wrote:
    > Ok. I am using 2/5, which is 40%. However, the last place person keeps
    > coming up with more than next to last. Test it here:
    > http://www.gig-golf.com/purse.asp
    > Is weird
    > I guess maybe it is giving the remaining amount to the guy in last place?


    Right, that's what it's doing.

    Anything less than 1/2 ratio will give the last place guy more than the
    2nd to last.

    I suppose you could do it differently. For example, let's say there
    are 10 "in the money "places.

    1+2+3...+10=55

    For easy math, lets say the pot is 1000

    1000/55=18.181818. Call this finalplace

    Take the place # of places+1-finish place * final place

    1st=$182
    2nd=$164
    3rd=$145
    4th=127

    etc.

    You need to decide how you want the money divided up in the first
    place, then develop a formula based on that. I've never studied the
    PGA money THAT closely to see if they have a set formula, but it could
    be a tournament by tournament decision. It certainly is for non-pga
    events such as the Masters or the US Open.
    Larry Bud, Dec 6, 2005
    #11
  12. Jeff

    Larry Bud Guest

    Jeff wrote:
    > Ok. I am using 2/5, which is 40%. However, the last place person keeps
    > coming up with more than next to last. Test it here:
    > http://www.gig-golf.com/purse.asp
    > Is weird
    > I guess maybe it is giving the remaining amount to the guy in last place?


    You know what you could also do, is keep the ratio going all the way
    through last place, then whatever is left over, give it to the first
    place guy, or spread it equally to all the other players.

    Like this:

    <%
    num_players=request.form("num_players")
    total_pot=request.form("total_pot")
    %>
    <html>

    <head>
    <meta http-equiv="Content-Language" content="en-us">
    <meta http-equiv="Content-Type" content="text/html;
    charset=windows-1252">
    <title>New Page 1</title>
    <meta name="Microsoft Theme" content="tacnet-blue 110, default">
    </head>

    <body>
    <%if num_players="" then%>
    <form method="POST" action="--WEBBOT-SELF--" name="theform1">
    <p># of players: <input type="text" name="num_players" size="20"></p>
    <p>Total pot: <input type="text" name="total_pot" size="20">
    <input type="submit" value="Submit" name="B1"></p>
    </form>
    <%else%>
    <table cellspacing="0" cellpadding="3">
    <tr><td><b>Place</b></td><td><b>Player</b></td><td><b>Amount</b></td></tr>
    <%
    ra=total_pot
    for i=1 to num_players
    place_pot=int(ra*2/5)
    ra=ra-place_pot
    %>
    <tr><td><%=i%></td><td><%=chr(i+64)%></td><td
    align="right"><%=place_pot%></td></tr>

    <%next%>

    </table>
    Amount left over: <%=ra%>
    <%end if%>

    </body>

    </html>
    Larry Bud, Dec 6, 2005
    #12
  13. Jeff

    Larry Bud Guest

    Jeff wrote:
    > LOL. Surely I wouldn't actually PAY that amount. And yes, I will stop
    > calling you shirley.
    >
    > Anyway, thanks Larry, this gives me a great starting point to go by.


    Also, for ties, you're going to have to tweak the code a bit.
    Larry Bud, Dec 6, 2005
    #13
  14. Jeff

    Evertjan. Guest

    Larry Bud wrote on 06 dec 2005 in
    microsoft.public.inetserver.asp.general:
    > Jeff wrote:
    >> Ok. I am using 2/5, which is 40%. However, the last place person
    >> keeps coming up with more than next to last. Test it here:
    >> http://www.gig-golf.com/purse.asp
    >> Is weird
    >> I guess maybe it is giving the remaining amount to the guy in last
    >> place?

    >
    > Right, that's what it's doing.
    > Anything less than 1/2 ratio will give the last place guy more than
    > the 2nd to last.
    >
    > I suppose you could do it differently. For example, let's say there
    > 1+2+3...+10=55
    > For easy math, lets say the pot is 1000
    > 1000/55=18.181818. Call this finalplace
    > Take the place # of places+1-finish place * final place
    >
    > 1st=$182
    > 2nd=$164
    > 3rd=$145
    > 4th=127
    >
    > You need to decide how you want the money divided up in the first
    > place, then develop a formula based on that. I've never studied the
    > PGA money THAT closely to see if they have a set formula, but it could
    > be a tournament by tournament decision. It certainly is for non-pga
    > events such as the Masters or the US Open.



    <script type='text/vbscript'>

    set response = document ' Using IE-vbs as ASP-vbs

    function calculate (numberOfWinners,amountToBeDevided)
    parts = 0
    for n=1 to numberOfWinners
    parts = parts + n^2
    next
    partAmount = amountToBeDevided/parts
    for n=1 to numberOfWinners
    t = "Number "&n&" gets $ "
    t=t&formatnumber((numberOfWinners-n+1)^2*partAmount,2)
    response.write t & "<br>"
    next
    response.write "=====================<br>"
    end function

    calculate 1, 1000
    calculate 2, 1000
    calculate 6, 140000
    calculate 30, 100000

    </script>


    --
    Evertjan.
    The Netherlands.
    (Replace all crosses with dots in my emailaddress)
    Evertjan., Dec 6, 2005
    #14
  15. Jeff

    Jeff Guest

    I kind of like the idea of giving it to the first place winner. Good idea.
    Thanks again for the reply bud

    Bam

    "Larry Bud" <> wrote in message
    news:...
    >
    > Jeff wrote:
    >> Ok. I am using 2/5, which is 40%. However, the last place person keeps
    >> coming up with more than next to last. Test it here:
    >> http://www.gig-golf.com/purse.asp
    >> Is weird
    >> I guess maybe it is giving the remaining amount to the guy in last place?

    >
    > You know what you could also do, is keep the ratio going all the way
    > through last place, then whatever is left over, give it to the first
    > place guy, or spread it equally to all the other players.
    >
    > Like this:
    >
    > <%
    > num_players=request.form("num_players")
    > total_pot=request.form("total_pot")
    > %>
    > <html>
    >
    > <head>
    > <meta http-equiv="Content-Language" content="en-us">
    > <meta http-equiv="Content-Type" content="text/html;
    > charset=windows-1252">
    > <title>New Page 1</title>
    > <meta name="Microsoft Theme" content="tacnet-blue 110, default">
    > </head>
    >
    > <body>
    > <%if num_players="" then%>
    > <form method="POST" action="--WEBBOT-SELF--" name="theform1">
    > <p># of players: <input type="text" name="num_players" size="20"></p>
    > <p>Total pot: <input type="text" name="total_pot" size="20">
    > <input type="submit" value="Submit" name="B1"></p>
    > </form>
    > <%else%>
    > <table cellspacing="0" cellpadding="3">
    > <tr><td><b>Place</b></td><td><b>Player</b></td><td><b>Amount</b></td></tr>
    > <%
    > ra=total_pot
    > for i=1 to num_players
    > place_pot=int(ra*2/5)
    > ra=ra-place_pot
    > %>
    > <tr><td><%=i%></td><td><%=chr(i+64)%></td><td
    > align="right"><%=place_pot%></td></tr>
    >
    > <%next%>
    >
    > </table>
    > Amount left over: <%=ra%>
    > <%end if%>
    >
    > </body>
    >
    > </html>
    >
    Jeff, Dec 6, 2005
    #15
  16. Jeff

    Larry Bud Guest

    > <script type='text/vbscript'>
    >
    > set response = document ' Using IE-vbs as ASP-vbs
    >
    > function calculate (numberOfWinners,amountToBeDevided)
    > parts = 0
    > for n=1 to numberOfWinners
    > parts = parts + n^2
    > next
    > partAmount = amountToBeDevided/parts
    > for n=1 to numberOfWinners
    > t = "Number "&n&" gets $ "
    > t=t&formatnumber((numberOfWinners-n+1)^2*partAmount,2)
    > response.write t & "<br>"
    > next
    > response.write "=====================<br>"
    > end function
    >
    > calculate 1, 1000
    > calculate 2, 1000
    > calculate 6, 140000
    > calculate 30, 100000
    >
    > </script>



    Now you're talkin'. And one could change the power of the function
    from ^2, to ^3 or higher if they want to front load the prize money to
    the higher places.
    Larry Bud, Dec 6, 2005
    #16
  17. Jeff

    Evertjan. Guest

    Larry Bud wrote on 06 dec 2005 in
    microsoft.public.inetserver.asp.general:

    >> <script type='text/vbscript'>
    >>
    >> set response = document ' Using IE-vbs as ASP-vbs
    >>
    >> function calculate (numberOfWinners,amountToBeDevided)
    >> parts = 0
    >> for n=1 to numberOfWinners
    >> parts = parts + n^2
    >> next
    >> partAmount = amountToBeDevided/parts
    >> for n=1 to numberOfWinners
    >> t = "Number "&n&" gets $ "
    >> t=t&formatnumber((numberOfWinners-n+1)^2*partAmount,2)
    >> response.write t & "<br>"
    >> next
    >> response.write "=====================<br>"
    >> end function
    >>
    >> calculate 1, 1000
    >> calculate 2, 1000
    >> calculate 6, 140000
    >> calculate 30, 100000
    >>
    >> </script>

    >
    >
    > Now you're talkin'. And one could change the power of the function
    > from ^2, to ^3 or higher if they want to front load the prize money to
    > the higher places.
    >
    >


    I felt obliged, after teasing you. ;-}


    function calculate (numberOfWinners, amountToBeDevided, power)
    parts = 0
    for n=1 to numberOfWinners
    parts = parts + n^power
    next
    partAmount = amountToBeDevided/parts
    for n=1 to numberOfWinners
    t = "Number "&n&" gets $ "
    t=t&formatnumber((numberOfWinners-n+1)^power*partAmount,2)
    response.write t & "<br>"
    next
    response.write "=====================<br>"
    end function

    calculate 10, 1000, 3


    --
    Evertjan.
    The Netherlands.
    (Replace all crosses with dots in my emailaddress)
    Evertjan., Dec 6, 2005
    #17
  18. "Jeff" <> wrote in message
    news:...
    > Ok gang. Here is what I have. I am using asp with Access DB on a microsoft
    > server.
    >
    > I don't know if a premade script exists out there, but I couldn't find it.
    > I am looking for a script to use for my golf team. We have In-House
    > Tourneys that we play, and I want to show earnings won for the tourney,
    > kind of like the PGA golf does. What this script would have to do, is see
    > how many players finished the tourney, and divide the total (which would
    > be $1,000,000 cyberbucks) per event. I would need it to give first the
    > most, second less, and so on. But the thing that I am unable to do, is
    > determine the breakdown with different amount of finishers.
    >
    > If 4 finished all the time, the formula would be easy, but sometimes there
    > are as many as 20 that finish.
    >
    > Does this make sense? If someone wants to email me about this they can. It
    > is kind of hard to describe what I need. --- (take out
    > the -- on both ends) is my email.
    > Thanks
    > Bam

    Here's a proof of concept that makes use of the formula for geometric
    series.

    <%
    Sub ShowPayouts (pot, places, step)
    Dim n : n = places - 1
    Dim x : x = 1 + step
    Dim sum : sum = (1.0 - x ^ (n + 1))/(1.0 - x)
    Dim i
    For i = n to 0 step -1
    Response.Write places - i & " : " & pot * x ^ i / sum & "<br>"
    Next
    End Sub
    ShowPayouts 1000000, 20, .4
    %>

    Notes:
    1. I got the formula from this page:
    http://en.wikipedia.org/wiki/Geometric_series

    2. You weren't clear about what 40% means. I assumed it to mean a 40% bump
    in payout from place to place, i.e.. 1st place pays 40% more than 2nd place,
    2nd place pays 40% more than 3rd place, etc...
    Chris Hohmann, Dec 6, 2005
    #18
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Ciar?n Hughes

    std_logic_vector divide

    Ciar?n Hughes, Oct 1, 2003, in forum: VHDL
    Replies:
    2
    Views:
    4,976
    David Bishop
    Oct 4, 2003
  2. Kim JM
    Replies:
    1
    Views:
    1,683
    Riyaz
    Apr 2, 2004
  3. Mushmech

    Divide by n

    Mushmech, Apr 11, 2004, in forum: VHDL
    Replies:
    2
    Views:
    3,344
    Charles M. Elias
    Apr 12, 2004
  4. Ash12

    Divide by 2 counter

    Ash12, Feb 27, 2005, in forum: VHDL
    Replies:
    2
    Views:
    6,164
    aaaaaa
    Feb 28, 2005
  5. scorpion53061

    Divide Script Between Cells?

    scorpion53061, Jul 20, 2004, in forum: Javascript
    Replies:
    0
    Views:
    74
    scorpion53061
    Jul 20, 2004
Loading...

Share This Page