Jump to content

Calculating win percents (1%)


Lukeidiot

Recommended Posts

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)

KNZbIIE.png

 

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 by Lukeidiot
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.