$runline = ''; $money_line = 101; if (isset($_POST['txtMoneyLine'])){ $money_line = $_POST['txtMoneyLine']; }; $status = "TRUE"; if (isset($_POST['rgStatus'])){ $status = $_POST['rgStatus']; }; function Convert_Spread_to_Probability( $a ) { if( $a == 0) { return 0.0; } else if ( $a > 0 ) { return ( 100.0 / ( $a + 100.0) ); } else { return ( $a * -1.0)/ ((-1.0) * ($a + 100.0)); } }; function Convert_Probability_to_Spread( $a ) { //$a = (double) $a; $temp_int = 0; $temp_double = 0; $temp_double2 = 0; if( $a == 0.5 ) { return 100; } else if( $a > 0.5 ) /*negative spread*/ { return (int) ((100.0 * $a) / ($a-1)); } else /*positive spread*/ { $temp_double = 1 - $a; $temp_double2 = $temp_double/$a; $temp_double2 *= 100; return (int) $temp_double2; } return 0; } /* conversion_types 1- RL to ML, 2- ML to RL */ /* isHome... TRUE - HOME..... FALSE- ROAD */ /* Curr_Spread... spread to be converted */ define ("HOME_RL_WIN_PERCENTAGE_GIVEN_SUW", 0.6857); define ("ROAD_RL_WIN_PERCENTAGE_GIVEN_SUW", 0.7683); function MoneyLine_RunLine_Conversion_Function( $Conversion_Type, $isHome, $Curr_Spread ) { $temp_double1 = 0.0; $temp_double2 = 0.0; $temp_int1 = 0; $temp_int2 = 0; switch( $Conversion_Type ) { case 1: if( $isHome == "TRUE" ) { /* Home Team - Convert Runline to Moneyline */ $temp_double1 = Convert_Spread_to_Probability( $Curr_Spread ); $temp_double1 /= HOME_RL_WIN_PERCENTAGE_GIVEN_SUW; $temp_int1 = Convert_Probability_to_Spread( $temp_double1 ); return (int) $temp_int1; } else { /* Road Team - Convert Runline to Moneyline */ $temp_double1 = Convert_Spread_to_Probability( $Curr_Spread ); $temp_double1 /= ROAD_RL_WIN_PERCENTAGE_GIVEN_SUW; $temp_int1 = Convert_Probability_to_Spread( $temp_double1 ); return (int) $temp_int1; } break; case 2: if( $isHome == "TRUE" ) { /* Home Team - Convert Moneyline to Runline */ $temp_double1 = Convert_Spread_to_Probability( $Curr_Spread ); if( $Curr_Spread > 0) { $temp_double1 /= HOME_RL_WIN_PERCENTAGE_GIVEN_SUW; // printf( "temp_double1 = %f\n", temp_double1); } else { $temp_double1 *= HOME_RL_WIN_PERCENTAGE_GIVEN_SUW; // printf( "temp_double1 = %f\n", temp_double1); } $temp_int1 = Convert_Probability_to_Spread( $temp_double1 ); return (int) $temp_int1; } else { /* Road Team - Convert Moneyline to Runline */ $temp_double1 = Convert_Spread_to_Probability( $Curr_Spread ); if( $Curr_Spread > 0) { $temp_double1 /= ROAD_RL_WIN_PERCENTAGE_GIVEN_SUW; //printf( "temp_double1 = %f\n", temp_double1); } else { $temp_double1 *= ROAD_RL_WIN_PERCENTAGE_GIVEN_SUW; // printf( "temp_double1 = %f\n", temp_double1); } $temp_int1 = Convert_Probability_to_Spread( $temp_double1 ); return (int) $temp_int1; } return 0; break; }; } $input_failed = "FALSE"; if ($money_line >= 100 || $money_line < -100){ $runline = MoneyLine_RunLine_Conversion_Function(2, $status, $money_line ); } else { $input_failed = "TRUE"; }; ?>
Documented #1 Free Baseball Handicapping Service - (310) 922-7443 |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Easy Baseball Betting | Free Baseball Betting Picks | Baseball Betting Systems | MLB Baseball Odds | Articles on Baseball | Betting Sites | Sportsbooks | Contact Copyright (c) 2005-2009 EasyBaseBallBetting.com. All rights reserved. |