2017 © Pedro Peláez
 

library php-fide

PHP implementation of the FIDE Rating System

image

lindelius/php-fide

PHP implementation of the FIDE Rating System

  • Wednesday, September 27, 2017
  • by lindelius
  • Repository
  • 1 Watchers
  • 0 Stars
  • 5 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 0 % Grown

The README.md

php-fide

CircleCI, (*1)

A zero-dependency PHP implementation of the FIDE Rating System., (*2)

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:, (*3)

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., (*4)

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)., (*5)

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., (*6)

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

$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., (*8)

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

Benchmarking

This library is using PHPBench for benchmarking., (*9)

You can benchmark the library on your own system by running the following command from the library's root folder:, (*10)

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

The Versions

27/09 2017

dev-master

9999999-dev https://github.com/lindelius/fide

PHP implementation of the FIDE Rating System

  Sources   Download

Apache-2.0

The Requires

  • php ^5.6 || ^7.0

 

The Development Requires

by Tom Lindelius

helpers php tournament rating elo ladder fide

13/05 2017

0.1

0.1.0.0 https://github.com/lindelius/fide

PHP implementation of the FIDE Rating System

  Sources   Download

Apache-2.0

The Requires

  • php ^5.6 || ^7.0

 

The Development Requires

by Tom Lindelius

helpers php tournament rating elo ladder fide