Advertisement
Guest User

Untitled

a guest
May 4th, 2016
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.62 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($grater_coef_key == 1){
  34. $c1 = $grater_coef;
  35. $c2 = 1/(1.11-(1/$c1));
  36. }else if($grater_coef_key == 2){
  37. $c2 = $grater_coef;
  38. $c1 = 1/(1.11-(1/$c2));
  39. }
  40.  
  41. if(strtolower($this->type) == "bo1"){
  42. $max_grater_coef = 3.679;
  43. }else{
  44. $max_grater_coef = 4.6;
  45. }
  46. // else if($hours_to_start >= 4){
  47. // $max_grater_coef = 3.705;
  48. // }else if($hours_to_start < 4 && $hours_to_start >= 2){
  49. // $max_grater_coef = 4.237;
  50. // }else if($hours_to_start < 2){
  51. // $max_grater_coef = 4.6;
  52. // }else if($this->i <= 36){
  53. // $max_grater_coef = 3.616;
  54. // }
  55.  
  56. $grater_coef_key = $this->getGraterCoefKey($c1, $c2);
  57.  
  58. if($grater_coef_key == 1){
  59. if($c1 >= $max_grater_coef){
  60. $c1 = $max_grater_coef;
  61. $c2 = 1/(1.11-(1/$c1));
  62. }
  63. }else if($grater_coef_key == 2){
  64. if($c2 >= $max_grater_coef){
  65. $c2 = $max_grater_coef;
  66. $c1 = 1/(1.11-(1/$c2));
  67. }
  68. }
  69.  
  70. return [
  71. 'c1' => $c1,
  72. 'c2' => $c2
  73. ];
  74. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement