lsv/fussball-elo

足球 Elo 排名,包含净胜球

2.0 2016-12-05 10:33 UTC

This package is auto-updated.

Last update: 2024-08-27 22:43:56 UTC


README

足球 Elo 排名 – Build Status codecov SensioLabsInsight StyleCI

=================

Elo 排名计算器,包含净胜球

安装

composer require lsv/fossball-elo

或将它添加到您的 composer.json 文件中

"require": {
    "lsv/fossball-elo": "^2.0"
}

用法

$hometeam_oldRating = 200;
$awayteam_oldRating = 280;

$hometeam_score = 3;
$awayteam_score = 2;

$factor = 20; // Tournament factor
// Normally these are used
// 60 - World Cup
// 50 - Continental Championship and Intercontinental Tournaments
// 40 - World Cup and Continental qualifiers and major tournaments
// 30 - All other tournaments
// 20 - Friendly Matches

use Lsv\FussballElo\Calculator;

$calculator = new Calculator(false);
// Change false to true if you want to give the hometeam a home advance

$ratings = $calculator->getRatings(
    $hometeam_oldRating,
    $awayteam_oldRating,
    $hometeam_score,
    $awayteam_score,
    $factor
);
// $ratings is now a instance of Lsv\FussballElo\Model\Result

$hometeam = $ratings->getHomeTeam();
$awayteam = $ratings->getAwayTeam();

$hometeam->getPointChange(); // Point change in this match for home team
$hometeam->getRating(); // New rating for home team

$awayteam->getPointChange(); // Point change in this match for away team
$awayteam->getRating(); // New rating for away team

也可以仅获取获胜期望值

$calculator = new Calculator(false);
// Change false to true if you want to give the hometeam a home advance
$resullt = $calculator->getWinExpectancies($hometeam_oldRating, $awayteam_oldRating);
$hometeam = $result->getHomeTeam();
// $hometeam is now a instance of Lsv\FussballElo\Model\TeamWinExpectancies
$awayteam = $result->getAwayTeam();

$hometeam->getWinExpectancies();
// 0.613
$awayteam->getWinExpectancies();
// 0.387

$hometeam->getWinExpectanciesInPercent(1);
// 1 = Number of digits
// 61.3

$awayteam->getWinExpectanciesInPercent(0);
// 39

版本

2.*
  • 使用 eloratings.net 公式
  • 可以使用主场优势
1.*
  • 使用维基百科的 Elo 公式

许可证

MIT 许可证 (MIT)

版权所有 (c) 2016 Martin Aarhof martin.aarhof@gmail.com

在此,免费向任何获得此软件及其相关文档副本(“软件”)的个人授予在此软件上不受限制的处理权限,包括但不限于使用、复制、修改、合并、发布、分发、再许可和/或出售软件副本的权利,并允许向软件提供者提供软件的个人以此类方式行事,但受以下条件的约束

上述版权声明和本许可声明应包含在软件的所有副本或主要部分中。

本软件按“现状”提供,不提供任何明示或暗示的保证,包括但不限于适销性、针对特定目的的适用性和非侵权性。在任何情况下,作者或版权所有者均不对任何索赔、损害或其他责任承担责任,无论该责任是因合同、侵权或其他原因引起的,与软件或其使用或与其他软件一起使用有关。