Whebon / dale-of-merchants

Board Game Arena adaptation of Dale Of Merchants
Other
2 stars 0 forks source link

Deck Selection #56

Closed Whebon closed 1 month ago

Whebon commented 2 months ago

All n players can submit a preference of up to n+1 animalfolk sets.

preferences = [
    [1, 2, 5, 0, 4],
    [4, 5],
    [],
    [2, 3, 5, 1]
]

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

Outcome example preferences.

score = {
  0: 25
  1: 3150,
  2: 3750,
  3: 625,
  4: 3130,
  5: 875,
  6: 0,
  7: 0,
  8: 0,
  9: 0,
  10: 0,
  11: 0
}

selection = [2, 1, 4, 5, 3]

Randomly decide the order of animalfolk that share the same score.