Beispiel #1
0
func (mp *MatchmakerParticipant) Quality(opponent *MatchmakerParticipant) float64 {
	teams := []skills.Team{mp.team, opponent.team}
	var calc trueskill.TwoPlayerCalc
	quality := calc.CalcMatchQual(skills.DefaultGameInfo, teams)

	return quality
}
Beispiel #2
0
func calculateNewRating(winnerId, loserId int64, winnerRating, winnerStdDev, loserRating, loserStdDev float64) (winnerNewRating, winnerNewStdDev, loserNewRating, loserNewStdDev, quality float64) {
	team1 := skills.NewTeam()
	team2 := skills.NewTeam()

	team1.AddPlayer(winnerId, skills.NewRating(winnerRating, winnerStdDev))
	team2.AddPlayer(loserId, skills.NewRating(loserRating, loserStdDev))

	teams := []skills.Team{team1, team2}

	var calc trueskill.TwoPlayerCalc
	ratings := calc.CalcNewRatings(skills.DefaultGameInfo, teams, 1, 2)
	quality = calc.CalcMatchQual(skills.DefaultGameInfo, teams)

	return ratings[winnerId].Mean(), ratings[winnerId].Stddev(), ratings[loserId].Mean(), ratings[loserId].Stddev(), quality
}