- Code: Select all
def choose_ladder_map_pool(self, player1, player2):
lucky_player = [player1,player2][random.randint(0,1)]
maps = self.getSelectedLadderMaps(lucky_player.id)
missing_maps = 15 - len(maps)
if missing_maps > 0:
maps += self.getPopularLadderMaps(missing_maps)[:missing_maps]
return maps
Explanation: we randomly pick one of the two players's map pools. If that map pool has less than 15 maps, we extend it to 15 with popular maps. Then we pick a random map from that list. This code is simpler and will result in a more diverse set of maps being played because all maps that a player has selected have some chance to be picked, rather than just the intersection. Also the 33% popular maps chance has been removed. Now you will only get your mappool extended with popular maps if you have selected less than 15.