swampymud icon indicating copy to clipboard operation
swampymud copied to clipboard

Add describe() methods to all of the classes in the sandbox

Open wsowens opened this issue 6 years ago • 0 comments

Our sandbox is composed of entities, items, characters, and locations. Each of these classes needs a flexible, describe() method.

For reference, we have agreed upon the following convention:

class Foo:
    _name               # private variable holding the name

    def __repr__(self): # returns a proper, pythonic representation

    def __str__(self):  # returns the name

    def describe(self, *args):     # returns the a thorough description of the thing

info() should allow for some structured input and return appropriate output. For example, given Wizard bill:

>>> bill.info("wielding")
"wielding an enchanted staff"
>>> bill.info("epithet")
"the Wizard"
>>> bill.info("epithet", "wielding")
("the Wizard", "wielding an enchanted staff")

This isn't set in stone, so other ideas are definitely welcome.

We can probably implement this by having some kind of dictionary.

wsowens avatar Apr 20 '19 19:04 wsowens