Calculate the selection based on a score (pseudocode).
score = new Map()
for player_id in range(n) {
for i in range(n+1) {
animalfolk = preferences[player_id][i]
prevScore = score.getOrDefault(animalfolk, 0)
score[animalfolk] += pow(n+1, n+1-i)
}
}
selection = []
for i in range(n+1) {
animalfolk, value = score.popHighestValue()
selection.push(animalfolk)
}
return selection
All n players can submit a preference of up to n+1 animalfolk sets.
Calculate the selection based on a score (pseudocode).
Outcome example preferences.
Randomly decide the order of animalfolk that share the same score.