Advertisement
Guest User

Untitled

a guest
May 4th, 2016
50
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.39 KB | None | 0 0
  1. public function cutCoefs($c1, $c2)
  2. {
  3. //При подсчете кофов, Больший коф умножается на 0.93, если он больше 2.16. После чего идет ограничение:
  4. //
  5. //если до начала матча больше 4 часов, макс.коф = 3,505
  6. //От 2 до 4 часов до начала матча, макс коф = 3,837
  7. //меньше 2 часов макс коф 4.5
  8. //
  9. //И в любом случае, если у матча итераций меньше 36, то макс коф = 3,516
  10. //Также в любом случае, когда БО1 макс коф = 3.379
  11. $grater_coef_key = $this->getGraterCoefKey($c1, $c2);
  12. $hours_to_start = $this->getHoursToStart();
  13.  
  14. if(!$grater_coef_key)return false;
  15.  
  16. if($grater_coef_key == 1){
  17. $grater_coef = $c1;
  18. }elseif($grater_coef_key == 2){
  19. $grater_coef = $c2;
  20. }
  21.  
  22. // if($grater_coef > 2.16){
  23. // $grater_coef = $grater_coef * 0.965;
  24. // if($grater_coef_key == 1){
  25. // $c1 = $grater_coef;
  26. // $c2 = 1/(1.11-(1/$c1));
  27. // }else if($grater_coef_key == 2){
  28. // $c2 = $grater_coef;
  29. // $c1 = 1/(1.11-(1/$c2));
  30. // }
  31. // }
  32.  
  33. if(strtolower($this->type) == "bo1"){
  34. $max_grater_coef = 3.679;
  35. }else{
  36. $max_grater_coef = 4.6;
  37. }
  38. // else if($hours_to_start >= 4){
  39. // $max_grater_coef = 3.705;
  40. // }else if($hours_to_start < 4 && $hours_to_start >= 2){
  41. // $max_grater_coef = 4.237;
  42. // }else if($hours_to_start < 2){
  43. // $max_grater_coef = 4.6;
  44. // }else if($this->i <= 36){
  45. // $max_grater_coef = 3.616;
  46. // }
  47.  
  48. $grater_coef_key = $this->getGraterCoefKey($c1, $c2);
  49.  
  50. if($grater_coef_key == 1){
  51. if($c1 > $max_grater_coef){
  52. $c1 = $max_grater_coef;
  53. $c2 = 1/(1.11-(1/$c1));
  54. }
  55. }else if($grater_coef_key == 2){
  56. if($c2 > $max_grater_coef){
  57. $c2 = $max_grater_coef;
  58. $c1 = 1/(1.11-(1/$c2));
  59. }
  60. }
  61.  
  62. return [
  63. 'c1' => $c1,
  64. 'c2' => $c2
  65. ];
  66. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement