def load(self): HighScores.high_scores = filehelper.FileHelper( self.high_scores_file).load() if HighScores.high_scores == None: keys = [i + 1 for i in range(10)] values = [("ACE", 100 * (i + 1)) for i in range(10, 0, -1)] HighScores.high_scores = dict(itertools.izip(keys, values))
def build_tree(self): new_name = self.answers[0] descriptor = self.answers[1] false_branch = self.tree[0] self.tree[0] = descriptor self.tree[1] = {True: [new_name, None]} self.tree[1][False] = [false_branch, None] filehelper.FileHelper(GameStart.question_file).save(question_tree)
def save(self): filehelper.FileHelper(self.high_scores_file).save( HighScores.high_scores)
def yes(self): global question_tree question_tree = filehelper.FileHelper(GameStart.question_file).load() self.transition()