Count total points.

This commit is contained in:
Michael Zhang 2017-03-13 00:50:22 -05:00
parent 5a1764b856
commit 231deba8ed

View file

@ -9,6 +9,7 @@ problem_names = os.listdir(os.path.dirname(os.path.abspath(__file__)))
problems = [] problems = []
failed = [] failed = []
total = 0
for problem_name in problem_names: for problem_name in problem_names:
folder = os.path.dirname(os.path.abspath(__file__)) + os.sep + problem_name folder = os.path.dirname(os.path.abspath(__file__)) + os.sep + problem_name
@ -36,8 +37,11 @@ for category, count in categories:
print(" %s: %s" % (category, count)) print(" %s: %s" % (category, count))
for problem in problems: for problem in problems:
if problem.get("category") != category: continue if problem.get("category") != category: continue
total += int(problem.get("value"))
print(" %s %s %sp" % (problem.get("title") + " " * (maxtitle - len(problem.get("title"))), problem.get("author") + " " * (maxauthor - len(problem.get("author"))), problem.get("value"))) print(" %s %s %sp" % (problem.get("title") + " " * (maxtitle - len(problem.get("title"))), problem.get("author") + " " * (maxauthor - len(problem.get("author"))), problem.get("value")))
print ("\nTOTAL VALUE: %d" % total)
print("\nThe following problems failed to parse.") print("\nThe following problems failed to parse.")
for title in failed: for title in failed:
if title in [".git"]: continue if title in [".git"]: continue