Spaces:
Running
on
Zero
Running
on
Zero
Update Leaderboard
Browse files- model/matchmaker.py +4 -0
model/matchmaker.py
CHANGED
@@ -79,6 +79,8 @@ def load_json_via_sftp():
|
|
79 |
class RunningPivot(object):
|
80 |
running_pivot = []
|
81 |
|
|
|
|
|
82 |
def matchmaker(num_players, k_group=4):
|
83 |
trueskill_env = TrueSkill()
|
84 |
|
@@ -90,6 +92,7 @@ def matchmaker(num_players, k_group=4):
|
|
90 |
# Randomly select a player
|
91 |
# selected_player = np.random.randint(0, num_players)
|
92 |
comparison_counts[:, RunningPivot.running_pivot] = float('inf')
|
|
|
93 |
selected_player = np.argmin(comparison_counts.sum(axis=1))
|
94 |
|
95 |
RunningPivot.running_pivot.append(selected_player)
|
@@ -103,6 +106,7 @@ def matchmaker(num_players, k_group=4):
|
|
103 |
|
104 |
# Exclude self, select opponent with highest UCB score
|
105 |
ucb_scores[selected_player] = -float('inf') # minimize the score for the selected player to exclude it
|
|
|
106 |
opponents = np.argsort(ucb_scores)[-k_group + 1:].tolist()
|
107 |
|
108 |
# Group players
|
|
|
79 |
class RunningPivot(object):
|
80 |
running_pivot = []
|
81 |
|
82 |
+
not_run = [11, 12, 13, 14, 15, 16, 17, 18, 19]
|
83 |
+
|
84 |
def matchmaker(num_players, k_group=4):
|
85 |
trueskill_env = TrueSkill()
|
86 |
|
|
|
92 |
# Randomly select a player
|
93 |
# selected_player = np.random.randint(0, num_players)
|
94 |
comparison_counts[:, RunningPivot.running_pivot] = float('inf')
|
95 |
+
comparison_counts[:, not_run] = float('inf')
|
96 |
selected_player = np.argmin(comparison_counts.sum(axis=1))
|
97 |
|
98 |
RunningPivot.running_pivot.append(selected_player)
|
|
|
106 |
|
107 |
# Exclude self, select opponent with highest UCB score
|
108 |
ucb_scores[selected_player] = -float('inf') # minimize the score for the selected player to exclude it
|
109 |
+
ucb_scores[not_run] = -float('inf')
|
110 |
opponents = np.argsort(ucb_scores)[-k_group + 1:].tolist()
|
111 |
|
112 |
# Group players
|