def generate(klass, name = None): loc = klass(name, make_place_desc(), set(random.sample(['N','E','W','S'], random.randint(1,3))) ) if random.randint(0,10) > 1: orc = User.generate(name + 'orc') loc.enemies.append(orc) Users.instance()[orc.name] = orc return loc
def announce(self, evt, replysock): logging.info("Generating user record: %s", evt.user) self.users[evt.user] = User.generate(evt.user) replysock.send_pyobj(Response('ANNOUNCE',initial_location='location-1'))