Skip to content

Commit

Permalink
Added challenge import
Browse files Browse the repository at this point in the history
  • Loading branch information
Kiel97 committed Jul 28, 2017
1 parent 0fdf41b commit 1f4b64a
Showing 1 changed file with 39 additions and 1 deletion.
40 changes: 39 additions & 1 deletion dcss_challenge_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,15 +66,53 @@ def import_non_available_combos(filename):

file.close()
print("Done!")

return list

def import_challenges(filename):
"""Imports challenges from file to mixed dictionary with lists"""
print("Importing challenges...",end="")

file = open_file(filename)

dictionary = {}

while True:
challenge_name = file.readline()

if challenge_name[:5] != "Name:":
break
challenge_name = challenge_name[6:].strip()

challenge_tiers = []
for i in range(3):
tier = file.readline()
tier = tier[6:].strip()
challenge_tiers.append(tier)

banned_species = file.readline()
banned_species = banned_species[11:].strip().split(" ")

banned_backgrounds = file.readline()
banned_backgrounds = banned_backgrounds[15:].strip().split(" ")

dictionary[challenge_name] = [challenge_tiers,banned_species,
banned_backgrounds]
file.readline()

file.close()
print("Done!")

return dictionary

def main():
"""This is where program starts."""

species_database = import_to_dictionary("species_database.txt")
backgrounds_database = import_to_dictionary("background_database.txt")

no_combo_database = import_non_available_combos("nocombo_database.txt")
challenges_database = import_challenges("challenge_database.txt")


print("Thank you for using this software!")
input("Press any key to exit.")
Expand Down

0 comments on commit 1f4b64a

Please sign in to comment.