from typing import Counter


def map_popularity_counters_bucketed_by_rating(players, edges):
    """ Returns an array of counters, each of which represents the cumulative proportional popularity of a map
    for every rated player for matches played when holding a rating between the edges. Note, a player is only checked
    if the player's "best rating" falls within the edges.
    players: the list of players to evaluate
    edges: an array of edges in which to delineate ratings. First edge should be greater than zero, so first "bucket"
    will be from 1 to edges[0], second edge from edges[0] to edges[1], finishing at edges[-2] to edges[-1]."""
    start = 0
    counters = []
    for edge in edges:
        map_ctr = Counter()
        counters.append(map_ctr)
        snapshot_players = [p for p in players if start < p.best_rating() <= edge]
        for player in snapshot_players:
            player.add_map_percentages(map_ctr, start, edge)
        start = edge - 50
    return counters