Last active
November 26, 2018 20:13
-
-
Save BriceShatzer/55e0028cb07d074672ea7a431683f81c to your computer and use it in GitHub Desktop.
Team Lunch - Chess ELO
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const EloCalc = require('elo-calculator'); | |
const elo = new EloCalc({}); | |
// let names = [ | |
// 'Brice Shatzer', | |
// 'Bryce Dorn', | |
// 'Danny Cheng', | |
// 'Jamie Levinson', | |
// 'Joe Duran', | |
// 'Mike Parent', | |
// ]; | |
// let players = {} | |
// playerNames.forEach(function(player) { | |
// players[player] = elo.createPlayer(); | |
// }); | |
const Brice_Shatzer = elo.createPlayer(); | |
Brice_Shatzer.name = 'Brice Shatzer'; | |
const Bryce_Dorn = elo.createPlayer(); | |
Bryce_Dorn.name = 'Bryce Dorn' | |
const Danny_Cheng = elo.createPlayer(); | |
Danny_Cheng.name = 'Danny Cheng'; | |
const Jamie_Levinson = elo.createPlayer(); | |
Jamie_Levinson.name = 'Jamie Levinson'; | |
const Joe_Duran = elo.createPlayer(); | |
Joe_Duran.name = 'Joe Duran'; | |
const Mike_Parent = elo.createPlayer(); | |
Mike_Parent.name = 'Mike Parent'; | |
elo.updateRatings([ | |
[Brice_Shatzer, Bryce_Dorn, 1], // Brice_Shatzer wins | |
[Brice_Shatzer, Bryce_Dorn, 0], // Brice_Shatzer loses | |
[Brice_Shatzer, Danny_Cheng, 1], | |
[Jamie_Levinson, Mike_Parent, 0] | |
// [player2, player3, .5] // Player 2 and player 3 draws the game | |
]); | |
elo.players.forEach(function(player, i) { | |
console.log(`${player.name} has played ${player.numberOfGamesPlayed} games and has a rating of ${Math.round(player.rating)}`); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"requires": true, | |
"lockfileVersion": 1, | |
"dependencies": { | |
"elo-calculator": { | |
"version": "1.0.1", | |
"resolved": "https://registry.npmjs.org/elo-calculator/-/elo-calculator-1.0.1.tgz", | |
"integrity": "sha1-LTLtpwAD0BJNNcYmAbMVP4c3dDk=" | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"main": "index.js", | |
"dependencies": { | |
"elo-calculator": "1.0.1" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment