I am currently working on creating a Jackpot Roulette game that features a main pot. Each round sees users joining and placing bets that contribute to the main pot, with the winner taking home the entire amount.
My goal is to provide each user with real-time information on their current chance of winning. This information needs to be updated every second to ensure accuracy as the game progresses.
Within my system, I have an array of users along with the corresponding bet amounts they have placed. For example:
[ username: user1, betAmount: 600],
[ username: user2, betAmount: 400]
I need assistance in calculating each user's chance of winning based on their bet amount relative to other users. Ideally, I want to display this calculated chance to the respective user (e.g. user1 has a 60% chance while user2 has a 40% chance).
If anyone can help me develop a function that can accurately calculate these chances by considering the bet amounts of all users and dividing the maximum chance of winning (100%) among them, it would be greatly appreciated.