Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AreEnemyFunc ¶
AreEnemyFunc is a function that checks if two members are enemies.
Parameters:
- m1: The first member.
- m2: The second member.
Returns:
- bool: True if the members are enemies, false otherwise.
- error: An error if the members are not valid.
type FilterFn ¶
FilterFn is a filter function.
Parameters:
- league: The league to filter.
Returns:
- bool: True if the league should be kept, false otherwise.
func WithNTeams ¶
WithNTeams returns a filter function that keeps only the specified number of teams.
Parameters:
- n: The number of teams to keep.
Returns:
- FilterFn: The filter function.
type League ¶
League is a collection of teams.
func EvaluateTeams ¶
func EvaluateTeams[T interface {
Equals(other T) bool
}](members []T, enemy_fn AreEnemyFunc[T]) ([]League[T], error)
EvaluateTeams evaluates the teams.
Parameters:
- members: the list of members to evaluate.
- enemy_fn: the function to use to check for enemies.
Returns:
- []League[T]: the list of teams. Never returns nil.
- error: an error if the evaluation fails.
func FilterSolutions ¶
func FilterSolutions[T interface {
Equals(other T) bool
}](res []League[T], filter FilterFn[T]) []League[T]
FilterSolutions filters solutions based on a filter function.
Parameters:
- res: The solutions to filter.
- filter: The filter function.
Returns:
- []League: The filtered solutions.
func (League[T]) ContainsTeam ¶
ContainsTeam checks whether the league contains a team.
Parameters:
- team: The team to check.
Returns:
- bool: True if the league contains the team, false otherwise.
type Team ¶
type Team[T interface {
Equals(other T) bool
}] []T
Team is a team of members.
Click to show internal directories.
Click to hide internal directories.