Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Maybe you want something like this? </p> <pre><code>class Map(object): def __init__(self): self.quips = [ "You died. You suck at this.", "Your mom would be proud, if she were smarter", "Such a luser.", "I have a small puppy that's better at this." ] def death(self): print self.quips[randint (0, len(self.quips)-1)] exit(1) def princess_lives_here(self): print "You see a beautiful Princess with a shiny crown." print "She offers you some cake." eat_it = raw_input("&gt;") if eat_it == "eat it": print "You explode like a pinata full of frogs." print "The Princess cackles and eats the frogs. Yum!" return 'death' elif eat_it == "do not eat it": print "She throws the cake at you and it cuts off your head." print "The last thing you see is her munching on your face. Yum!" return 'death' elif eat_it == "make her eat it": print "The Princess screams as you cram the cake in her mouth." print "Then she smiles and cries and thank you for saving her." print "She points to a tiny door and says, 'The Koi needs cake too.'" print "She gives you the very last bit of cake and shoves you in." return 'gold_koi_pond' else: print "The Princess looks at you confused and just points at the cake." return 'princess_lives_here' class Engine(object): def __init__(self, map, start): self.quips = [ "You died. You suck at this.", "Your mom would be proud, if she were smarter", "Such a luser.", "I have a small puppy that's better at this." ] self.map = map self.start = start def play(self): next = self.start while True: print "\n-----" room = getattr(self.map, next) next = room() </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload