Skip to content

Commit

Permalink
added const for WIN, DRAW and LOST values, update readme.
Browse files Browse the repository at this point in the history
  • Loading branch information
Sysix committed Jun 23, 2017
1 parent aa2cb1e commit 1cbe069
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 2 additions & 2 deletions README.md
Expand Up @@ -10,14 +10,14 @@ A PHP class which implements the [Elo rating system](http://en.wikipedia.org/wik
// player A lost
// player B win

$rating = new Rating(1000, 2000, 0, 1);
$rating = new Rating(1000, 2000, Rating::LOST, Rating::WIN);

// player A elo = 1000
// player B elo = 2000
// player A draw
// player B draw

$rating = new Rating(1000, 2000, .5, .5);
$rating = new Rating(1000, 2000, Rating::DRAW, Rating::DRAW);

$results = $rating->getNewRatings();

Expand Down
4 changes: 4 additions & 0 deletions src/Rating/Rating.php
Expand Up @@ -18,6 +18,10 @@ class Rating
*/
const KFACTOR = 16;

const WIN = 1;
const DRAW = 0.5;
const LOST = 0;

/**
* Protected & private variables.
*/
Expand Down

0 comments on commit 1cbe069

Please sign in to comment.