glicko2

package
v0.0.8-tcp Latest Latest
Warning

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

Go to latest
Published: Aug 12, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Configer

type Configer struct {
	Glicko2 config.Glicko2
}

type Funcs

type Funcs struct {
	ArgsFunc          func() *glicko2.QueueArgs
	NewTeamFunc       func(group glicko2.Group) glicko2.Team
	NewRoomFunc       func(team glicko2.Team) glicko2.Room
	NewRoomWithAIFunc func(team glicko2.Team) glicko2.Room
}

Funcs is the funcs needed for glicko2 matcher.

type Matcher

type Matcher struct {

	// for debug
	ErrCount  int
	RoomCount atomic.Int64
	// contains filtered or unexported fields
}

Matcher is the glicko2 matcher.

func New

func New(
	roomChannelToService chan entry.Room,
	configer *Configer, matchInterval time.Duration,
	playerMgr *repository.PlayerMgr, groupMgr *repository.GroupMgr,
	teamMgr *repository.TeamMgr, roomMgr *repository.RoomMgr,
) *Matcher

New returns the new glicko2 matcher, and start it.

func (*Matcher) AddMode

func (m *Matcher) AddMode(mode constant.GameMode, funcs *Funcs)

AddMode adds the funcs of the given mode.

func (*Matcher) GetFuncs

func (m *Matcher) GetFuncs(mode constant.GameMode) *Funcs

GetFuncs returns the funcs of the given mode.

func (*Matcher) GetMatcher

func (m *Matcher) GetMatcher(key string) *glicko2.Matcher

GetMatcher returns the matcher of the given key.

func (*Matcher) Lock

func (m *Matcher) Lock()

func (*Matcher) Match

func (m *Matcher) Match(g glicko2.Group)

func (*Matcher) NewMatcher

func (m *Matcher) NewMatcher(
	key string,
	argsFunc func() *glicko2.QueueArgs,
	newTeamFunc func(group glicko2.Group) glicko2.Team,
	newRoomFunc, newRoomWithAIFunc func(team glicko2.Team) glicko2.Room,
) (matcher *glicko2.Matcher, err error)

NewMatcher returns the new matcher of the given key, if the key exists, it will return the existing one. `key` is used to separate different matching groups.

func (*Matcher) RLock

func (m *Matcher) RLock()

func (*Matcher) RUnlock

func (m *Matcher) RUnlock()

func (*Matcher) Stop

func (m *Matcher) Stop()

Stop stops all matchers.

func (*Matcher) Unlock

func (m *Matcher) Unlock()

Jump to

Keyboard shortcuts

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