This is not necesarily PHP, but algorithm question, I am just doing it in PHP. So don't know if its the best place to post.
The problem is - I need to calculate maximum posible winning for a game, depending on bets.
We are making dogs racing game, but the algorithm would be similar to roullette. Roullette is more known in the world, so I ask how would you calculate.
For example in roulete there is bets on ODD and EVEN. And another bet is on a number lets say.
If player bets on number 36, then only bet on EVEN can win if wins bet on number 36. So there we can add those 2 values of winning.
But the player might bet huge amount lets say on ODD, and just small amounts on EVEN and 36, so maximum win amount from ODD would outghweight sum of bets on EVEN and 36.
And there can be lot of such conditions. What would be general apradch to these kind of prioblems, so it would not get to complicated.
I wrote code, but there are so many if and loops, so it gets confusing to me, so person who would need to edit it - it would be even harder for him.