Documentation
¶
Overview ¶
Package memorymatch provides a channel-based matchmaking system for player pairing.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type MemoryMatchClient ¶
type MemoryMatchClient struct {
// contains filtered or unexported fields
}
MemoryMatchClient implements thread-safe channel-based player matching.
func NewMemoryMatchClient ¶
func NewMemoryMatchClient() *MemoryMatchClient
NewMemoryMatchClient returns an initialized MemoryMatchClient.
func (*MemoryMatchClient) RequestMatch ¶
func (m *MemoryMatchClient) RequestMatch(ctx context.Context, playerID string, gameID string) (<-chan []string, error)
RequestMatch implements the channel-based matchmaking system:
- If queue is empty, creates a new connection and returns nil (player has a channel)
- If queue has players, finds a matching player and returns MatchFound with a channel
- If matching fails, player is requeued
type PlayerConnection ¶
PlayerConnection encapsulates player data and channel for communication.
Click to show internal directories.
Click to hide internal directories.