Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

github.com/mashiike/rating

Package Overview
Dependencies
Alerts
File Explorer
Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

github.com/mashiike/rating

  • v0.5.1
  • Source
  • Go
  • Socket score

Version published
Created
Source

rating

GoDoc Go Report Card Test

Usage: basic

This is the Go implementation of Gliko2 Rating In a simple use case we use as follows

Import the package

import "github.com/mashiike/rating"

Batch by Rating Period.

At the end of each rating period, it reflects the results of the game played in that period.

player := rating.New(1500.0, 200.0, 0.06)
opponents := []rating.Rating{
	rating.New(1400.0, 30.0, 0.06),
	rating.New(1550.0, 100.0, 0.06),
	rating.New(1700.0, 300.0, 0.06),
}
scores := []float64{
	rating.ScoreWin,
	rating.ScoreLose,
	rating.ScoreLose,
}
updated, _ := player.Update(opponents, scores, 0.5)

Sequentially for each game

Use Esteminated struct as follows. Then save the information in a database or file system etc.

player := rating.New(1500.0, 200.0, 0.06)
e := rating.NewEstimated(r)
opponent := rating.New(1400.0, 30.0, 0.06)
err := e.ApplyMatch(opponent, rating.ScoreWin)
//when the rating period is over
err = e.Fix(0.5)
updated := e.Fixed

Usage: use rating util GoDoc

svc := ratingutil.New(ratingutil.NewConfig())
team1 := svc.NewTeam(
	"bovidae",
	ratingutil.Players{
		svc.NewPlayer(
			"sheep",
			rating.New(1700.0, 50.0, svc.Config.InitialVolatility()),
			svc.Config.Now(),
		),
		svc.NewDefaultPlayer("goat"),
	},
)
team2 := svc.NewTeam(
	"equidae",
	ratingutil.Players{
		svc.NewPlayer(
			"donkey",
			rating.New(1400.0, 50.0, svc.Config.InitialVolatility()),
			svc.Config.Now(),
		),
		svc.NewDefaultPlayer("zebra"),
	},
)
match, _ := svc.NewMatch(team1, team2)
match.Add(team1, 1.0)
match.Add(team2, 0.0)
err := svc.Apply(match)

FAQs

Package last updated on 30 Nov 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc