Last active
November 17, 2016 23:34
-
-
Save macalinao/36b8afefd684d03d277504bed3ee823e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// derive runes | |
var runes []*apb.MatchAggregateCollections_RuneSet | |
for rs, rstats := range quot.Runes { | |
if rstats.Plays < minPlayRate { | |
continue | |
} | |
// rs is rune set string | |
// rstats is rune set subscalars | |
runeSet, err := deserializeBonusSet(rs) | |
if err != nil { | |
return nil, fmt.Errorf("could not deserialize rune set: %v", err) | |
} | |
runes = append(runes, &apb.MatchAggregateCollections_RuneSet{ | |
Runes: runeSet, | |
PickRate: rstats.Plays, | |
WinRate: rstats.Wins, | |
NumMatches: uint32(rstats.PlayCount), | |
}) | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
MatchAggregate.Collections( | |
runes = quot.runes | |
.filter(_._2.plays >= minPlayRate) // Ensure minimum play rate is met | |
.map { case (runeSet, subscalars) => | |
MatchAggregate.Collections.RuneSet( | |
runes = deserializeBonusSet(runeSet), | |
pickRate = subscalars.plays, | |
winRate = subscalars.wins, | |
numMatches = subscalars.playCount.toInt | |
) | |
}.toSeq |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment