947740 Posted May 12, 2010 Share Posted May 12, 2010 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. Quote Link to comment https://forums.phpfreaks.com/topic/201533-bid-system-stuck-on-the-logic/ Share on other sites More sharing options...
aebstract Posted May 12, 2010 Share Posted May 12, 2010 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? Quote Link to comment https://forums.phpfreaks.com/topic/201533-bid-system-stuck-on-the-logic/#findComment-1057349 Share on other sites More sharing options...
947740 Posted May 12, 2010 Author Share Posted May 12, 2010 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. Quote Link to comment https://forums.phpfreaks.com/topic/201533-bid-system-stuck-on-the-logic/#findComment-1057353 Share on other sites More sharing options...
aebstract Posted May 12, 2010 Share Posted May 12, 2010 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. Quote Link to comment https://forums.phpfreaks.com/topic/201533-bid-system-stuck-on-the-logic/#findComment-1057361 Share on other sites More sharing options...
947740 Posted May 12, 2010 Author Share Posted May 12, 2010 Ah, good question. The system is built so that only 1200 points (or the set value for the prize) can be bet/bid on that prize. Thanks again. Quote Link to comment https://forums.phpfreaks.com/topic/201533-bid-system-stuck-on-the-logic/#findComment-1057362 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.