mirror of
https://github.com/googleforgames/open-match.git
synced 2025-03-25 13:24:18 +00:00
check for empty pools in py3 mmf
This commit is contained in:
committed by
Joseph Holley
parent
128f0a2941
commit
d52773543d
@ -31,9 +31,13 @@ def makeMatches(profile_dict, player_pools):
|
||||
for roster in profile_dict['properties']['rosters']:
|
||||
for player in roster['players']:
|
||||
if 'pool' in player:
|
||||
player['id'] = random.choice(list(player_pools[player['pool']]))
|
||||
del player_pools[player['pool']][player['id']]
|
||||
print("Selected player %s from pool %s (strategy: RANDOM)" % (player['id'], player['pool']))
|
||||
player_pool = list(player_pools[player['pool']])
|
||||
if len(player_pool) > 0:
|
||||
player['id'] = random.choice(player_pool)
|
||||
del player_pools[player['pool']][player['id']]
|
||||
print("Selected player %s from pool %s (strategy: RANDOM)" % (player['id'], player['pool']))
|
||||
else:
|
||||
print("Player pool %s is empty (roster %s)" % (player['pool'], roster['name']))
|
||||
else:
|
||||
print(player)
|
||||
return profile_dict
|
||||
|
Reference in New Issue
Block a user