承接 alcalyn/elo 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

alcalyn/elo

Composer 安装命令:

composer require alcalyn/elo

包简介

Elo system with a reliability purpose

关键字:

README 文档

README

Another Elo implementation in PHP ! But this one introduce a reliability purpose.

Scrutinizer Code Quality Build Status License

Reliability purpose

A history: You have a good player A which played many games and have a score of 2100 Elo. A new player B subscribe to the game website, so his Elo score is initialized to 1500. But in fact, he is a very good player, better than A, and beat him like crushing an ant.

The problem: New player B will win many Elo because he won against a 2100 Elo player. That's ok. But player A (2100 Elo) will lose many Elo because he lost against a 1500 Elo player, but in fact strongest.

The fact is that the new player Elo score is not reliable, so it should not impact others players Elo scores.

The solution: This library. It introduces a reliability coefficient (decimal between 0.0 and 1.0) for Elo A and Elo B.

Composer

Install via composer

{
    "require": {
        "alcalyn/elo": "1.x"
    }
}

Or download the library manually if you don't use composer.

Usage

  • Instantiate a standard Elo system
use Alcalyn/Elo/EloSystem;

$eloSystem = new EloSystem();
  • Calculate updated Elo scores from old Elo
/**
 * A player with 1650 Elo beat another with 1920
 */
$updatedElos = $eloSystem->calculate(1650, 1920, 1);

print_r($updatedElos);
/* Output:
    Array
    (
        [0] => 1663.2084157978
        [1] => 1906.7915842022
    )
*/
  • Set reliability coefficient to Elo scores
/**
 * A player with 1907 Elo (1.0 reliability)
 * lose against a new player with 1500 (and reliability to 0.0)
 */
$updatedElos = $eloSystem->calculate(1907, 1500, 0, 1.0, 0.0);

print_r($updatedElos);
/* Output:
Array
(
    [0] => 1907
    [1] => 1514.5978664353
)
*/
  • Using method aliases for win, lose or draw
/**
 * Method Aliases
 */
$elo->win(2100, 1500, 1.0, 0.0);
$elo->lose(2100, 1500, 1.0, 0.0);
$elo->draw(2100, 1500, 1.0, 0.0);
  • Instanciate a system with a different K factor (default is 16)
/**
 * Use a different K factor in your Elo system
 */
$eloSystemK32 = new EloSystem(32);

Detailled examples

A new player:

Player A has 2100 Elo, reliability 1.0
Player B has 1500 Elo, reliability 0.0

A wins: Expected result, so B loses a small amount of Elo, and A win nothing.
B wins: NOT expected result, so B wins a BIG amount of Elo, and A lose nothing.

A Elo score will not be updated when he plays versus a new player with an unreliable Elo score.

(And new player B should have its Elo reliability increased by something like 1/10 after every games until his reliability reaches 1)

$elo = new EloSystem();

/**
 * Result without reliability
 */
print_r($elo->lose(2100, 1500));

/* Output:
    Array
    (
        [0] => 2084.4904548805 // lose -16 Elo
        [1] => 1515.5095451195 // win  +16 Elo
    )
*/

/**
 * Result with reliability
 */
print_r($elo->lose(2100, 1500, 1.0, 0.0));

/* Output:
    Array
    (
        [0] => 2100 // don't lose Elo against new player
        [1] => 1515.5095451195 // win +16 Elo vs reliable Elo score
    )
*/

Another example: two newbies players:

Player A has 1500 Elo, reliability 0.0
Player B has 1500 Elo, reliability 0.0

There is two new players, so their reliabilities are both 0.0: the algorithm takes them like if they were both 1.0.

And if player A had an Elo reliability equal to 0.4, and player B equal to 0.0, the algorithm adds them +0.6 so one of reliabilities reaches 1.0.

License

This project is under MIT Lisense

alcalyn/elo 适用场景与选型建议

alcalyn/elo 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 647 次下载、GitHub Stars 达 6, 最近一次更新时间为 2014 年 11 月 25 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「php」 「elo」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 alcalyn/elo 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 alcalyn/elo 我们能提供哪些服务?
定制开发 / 二次开发

基于 alcalyn/elo 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 647
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 7
  • 点击次数: 11
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 6
  • Watchers: 1
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2014-11-25