Commits

Arne Babenhauserheide  committed c944463

Made the branching story adhere the passed story and ask functions.

  • Participants
  • Parent commits 33dbc2f

Comments (0)

Files changed (1)

File branching_story.py

         question = " ".join([question] + answers + [")"])
         description = "\n".join(['to the ' + i + ' you see ' + 
 self.pos_to_name(directions[i]) for i in answers])
-        story(description)
+        self.story(description)
         target = ""
         # Ask the user until he/she supplies a valid answer. 
         while not target:  
-            story("", autoscroll=True)
-            ans = ask(question).strip() # removing any whitespace before the first letter
+            self.story("", autoscroll=True)
+            ans = self.ask(question).strip() # removing any whitespace before the first letter
             # the users input fits any of the answers 
             # of the name of teh region for that answer, 
             # Pick that as target. 
                 if ans.lower() in [i.lower(), i.lower()[0], name, " ".join(name.split()[1:])]: 
                     target = directions[i]
         self.position = target
-        story("""You go to """ + self.pos_to_name(self.position))
-        story(self.get_description(self.pos_to_name(self.position)))
+        self.story("""You go to """ + self.pos_to_name(self.position))
+        self.story(self.get_description(self.pos_to_name(self.position)))
 
 
 ### Usage ###