https://github.com/nicolasbrugneaux/elo-js
Elo algorithm implementation in JS.
https://github.com/nicolasbrugneaux/elo-js
chess elo elo-js javascript
Last synced: 6 months ago
JSON representation
Elo algorithm implementation in JS.
- Host: GitHub
- URL: https://github.com/nicolasbrugneaux/elo-js
- Owner: nicolasbrugneaux
- Created: 2014-10-25T10:20:35.000Z (almost 11 years ago)
- Default Branch: master
- Last Pushed: 2015-05-06T18:18:10.000Z (over 10 years ago)
- Last Synced: 2024-10-22T10:53:14.676Z (12 months ago)
- Topics: chess, elo, elo-js, javascript
- Language: JavaScript
- Homepage: http://nicolasbrugneaux.github.io/elo-js
- Size: 262 KB
- Stars: 18
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Elo-js [](https://travis-ci.org/nicolasbrugneaux/elo-js)[](https://www.omniref.com/js/npm/elo-js)
This is a small implemention of the [Elo system](http://en.wikipedia.org/wiki/Elo_rating_system). Based on wikipeda's information.
Trying to use ES6 features such as class to be fancy.
## Installation
```
npm install elo-js
```## Usage
#### Browser
requireJS and browserify compatible.
```html
var elo = new Elo();
var player1Rating = 1200;
var player2Rating = 1250;var newPlayer1Rating = elo.ifWins( player1Rating, player2Rating );
newPlayer1Rating = elo.ifLoses( player1Rating, player2Rating );
newPlayer1Rating = elo.ifTies( player1Rating, player2Rating );```
#### Node
```js
var Elo = require( 'elo-js' );
var elo = new Elo();var player1Rating = 1200;
var player2Rating = 1250;var newPlayer1Rating = elo.ifWins( player1Rating, player2Rating );
newPlayer1Rating = elo.ifLoses( player1Rating, player2Rating );
newPlayer1Rating = elo.ifTies( player1Rating, player2Rating );
```## Contribute
Any idea, remarks? Fill an issue, drop a mail, feel free! :heart:
## Build from source
```sh
git clone https://github.com/nicolasbrugneaux/elo-js.git
cd elo-js
npm install
gulp # watch src and runs tests
```