Skip to content

Instantly share code, notes, and snippets.

@commadelimited
Created July 14, 2017 19:56
Show Gist options
  • Save commadelimited/5cdcf6e9494a3ca59ad1ec719ed7e4b5 to your computer and use it in GitHub Desktop.
Save commadelimited/5cdcf6e9494a3ca59ad1ec719ed7e4b5 to your computer and use it in GitHub Desktop.
#!/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