Lukeidiot Posted November 21, 2013 Share Posted November 21, 2013 (edited) Hello people of PHPFreaks. I am trying to calculate win percents that are 1% in my favor (house edge). Here are the variables: Game Type (1 = over, 0 = under) Game Number:(49.50) (game type 1 to win if your roll is OVER 49.50 :::::: game type 0 to win if your roll is UNDER 50.50) Multiplier: Any number between 1 and 9900 Preview of panel: (www.dice.sx for live example) What I am trying to calculate is the chance with a 1% house edge. How do I go by this? Here is what I have so far (which doesnt really work) <?php $type = 1; $game_int = 50; $roll = 70; $bet = 100; //Get payout if($type == 1){ $chance = (100 - $game_int); $multiplier = round((100 / $chance), 5); if($roll > $game_int){ $result = 1; $payout = round($bet * $multiplier, 5); echo "Type: $type - Payout: $payout - Chance: $chance - Multiplier: $multiplier - Game: $game_int - Bet: $bet"; } else { $result = 0; $payout = round($bet, 5); echo "Lose: $bet"; } } else { $chance = $game_int; $multiplier = (100 / $chance); if($roll < $game_int){ $result = 1; $payout = round($bet * $multiplier, 5); echo "Type: $type - Payout: $payout - Chance: $chance - Multiplier: $multipler - Game: $game_int - Bet: $bet"; } else { $result = 0; $payout = round($bet, 5); echo "Lose: $bet"; } } ?> Edited November 21, 2013 by Lukeidiot Quote Link to comment 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.