Skip to content

Instantly share code, notes, and snippets.

@syntxerror
syntxerror / ticket.go
Created October 6, 2020 00:02
Complete Skill Based Match Function Ticket
ticket := &pb.Ticket{
SearchFields: &pb.SearchFields{
DoubleArgs: map[string]float64{
"skill": generateSkill(),
},
},
}
func generateSkill() float64 {
skill := rand.NormFloat64()*1.5 + 3
@syntxerror
syntxerror / ticket.go
Last active October 6, 2020 00:03
Incomplete Skill Based Matchfunction Ticket
ticket := &pb.Ticket{
SearchFields: &pb.SearchFields{
DoubleArgs: map[string]float64{
"skill": generateSkill(),
},
},
}
@syntxerror
syntxerror / matchfunction.go
Created October 5, 2020 23:57
Incomplete Skill Based Match Function
func makeMatches(p *pb.MatchProfile, poolTickets map[string][]*pb.Ticket) ([]*pb.Match, error) {
// Create a collection to hold match proposals
var matches []*pb.Match
count := 0
for {
insufficientTickets := false
// Create a collection to hold tickets selected for a match
matchTickets := []*pb.Ticket{}
for pool, tickets := range poolTickets {
// Set flag if there are not enough tickets to create a match
@syntxerror
syntxerror / profile.go
Created October 5, 2020 23:53
Profile for Skill Based Match Function
var profiles []*pb.MatchProfile
for i := 0; i <= 3; i++ {
p = append(p, &pb.MatchProfile{
Name: fmt.Sprintf("Profile_%v-%v", i, i+2),
Pools: []*pb.Pool{
{
Name: poolName,
DoubleRangeFilters: []*pb.DoubleRangeFilter{
{
DoubleArg: "skill",
@syntxerror
syntxerror / matchfunction.go
Created October 5, 2020 23:48
Skill Based Match Function
func makeMatches(p *pb.MatchProfile, poolTickets map[string][]*pb.Ticket) ([]*pb.Match, error) {
// Create a colletion to hold match proposals
var matches []*pb.Match
count := 0
for {
insufficientTickets := false
// Create a collection to hold tickets selected for a match
matchTickets := []*pb.Ticket{}
for pool, tickets := range poolTickets {
// Set flag if there are not enough tickets to create a match