def checkIfScoresBonusPoints(playerList, scoreBonus):
    """Checks if any player should score the end-of-level bonus points, and if so, which player should.

    Args:
        playerList: A list of all PlayerSprite objects in the game.
        scoreBonus: A boolean indicating if the level has been completed within 300 counts of the timer.

    Returns:
        doesScoreBonus: A boolean indicating if the bonus points should be awarded for this level.
        bonusScoringIndex: An integer indicating which player should score the bonus points.
    """

    # If only one player is playing, bonus points are scored if scoreBonus is True.
    # Otherwise, bonus points are only awarded if one player has collected more gold than any other player.
    if len(playerList) == 1:
        if scoreBonus:
            return True, 0
    else:
        for num, player in enumerate(playerList):
            if all(player.goldCollectedCount > otherPlayer.goldCollectedCount for otherPlayer in playerList if
                   otherPlayer != player):
                return True, num
    return False, 0