示例#1
0
def describePantheon(seed):
    """Name a pantheon and its entities, describe those entities"""
    pantheon = pantheonSeed(seed)
    pantheon_name = phonetics.hashToPhonems(pantheon.hexdigest())
    # Make choices deterministic based on pantheon
    # Each entity sets its own seed as well, so don't rely on this after them
    random.seed(pantheon_name)
    descriptionsRange = xrange(random.randrange(MIN_ENTITIES, MAX_ENTITIES))
    names = [entityName(pantheon, i) for i in descriptionsRange]
    property_roots = choosePropertyRoots()
    random.shuffle(property_roots)
    descriptions = [("%s (%s)" % (names[i], pantheon_name),
                     describeEntity(names[i], names, property_roots))
                    for i in descriptionsRange]
    return descriptions
示例#2
0
def entityName(pantheon_hash, entity_index):
    """Name the entity"""
    entity_hash = pantheon_hash.copy()
    entity_hash.update(str(entity_index))
    return phonetics.hashToPhonems(entity_hash.hexdigest())