elo

package module
v0.0.0-...-11597b5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 9, 2019 License: GPL-3.0 Imports: 1 Imported by: 1

README

elo

Documentation

An elo rating library implemented in Go. This library can be used to manage ratings for, e.g., a sports conference, gaming, etc., as well as to predict match outcomes based on the ratings of the players.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExpectedScore

func ExpectedScore(ratingA, ratingB int) float64

ExpectedScore returns the expected score (chance of winning) of Player A. The expected score of Player B is 1 - ExpectedScore(ratingA, ratingB). This function can be used to predict matchups without alone. Equation: ExpectedScoreA = 1 / (1 + 10^{(ratingB - ratingA)/deviation}).

Types

type Match

type Match struct {
	W, L *Player
	Draw bool
}

Match contains two *Players: w is the winner, l is the loser. If draw is set, the order of *Players doesn't matter.

func (*Match) Play

func (m *Match) Play()

Play updates the ratings based on the match results by modifying the Players referenced by m.

type Player

type Player struct {
	Rating int
}

Player contains the Player's rating. Using a struct to support the future addition of other information.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL