Link to "Overall Prize Mod"

Message board links from 2010 as taken from the Internet Wayback Machine pages.
Post Reply
User avatar
admin
Site Admin
Posts: 159
Joined: Mon Aug 26, 2013 3:47 pm

Re: Link to "Overall Prize Mod"

Post by admin »

08-26-2009 1:18 PM
poolie
Top 10 Contributor
Joined on 08-20-2009
Posts 58

Overall Prize Mod
Reply Contact

Is it possible to easily change the Overall Prize to First, Second, Third place? I like the inclusion of the overall prize, but only one at then end doesnt work well in large pools.

Anyone else have interest in this?
Filed under: overall prize mod
08-26-2009 1:45 PM In reply to
Spooky
Top 10 Contributor
Joined on 08-19-2009
Denver CO
Posts 49

Re: Overall Prize Mod
Reply Contact

We are doing that in our pool, but I didn't see a need to change anything in the software to do that.... I just change the help file so that it explained the rules accordingly. We are doing a 50/30/20 breakdown, and I can make sure it goes to the right people in the end... I'm still holding the purse after all.



Though, if I'm missing something pertinent by not addressing this I would like to hear about it.
08-26-2009 2:48 PM In reply to
poolie
Top 10 Contributor
Joined on 08-20-2009
Posts 58

Re: Overall Prize Mod
Reply Contact

What I mean is to add flags in the config file to control the prize payout calculations along with dynamic help files, stat pages, etc. I would like to keep within the design of the site.(really nice job Mike Hall)

I know its alot to tackle in two weeks, but maybe if we just write some code to which puts the top overall 10 players in a numbered list.

Example:

Overall Weekly Pool Statistics

# Name Picks

1. John Doe 24/28
2. Jane Doe 22/28
3. Mike Smith 20/28
...

This way our members have a nice stat page to check
08-26-2009 3:05 PM In reply to
drizzt09
Top 10 Contributor
Joined on 08-22-2009
Ontario Canada
Posts 323

Re: Overall Prize Mod
Reply Contact

We are also doing this in our pool, but we are also just splitting it by math of the top 3 in the summery page
08-26-2009 5:10 PM In reply to
shotrock
Top 10 Contributor
Joined on 08-17-2009
Posts 52

Re: Overall Prize Mod
Reply Contact

weeklySummary.asp
topWeeklyScores.asp

Take a look at the code on these two pages. You should have no problem merging/modding this code to produce a Overall Leaderboard.
Filed under: leaderboard, mod, overall prize
08-26-2009 6:11 PM In reply to
mikehall
Top 10 Contributor
Joined on 08-09-2009
Chandler, AZ
Posts 457

Re: Overall Prize Mod
Reply Contact

topWeeklyScores.asp is a good starting place. The only thing that will cause problems is a case where two or more players tie for a position. For example, say you want 1st, 2nd and 3rd place prizes. And suppose you have these scores:

Joe 200, Mary 155, Steve 155, Bill 140

There are two ways you might handle this:
Joe 200
Mary 155, Steve 155 (split 2nd place prize)
Bill 140

Or:
Joe 200
Mary 155, Steve 155 (split the total of 2nd and 3rd place prizes)

The second way seems more fair to me, but either way it's something you'll have to deal with in the code.
08-27-2009 4:16 PM In reply to
poolie
Top 10 Contributor
Joined on 08-20-2009
Posts 58

Re: Overall Prize Mod
Reply Contact

The 2nd option is what we do and it usually happens! I could prob manage a list of top 10 players but that coding is over my head.
08-27-2009 6:24 PM In reply to
Spooky
Top 10 Contributor
Joined on 08-19-2009
Denver CO
Posts 49

Re: Overall Prize Mod
Reply Contact

poolie:
The 2nd option is what we do and it usually happens! I could prob manage a list of top 10 players but that coding is over my head.


This is how are doing ours... nothing will be coded for it. I figure the default "topWeeklyScores.asp" should give us the data we need to figure it out

helpRules.asp:
The breakdown for the Overall Winner Prizes is as follows:


First Place will get 50% of the pot
Second Place will get 30% of the pot
Third Place will get 20% of the pot

If there is a tie for a given place, then whoever is the closest to the tiebreaker score on the final game of the season will win that place and any others involved in the tie will vie for the next lower place if there is still a lower place available.

Only one person can win any given place. If you think about it, the reason for this makes good sense. For example... two people splitting first place could be getting 25% of the pool each, and the person in second place could be winning more than either of them did, even though both of the first place players picked better then the second place player. It just would not be right.

If there is still a tie after the tiebreaker method has been evaluated then the parties still involved will resolve the outcome with a method agreeable to all parties (choosing a name from a hat, rolling dice, drawing cards, playing on-line poker, arm wrestling... whatever they want, as long as all involved parties can agree on it). If all parties cannot agree on a mutually acceptable method then the Pool Administrator will determine and use a random method to decide the outcome.


09-05-2009 9:06 AM In reply to
mikehall
Top 10 Contributor
Joined on 08-09-2009
Chandler, AZ
Posts 457

Re: Overall Prize Mod
Reply Contact

I managed to get some work done on this. It's set up for individual weekly pools but the code would be similar for the overall. Here's it is if anyone wants to take a crack at it.

<%@ LANGUAGE="VBScript" %>
<!-- #include file="includes/config.asp" --><!-- #include file="includes/common.asp" --><% PageSubTitle = "Weekly Payouts Test" %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<% 'Require login to access the page.
call CheckAccess(false) %>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<title><% = PAGE_TITLE & ": " & PageSubTitle %></title>
<link rel="shortcut icon" href="favicon.ico" />
<link rel="stylesheet" type="text/css" href="styles/common.css" />
<link rel="stylesheet" type="text/css" href="styles/print.css" media="print" />
<script type="text/javascript" src="scripts/scriptLib.js"></script>
<script type="text/javascript" src="scripts/common.js"></script>
</head>
<body>
<!-- #include file="includes/header.asp" -->
<!-- #include file="includes/siteMenu.asp" -->
<div id="contentSection">
<!-- #include file="includes/weekly.asp" -->
<table id="mainWrapper" border="0" cellpadding="0" cellspacing="0"><tr><td>
<% 'Open the database.
call OpenDB()

'Define payouts (1st place, 2nd place, etc.) Values should add up to 1.00.
dim basePayouts
'basePayouts = Array(1.00)
'basePayouts = Array(.65, .35)
'basePayouts = Array(.50, .30, .20)
'basePayouts = Array(.40, .30, .20, .10)
basePayouts = Array(.30, .25, .20, .15, .10 )

'Get the week to display.
dim week
week = GetRequestedWeek()

'Find the number of entries.
dim numEntries
numEntries = GetWeeklyEntryCount(week)

'If there are less entries than payouts, adjust accordingly.
dim payouts
dim x
if numEntries > 0 and numEntries < UBound(basePayouts) + 1 then
redim payouts(numEntries - 1)

'Find the total overage.
x = 0
for i = numEntries to UBound(basePayouts)
x = x + basePayouts(i)
next

'Split it evenly over the entries.
x = x / numEntries
for i = 0 to numEntries - 1
payouts(i) = basePayouts(i) + x
next
else
payouts = basePayouts
end if

'Get the week's pot.
dim pot
pot = GetWeeklyPotAmount(week)

'Get the number of completed and total games for the given week and the
'actual tiebreaker score difference (if available).
dim numGames, completedGames, tbTarget
numGames = GetGameCount(week)
completedGames = GetCompletedGameCount(week)
tbTarget = GetWeeklyTiebreakerActual(week)

'Get user score data.
dim list, userScores
dim i, j
dim swap, temp
dim count, rank
dim lastScore, lastTiebreaker
dim totalPct, totalAmount, shareAmount
list = GetWeeklyPlayersList(week)
if IsArray(list) then

'Create an array of user score objects.
redim userScores(UBound(list))
for i = 0 to UBound(list)
set userScores(i) = new WeeklyUserScoreObj
userScores(i).setData(list(i))
next

'Sort the list by score and tiebreaker (best first).
for i = 0 to UBound(userScores) - 1
for j = i + 1 to UBound(userScores)
swap = false
if userScores(i).score < userScores(j).score then
swap = true
elseif userScores(i).score = userScores(j).score and userScores(i).tiebreaker > userScores(j).tiebreaker then
swap = true
end if
if swap then
set temp = userScores(i)
set userScores(i) = userScores(j)
set userScores(j) = temp
end if
next
next

'Rank the user scores.
count = 0
rank = 1
lastScore = ""
lastTiebreaker = ""
for i = 0 to UBound(userScores)

'Adjust rank if appropriate.
count = count + 1
if not IsNumeric(lastScore) then
lastScore = userScores(i).score
lastTiebreaker = userScores(i).tiebreaker
elseif userScores(i).score = lastScore then
if userScores(i).tiebreaker > lastTiebreaker then
rank = count
lastTiebreaker = userScores(i).tiebreaker
end if
elseif userScores(i).score < lastScore then
rank = count
lastScore = userScores(i).score
lastTiebreaker = userScores(i).tiebreaker
end if
userScores(i).rank = rank
next

'If all games are completed, determine the payouts for each rank.
if numGames = completedGames then
rank = 1
for i = 0 to UBound(payouts)
rank = i + 1
count = GetRankCount(rank)
totalPct = 0
for j = i to i + count - 1
if j <= UBound(payouts) then
totalPct = totalPct + payouts(j)
end if
next
totalAmount = totalPct * pot
shareAmount = 0
if count > 0 then
shareAmount = (totalAmount / count)
end if
call SetUserScoreAward(i + 1, totalAmount, shareAmount)
i = i + count - 1
next
end if
end if

'Build the display. %>
<h2>Weekly Player Standings</h2>
<table class="main" border="0" cellpadding="0" cellspacing="0">
<thead>
<tr class="header bottomEdge singleLine">
<th align="left" colspan="7">Week <% = week %></th>
</tr>
<tr class="subHeader bottomEdge singleLine">
<th># </th>
<th align="left">Name</th>
<th colspan="2">Score</th>
<th>TB Diff.</th>
<th>Total Award</th>
<th>Individual Share</th>
</tr>
</thead>
<tbody>
<% dim lastRank, rankStr, scoreStr, tbStr, pctStr, totalStr, shareStr
lastRank = 0
alt = false
if IsArray(userScores) then
for i = 0 to UBound(userScores)
if alt then %>
<tr align="right" class="alt singleLine">
<% else %>
<tr align="right" class="singleLine">
<% end if
alt = not alt

rankStr = " "
scoreStr = "n/a"
pctStr = " "
tbStr = "n/a"
totalStr = " "
shareStr = " "
if completedGames > 0 and userScores(i).rank <> lastRank then
rankStr = userScores(i).rank & "."
if IsNumeric(userScores(i).total) then
totalStr = FormatAmount(userScores(i).total)
end if
lastRank = userScores(i).rank
end if
if completedGames > 0 then
scoreStr = userScores(i).score & "/" & completedGames
tbStr = userScores(i).tiebreaker
pctStr = "(" & FormatPercentage(userScores(i).score / completedGames) & ")"
end if
if IsNumeric(userScores(i).share) then
shareStr = FormatAmount(userScores(i).share)
end if %>
<td><% = rankStr %></td>
<td align="left"><% = userScores(i).name %></td>
<td><% = scoreStr %></td>
<td><% = pctStr %></td>
<td><% = tbStr %></td>
<td><% = totalStr %></td>
<td><% = shareStr %></td>
</tr>
<% next
else %>
<tr class="noSort">
<td align="center" colspan="7"><em>No entries found.</em></td>
</tr>
<% end if %>
</tbody>
</table>
<% 'Get payouts sum (sanity check).
totalPct = 0
for i = 0 to UBound(payouts)
totalPct = totalPct + payouts(i)
next %>
<h2>Award Breakdown</h2>
<table class="main" border="0" cellpadding="0" cellspacing="0">
<thead>
<tr align="right" class="header bottomEdge singleLine">
<th># </th>
<th style="width: 8em;">% of Total</th>
<th style="width: 8em;">Amount</th>
</tr>
</thead>
<tfoot>
<tr class="subHeader topEdge bottomEdge">
<th align="left" colspan="3">Totals</th>
</tr>
<tr align="right">
<td> </td>
<td><% = FormatNumber(100 * totalPct, 2) & "%" %></td>
<td><% = FormatAmount(pot) %></td>
</tr>
</tfoot>
<tbody>
<% dim alt
alt = false
for i = 0 to UBound(payouts)
if alt then %>
<tr align="right" class="alt singleLine">
<% else %>
<tr align="right" class="singleLine">
<% end if
alt = not alt %>
<td><% = (i + 1) %>.</td>
<td><% = FormatNumber(100 * payouts(i), 2) & "%" %></td>
<td><% = FormatAmount(payouts(i) * pot) %></td>
</tr>
<% next %>
</tbody>
</table>

<% 'List links to view other weeks.
call DisplayGoToNavigation("week", GetWeekCount(), "") %>
</td></tr></table>
<!-- #include file="includes/footer.asp" -->
</body>
</html>
<% '**************************************************************************
'* Local functions and subroutines. *
'**************************************************************************

'--------------------------------------------------------------------------
' Sets the total and share amounts for user scores with the given rank.
'--------------------------------------------------------------------------
sub SetUserScoreAward(rank, total, share)

dim i

for i = 0 to UBound(userScores)
if userScores(i).rank > rank then
exit sub
elseif userScores(i).rank = rank then
userScores(i).total = total
userScores(i).share = share
end if
next

end sub

'--------------------------------------------------------------------------
' Returns the number of players with the given rank.
'--------------------------------------------------------------------------
function GetRankCount(rank)

dim i

GetRankCount = 0
for i = 0 to UBound(userScores)
if userScores(i).rank > rank then
exit function
elseif userScores(i).rank = rank then
GetRankCount = GetRankCount + 1
end if
next

end function

'**************************************************************************
'* Local class definitions. *
'**************************************************************************

'--------------------------------------------------------------------------
' WeeklyUserScoreObj: Holds information for a single user score.
'--------------------------------------------------------------------------
class WeeklyUserScoreObj

public rank, name, score, tiebreaker, total, share

private sub Class_Initialize()
end sub

private sub Class_Terminate()
end sub

public sub setData(username)

'Set the user score properties.
rank = 0
name = username
if USE_CONFIDENCE_POINTS then
score = GetWeeklyConfidenceScore(username, week)
else
score = GetWeeklyPickScore(username, week)
end if
if IsNumeric(tbTarget) then
tiebreaker = Abs(tbTarget - GetWeeklyTiebreakerGuess(username, week))
else
tiebreaker = ""
end if
total = ""
share = ""

end sub

end class %>

There's obviously a lot more to do, like saving the results to the database for quick look up, adding functions to get a list of winners or an individual player's winnings, and so on. But at least the logic works.
09-05-2009 1:53 PM In reply to
drizzt09
Top 10 Contributor
Joined on 08-22-2009
Ontario Canada
Posts 323

Re: Overall Prize Mod
Reply Contact

Would love to see this finished and ready... I love the idea.
09-05-2009 10:23 PM In reply to
mikehall
Top 10 Contributor
Joined on 08-09-2009
Chandler, AZ
Posts 457

Re: Overall Prize Mod
Reply Contact

I think I can get it done for the overall (plenty of time for that) and post and upgrade for it. Give me a couple of weeks.
09-06-2009 8:36 AM In reply to
drizzt09
Top 10 Contributor
Joined on 08-22-2009
Ontario Canada
Posts 323

Re: Overall Prize Mod
Reply Contact

ya we have 17 weeks for that



thanks
09-16-2009 11:45 AM In reply to
bcowing
Top 75 Contributor
Joined on 09-16-2009
London, United Kingdom
Posts 2

Re: Overall Prize Mod
Reply Contact
I absolutely agree, this would be excellent functionality to have. Looking forward to being able to implement it!
09-16-2009 1:40 PM In reply to
drizzt09
Top 10 Contributor
Joined on 08-22-2009
Ontario Canada
Posts 323

Re: Overall Prize Mod
Reply Contact

ok so we have finalized our breakdown for this

Season end pot breakdown:

1st = 50%
2nd = 25%
3rd = 15%
10th = 5%
2nd last(19th) = 5%

So when anyone works on this coding can you keep into consideration of makind the fields editable for up to 5 positions for me(maybe more for others)

also the percentages editable



thanks
09-16-2009 6:43 PM In reply to
mikehall
Top 10 Contributor
Joined on 08-09-2009
Chandler, AZ
Posts 457

Re: Overall Prize Mod
Reply Contact

Got that covered with the code above. This:

'Define payouts (1st place, 2nd place, etc.) Values should add up to 1.00.
dim basePayouts
basePayouts = Array(.40, .30, .20, .10)

Sets the number of awards (there are 4 numbers in the array so it goes 1st, 2nd, 3rd and 4th place). The values represent the percentage (1st is 40%, 2nd is 30%,3rd is 20% and 4th is 10%). You can adjust that however you want, just be sure all the values (however many you have) add up to 1.00.

Now if you're asking for consolation prizes (5% to the last place player or whatever), that's a little more complicated since the number of players will vary, but it's still possible. If there's enough demand for that then it may be worth working on.

Page 1 of 2 (17 items) 1 2 Next >
User avatar
admin
Site Admin
Posts: 159
Joined: Mon Aug 26, 2013 3:47 pm

Re: Link to "Overall Prize Mod"

Post by admin »

09-16-2009 8:58 PM In reply to
drizzt09
Top 10 Contributor
Joined on 08-22-2009
Ontario Canada
Posts 323

Re: Overall Prize Mod
Reply Contact

wellit would be up to the admin to place it right, I know there are 20 ppl in my pool so I would give it to 19th place.

if another user wanted 2nd last but had 25 ppl, he would set it for 24th position
09-17-2009 4:27 PM In reply to
shotrock
Top 10 Contributor
Joined on 08-17-2009
Posts 52

Re: Overall Prize Mod
Reply Contact

I like that idea. We do similiar.

First, 2nd, 3rd, and last place.

Page 2 of 2 (17 items) < Previous 1 2
Post Reply