Loading server/matchmaker_process.go +23 −19 Original line number Diff line number Diff line Loading @@ -489,8 +489,7 @@ func (m *LocalMatchmaker) processCustom() [][]*MatchmakerEntry { hitIndexes = append(hitIndexes, hitIndex) } hitIndexesCombinations := combinationsMinMax(hitIndexes, 1, index.MaxCount-index.Count) for _, hitIndexes := range hitIndexesCombinations { for hitIndexes := range combinationsMinMax(hitIndexes, 1, index.MaxCount-index.Count) { // Check the min and max counts are met across the hit. var hitCount int for _, hitIndex := range hitIndexes { Loading Loading @@ -653,7 +652,11 @@ func (m *LocalMatchmaker) processCustom() [][]*MatchmakerEntry { return finalMatchedEntries } func combinationsMinMax[T any](from []T, min, max int) (combinations [][]T) { func combinationsMinMax[T any](from []T, min, max int) <-chan []T { c := make(chan []T) go func() { defer close(c) length := uint(len(from)) // Go through all possible combinations of from 1 (only first element in subset) to 2^length (all objects in subset) Loading @@ -671,7 +674,8 @@ func combinationsMinMax[T any](from []T, min, max int) (combinations [][]T) { combination = append(combination, from[element]) } } combinations = append(combinations, combination) c <- combination } return combinations }() return c } Loading
server/matchmaker_process.go +23 −19 Original line number Diff line number Diff line Loading @@ -489,8 +489,7 @@ func (m *LocalMatchmaker) processCustom() [][]*MatchmakerEntry { hitIndexes = append(hitIndexes, hitIndex) } hitIndexesCombinations := combinationsMinMax(hitIndexes, 1, index.MaxCount-index.Count) for _, hitIndexes := range hitIndexesCombinations { for hitIndexes := range combinationsMinMax(hitIndexes, 1, index.MaxCount-index.Count) { // Check the min and max counts are met across the hit. var hitCount int for _, hitIndex := range hitIndexes { Loading Loading @@ -653,7 +652,11 @@ func (m *LocalMatchmaker) processCustom() [][]*MatchmakerEntry { return finalMatchedEntries } func combinationsMinMax[T any](from []T, min, max int) (combinations [][]T) { func combinationsMinMax[T any](from []T, min, max int) <-chan []T { c := make(chan []T) go func() { defer close(c) length := uint(len(from)) // Go through all possible combinations of from 1 (only first element in subset) to 2^length (all objects in subset) Loading @@ -671,7 +674,8 @@ func combinationsMinMax[T any](from []T, min, max int) (combinations [][]T) { combination = append(combination, from[element]) } } combinations = append(combinations, combination) c <- combination } return combinations }() return c }