Sunday, 15 January 2012

php - How to calculate luck factor based on bet winchance/result? -


I am working on a website where users can bet on events with variable win chances. One has to display a fixed user's "Luck factor" based on his wager.

Here is the definition of fortune factor:

The percentage of destined display indicates how many bets you have won, how much do you live in comparison to this? For example, if you play 10 times with a 10% chance of winning and winning two of the 10 bets, then your fate will show up as 200% because you win twice as much as you want. While calculating fortune, the condition size is not kept in mind, so it is possible to get less than 100% fortune and will still show the benefit if your winning bets take more risk than your losing bets.

Here is my (

  • winchance (0.01 - 99.99)
  • Win (true / false)

The application is written in PHP, but I'm sure a pseudo-angle example will push me in the right direction.

If I understand your question, okay, then using the mysql winchance column and the actual winning ratio Can take the average of the chance of winning (number of wins / total bets). These two values In view of the fact, the actual proportion / factor of fate will be average * 100. For example, the average win chance is 0.1 and the real winning ratio is 2/10 = 0.2, then the factor of luck is 0.2 / 0.1 * 100 = 200%. It will be easily calculated with the mysql inbuilt function.


No comments:

Post a Comment