<commit_before>package trueskill

import "strconv"

// Player is a struct that reflects one contestant in a game. The skill level
// is assumed to be bell shaped (normal or Gaussian distributed) with a peak
// point µ (mu) and a spread σ (sigma). The actual skill of the player is
// therefore assumed to be within µ +/- 3σ with 99.7% accuracy.
type Player struct {
	id uint
	g  Gaussian
}

// NewDefaultPlayer creates and returns a Player with default values for skill
// estimation.
func NewDefaultPlayer(id uint) Player {
	return Player{
		id: id,
		g:  NewGaussian(DefMu, DefSig),
	}
}

// NewPlayer creates and returns a Player with a specified skill level.
func NewPlayer(id uint, mu, sigma float64) Player {
	return Player{
		id: id,
		g:  NewGaussian(mu, sigma),
	}
}

// GetGaussian returns the Gaussian associated with the players skill.
func (p *Player) GetGaussian() Gaussian {
	return p.g
}

// GetID returns the ID of the player
func (p *Player) GetID() uint {
	return p.id
}

// UpdateSkill updates the skill rating of player to the provided Gaussian.
func (p *Player) UpdateSkill(g Gaussian) {
	p.g = g
	return
}

func (p *Player) String() (s string) {
	g := p.GetGaussian()

	s = "Player [" + string(p.id)
	s += "] Skill-Estimate:"
	s += strconv.FormatFloat(g.GetConservativeEstimate(), 'f', 3, 64)
	s += " (mu: " + strconv.FormatFloat(g.GetMu(), 'f', 3, 64)
	s += " sig: " + strconv.FormatFloat(g.GetSigma(), 'f', 3, 64)
	s += ")"
	return
}<commit_msg>Added convenience functions to Player<commit_after>package trueskill

import "strconv"

// Player is a struct that reflects one contestant in a game. The skill level
// is assumed to be bell shaped (normal or Gaussian distributed) with a peak
// point µ (mu) and a spread σ (sigma). The actual skill of the player is
// therefore assumed to be within µ +/- 3σ with 99.7% accuracy.
type Player struct {
	id uint
	g  Gaussian
}

// NewDefaultPlayer creates and returns a Player with default values for skill
// estimation.
func NewDefaultPlayer(id uint) Player {
	return Player{
		id: id,
		g:  NewGaussian(DefMu, DefSig),
	}
}

// NewPlayer creates and returns a Player with a specified skill level.
func NewPlayer(id uint, mu, sigma float64) Player {
	return Player{
		id: id,
		g:  NewGaussian(mu, sigma),
	}
}

// GetGaussian returns the Gaussian associated with the players skill.
func (p *Player) GetGaussian() Gaussian {
	return p.g
}

// GetID returns the ID of the player
func (p *Player) GetID() uint {
	return p.id
}

// UpdateSkill updates the skill rating of player to the provided Gaussian.
func (p *Player) UpdateSkill(g Gaussian) {
	p.g = g
	return
}

// GetMu is a convenience wrapper for Gaussian.GetMu()
func (p *Player) GetMu() float64 {
	return p.g.GetMu()
}

// GetSigma is a convenience wrapper for Gaussian.GetSigma()
func (p *Player) GetSigma() float64 {
	return p.g.GetSigma()
}

func (p *Player) String() (s string) {
	g := p.GetGaussian()

	s = "Player [" + string(p.id)
	s += "] Skill-Estimate:"
	s += strconv.FormatFloat(g.GetConservativeEstimate(), 'f', 3, 64)
	s += " (mu: " + strconv.FormatFloat(g.GetMu(), 'f', 3, 64)
	s += " sig: " + strconv.FormatFloat(g.GetSigma(), 'f', 3, 64)
	s += ")"
	return
}
{'fraction_non_alphanumeric': 0.12242348532167395, 'fraction_numerical': 0.010618363522798251, 'mean_word_length': 3.675912408759124, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6901419', 'n_tokens_mistral': 1111, 'n_tokens_neox': 1047, 'n_words': 416}