Created
July 14, 2017 19:56
-
-
Save commadelimited/5cdcf6e9494a3ca59ad1ec719ed7e4b5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
""" | |
How many unique, simultaneous, players can my board game collection support? | |
""" | |
import sys | |
from boardgamegeek import BGGClient | |
username = sys.argv[1] | |
def query_bgg(user): | |
bgg = BGGClient() | |
collection = bgg.collection(user_name=user, exclude_subtype='boardgameexpansion', own=True) | |
total_games = len(collection) | |
total_players = 0 | |
for item in collection.items: | |
total_players += item.max_players | |
return total_games, total_players | |
if __name__ == '__main__': | |
total_games, total_players = query_bgg(username) | |
print 'TOTAL GAMES:', total_games | |
print 'TOTAL PLAYERS:', total_players |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment