473,395 Members | 1,797 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

General Opinion on a how to?

Hi guys

I have a requirment to calculate a prize pool for a competiton similar to a
poker tournament. But i am stuck on best ways or even if i have the right
ideas, so:

Players pay to play, total paid is prize pool and is distributed to top 3 or
so winners.

Variables are number of players who will win, if a lot enter i increase
number of winners. i think a standard top 30% rounded off would work for
calculating paid positions? So 10 players. 30% would be 3 of them (rounded)

Now to calculate the actual amount of prize each gets i'd like to be able to
vary it. So i could offer or be versatile enough to offer different
distribtuions. Such as, a winner takes all, a top 2 get the most and then
3rd gets a fair bit less, or a 4 out of 10 get prizes.....etc

Also i'd like to be able to offer prizes where say first place can get cash
AND a car for example. But other 2 places just cash etc etc

This is where i am stuck, do i go for a hard coded table in database and
read off it when my prog loads into a struct and just reference that when
doing calculations? One way forward, but then if a number of players enters
that i havent accounted for, then what?

Alternatively as i said above i calculate winning positions based on a % but
then how do idecide which of those positions wins what?

Very stuck and confused, i keep thinking this must be simple. any ideas or
pointers welcome?

Thanks

Jan 29 '07 #1
6 1192
Daniel,

You could create an interface that defines a winnings calculator and then
uses a factory to dynamically load and instantiate the named interface from
an external assembly. This would allow you to be flexible enough to add new
calculations to the system down the road.

Jamey

"Daniel" <no****@pokercat.co.ukwrote in message
news:O$**************@TK2MSFTNGP03.phx.gbl...
Hi guys

I have a requirment to calculate a prize pool for a competiton similar to
a poker tournament. But i am stuck on best ways or even if i have the
right ideas, so:

Players pay to play, total paid is prize pool and is distributed to top 3
or so winners.

Variables are number of players who will win, if a lot enter i increase
number of winners. i think a standard top 30% rounded off would work for
calculating paid positions? So 10 players. 30% would be 3 of them
(rounded)

Now to calculate the actual amount of prize each gets i'd like to be able
to vary it. So i could offer or be versatile enough to offer different
distribtuions. Such as, a winner takes all, a top 2 get the most and then
3rd gets a fair bit less, or a 4 out of 10 get prizes.....etc

Also i'd like to be able to offer prizes where say first place can get
cash AND a car for example. But other 2 places just cash etc etc

This is where i am stuck, do i go for a hard coded table in database and
read off it when my prog loads into a struct and just reference that when
doing calculations? One way forward, but then if a number of players
enters that i havent accounted for, then what?

Alternatively as i said above i calculate winning positions based on a %
but then how do idecide which of those positions wins what?

Very stuck and confused, i keep thinking this must be simple. any ideas or
pointers welcome?

Thanks

Jan 29 '07 #2
Seems to me you need to do some analysis.

Some obvious objects are:

Game
Player
Prize
PrizePool

Now, can you say what state variables and methods these objects should have?
Does thinking about that suggest to you that you may want an inheritance
hierarchy, or an interface for some of these objects? E.g.

Could there be different types of Games (Pool, Poker, Darts, Domines,
Cribbage)? Would they have extra/different state and behaviour?

What about prizes? Would an interface work best here? Then a PrizePool
could hold objects that implement the interface?

Will a Game hold a collection of players? Presumably a PrizePool will hold
a collection of Prizes. Since the Prizes may be different, will they be
different in an inheritance sense, or in an interface sense? Will a
PrizePool need a reference to a Game (i.e. need to know which Game it is the
PrizePool for)? Will a Prize need a reference to a Game, too? Or could the
same Prize be used for many Games.

There's no substitute for good analysis.

HTH, IMHO, YMMV, Just my 2c etc etc
Peter


"Daniel" <no****@pokercat.co.ukwrote in message
news:O$**************@TK2MSFTNGP03.phx.gbl...
Hi guys

I have a requirment to calculate a prize pool for a competiton similar to
a poker tournament. But i am stuck on best ways or even if i have the
right ideas, so:

Players pay to play, total paid is prize pool and is distributed to top 3
or so winners.

Variables are number of players who will win, if a lot enter i increase
number of winners. i think a standard top 30% rounded off would work for
calculating paid positions? So 10 players. 30% would be 3 of them
(rounded)

Now to calculate the actual amount of prize each gets i'd like to be able
to vary it. So i could offer or be versatile enough to offer different
distribtuions. Such as, a winner takes all, a top 2 get the most and then
3rd gets a fair bit less, or a 4 out of 10 get prizes.....etc

Also i'd like to be able to offer prizes where say first place can get
cash AND a car for example. But other 2 places just cash etc etc

This is where i am stuck, do i go for a hard coded table in database and
read off it when my prog loads into a struct and just reference that when
doing calculations? One way forward, but then if a number of players
enters that i havent accounted for, then what?

Alternatively as i said above i calculate winning positions based on a %
but then how do idecide which of those positions wins what?

Very stuck and confused, i keep thinking this must be simple. any ideas or
pointers welcome?

Thanks

Jan 29 '07 #3
That part is already done and complete. The issue is more the back end
storage of the prize pool break dowm to hard code in code as your method
suggests or not?

If i have a database table that reads the variables out then that to be is
the only way forward.

As Jamey said, a interface and a factory sounds a good plan and i can
instatiate each from the database in advamce choosing the one needed at run
time.

The way i see my calculation working with the aid of Jameys tips is this:

- load a game
- Retrieve Tournament placed winning positions from database as a %, top
30%, top 1% (winner takes all), etc
- Load into a prize pool object instance for that game

My biggest issue is the distribution of that prize pool. Rather than hard
code, "if 3 prize positions then break down as follows", "if 4 etc".

I would rather some form of algorithm for or setting in my database to say
that for this game use this ditribution, for this one use another one, and
eaxh distribution be stored in a back end db table.

But how do you store a 'distribution'? I guess its an algorithm, if so i
could store in the db which algorithm to use etc? this is where i am
stuck....

Any ideas?
"Peter Bradley" <pb******@uwic.ac.ukwrote in message
news:%2******************@TK2MSFTNGP06.phx.gbl...
Seems to me you need to do some analysis.

Some obvious objects are:

Game
Player
Prize
PrizePool

Now, can you say what state variables and methods these objects should
have? Does thinking about that suggest to you that you may want an
inheritance hierarchy, or an interface for some of these objects? E.g.

Could there be different types of Games (Pool, Poker, Darts, Domines,
Cribbage)? Would they have extra/different state and behaviour?

What about prizes? Would an interface work best here? Then a PrizePool
could hold objects that implement the interface?

Will a Game hold a collection of players? Presumably a PrizePool will
hold a collection of Prizes. Since the Prizes may be different, will they
be different in an inheritance sense, or in an interface sense? Will a
PrizePool need a reference to a Game (i.e. need to know which Game it is
the PrizePool for)? Will a Prize need a reference to a Game, too? Or
could the same Prize be used for many Games.

There's no substitute for good analysis.

HTH, IMHO, YMMV, Just my 2c etc etc
Peter


"Daniel" <no****@pokercat.co.ukwrote in message
news:O$**************@TK2MSFTNGP03.phx.gbl...
>Hi guys

I have a requirment to calculate a prize pool for a competiton similar to
a poker tournament. But i am stuck on best ways or even if i have the
right ideas, so:

Players pay to play, total paid is prize pool and is distributed to top 3
or so winners.

Variables are number of players who will win, if a lot enter i increase
number of winners. i think a standard top 30% rounded off would work for
calculating paid positions? So 10 players. 30% would be 3 of them
(rounded)

Now to calculate the actual amount of prize each gets i'd like to be able
to vary it. So i could offer or be versatile enough to offer different
distribtuions. Such as, a winner takes all, a top 2 get the most and then
3rd gets a fair bit less, or a 4 out of 10 get prizes.....etc

Also i'd like to be able to offer prizes where say first place can get
cash AND a car for example. But other 2 places just cash etc etc

This is where i am stuck, do i go for a hard coded table in database and
read off it when my prog loads into a struct and just reference that when
doing calculations? One way forward, but then if a number of players
enters that i havent accounted for, then what?

Alternatively as i said above i calculate winning positions based on a %
but then how do idecide which of those positions wins what?

Very stuck and confused, i keep thinking this must be simple. any ideas
or pointers welcome?

Thanks


Jan 29 '07 #4
If it were me, I'd implement a rules engine for the project. Your
design must define the general rules of how the payout behavior will
operate based on the number of players. Check out the book "MDA
Explained: The Model Driven Architecture--Practice and Promise" for an
excellent example of how to implement an object-oriented rules
engines. For the varying behavior you describe, I would just use the
random number generator seeded with the current second when the payout
is calculated. Your algorithm's in the rules engine will have to be
able to use this value somehow to calculate the varying payouts.

On Jan 29, 6:48 am, "Daniel" <nos...@pokercat.co.ukwrote:
Hi guys

I have a requirment to calculate a prize pool for a competiton similar to a
poker tournament. But i am stuck on best ways or even if i have the right
ideas, so:

Players pay to play, total paid is prize pool and is distributed to top 3 or
so winners.

Variables are number of players who will win, if a lot enter i increase
number of winners. i think a standard top 30% rounded off would work for
calculating paid positions? So 10 players. 30% would be 3 of them (rounded)

Now to calculate the actual amount of prize each gets i'd like to be able to
vary it. So i could offer or be versatile enough to offer different
distribtuions. Such as, a winner takes all, a top 2 get the most and then
3rd gets a fair bit less, or a 4 out of 10 get prizes.....etc

Also i'd like to be able to offer prizes where say first place can get cash
AND a car for example. But other 2 places just cash etc etc

This is where i am stuck, do i go for a hard coded table in database and
read off it when my prog loads into a struct and just reference that when
doing calculations? One way forward, but then if a number of players enters
that i havent accounted for, then what?

Alternatively as i said above i calculate winning positions based on a % but
then how do idecide which of those positions wins what?

Very stuck and confused, i keep thinking this must be simple. any ideas or
pointers welcome?

Thanks
Jan 29 '07 #5
You could store the name of the algorithm in the database along with some
params for it. I have done this two ways in the past successfully. First,
you could store the params in a TEXT field as xml. Second you can create
another detail table with key value pairs. Either way you would not have to
change the database as you add new algorithm to the system. We used a
system similar to this for calculating holidays for a calendar. Almost all
holidays on the calendar could be calculated with a few basic algorithms.
<holiday name="CHRISTmas" algorithm ="date" day="25" month="12"/>
<holiday name="July 4th" algorithm ="date" day="4" month="7"/>
<holiday name="Thanksgiving" algorithm ="weekday" month="11" week="4"
weekday="5"/>

however easter was different so we had create a special algorithm for it.
<holiday name="Easter" algorithm ="easter"/>
<holiday name="Good Friday" algorithm ="relative" relativeHoliday="Easter"
metric="day" distance="-2"/>

All in all we have arround 5 algorithms and almost 100 holidays. This came
in very usefull this year because with daylight savings time changing we had
to only change the xml file.

Hope this helps

Jamey

"Daniel" <no****@pokercat.co.ukwrote in message
news:%2******************@TK2MSFTNGP04.phx.gbl...
That part is already done and complete. The issue is more the back end
storage of the prize pool break dowm to hard code in code as your method
suggests or not?

If i have a database table that reads the variables out then that to be is
the only way forward.

As Jamey said, a interface and a factory sounds a good plan and i can
instatiate each from the database in advamce choosing the one needed at
run time.

The way i see my calculation working with the aid of Jameys tips is this:

- load a game
- Retrieve Tournament placed winning positions from database as a %, top
30%, top 1% (winner takes all), etc
- Load into a prize pool object instance for that game

My biggest issue is the distribution of that prize pool. Rather than hard
code, "if 3 prize positions then break down as follows", "if 4 etc".

I would rather some form of algorithm for or setting in my database to say
that for this game use this ditribution, for this one use another one, and
eaxh distribution be stored in a back end db table.

But how do you store a 'distribution'? I guess its an algorithm, if so i
could store in the db which algorithm to use etc? this is where i am
stuck....

Any ideas?
"Peter Bradley" <pb******@uwic.ac.ukwrote in message
news:%2******************@TK2MSFTNGP06.phx.gbl...
>Seems to me you need to do some analysis.

Some obvious objects are:

Game
Player
Prize
PrizePool

Now, can you say what state variables and methods these objects should
have? Does thinking about that suggest to you that you may want an
inheritance hierarchy, or an interface for some of these objects? E.g.

Could there be different types of Games (Pool, Poker, Darts, Domines,
Cribbage)? Would they have extra/different state and behaviour?

What about prizes? Would an interface work best here? Then a PrizePool
could hold objects that implement the interface?

Will a Game hold a collection of players? Presumably a PrizePool will
hold a collection of Prizes. Since the Prizes may be different, will
they be different in an inheritance sense, or in an interface sense?
Will a PrizePool need a reference to a Game (i.e. need to know which Game
it is the PrizePool for)? Will a Prize need a reference to a Game, too?
Or could the same Prize be used for many Games.

There's no substitute for good analysis.

HTH, IMHO, YMMV, Just my 2c etc etc
Peter


"Daniel" <no****@pokercat.co.ukwrote in message
news:O$**************@TK2MSFTNGP03.phx.gbl...
>>Hi guys

I have a requirment to calculate a prize pool for a competiton similar
to a poker tournament. But i am stuck on best ways or even if i have the
right ideas, so:

Players pay to play, total paid is prize pool and is distributed to top
3 or so winners.

Variables are number of players who will win, if a lot enter i increase
number of winners. i think a standard top 30% rounded off would work for
calculating paid positions? So 10 players. 30% would be 3 of them
(rounded)

Now to calculate the actual amount of prize each gets i'd like to be
able to vary it. So i could offer or be versatile enough to offer
different distribtuions. Such as, a winner takes all, a top 2 get the
most and then 3rd gets a fair bit less, or a 4 out of 10 get
prizes.....etc

Also i'd like to be able to offer prizes where say first place can get
cash AND a car for example. But other 2 places just cash etc etc

This is where i am stuck, do i go for a hard coded table in database and
read off it when my prog loads into a struct and just reference that
when doing calculations? One way forward, but then if a number of
players enters that i havent accounted for, then what?

Alternatively as i said above i calculate winning positions based on a %
but then how do idecide which of those positions wins what?

Very stuck and confused, i keep thinking this must be simple. any ideas
or pointers welcome?

Thanks



Jan 30 '07 #6
Hi Jeremy,

Thats exactly the idea i had in mind, to store the algorithm for the
calculation in the db and then have my server use that. So different prize
distributions could be calculated with ease. No need for any big design
changes to my code.

So do all calculations in the code based on the database values. I'll look
intot his methodology. My next problem is how to calculate a non uniform
spread in c#. Another post may loom i think.

thanks to all responses.
"Jamey McElveen" <ja************@acstechnologies.com_nospamwrote in
message news:um****************@TK2MSFTNGP02.phx.gbl...
You could store the name of the algorithm in the database along with some
params for it. I have done this two ways in the past successfully.
First, you could store the params in a TEXT field as xml. Second you can
create another detail table with key value pairs. Either way you would
not have to change the database as you add new algorithm to the system.
We used a system similar to this for calculating holidays for a calendar.
Almost all holidays on the calendar could be calculated with a few basic
algorithms.
<holiday name="CHRISTmas" algorithm ="date" day="25" month="12"/>
<holiday name="July 4th" algorithm ="date" day="4" month="7"/>
<holiday name="Thanksgiving" algorithm ="weekday" month="11" week="4"
weekday="5"/>

however easter was different so we had create a special algorithm for it.
<holiday name="Easter" algorithm ="easter"/>
<holiday name="Good Friday" algorithm ="relative" relativeHoliday="Easter"
metric="day" distance="-2"/>

All in all we have arround 5 algorithms and almost 100 holidays. This
came in very usefull this year because with daylight savings time changing
we had to only change the xml file.

Hope this helps

Jamey

"Daniel" <no****@pokercat.co.ukwrote in message
news:%2******************@TK2MSFTNGP04.phx.gbl...
>That part is already done and complete. The issue is more the back end
storage of the prize pool break dowm to hard code in code as your method
suggests or not?

If i have a database table that reads the variables out then that to be
is the only way forward.

As Jamey said, a interface and a factory sounds a good plan and i can
instatiate each from the database in advamce choosing the one needed at
run time.

The way i see my calculation working with the aid of Jameys tips is this:

- load a game
- Retrieve Tournament placed winning positions from database as a %, top
30%, top 1% (winner takes all), etc
- Load into a prize pool object instance for that game

My biggest issue is the distribution of that prize pool. Rather than hard
code, "if 3 prize positions then break down as follows", "if 4 etc".

I would rather some form of algorithm for or setting in my database to
say that for this game use this ditribution, for this one use another
one, and eaxh distribution be stored in a back end db table.

But how do you store a 'distribution'? I guess its an algorithm, if so i
could store in the db which algorithm to use etc? this is where i am
stuck....

Any ideas?
"Peter Bradley" <pb******@uwic.ac.ukwrote in message
news:%2******************@TK2MSFTNGP06.phx.gbl. ..
>>Seems to me you need to do some analysis.

Some obvious objects are:

Game
Player
Prize
PrizePool

Now, can you say what state variables and methods these objects should
have? Does thinking about that suggest to you that you may want an
inheritance hierarchy, or an interface for some of these objects? E.g.

Could there be different types of Games (Pool, Poker, Darts, Domines,
Cribbage)? Would they have extra/different state and behaviour?

What about prizes? Would an interface work best here? Then a PrizePool
could hold objects that implement the interface?

Will a Game hold a collection of players? Presumably a PrizePool will
hold a collection of Prizes. Since the Prizes may be different, will
they be different in an inheritance sense, or in an interface sense?
Will a PrizePool need a reference to a Game (i.e. need to know which
Game it is the PrizePool for)? Will a Prize need a reference to a Game,
too? Or could the same Prize be used for many Games.

There's no substitute for good analysis.

HTH, IMHO, YMMV, Just my 2c etc etc
Peter


"Daniel" <no****@pokercat.co.ukwrote in message
news:O$**************@TK2MSFTNGP03.phx.gbl...
Hi guys

I have a requirment to calculate a prize pool for a competiton similar
to a poker tournament. But i am stuck on best ways or even if i have
the right ideas, so:

Players pay to play, total paid is prize pool and is distributed to top
3 or so winners.

Variables are number of players who will win, if a lot enter i increase
number of winners. i think a standard top 30% rounded off would work
for calculating paid positions? So 10 players. 30% would be 3 of them
(rounded)

Now to calculate the actual amount of prize each gets i'd like to be
able to vary it. So i could offer or be versatile enough to offer
different distribtuions. Such as, a winner takes all, a top 2 get the
most and then 3rd gets a fair bit less, or a 4 out of 10 get
prizes.....etc

Also i'd like to be able to offer prizes where say first place can get
cash AND a car for example. But other 2 places just cash etc etc

This is where i am stuck, do i go for a hard coded table in database
and read off it when my prog loads into a struct and just reference
that when doing calculations? One way forward, but then if a number of
players enters that i havent accounted for, then what?

Alternatively as i said above i calculate winning positions based on a
% but then how do idecide which of those positions wins what?

Very stuck and confused, i keep thinking this must be simple. any ideas
or pointers welcome?

Thanks





Jan 30 '07 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Andrew MacLean | last post by:
Hello all, I am fairly new to .NET, but not to VB. I have a couple of questions. 1. Shared Code Base I have a solution with several different applications within it. Many of the...
1
by: Yosh | last post by:
I am looking for a mail UI component for .Net. I know how to send emails using the System.Web namespace but I am interested in a component with a UI built in? Does anyone know of a component or...
15
by: John Salerno | last post by:
After my last post, I thought of another question as a result of the following: ------------------------------ Mike Meyer wrote: > John Salerno <johnjsal@NOSPAMgmail.com> writes: > > >>So...
39
by: Hareth | last post by:
C# 2005 express & vb 2005 express: 1. During runtime, I can edit my codes in C#..... How come this cannot be done in VB? it says ...."read-only" during runtime...... 2. Why does vb...
4
by: Bill | last post by:
In vbscript and vb6 when you created a array via a join that contained no entries when you did a ubound against that array it returned -1, which of course was very helpful for using it as the upper...
14
by: Mr Newbie | last post by:
I am often in the situation where I want to act on the result of a function, but a simple boolean is not enough. For example, I may have a function called isAuthorised ( User, Action ) as ?????...
66
by: KimmoA | last post by:
Hey! Some questions about C that have been bugging me for a while... 1) Is inline a valid C keyword or not? I was kind of surprised of not finding it in C, to be honest. My "The C Programming...
17
by: pamelafluente | last post by:
Hi I have to insert dates into some Access and SQL Databases. I need to be general as the target computer might be in any country. -------- - For access I wrote the follow: Function...
37
by: dmoran21 | last post by:
I am a mathematician trying to write a program in C to do some curve fitting. When I get to the point where I attempt to enter data in my arrays, I get a General Protection Exception error message....
6
by: john_c | last post by:
FxCopy says this about catching general exceptions: "You should not catch Exception or SystemException. Catching generic exception types can hide run-time problems from the library user, and can...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.