Jump to content

Bid System - Stuck on the Logic


947740

Recommended Posts

Okay so here's a quick summary of what I'm doing:

 

People are given a certain amount of points.  There are prizes that are valued at a certain amount of points.

 

Let's say there are three people:

Bob, Sue, Andy

 

Each has 500 points.

 

There is a prize, for which, 1200 points need to be bet by the individuals.

 

Let's say Bob bets 500, Sue bets 400, and Andy bets 300.

 

By this logic, bob would have a 5/12 chance of winning the prize, Sue a 4/12 chance, and Andy a 3/12 chance.

 

But, using PHP, how do I determine which one wins, randomly, according to these given probabilities?

 

I've never worked with this sort of stuff before, so I'm not sure what options I have.  Any ideas would be helpful.

Link to comment
Share on other sites

Could you start with something as basic as making a random number 1-12 and if its 1-5 bob wins, 6-9 sue wins and 10-12 andy wins? Of course it's gonna change up depending on number of people pooling in I suppose, but something along that very basic idea should do this?

Link to comment
Share on other sites

Ah, I kind of get what you are saying.  Realistically, the problem is simple...I must be overthinking it.

 

I had a thought of using 100 items in an array and then giving Bob 5/12 of those,  Sue 4/12 of those, and Andy 3/12, and then make a random number between 1 and 100.

 

I think it's basically the same idea...I like yours more, though, as it's a lot more simple.

 

Thanks.

Link to comment
Share on other sites

mhm, the only thing I can see that you would have to think a little harder on is: Can you have say 10 people pooling in for that 1200 points, but say each of them put 600 points? Meaning they went way over the 1200? Regardless you would still handle it the same, just using everyone's value added together. Good luck.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.