Example #1
0
# CS 61A World Game Data:
try:
    from adventure_solution import me, Person, Thing, Place 
except:
    from adventure import me, Person, Thing, Place 

motd = """
Welcome to the micro-world of CS 61A! You have a
midterm tomorrow, and in hopes of doing well, you
quest to seek the TA, Werdna, a mythical creature who
is rumored to hold the key to besting the test."""


RubberDucky = Thing('rubber ducky', "Hm. It's yellow and it's rubber and it squeaks. Fascinating.")

HearstAve = Place('Hearst Ave.',
                     'You find yourself on the sidewalk of Hearst Ave.')

EuclidAve = Place('Euclid Ave.',
                     "You find yourself on the corner of Euclid Ave. It's not "
                       + "as noisy here!")

def werdnas_brain(self, msg):
    """ A dispatch function for Werdna.

        Werdna becomes aware of self
        if you set his brain attribute accordingly
        (which is why you can use self outside of
         a class; probably not the best thing to do)
        ;)
    """
    if self.inventory.count(RubberDucky) != 2:
Example #2
0
# CS 61A World Game Data:
try:
    from adventure_solution import me, Person, Thing, Place 
except:
    from adventure import me, Person, Thing, Place 

motd = """
Welcome to the micro-world of CS 61A! You have a
midterm tomorrow, and in hopes of doing well, you
quest to seek the TA, Werdna, a mythical creature who
is rumored to hold the key to besting the test."""


RubberDucky = Thing('rubber ducky', "Hm. It's yellow and it's rubber and it squeaks. Fascinating.")

HearstAve = Place('Hearst Ave.',
                     'You find yourself on the sidewalk of Hearst Ave.')

EuclidAve = Place('Euclid Ave.',
                     "You find yourself on the corner of Euclid Ave. It's not "
                       + "as noisy here!")

def werdnas_brain(self, msg):
    """ A dispatch function for Werdna.

        Werdna becomes aware of self
        if you set his brain attribute accordingly
        (which is why you can use self outside of
         a class; probably not the best thing to do)
        ;)
    """
    if self.inventory.count(RubberDucky) != 2: