GithubHelp home page GithubHelp logo

pavadik / trueskill Goto Github PK

View Code? Open in Web Editor NEW

This project forked from izaakschroeder/trueskill

0.0 0.0 0.0 148 KB

TrueSkill compatible ranking system.

Home Page: http://izaakschroeder.github.io/trueskill/

License: Creative Commons Zero v1.0 Universal

JavaScript 100.00%

trueskill's Introduction

TrueSkill

A purely functional implementation of a TrueSkill-compatible ranking system compatible with your web browser and nodejs.

Build Status

npm install com.izaakschroeder.trueskill

Usage

Examples can be found in the examples folder.

var 
	//Create TrueSkill instance with default parameters
	trueSkill = require('com.izaakschroeder.trueskill').create(),
	//Create some players
	players = [ { 
		name: 'Justin', 
		rating: trueSkill.createRating() 
	}, { 
		name: 'James',
		rating: trueSkill.createRating()
	} ];

//Play a single match and update the player ratings
function playMatch(results) {
	//Get the new ratings by creating one player teams for each player
	newRatings = trueSkill.update(players.map(function(player) { return [player.rating]; }), results);
	//Update the player's rating
	players.forEach(function(player, i) {
		player.rating = newRatings[i][0];
	});
}

//Show initial ratings
console.log('Initial ratings: Justin = '+players[0].rating.mu+', James = '+players[1].rating.mu);

//Play some games
playMatch([1,0]); //James wins
playMatch([0,1]); //Justin wins
playMatch([1,0]); //James wins
playMatch([1,0]); //James wins

//Show final ratings
console.log('Final ratings: Justin = '+players[0].rating.mu+', James = '+players[1].rating.mu);

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.