Example #1
0
def plotSelector():
    motivePath = os.path.join(os.path.dirname(__file__), "plots", "motives.txt")
    actionPath = os.path.join(os.path.dirname(__file__), "plots", "actupon.txt")
    motive = lambda:util.selectFromFile(motivePath)
    action = lambda:util.selectFromFile(actionPath)
    charList = ["Alice","Bob","Casey"]
    mover = "Alice" # nameSelector(genderSelector())  # mover as in an Aristotle type way
    movee = "Bob" # nameSelector(genderSelector())
    event = " ".join([mover,action(),movee]) #,"because",motive()]) 
    reaction = " ".join(["and",movee,action(),mover]) 

    eventList = []
    for i in range(3):
        mover = random.choice(charList)
        listWithoutMover = charList[:]
        listWithoutMover.remove(mover)
        movee = random.choice(listWithoutMover)
        event = " ".join([mover,action(),movee])
        if random.randint(0,1):
            l = event.split()
            l.insert(1,traitSelector().lower() + "ly")
            event = " ".join(l)
        eventList.append(event)

    if random.randint(0,1):
        l = event.split()
        l.insert(1,traitSelector().lower() + "ly")
        event = " ".join(l)
    if random.randint(0,1):
        l = reaction.split()
        l.insert(2,traitSelector().lower() + "ly")
        reaction = " ".join(l)
    moverTraits = " ".join(["Alice is",traitSelector().lower()])
    moveeTraits = " ".join(["Bob is",traitSelector().lower()])
    return "\n".join(eventList) + "\n"
Example #2
0
def nameSelector(gender="male"):
    name = ""
    if gender == "male":
        maleNamesPath = os.path.join(os.path.dirname(__file__), "names", "maleFirst.txt")
        name += util.selectFromFile(maleNamesPath)
    else:
        femaleNamesPath = os.path.join(os.path.dirname(__file__), "names", "femaleFirst.txt")
        name += util.selectFromFile(femaleNamesPath)
    name += " "
    lastNamesPath = os.path.join(os.path.dirname(__file__), "names", "last.txt")
    name += util.selectFromFile(lastNamesPath)
    return name
Example #3
0
def weatherSelector(season="winter", yesterday=UNDEFINED):
    if yesterday != UNDEFINED:  #If a previous weather is provided there is a 50% chance it will be the same today
        if random.randint(0, 1):
            return yesterday
    seasonPathName = os.path.join(os.path.dirname(__file__), "weather",
                                  season + ".txt")
    return util.selectFromFile(seasonPathName)
Example #4
0
def occupationTypeSelector(excluded=None,setting="urban"):
    settingFileName = "typesList" + setting.capitalize() + ".txt"
    occupationTypesPath = os.path.join(os.path.dirname(__file__), "occupations", settingFileName)
    retVal = util.selectFromFile(occupationTypesPath)
    if retVal == excluded:  # if we get the excluded value, try again
        return occupationTypeSelector(excluded,setting)
    return retVal
Example #5
0
def weatherSelector(season="winter",yesterday=UNDEFINED):
    if yesterday != UNDEFINED:    #If a previous weather is provided there is a 50% chance it will be the same today
        if random.randint(0,1):
            return yesterday
    seasonPathName = os.path.join(os.path.dirname(__file__), "weather", season + ".txt")
    return util.selectFromFile(seasonPathName)
Example #6
0
def eventSelector():
    eventsPath = os.path.join(os.path.dirname(__file__), "events", "events.txt")
    return util.selectFromFile(eventsPath)
Example #7
0
def nameSelector():
    typeSeedInt = random.randint(1, 7)
    nounPath = os.path.join(os.path.dirname(__file__), "taverns",
                            "tavernNouns.txt")
    descriptorPath = os.path.join(os.path.dirname(__file__), "taverns",
                                  "tavernDescriptors.txt")

    if typeSeedInt <= 1:  #The NOUN and NOUN
        firstNounStr = util.selectFromFile(nounPath)
        secondNounStr = util.selectFromFile(nounPath)
        while firstNounStr == secondNounStr:
            secondNounStr = util.selectFromFile(nounPath)
        return "The " + firstNounStr + " and " + secondNounStr

    elif typeSeedInt <= 2:  #The DESCRIPTOR NOUN and DESCRIPTOR NOUN
        firstNounStr = util.selectFromFile(nounPath)
        secondNounStr = util.selectFromFile(nounPath)
        firstDescriptorStr = util.selectFromFile(descriptorPath)
        secondDescriptorStr = util.selectFromFile(descriptorPath)
        while firstNounStr == secondNounStr:
            secondNounStr = util.selectFromFile(nounPath)
        while firstDescriptorStr == secondDescriptorStr:
            secondDescriptorStr = util.selectFromFile(descriptorPath)
        return "The " + firstDescriptorStr + " " + firstNounStr + " and " + secondDescriptorStr + " " + secondNounStr

    elif typeSeedInt <= 3:  #The DESCRIPTOR NOUN and NOUN
        firstNounStr = util.selectFromFile(nounPath)
        secondNounStr = util.selectFromFile(nounPath)
        descriptorStr = util.selectFromFile(descriptorPath)
        while firstNounStr == secondNounStr:
            secondNounStr = util.selectFromFile(nounPath)
        return "The " + descriptorStr + " " + firstNounStr + " and " + secondNounStr

    elif typeSeedInt <= 4:  #The NOUN and DESCRIPTOR NOUN
        firstNounStr = util.selectFromFile(nounPath)
        secondNounStr = util.selectFromFile(nounPath)
        descriptorStr = util.selectFromFile(descriptorPath)
        while firstNounStr == secondNounStr:
            secondNounStr = util.selectFromFile(nounPath)
        return "The " + firstNounStr + " and " + descriptorStr + " " + secondNounStr

    elif typeSeedInt <= 5:  #The NOUN
        nounStr = util.selectFromFile(nounPath)
        return "The " + nounStr

    elif typeSeedInt <= 6:  #The DESCRIPTOR Inn
        descriptorStr = util.selectFromFile(descriptorPath)
        return "The " + descriptorStr + " Inn "

    elif typeSeedInt <= 7:  #The DESCRIPTOR NOUN
        nounStr = util.selectFromFile(nounPath)
        descriptorStr = util.selectFromFile(descriptorPath)
        return "The " + descriptorStr + " " + nounStr
Example #8
0
def weaponSelector():
    weaponsPath = os.path.join(os.path.dirname(__file__), "items", "weapons.txt")
    return util.selectFromFile(weaponsPath)
Example #9
0
def traitSelector():
    traitsPath = os.path.join(os.path.dirname(__file__), "traits", "traits.txt")
    return util.selectFromFile(traitsPath)
Example #10
0
def hairLengthSelector():
    hairLengthsPath = os.path.join(os.path.dirname(__file__), "hair", "hairLengths.txt")
    return util.selectFromFile(hairLengthsPath)
Example #11
0
def hairTypeSelector():
    hairTypePath = os.path.join(os.path.dirname(__file__), "hair", "hairTypes.txt")
    return util.selectFromFile(hairTypePath)
Example #12
0
def hairColorSelector(eyecolor):
    hairColorPath = os.path.join(os.path.dirname(__file__), "hair", eyecolor + "EyesHair.txt")
    return util.selectFromFile(hairColorPath)
Example #13
0
def eyeColorSelector():
    eyeColorPath = os.path.join(os.path.dirname(__file__), "eyes", "eyeColor.txt")
    return util.selectFromFile(eyeColorPath)
Example #14
0
def occupationSelector(occupationType=DEFAULT):
    if occupationType == DEFAULT:
        occupationType = occupationTypeSelector()
    occupationPath = os.path.join(os.path.dirname(__file__), "occupations", occupationType + ".txt")
    return util.selectFromFile(occupationPath)
Example #15
0
def weaponSelector():
    weaponsPath = os.path.join(os.path.dirname(__file__), "items",
                               "weapons.txt")
    return util.selectFromFile(weaponsPath)
Example #16
0
def nameSelector():
    typeSeedInt = random.randint(1,7)
    nounPath = os.path.join(os.path.dirname(__file__), "taverns", "tavernNouns.txt")
    descriptorPath = os.path.join(os.path.dirname(__file__), "taverns" , "tavernDescriptors.txt")

    if typeSeedInt <= 1: #The NOUN and NOUN
        firstNounStr = util.selectFromFile(nounPath)
        secondNounStr = util.selectFromFile(nounPath)
        while firstNounStr == secondNounStr:
            secondNounStr = util.selectFromFile(nounPath)
        return "The " + firstNounStr + " and " +  secondNounStr

    elif typeSeedInt <= 2: #The DESCRIPTOR NOUN and DESCRIPTOR NOUN
        firstNounStr = util.selectFromFile(nounPath)
        secondNounStr = util.selectFromFile(nounPath)
        firstDescriptorStr = util.selectFromFile(descriptorPath)
        secondDescriptorStr = util.selectFromFile(descriptorPath)
        while firstNounStr == secondNounStr:
            secondNounStr = util.selectFromFile(nounPath)
        while firstDescriptorStr == secondDescriptorStr:
            secondDescriptorStr = util.selectFromFile(descriptorPath)
        return "The " + firstDescriptorStr + " " + firstNounStr + " and " + secondDescriptorStr + " " + secondNounStr

    elif typeSeedInt <= 3: #The DESCRIPTOR NOUN and NOUN
        firstNounStr = util.selectFromFile(nounPath)
        secondNounStr = util.selectFromFile(nounPath)
        descriptorStr = util.selectFromFile(descriptorPath)
        while firstNounStr == secondNounStr:
            secondNounStr = util.selectFromFile(nounPath)
        return "The " + descriptorStr + " " + firstNounStr + " and " + secondNounStr

    elif typeSeedInt <= 4: #The NOUN and DESCRIPTOR NOUN
        firstNounStr = util.selectFromFile(nounPath)
        secondNounStr = util.selectFromFile(nounPath)
        descriptorStr = util.selectFromFile(descriptorPath)
        while firstNounStr == secondNounStr:
            secondNounStr = util.selectFromFile(nounPath)
        return "The " + firstNounStr + " and " + descriptorStr + " " + secondNounStr

    elif typeSeedInt <= 5: #The NOUN
        nounStr = util.selectFromFile(nounPath)
        return "The " + nounStr

    elif typeSeedInt <= 6: #The DESCRIPTOR Inn
        descriptorStr = util.selectFromFile(descriptorPath)
        return "The " + descriptorStr + " Inn "

    elif typeSeedInt <= 7: #The DESCRIPTOR NOUN
        nounStr = util.selectFromFile(nounPath)
        descriptorStr = util.selectFromFile(descriptorPath)
        return "The " + descriptorStr + " " + nounStr
Example #17
0
def eventSelector():
    eventsPath = os.path.join(os.path.dirname(__file__), "events",
                              "events.txt")
    return util.selectFromFile(eventsPath)
Example #18
0
def nameSelector():
    townNamesPath = os.path.join(os.path.dirname(__file__), "towns", "townNames.txt")
    return util.selectFromFile(townNamesPath)