承接 lindelius/php-fide 相关项目开发

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

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

lindelius/php-fide

Composer 安装命令:

composer require lindelius/php-fide

包简介

A zero-dependency PHP implementation of the FIDE Rating System.

README 文档

README

CircleCI

A zero-dependency PHP implementation of the FIDE Rating System.

Requirements

  • PHP 8.1, or higher

Installation

If you are using Composer, you may install the latest version of this library by running the following command from your project's root folder:

composer require lindelius/php-fide

You may also manually download the library by navigating to the "Releases" page and then expanding the "Assets" section of the latest release.

Usage

Step 1. Implement the Lindelius\FIDE\ContestantInterface interface in your contestant entity model (the object holding rating information about a given contestant in a given competition).

use Lindelius\FIDE\ContestantInterface;

final class MyContestant implements ContestantInterface
{
    private int $highestRating;
    private int $matchesPlayed;
    private int $rating;
    
    // ...

    public function getCurrentRating(): int
    {
        return $this->rating;
    }

    public function getHighestRating(): int
    {
        return $this->highestRating;
    }

    public function getTotalMatchesPlayed(): int
    {
        return $this->matchesPlayed;
    }
}

Step 2. Use the appropriate Lindelius\FIDE\RatingSystemInterface method(s) to calculate the new ratings for the contestants after each match. Please note that all available methods return the new rating for the contestant, and not just the rating change.

For matches with a winner, you will want to use the calculateRatingAfterWin() and calculateRatingAfterLoss() methods.

$newRatingForWinner = $ratingSystem->calculateRatingAfterWin($winner, $loser);
$newRatingForLoser = $ratingSystem->calculateRatingAfterLoss($loser, $winner);

And for matches that end in a draw, you will want to use the calculateRatingAfterDraw() method.

$newRatingForContestant = $ratingSystem->calculateRatingAfterDraw($contestant, $opponent);
$newRatingForOpponent = $ratingSystem->calculateRatingAfterDraw($opponent, $contestant);

Benchmarking

This library is using PHPBench for benchmarking.

You can benchmark the library on your own system by running the following command from the library's root folder:

./vendor/bin/phpbench run --report=default

统计信息

  • 总下载量: 29
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 6
  • 点击次数: 2
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

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

其他信息

  • 授权协议: Apache-2.0
  • 更新时间: 2017-05-13

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固